@devexperts/dxcharts-lite 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/chart/animation/canvas-animation.d.ts +1 -1
- package/dist/chart/animation/canvas-animation.js +1 -1
- package/dist/chart/animation/types/animation.d.ts +1 -1
- package/dist/chart/animation/types/animation.js +1 -1
- package/dist/chart/animation/types/color-alpha-animation.d.ts +1 -1
- package/dist/chart/animation/types/color-alpha-animation.js +1 -1
- package/dist/chart/animation/types/color-transition-animation.d.ts +1 -1
- package/dist/chart/animation/types/color-transition-animation.js +1 -1
- package/dist/chart/animation/types/viewport-movement-animation.d.ts +1 -1
- package/dist/chart/animation/types/viewport-movement-animation.js +1 -1
- package/dist/chart/animation/viewport-model-animation.d.ts +1 -1
- package/dist/chart/animation/viewport-model-animation.js +1 -1
- package/dist/chart/bootstrap.d.ts +1 -1
- package/dist/chart/bootstrap.js +1 -1
- package/dist/chart/canvas/canvas-bounds-container.d.ts +1 -1
- package/dist/chart/canvas/canvas-bounds-container.js +1 -1
- package/dist/chart/canvas/canvas-chart-html.d.ts +1 -1
- package/dist/chart/canvas/canvas-chart-html.js +1 -1
- package/dist/chart/canvas/chart-elements.d.ts +1 -1
- package/dist/chart/canvas/chart-elements.js +1 -1
- package/dist/chart/canvas/cursor.handler.d.ts +1 -1
- package/dist/chart/canvas/cursor.handler.js +1 -1
- package/dist/chart/canvas/layout-creator.d.ts +1 -1
- package/dist/chart/canvas/layout-creator.js +1 -1
- package/dist/chart/canvas/y-axis-bounds.container.d.ts +1 -1
- package/dist/chart/canvas/y-axis-bounds.container.js +1 -1
- package/dist/chart/chart-container.d.ts +1 -1
- package/dist/chart/chart-container.js +1 -1
- package/dist/chart/chart.config.d.ts +1 -1
- package/dist/chart/chart.config.js +1 -1
- package/dist/chart/components/chart/basic-scale.d.ts +1 -1
- package/dist/chart/components/chart/basic-scale.js +1 -1
- package/dist/chart/components/chart/candle-transformer.functions.d.ts +1 -1
- package/dist/chart/components/chart/candle-transformer.functions.js +1 -1
- package/dist/chart/components/chart/candle-width-calculator.functions.d.ts +1 -1
- package/dist/chart/components/chart/candle-width-calculator.functions.js +1 -1
- package/dist/chart/components/chart/candle.functions.d.ts +1 -1
- package/dist/chart/components/chart/candle.functions.js +1 -1
- package/dist/chart/components/chart/chart-area-pan.handler.d.ts +1 -1
- package/dist/chart/components/chart/chart-area-pan.handler.js +1 -1
- package/dist/chart/components/chart/chart-base.model.d.ts +1 -1
- package/dist/chart/components/chart/chart-base.model.js +1 -1
- package/dist/chart/components/chart/chart.component.d.ts +1 -1
- package/dist/chart/components/chart/chart.component.js +1 -1
- package/dist/chart/components/chart/chart.model.d.ts +1 -1
- package/dist/chart/components/chart/chart.model.js +1 -1
- package/dist/chart/components/chart/data-series.high-low-provider.d.ts +1 -1
- package/dist/chart/components/chart/data-series.high-low-provider.js +1 -1
- package/dist/chart/components/chart/fake-candles.d.ts +1 -1
- package/dist/chart/components/chart/fake-candles.js +1 -1
- package/dist/chart/components/chart/price.formatter.d.ts +1 -1
- package/dist/chart/components/chart/price.formatter.js +1 -1
- package/dist/chart/components/chart/secondary-chart-colors-pool.d.ts +1 -1
- package/dist/chart/components/chart/secondary-chart-colors-pool.js +1 -1
- package/dist/chart/components/cross_tool/cross-tool.component.d.ts +1 -1
- package/dist/chart/components/cross_tool/cross-tool.component.js +1 -1
- package/dist/chart/components/cross_tool/cross-tool.drawer.d.ts +1 -1
- package/dist/chart/components/cross_tool/cross-tool.drawer.js +1 -1
- package/dist/chart/components/cross_tool/cross-tool.model.d.ts +1 -1
- package/dist/chart/components/cross_tool/cross-tool.model.js +1 -1
- package/dist/chart/components/cross_tool/types/cross-and-labels.drawer.d.ts +1 -1
- package/dist/chart/components/cross_tool/types/cross-and-labels.drawer.js +1 -1
- package/dist/chart/components/cross_tool/types/none.drawer.d.ts +1 -1
- package/dist/chart/components/cross_tool/types/none.drawer.js +1 -1
- package/dist/chart/components/dran-n-drop_helper/drag-n-drop-x.component.d.ts +1 -1
- package/dist/chart/components/dran-n-drop_helper/drag-n-drop-x.component.js +1 -1
- package/dist/chart/components/dran-n-drop_helper/drag-n-drop-y.component.d.ts +1 -1
- package/dist/chart/components/dran-n-drop_helper/drag-n-drop-y.component.js +1 -1
- package/dist/chart/components/dran-n-drop_helper/drag-n-drop.component.d.ts +1 -1
- package/dist/chart/components/dran-n-drop_helper/drag-n-drop.component.js +1 -1
- package/dist/chart/components/events/events-hit-test.drawer.d.ts +1 -1
- package/dist/chart/components/events/events-hit-test.drawer.js +1 -1
- package/dist/chart/components/events/events.component.d.ts +1 -1
- package/dist/chart/components/events/events.component.js +1 -1
- package/dist/chart/components/events/events.drawer.d.ts +1 -1
- package/dist/chart/components/events/events.drawer.js +1 -1
- package/dist/chart/components/events/events.model.d.ts +1 -1
- package/dist/chart/components/events/events.model.js +1 -1
- package/dist/chart/components/grid/grid.component.d.ts +1 -1
- package/dist/chart/components/grid/grid.component.js +1 -1
- package/dist/chart/components/grid/grid.drawer.d.ts +1 -1
- package/dist/chart/components/grid/grid.drawer.js +1 -1
- package/dist/chart/components/high_low/high-low.component.d.ts +1 -1
- package/dist/chart/components/high_low/high-low.component.js +1 -1
- package/dist/chart/components/high_low/high-low.drawer.d.ts +1 -1
- package/dist/chart/components/high_low/high-low.drawer.js +1 -1
- package/dist/chart/components/highlights/highlights.component.d.ts +1 -1
- package/dist/chart/components/highlights/highlights.component.js +1 -1
- package/dist/chart/components/highlights/highlights.drawer.d.ts +1 -1
- package/dist/chart/components/highlights/highlights.drawer.js +1 -1
- package/dist/chart/components/highlights/highlights.model.d.ts +1 -1
- package/dist/chart/components/highlights/highlights.model.js +1 -1
- package/dist/chart/components/labels_generator/numeric-axis-labels.generator.d.ts +1 -1
- package/dist/chart/components/labels_generator/numeric-axis-labels.generator.js +1 -1
- package/dist/chart/components/navigation_map/navigation-map-move.handler.d.ts +1 -1
- package/dist/chart/components/navigation_map/navigation-map-move.handler.js +1 -1
- package/dist/chart/components/navigation_map/navigation-map.component.d.ts +1 -1
- package/dist/chart/components/navigation_map/navigation-map.component.js +1 -1
- package/dist/chart/components/navigation_map/navigation-map.drawer.d.ts +1 -1
- package/dist/chart/components/navigation_map/navigation-map.drawer.js +1 -1
- package/dist/chart/components/navigation_map/navigation-map.model.d.ts +1 -1
- package/dist/chart/components/navigation_map/navigation-map.model.js +1 -1
- package/dist/chart/components/pan/chart-pan.component.d.ts +1 -1
- package/dist/chart/components/pan/chart-pan.component.js +1 -1
- package/dist/chart/components/pane/extent/y-extent-component.d.ts +1 -1
- package/dist/chart/components/pane/extent/y-extent-component.js +1 -1
- package/dist/chart/components/pane/pane-hit-test.controller.d.ts +1 -1
- package/dist/chart/components/pane/pane-hit-test.controller.js +1 -1
- package/dist/chart/components/pane/pane-manager.component.d.ts +1 -1
- package/dist/chart/components/pane/pane-manager.component.js +1 -1
- package/dist/chart/components/pane/pane.component.d.ts +2 -2
- package/dist/chart/components/pane/pane.component.js +2 -2
- package/dist/chart/components/resizer/bar-resizer.component.d.ts +1 -1
- package/dist/chart/components/resizer/bar-resizer.component.js +1 -1
- package/dist/chart/components/resizer/bar-resizer.drawer.d.ts +1 -1
- package/dist/chart/components/resizer/bar-resizer.drawer.js +1 -1
- package/dist/chart/components/snapshot/snapshot.component.d.ts +1 -1
- package/dist/chart/components/snapshot/snapshot.component.js +1 -1
- package/dist/chart/components/volumes/separate-volumes.component.d.ts +1 -1
- package/dist/chart/components/volumes/separate-volumes.component.js +1 -1
- package/dist/chart/components/volumes/volume-color-resolvers.functions.d.ts +1 -1
- package/dist/chart/components/volumes/volume-color-resolvers.functions.js +1 -1
- package/dist/chart/components/volumes/volumes.component.d.ts +3 -2
- package/dist/chart/components/volumes/volumes.component.js +2 -2
- package/dist/chart/components/volumes/volumes.drawer.d.ts +1 -1
- package/dist/chart/components/volumes/volumes.drawer.js +1 -1
- package/dist/chart/components/volumes/volumes.formatter.d.ts +1 -1
- package/dist/chart/components/volumes/volumes.formatter.js +1 -1
- package/dist/chart/components/volumes/volumes.model.d.ts +1 -1
- package/dist/chart/components/volumes/volumes.model.js +1 -1
- package/dist/chart/components/watermark/water-mark.component.d.ts +1 -1
- package/dist/chart/components/watermark/water-mark.component.js +1 -1
- package/dist/chart/components/watermark/water-mark.drawer.d.ts +1 -1
- package/dist/chart/components/watermark/water-mark.drawer.js +1 -1
- package/dist/chart/components/x_axis/numeric-x-axis-labels.generator.d.ts +1 -1
- package/dist/chart/components/x_axis/numeric-x-axis-labels.generator.js +1 -1
- package/dist/chart/components/x_axis/time/parser/time-formats-matchers.functions.d.ts +1 -1
- package/dist/chart/components/x_axis/time/parser/time-formats-matchers.functions.js +1 -1
- package/dist/chart/components/x_axis/time/parser/time-formats-parser.functions.d.ts +1 -1
- package/dist/chart/components/x_axis/time/parser/time-formats-parser.functions.js +1 -1
- package/dist/chart/components/x_axis/time/parser/time-formats-validators.functions.d.ts +1 -1
- package/dist/chart/components/x_axis/time/parser/time-formats-validators.functions.js +1 -1
- package/dist/chart/components/x_axis/time/parser/time-formats.model.d.ts +1 -1
- package/dist/chart/components/x_axis/time/parser/time-formats.model.js +1 -1
- package/dist/chart/components/x_axis/time/x-axis-weights.functions.d.ts +1 -1
- package/dist/chart/components/x_axis/time/x-axis-weights.functions.js +1 -1
- package/dist/chart/components/x_axis/time/x-axis-weights.generator.d.ts +1 -1
- package/dist/chart/components/x_axis/time/x-axis-weights.generator.js +1 -1
- package/dist/chart/components/x_axis/x-axis-draw.functions.d.ts +1 -1
- package/dist/chart/components/x_axis/x-axis-draw.functions.js +1 -1
- package/dist/chart/components/x_axis/x-axis-labels.drawer.d.ts +1 -1
- package/dist/chart/components/x_axis/x-axis-labels.drawer.js +1 -1
- package/dist/chart/components/x_axis/x-axis-labels.generator.d.ts +1 -1
- package/dist/chart/components/x_axis/x-axis-labels.generator.js +1 -1
- package/dist/chart/components/x_axis/x-axis-labels.model.d.ts +1 -1
- package/dist/chart/components/x_axis/x-axis-labels.model.js +1 -1
- package/dist/chart/components/x_axis/x-axis-scale.handler.d.ts +1 -1
- package/dist/chart/components/x_axis/x-axis-scale.handler.js +1 -1
- package/dist/chart/components/x_axis/x-axis-time-labels.drawer.d.ts +1 -1
- package/dist/chart/components/x_axis/x-axis-time-labels.drawer.js +1 -1
- package/dist/chart/components/x_axis/x-axis.component.d.ts +1 -1
- package/dist/chart/components/x_axis/x-axis.component.js +1 -1
- package/dist/chart/components/y_axis/label-color.functions.d.ts +1 -1
- package/dist/chart/components/y_axis/label-color.functions.js +1 -1
- package/dist/chart/components/y_axis/numeric-y-axis-labels.generator.d.ts +1 -1
- package/dist/chart/components/y_axis/numeric-y-axis-labels.generator.js +1 -1
- package/dist/chart/components/y_axis/price_labels/data-series-y-axis-labels.provider.d.ts +1 -1
- package/dist/chart/components/y_axis/price_labels/data-series-y-axis-labels.provider.js +1 -1
- package/dist/chart/components/y_axis/price_labels/labels-positions-calculator.d.ts +1 -1
- package/dist/chart/components/y_axis/price_labels/labels-positions-calculator.js +1 -1
- package/dist/chart/components/y_axis/price_labels/last-candle-labels.provider.d.ts +1 -1
- package/dist/chart/components/y_axis/price_labels/last-candle-labels.provider.js +1 -1
- package/dist/chart/components/y_axis/price_labels/price-label.drawer.d.ts +1 -1
- package/dist/chart/components/y_axis/price_labels/price-label.drawer.js +1 -1
- package/dist/chart/components/y_axis/price_labels/y-axis-labels.model.d.ts +1 -1
- package/dist/chart/components/y_axis/price_labels/y-axis-labels.model.js +1 -1
- package/dist/chart/components/y_axis/price_labels/y-axis-price-labels.drawer.d.ts +1 -1
- package/dist/chart/components/y_axis/price_labels/y-axis-price-labels.drawer.js +1 -1
- package/dist/chart/components/y_axis/y-axis-base-labels.model.d.ts +1 -1
- package/dist/chart/components/y_axis/y-axis-base-labels.model.js +1 -1
- package/dist/chart/components/y_axis/y-axis-labels.drawer.d.ts +1 -1
- package/dist/chart/components/y_axis/y-axis-labels.drawer.js +1 -1
- package/dist/chart/components/y_axis/y-axis-scale.handler.d.ts +1 -1
- package/dist/chart/components/y_axis/y-axis-scale.handler.js +1 -1
- package/dist/chart/components/y_axis/y-axis.component.d.ts +1 -1
- package/dist/chart/components/y_axis/y-axis.component.js +1 -1
- package/dist/chart/components/y_axis/y-axis.drawer.d.ts +1 -1
- package/dist/chart/components/y_axis/y-axis.drawer.js +1 -1
- package/dist/chart/components/y_axis/y-axis.model.d.ts +1 -1
- package/dist/chart/components/y_axis/y-axis.model.js +1 -1
- package/dist/chart/drawers/chart-background.drawer.d.ts +1 -1
- package/dist/chart/drawers/chart-background.drawer.js +1 -1
- package/dist/chart/drawers/chart-type-drawers/area.drawer.d.ts +1 -1
- package/dist/chart/drawers/chart-type-drawers/area.drawer.js +1 -1
- package/dist/chart/drawers/chart-type-drawers/bar.drawer.d.ts +1 -1
- package/dist/chart/drawers/chart-type-drawers/bar.drawer.js +1 -1
- package/dist/chart/drawers/chart-type-drawers/baseline.drawer.d.ts +1 -1
- package/dist/chart/drawers/chart-type-drawers/baseline.drawer.js +1 -1
- package/dist/chart/drawers/chart-type-drawers/candle.drawer.d.ts +1 -1
- package/dist/chart/drawers/chart-type-drawers/candle.drawer.js +1 -1
- package/dist/chart/drawers/chart-type-drawers/histogram.drawer.d.ts +1 -1
- package/dist/chart/drawers/chart-type-drawers/histogram.drawer.js +1 -1
- package/dist/chart/drawers/chart-type-drawers/line.drawer.d.ts +1 -1
- package/dist/chart/drawers/chart-type-drawers/line.drawer.js +1 -1
- package/dist/chart/drawers/chart-type-drawers/scatter-plot.drawer.d.ts +1 -1
- package/dist/chart/drawers/chart-type-drawers/scatter-plot.drawer.js +1 -1
- package/dist/chart/drawers/clear-canvas.drawer.d.ts +1 -1
- package/dist/chart/drawers/clear-canvas.drawer.js +1 -1
- package/dist/chart/drawers/composite.drawer.d.ts +1 -1
- package/dist/chart/drawers/composite.drawer.js +1 -1
- package/dist/chart/drawers/data-series-drawers/candle-series-wrapper.d.ts +1 -1
- package/dist/chart/drawers/data-series-drawers/candle-series-wrapper.js +1 -1
- package/dist/chart/drawers/data-series-drawers/color-candle.drawer.d.ts +1 -1
- package/dist/chart/drawers/data-series-drawers/color-candle.drawer.js +1 -1
- package/dist/chart/drawers/data-series-drawers/data-series-drawers.utils.d.ts +1 -1
- package/dist/chart/drawers/data-series-drawers/data-series-drawers.utils.js +1 -1
- package/dist/chart/drawers/data-series-drawers/difference-cloud.drawer.d.ts +1 -1
- package/dist/chart/drawers/data-series-drawers/difference-cloud.drawer.js +1 -1
- package/dist/chart/drawers/data-series-drawers/histogram.drawer.d.ts +1 -1
- package/dist/chart/drawers/data-series-drawers/histogram.drawer.js +1 -1
- package/dist/chart/drawers/data-series-drawers/linear.drawer.d.ts +1 -1
- package/dist/chart/drawers/data-series-drawers/linear.drawer.js +1 -1
- package/dist/chart/drawers/data-series-drawers/points.drawer.d.ts +1 -1
- package/dist/chart/drawers/data-series-drawers/points.drawer.js +1 -1
- package/dist/chart/drawers/data-series-drawers/rectangular-tool.drawer.d.ts +1 -1
- package/dist/chart/drawers/data-series-drawers/rectangular-tool.drawer.js +1 -1
- package/dist/chart/drawers/data-series-drawers/text.drawer.d.ts +1 -1
- package/dist/chart/drawers/data-series-drawers/text.drawer.js +1 -1
- package/dist/chart/drawers/data-series-drawers/trend-histogram.drawer.d.ts +1 -1
- package/dist/chart/drawers/data-series-drawers/trend-histogram.drawer.js +1 -1
- package/dist/chart/drawers/data-series-drawers/triangle.drawer.d.ts +1 -1
- package/dist/chart/drawers/data-series-drawers/triangle.drawer.js +1 -1
- package/dist/chart/drawers/data-series.drawer.d.ts +1 -1
- package/dist/chart/drawers/data-series.drawer.js +1 -1
- package/dist/chart/drawers/drawing-manager.d.ts +1 -1
- package/dist/chart/drawers/drawing-manager.js +1 -1
- package/dist/chart/drawers/ht-data-series.drawer.d.ts +1 -1
- package/dist/chart/drawers/ht-data-series.drawer.js +1 -1
- package/dist/chart/events/event-bus.d.ts +1 -1
- package/dist/chart/events/event-bus.js +1 -1
- package/dist/chart/events/events.d.ts +1 -1
- package/dist/chart/events/events.js +1 -1
- package/dist/chart/inputhandlers/candle-tap.handler.d.ts +1 -1
- package/dist/chart/inputhandlers/candle-tap.handler.js +1 -1
- package/dist/chart/inputhandlers/chart-resize.handler.d.ts +1 -1
- package/dist/chart/inputhandlers/chart-resize.handler.js +1 -1
- package/dist/chart/inputhandlers/cross-event-producer.component.d.ts +1 -1
- package/dist/chart/inputhandlers/cross-event-producer.component.js +1 -1
- package/dist/chart/inputhandlers/hover-producer.component.d.ts +1 -1
- package/dist/chart/inputhandlers/hover-producer.component.js +1 -1
- package/dist/chart/inputhandlers/main-canvas-touch.handler.d.ts +1 -1
- package/dist/chart/inputhandlers/main-canvas-touch.handler.js +1 -1
- package/dist/chart/inputlisteners/canvas-input-listener.component.d.ts +1 -1
- package/dist/chart/inputlisteners/canvas-input-listener.component.js +1 -1
- package/dist/chart/model/baseline.model.d.ts +1 -1
- package/dist/chart/model/baseline.model.js +1 -1
- package/dist/chart/model/bounds.model.d.ts +1 -1
- package/dist/chart/model/bounds.model.js +1 -1
- package/dist/chart/model/candle-hover.d.ts +1 -1
- package/dist/chart/model/candle-hover.js +1 -1
- package/dist/chart/model/candle-series-high-low.provider.d.ts +1 -1
- package/dist/chart/model/candle-series-high-low.provider.js +1 -1
- package/dist/chart/model/candle-series.model.d.ts +1 -1
- package/dist/chart/model/candle-series.model.js +1 -1
- package/dist/chart/model/candle.model.d.ts +1 -1
- package/dist/chart/model/candle.model.js +1 -1
- package/dist/chart/model/canvas.model.d.ts +1 -1
- package/dist/chart/model/canvas.model.js +1 -1
- package/dist/chart/model/chart-base-element.d.ts +1 -1
- package/dist/chart/model/chart-base-element.js +1 -1
- package/dist/chart/model/compare-series-hover.d.ts +1 -1
- package/dist/chart/model/compare-series-hover.js +1 -1
- package/dist/chart/model/data-series-view.d.ts +1 -1
- package/dist/chart/model/data-series-view.js +1 -1
- package/dist/chart/model/data-series.config.d.ts +1 -1
- package/dist/chart/model/data-series.config.js +1 -1
- package/dist/chart/model/data-series.model.d.ts +1 -1
- package/dist/chart/model/data-series.model.js +1 -1
- package/dist/chart/model/date-time.formatter.d.ts +1 -1
- package/dist/chart/model/date-time.formatter.js +1 -1
- package/dist/chart/model/hit-test-canvas.model.d.ts +1 -1
- package/dist/chart/model/hit-test-canvas.model.js +2 -2
- package/dist/chart/model/main-candle-series.model.d.ts +1 -1
- package/dist/chart/model/main-candle-series.model.js +1 -1
- package/dist/chart/model/scale.model.d.ts +1 -1
- package/dist/chart/model/scale.model.js +1 -1
- package/dist/chart/model/scaling/auto-scale.model.d.ts +1 -1
- package/dist/chart/model/scaling/auto-scale.model.js +1 -1
- package/dist/chart/model/scaling/constrait.functions.d.ts +1 -1
- package/dist/chart/model/scaling/constrait.functions.js +1 -1
- package/dist/chart/model/scaling/lock-ratio.model.d.ts +1 -1
- package/dist/chart/model/scaling/lock-ratio.model.js +1 -1
- package/dist/chart/model/scaling/move-chart.functions.d.ts +1 -1
- package/dist/chart/model/scaling/move-chart.functions.js +1 -1
- package/dist/chart/model/scaling/viewport.model.d.ts +1 -1
- package/dist/chart/model/scaling/viewport.model.js +1 -1
- package/dist/chart/model/scaling/x-zooming.functions.d.ts +1 -1
- package/dist/chart/model/scaling/x-zooming.functions.js +1 -1
- package/dist/chart/model/time-zone.model.d.ts +1 -1
- package/dist/chart/model/time-zone.model.js +1 -1
- package/dist/chart/model/visual-candle.d.ts +1 -1
- package/dist/chart/model/visual-candle.js +1 -1
- package/dist/chart/utils/__tests__/array.utils.test.d.ts +1 -1
- package/dist/chart/utils/__tests__/array.utils.test.js +1 -1
- package/dist/chart/utils/__tests__/math.utils.test.d.ts +6 -0
- package/dist/chart/utils/__tests__/math.utils.test.js +6 -0
- package/dist/chart/utils/__tests__/object.utils.test.d.ts +1 -1
- package/dist/chart/utils/__tests__/object.utils.test.js +1 -1
- package/dist/chart/utils/__tests__/priceIncrementsUtils.test.d.ts +1 -1
- package/dist/chart/utils/__tests__/priceIncrementsUtils.test.js +1 -1
- package/dist/chart/utils/array.utils.d.ts +1 -1
- package/dist/chart/utils/array.utils.js +1 -1
- package/dist/chart/utils/auto-period-detector.utils.d.ts +1 -1
- package/dist/chart/utils/auto-period-detector.utils.js +1 -1
- package/dist/chart/utils/candles-generator-ts.utils.d.ts +1 -1
- package/dist/chart/utils/candles-generator-ts.utils.js +1 -1
- package/dist/chart/utils/candles-generator.utils.d.ts +1 -1
- package/dist/chart/utils/candles-generator.utils.js +1 -1
- package/dist/chart/utils/candles.utils.d.ts +1 -1
- package/dist/chart/utils/candles.utils.js +1 -1
- package/dist/chart/utils/canvas/canvas-drawing-functions.utils.d.ts +1 -1
- package/dist/chart/utils/canvas/canvas-drawing-functions.utils.js +1 -1
- package/dist/chart/utils/canvas/canvas-font-measure-tool.utils.d.ts +1 -1
- package/dist/chart/utils/canvas/canvas-font-measure-tool.utils.js +1 -1
- package/dist/chart/utils/canvas/canvas-text-functions.utils.d.ts +1 -1
- package/dist/chart/utils/canvas/canvas-text-functions.utils.js +1 -1
- package/dist/chart/utils/color.utils.d.ts +1 -1
- package/dist/chart/utils/color.utils.js +1 -1
- package/dist/chart/utils/device/browser.utils.d.ts +1 -1
- package/dist/chart/utils/device/browser.utils.js +1 -1
- package/dist/chart/utils/device/device-detector.utils.d.ts +1 -1
- package/dist/chart/utils/device/device-detector.utils.js +1 -1
- package/dist/chart/utils/device/device-pixel-ratio.utils.d.ts +1 -1
- package/dist/chart/utils/device/device-pixel-ratio.utils.js +1 -1
- package/dist/chart/utils/device/touchpad.utils.d.ts +1 -1
- package/dist/chart/utils/device/touchpad.utils.js +1 -1
- package/dist/chart/utils/dom.utils.d.ts +1 -1
- package/dist/chart/utils/dom.utils.js +1 -1
- package/dist/chart/utils/function.utils.d.ts +1 -1
- package/dist/chart/utils/function.utils.js +1 -1
- package/dist/chart/utils/math.utils.d.ts +1 -1
- package/dist/chart/utils/math.utils.js +1 -1
- package/dist/chart/utils/merge.utils.d.ts +1 -1
- package/dist/chart/utils/merge.utils.js +1 -1
- package/dist/chart/utils/object.utils.d.ts +1 -1
- package/dist/chart/utils/object.utils.js +1 -1
- package/dist/chart/utils/perfomance/animation-frame-cache.utils.d.ts +1 -1
- package/dist/chart/utils/perfomance/animation-frame-cache.utils.js +1 -1
- package/dist/chart/utils/perfomance/debounce.utils.d.ts +1 -1
- package/dist/chart/utils/perfomance/debounce.utils.js +1 -1
- package/dist/chart/utils/perfomance/memoize.utils.d.ts +1 -1
- package/dist/chart/utils/perfomance/memoize.utils.js +1 -1
- package/dist/chart/utils/perfomance/request-animation-frame-throttle.utils.d.ts +1 -1
- package/dist/chart/utils/perfomance/request-animation-frame-throttle.utils.js +1 -1
- package/dist/chart/utils/perfomance/throttle.utils.d.ts +1 -1
- package/dist/chart/utils/perfomance/throttle.utils.js +1 -1
- package/dist/chart/utils/price-increments.utils.d.ts +1 -1
- package/dist/chart/utils/price-increments.utils.js +1 -1
- package/dist/chart/utils/uuid.utils.d.ts +1 -1
- package/dist/chart/utils/uuid.utils.js +1 -1
- package/dist/dxchart.min.js +5 -5
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/dxchart.min.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright (C)
|
|
2
|
+
* Copyright (C) 2019 - 2023 Devexperts Solutions IE Limited
|
|
3
3
|
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
4
4
|
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
5
|
*/
|
|
6
|
-
(()=>{var rv;(()=>{var Ra={8168:(L,M,w)=>{var T=w(9092),I={};for(var H in T)T.hasOwnProperty(H)&&(I[T[H]]=H);var D=L.exports={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};for(var F in D)if(D.hasOwnProperty(F)){if(!("channels"in D[F]))throw new Error("missing channels property: "+F);if(!("labels"in D[F]))throw new Error("missing channel labels property: "+F);if(D[F].labels.length!==D[F].channels)throw new Error("channel and label counts mismatch: "+F);var A=D[F].channels,S=D[F].labels;delete D[F].channels,delete D[F].labels,Object.defineProperty(D[F],"channels",{value:A}),Object.defineProperty(D[F],"labels",{value:S})}D.rgb.hsl=function(d){var m=d[0]/255,C=d[1]/255,b=d[2]/255,P=Math.min(m,C,b),u=Math.max(m,C,b),f=u-P,g,x,_;return u===P?g=0:m===u?g=(C-b)/f:C===u?g=2+(b-m)/f:b===u&&(g=4+(m-C)/f),g=Math.min(g*60,360),g<0&&(g+=360),_=(P+u)/2,u===P?x=0:_<=.5?x=f/(u+P):x=f/(2-u-P),[g,x*100,_*100]},D.rgb.hsv=function(d){var m,C,b,P,u,f=d[0]/255,g=d[1]/255,x=d[2]/255,_=Math.max(f,g,x),B=_-Math.min(f,g,x),W=function(j){return(_-j)/6/B+1/2};return B===0?P=u=0:(u=B/_,m=W(f),C=W(g),b=W(x),f===_?P=b-C:g===_?P=.3333333333333333+m-b:x===_&&(P=.6666666666666666+C-m),P<0?P+=1:P>1&&(P-=1)),[P*360,u*100,_*100]},D.rgb.hwb=function(d){var m=d[0],C=d[1],b=d[2],P=D.rgb.hsl(d)[0],u=1/255*Math.min(m,Math.min(C,b));return b=1-.00392156862745098*Math.max(m,Math.max(C,b)),[P,u*100,b*100]},D.rgb.cmyk=function(d){var m=d[0]/255,C=d[1]/255,b=d[2]/255,P,u,f,g;return g=Math.min(1-m,1-C,1-b),P=(1-m-g)/(1-g)||0,u=(1-C-g)/(1-g)||0,f=(1-b-g)/(1-g)||0,[P*100,u*100,f*100,g*100]};function O(d,m){return Math.pow(d[0]-m[0],2)+Math.pow(d[1]-m[1],2)+Math.pow(d[2]-m[2],2)}D.rgb.keyword=function(d){var m=I[d];if(m)return m;var C=1/0,b;for(var P in T)if(T.hasOwnProperty(P)){var u=T[P],f=O(d,u);f<C&&(C=f,b=P)}return b},D.keyword.rgb=function(d){return T[d]},D.rgb.xyz=function(d){var m=d[0]/255,C=d[1]/255,b=d[2]/255;m=m>.04045?Math.pow((m+.055)/1.055,2.4):m/12.92,C=C>.04045?Math.pow((C+.055)/1.055,2.4):C/12.92,b=b>.04045?Math.pow((b+.055)/1.055,2.4):b/12.92;var P=m*.4124+C*.3576+b*.1805,u=m*.2126+C*.7152+b*.0722,f=m*.0193+C*.1192+b*.9505;return[P*100,u*100,f*100]},D.rgb.lab=function(d){var m=D.rgb.xyz(d),C=m[0],b=m[1],P=m[2],u,f,g;return C/=95.047,b/=100,P/=108.883,C=C>.008856?Math.pow(C,.3333333333333333):7.787*C+.13793103448275862,b=b>.008856?Math.pow(b,.3333333333333333):7.787*b+.13793103448275862,P=P>.008856?Math.pow(P,.3333333333333333):7.787*P+.13793103448275862,u=116*b-16,f=500*(C-b),g=200*(b-P),[u,f,g]},D.hsl.rgb=function(d){var m=d[0]/360,C=d[1]/100,b=d[2]/100,P,u,f,g,x;if(C===0)return x=b*255,[x,x,x];b<.5?u=b*(1+C):u=b+C-b*C,P=2*b-u,g=[0,0,0];for(var _=0;_<3;_++)f=m+.3333333333333333*-(_-1),f<0&&f++,f>1&&f--,6*f<1?x=P+(u-P)*6*f:2*f<1?x=u:3*f<2?x=P+(u-P)*(.6666666666666666-f)*6:x=P,g[_]=x*255;return g},D.hsl.hsv=function(d){var m=d[0],C=d[1]/100,b=d[2]/100,P=C,u=Math.max(b,.01),f,g;return b*=2,C*=b<=1?b:2-b,P*=u<=1?u:2-u,g=(b+C)/2,f=b===0?2*P/(u+P):2*C/(b+C),[m,f*100,g*100]},D.hsv.rgb=function(d){var m=d[0]/60,C=d[1]/100,b=d[2]/100,P=Math.floor(m)%6,u=m-Math.floor(m),f=255*b*(1-C),g=255*b*(1-C*u),x=255*b*(1-C*(1-u));switch(b*=255,P){case 0:return[b,x,f];case 1:return[g,b,f];case 2:return[f,b,x];case 3:return[f,g,b];case 4:return[x,f,b];case 5:return[b,f,g]}},D.hsv.hsl=function(d){var m=d[0],C=d[1]/100,b=d[2]/100,P=Math.max(b,.01),u,f,g;return g=(2-C)*b,u=(2-C)*P,f=C*P,f/=u<=1?u:2-u,f=f||0,g/=2,[m,f*100,g*100]},D.hwb.rgb=function(d){var m=d[0]/360,C=d[1]/100,b=d[2]/100,P=C+b,u,f,g,x;P>1&&(C/=P,b/=P),u=Math.floor(6*m),f=1-b,g=6*m-u,u&1&&(g=1-g),x=C+g*(f-C);var _,B,W;switch(u){default:case 6:case 0:_=f,B=x,W=C;break;case 1:_=x,B=f,W=C;break;case 2:_=C,B=f,W=x;break;case 3:_=C,B=x,W=f;break;case 4:_=x,B=C,W=f;break;case 5:_=f,B=C,W=x;break}return[_*255,B*255,W*255]},D.cmyk.rgb=function(d){var m=d[0]/100,C=d[1]/100,b=d[2]/100,P=d[3]/100,u,f,g;return u=1-Math.min(1,m*(1-P)+P),f=1-Math.min(1,C*(1-P)+P),g=1-Math.min(1,b*(1-P)+P),[u*255,f*255,g*255]},D.xyz.rgb=function(d){var m=d[0]/100,C=d[1]/100,b=d[2]/100,P,u,f;return P=m*3.2406+C*-1.5372+b*-.4986,u=m*-.9689+C*1.8758+b*.0415,f=m*.0557+C*-.204+b*1.057,P=P>.0031308?1.055*Math.pow(P,.4166666666666667)-.055:P*12.92,u=u>.0031308?1.055*Math.pow(u,.4166666666666667)-.055:u*12.92,f=f>.0031308?1.055*Math.pow(f,.4166666666666667)-.055:f*12.92,P=Math.min(Math.max(0,P),1),u=Math.min(Math.max(0,u),1),f=Math.min(Math.max(0,f),1),[P*255,u*255,f*255]},D.xyz.lab=function(d){var m=d[0],C=d[1],b=d[2],P,u,f;return m/=95.047,C/=100,b/=108.883,m=m>.008856?Math.pow(m,.3333333333333333):7.787*m+.13793103448275862,C=C>.008856?Math.pow(C,.3333333333333333):7.787*C+.13793103448275862,b=b>.008856?Math.pow(b,.3333333333333333):7.787*b+.13793103448275862,P=116*C-16,u=500*(m-C),f=200*(C-b),[P,u,f]},D.lab.xyz=function(d){var m=d[0],C=d[1],b=d[2],P,u,f;u=(m+16)/116,P=C/500+u,f=u-b/200;var g=Math.pow(u,3),x=Math.pow(P,3),_=Math.pow(f,3);return u=g>.008856?g:(u-.13793103448275862)/7.787,P=x>.008856?x:(P-.13793103448275862)/7.787,f=_>.008856?_:(f-.13793103448275862)/7.787,P*=95.047,u*=100,f*=108.883,[P,u,f]},D.lab.lch=function(d){var m=d[0],C=d[1],b=d[2],P,u,f;return P=Math.atan2(b,C),u=P*360/2/Math.PI,u<0&&(u+=360),f=Math.sqrt(C*C+b*b),[m,f,u]},D.lch.lab=function(d){var m=d[0],C=d[1],b=d[2],P,u,f;return f=b/360*2*Math.PI,P=C*Math.cos(f),u=C*Math.sin(f),[m,P,u]},D.rgb.ansi16=function(d){var m=d[0],C=d[1],b=d[2],P=1 in arguments?arguments[1]:D.rgb.hsv(d)[2];if(P=Math.round(P/50),P===0)return 30;var u=30+(Math.round(b/255)<<2|Math.round(C/255)<<1|Math.round(m/255));return P===2&&(u+=60),u},D.hsv.ansi16=function(d){return D.rgb.ansi16(D.hsv.rgb(d),d[2])},D.rgb.ansi256=function(d){var m=d[0],C=d[1],b=d[2];if(m===C&&C===b)return m<8?16:m>248?231:Math.round((m-8)/247*24)+232;var P=16+36*Math.round(m/255*5)+6*Math.round(C/255*5)+Math.round(b/255*5);return P},D.ansi16.rgb=function(d){var m=d%10;if(m===0||m===7)return d>50&&(m+=3.5),m=m/10.5*255,[m,m,m];var C=(~~(d>50)+1)*.5,b=(m&1)*C*255,P=(m>>1&1)*C*255,u=(m>>2&1)*C*255;return[b,P,u]},D.ansi256.rgb=function(d){if(d>=232){var m=(d-232)*10+8;return[m,m,m]}d-=16;var C,b=Math.floor(d/36)/5*255,P=Math.floor((C=d%36)/6)/5*255,u=C%6/5*255;return[b,P,u]},D.rgb.hex=function(d){var m=((Math.round(d[0])&255)<<16)+((Math.round(d[1])&255)<<8)+(Math.round(d[2])&255),C=m.toString(16).toUpperCase();return"000000".substring(C.length)+C},D.hex.rgb=function(d){var m=d.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!m)return[0,0,0];var C=m[0];m[0].length===3&&(C=C.split("").map(function(g){return g+g}).join(""));var b=parseInt(C,16),P=b>>16&255,u=b>>8&255,f=b&255;return[P,u,f]},D.rgb.hcg=function(d){var m=d[0]/255,C=d[1]/255,b=d[2]/255,P=Math.max(Math.max(m,C),b),u=Math.min(Math.min(m,C),b),f=P-u,g,x;return f<1?g=u/(1-f):g=0,f<=0?x=0:P===m?x=(C-b)/f%6:P===C?x=2+(b-m)/f:x=4+(m-C)/f+4,x/=6,x%=1,[x*360,f*100,g*100]},D.hsl.hcg=function(d){var m=d[1]/100,C=d[2]/100,b=1,P=0;return C<.5?b=2*m*C:b=2*m*(1-C),b<1&&(P=(C-.5*b)/(1-b)),[d[0],b*100,P*100]},D.hsv.hcg=function(d){var m=d[1]/100,C=d[2]/100,b=m*C,P=0;return b<1&&(P=(C-b)/(1-b)),[d[0],b*100,P*100]},D.hcg.rgb=function(d){var m=d[0]/360,C=d[1]/100,b=d[2]/100;if(C===0)return[b*255,b*255,b*255];var P=[0,0,0],u=m%1*6,f=u%1,g=1-f,x=0;switch(Math.floor(u)){case 0:P[0]=1,P[1]=f,P[2]=0;break;case 1:P[0]=g,P[1]=1,P[2]=0;break;case 2:P[0]=0,P[1]=1,P[2]=f;break;case 3:P[0]=0,P[1]=g,P[2]=1;break;case 4:P[0]=f,P[1]=0,P[2]=1;break;default:P[0]=1,P[1]=0,P[2]=g}return x=(1-C)*b,[(C*P[0]+x)*255,(C*P[1]+x)*255,(C*P[2]+x)*255]},D.hcg.hsv=function(d){var m=d[1]/100,C=d[2]/100,b=m+C*(1-m),P=0;return b>0&&(P=m/b),[d[0],P*100,b*100]},D.hcg.hsl=function(d){var m=d[1]/100,C=d[2]/100,b=C*(1-m)+.5*m,P=0;return b>0&&b<.5?P=m/(2*b):b>=.5&&b<1&&(P=m/(2*(1-b))),[d[0],P*100,b*100]},D.hcg.hwb=function(d){var m=d[1]/100,C=d[2]/100,b=m+C*(1-m);return[d[0],(b-m)*100,(1-b)*100]},D.hwb.hcg=function(d){var m=d[1]/100,C=d[2]/100,b=1-C,P=b-m,u=0;return P<1&&(u=(b-P)/(1-P)),[d[0],P*100,u*100]},D.apple.rgb=function(d){return[d[0]/65535*255,d[1]/65535*255,d[2]/65535*255]},D.rgb.apple=function(d){return[d[0]/255*65535,d[1]/255*65535,d[2]/255*65535]},D.gray.rgb=function(d){return[d[0]/100*255,d[0]/100*255,d[0]/100*255]},D.gray.hsl=D.gray.hsv=function(d){return[0,0,d[0]]},D.gray.hwb=function(d){return[0,100,d[0]]},D.gray.cmyk=function(d){return[0,0,0,d[0]]},D.gray.lab=function(d){return[d[0],0,0]},D.gray.hex=function(d){var m=Math.round(d[0]/100*255)&255,C=(m<<16)+(m<<8)+m,b=C.toString(16).toUpperCase();return"000000".substring(b.length)+b},D.rgb.gray=function(d){var m=(d[0]+d[1]+d[2])/3;return[m/255*100]}},2085:(L,M,w)=>{var T=w(8168),I=w(4111),H={},D=Object.keys(T);function F(S){var O=function(d){return d==null?d:(arguments.length>1&&(d=Array.prototype.slice.call(arguments)),S(d))};return"conversion"in S&&(O.conversion=S.conversion),O}function A(S){var O=function(d){if(d==null)return d;arguments.length>1&&(d=Array.prototype.slice.call(arguments));var m=S(d);if(typeof m=="object")for(var C=m.length,b=0;b<C;b++)m[b]=Math.round(m[b]);return m};return"conversion"in S&&(O.conversion=S.conversion),O}D.forEach(function(S){H[S]={},Object.defineProperty(H[S],"channels",{value:T[S].channels}),Object.defineProperty(H[S],"labels",{value:T[S].labels});var O=I(S),d=Object.keys(O);d.forEach(function(m){var C=O[m];H[S][m]=A(C),H[S][m].raw=F(C)})}),L.exports=H},9092:L=>{"use strict";L.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}},4111:(L,M,w)=>{var T=w(8168);function I(){for(var A={},S=Object.keys(T),O=S.length,d=0;d<O;d++)A[S[d]]={distance:-1,parent:null};return A}function H(A){var S=I(),O=[A];for(S[A].distance=0;O.length;)for(var d=O.pop(),m=Object.keys(T[d]),C=m.length,b=0;b<C;b++){var P=m[b],u=S[P];u.distance===-1&&(u.distance=S[d].distance+1,u.parent=d,O.unshift(P))}return S}function D(A,S){return function(O){return S(A(O))}}function F(A,S){for(var O=[S[A].parent,A],d=T[S[A].parent][A],m=S[A].parent;S[m].parent;)O.unshift(S[m].parent),d=D(T[S[m].parent][m],d),m=S[m].parent;return d.conversion=O,d}L.exports=function(A){for(var S=H(A),O={},d=Object.keys(S),m=d.length,C=0;C<m;C++){var b=d[C],P=S[b];P.parent!==null&&(O[b]=F(b,S))}return O}},8874:L=>{"use strict";L.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}},9818:(L,M,w)=>{var T=w(8874),I=w(6851),H=Object.hasOwnProperty,D=Object.create(null);for(var F in T)H.call(T,F)&&(D[T[F]]=F);var A=L.exports={to:{},get:{}};A.get=function(d){var m=d.substring(0,3).toLowerCase(),C,b;switch(m){case"hsl":C=A.get.hsl(d),b="hsl";break;case"hwb":C=A.get.hwb(d),b="hwb";break;default:C=A.get.rgb(d),b="rgb";break}return C?{model:b,value:C}:null},A.get.rgb=function(d){if(!d)return null;var m=/^#([a-f0-9]{3,4})$/i,C=/^#([a-f0-9]{6})([a-f0-9]{2})?$/i,b=/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,P=/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,u=/^(\w+)$/,f=[0,0,0,1],g,x,_;if(g=d.match(C)){for(_=g[2],g=g[1],x=0;x<3;x++){var B=x*2;f[x]=parseInt(g.slice(B,B+2),16)}_&&(f[3]=parseInt(_,16)/255)}else if(g=d.match(m)){for(g=g[1],_=g[3],x=0;x<3;x++)f[x]=parseInt(g[x]+g[x],16);_&&(f[3]=parseInt(_+_,16)/255)}else if(g=d.match(b)){for(x=0;x<3;x++)f[x]=parseInt(g[x+1],0);g[4]&&(g[5]?f[3]=parseFloat(g[4])*.01:f[3]=parseFloat(g[4]))}else if(g=d.match(P)){for(x=0;x<3;x++)f[x]=Math.round(parseFloat(g[x+1])*2.55);g[4]&&(g[5]?f[3]=parseFloat(g[4])*.01:f[3]=parseFloat(g[4]))}else return(g=d.match(u))?g[1]==="transparent"?[0,0,0,0]:H.call(T,g[1])?(f=T[g[1]],f[3]=1,f):null:null;for(x=0;x<3;x++)f[x]=S(f[x],0,255);return f[3]=S(f[3],0,1),f},A.get.hsl=function(d){if(!d)return null;var m=/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/,C=d.match(m);if(C){var b=parseFloat(C[4]),P=(parseFloat(C[1])%360+360)%360,u=S(parseFloat(C[2]),0,100),f=S(parseFloat(C[3]),0,100),g=S(isNaN(b)?1:b,0,1);return[P,u,f,g]}return null},A.get.hwb=function(d){if(!d)return null;var m=/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/,C=d.match(m);if(C){var b=parseFloat(C[4]),P=(parseFloat(C[1])%360+360)%360,u=S(parseFloat(C[2]),0,100),f=S(parseFloat(C[3]),0,100),g=S(isNaN(b)?1:b,0,1);return[P,u,f,g]}return null},A.to.hex=function(){var d=I(arguments);return"#"+O(d[0])+O(d[1])+O(d[2])+(d[3]<1?O(Math.round(d[3]*255)):"")},A.to.rgb=function(){var d=I(arguments);return d.length<4||d[3]===1?"rgb("+Math.round(d[0])+", "+Math.round(d[1])+", "+Math.round(d[2])+")":"rgba("+Math.round(d[0])+", "+Math.round(d[1])+", "+Math.round(d[2])+", "+d[3]+")"},A.to.rgb.percent=function(){var d=I(arguments),m=Math.round(d[0]/255*100),C=Math.round(d[1]/255*100),b=Math.round(d[2]/255*100);return d.length<4||d[3]===1?"rgb("+m+"%, "+C+"%, "+b+"%)":"rgba("+m+"%, "+C+"%, "+b+"%, "+d[3]+")"},A.to.hsl=function(){var d=I(arguments);return d.length<4||d[3]===1?"hsl("+d[0]+", "+d[1]+"%, "+d[2]+"%)":"hsla("+d[0]+", "+d[1]+"%, "+d[2]+"%, "+d[3]+")"},A.to.hwb=function(){var d=I(arguments),m="";return d.length>=4&&d[3]!==1&&(m=", "+d[3]),"hwb("+d[0]+", "+d[1]+"%, "+d[2]+"%"+m+")"},A.to.keyword=function(d){return D[d.slice(0,3)]};function S(d,m,C){return Math.min(Math.max(m,d),C)}function O(d){var m=Math.round(d).toString(16).toUpperCase();return m.length<2?"0"+m:m}},6767:(L,M,w)=>{"use strict";var T=w(9818),I=w(2085),H=[].slice,D=["keyword","gray","hex"],F={};Object.keys(I).forEach(function(u){F[H.call(I[u].labels).sort().join("")]=u});var A={};function S(u,f){if(!(this instanceof S))return new S(u,f);if(f&&f in D&&(f=null),f&&!(f in I))throw new Error("Unknown model: "+f);var g,x;if(u==null)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(u instanceof S)this.model=u.model,this.color=u.color.slice(),this.valpha=u.valpha;else if(typeof u=="string"){var _=T.get(u);if(_===null)throw new Error("Unable to parse color from string: "+u);this.model=_.model,x=I[this.model].channels,this.color=_.value.slice(0,x),this.valpha=typeof _.value[x]=="number"?_.value[x]:1}else if(u.length){this.model=f||"rgb",x=I[this.model].channels;var B=H.call(u,0,x);this.color=P(B,x),this.valpha=typeof u[x]=="number"?u[x]:1}else if(typeof u=="number")u&=16777215,this.model="rgb",this.color=[u>>16&255,u>>8&255,u&255],this.valpha=1;else{this.valpha=1;var W=Object.keys(u);"alpha"in u&&(W.splice(W.indexOf("alpha"),1),this.valpha=typeof u.alpha=="number"?u.alpha:0);var j=W.sort().join("");if(!(j in F))throw new Error("Unable to parse color from object: "+JSON.stringify(u));this.model=F[j];var ee=I[this.model].labels,V=[];for(g=0;g<ee.length;g++)V.push(u[ee[g]]);this.color=P(V)}if(A[this.model])for(x=I[this.model].channels,g=0;g<x;g++){var z=A[this.model][g];z&&(this.color[g]=z(this.color[g]))}this.valpha=Math.max(0,Math.min(1,this.valpha)),Object.freeze&&Object.freeze(this)}S.prototype={toString:function(){return this.string()},toJSON:function(){return this[this.model]()},string:function(u){var f=this.model in T.to?this:this.rgb();f=f.round(typeof u=="number"?u:1);var g=f.valpha===1?f.color:f.color.concat(this.valpha);return T.to[f.model](g)},percentString:function(u){var f=this.rgb().round(typeof u=="number"?u:1),g=f.valpha===1?f.color:f.color.concat(this.valpha);return T.to.rgb.percent(g)},array:function(){return this.valpha===1?this.color.slice():this.color.concat(this.valpha)},object:function(){for(var u={},f=I[this.model].channels,g=I[this.model].labels,x=0;x<f;x++)u[g[x]]=this.color[x];return this.valpha!==1&&(u.alpha=this.valpha),u},unitArray:function(){var u=this.rgb().color;return u[0]/=255,u[1]/=255,u[2]/=255,this.valpha!==1&&u.push(this.valpha),u},unitObject:function(){var u=this.rgb().object();return u.r/=255,u.g/=255,u.b/=255,this.valpha!==1&&(u.alpha=this.valpha),u},round:function(u){return u=Math.max(u||0,0),new S(this.color.map(d(u)).concat(this.valpha),this.model)},alpha:function(u){return arguments.length?new S(this.color.concat(Math.max(0,Math.min(1,u))),this.model):this.valpha},red:m("rgb",0,C(255)),green:m("rgb",1,C(255)),blue:m("rgb",2,C(255)),hue:m(["hsl","hsv","hsl","hwb","hcg"],0,function(u){return(u%360+360)%360}),saturationl:m("hsl",1,C(100)),lightness:m("hsl",2,C(100)),saturationv:m("hsv",1,C(100)),value:m("hsv",2,C(100)),chroma:m("hcg",1,C(100)),gray:m("hcg",2,C(100)),white:m("hwb",1,C(100)),wblack:m("hwb",2,C(100)),cyan:m("cmyk",0,C(100)),magenta:m("cmyk",1,C(100)),yellow:m("cmyk",2,C(100)),black:m("cmyk",3,C(100)),x:m("xyz",0,C(100)),y:m("xyz",1,C(100)),z:m("xyz",2,C(100)),l:m("lab",0,C(100)),a:m("lab",1),b:m("lab",2),keyword:function(u){return arguments.length?new S(u):I[this.model].keyword(this.color)},hex:function(u){return arguments.length?new S(u):T.to.hex(this.rgb().round().color)},rgbNumber:function(){var u=this.rgb().color;return(u[0]&255)<<16|(u[1]&255)<<8|u[2]&255},luminosity:function(){for(var u=this.rgb().color,f=[],g=0;g<u.length;g++){var x=u[g]/255;f[g]=x<=.03928?x/12.92:Math.pow((x+.055)/1.055,2.4)}return .2126*f[0]+.7152*f[1]+.0722*f[2]},contrast:function(u){var f=this.luminosity(),g=u.luminosity();return f>g?(f+.05)/(g+.05):(g+.05)/(f+.05)},level:function(u){var f=this.contrast(u);return f>=7.1?"AAA":f>=4.5?"AA":""},isDark:function(){var u=this.rgb().color,f=(u[0]*299+u[1]*587+u[2]*114)/1e3;return f<128},isLight:function(){return!this.isDark()},negate:function(){for(var u=this.rgb(),f=0;f<3;f++)u.color[f]=255-u.color[f];return u},lighten:function(u){var f=this.hsl();return f.color[2]+=f.color[2]*u,f},darken:function(u){var f=this.hsl();return f.color[2]-=f.color[2]*u,f},saturate:function(u){var f=this.hsl();return f.color[1]+=f.color[1]*u,f},desaturate:function(u){var f=this.hsl();return f.color[1]-=f.color[1]*u,f},whiten:function(u){var f=this.hwb();return f.color[1]+=f.color[1]*u,f},blacken:function(u){var f=this.hwb();return f.color[2]+=f.color[2]*u,f},grayscale:function(){var u=this.rgb().color,f=u[0]*.3+u[1]*.59+u[2]*.11;return S.rgb(f,f,f)},fade:function(u){return this.alpha(this.valpha-this.valpha*u)},opaquer:function(u){return this.alpha(this.valpha+this.valpha*u)},rotate:function(u){var f=this.hsl(),g=f.color[0];return g=(g+u)%360,g=g<0?360+g:g,f.color[0]=g,f},mix:function(u,f){if(!u||!u.rgb)throw new Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof u);var g=u.rgb(),x=this.rgb(),_=f===void 0?.5:f,B=2*_-1,W=g.alpha()-x.alpha(),j=((B*W===-1?B:(B+W)/(1+B*W))+1)/2,ee=1-j;return S.rgb(j*g.red()+ee*x.red(),j*g.green()+ee*x.green(),j*g.blue()+ee*x.blue(),g.alpha()*_+x.alpha()*(1-_))}},Object.keys(I).forEach(function(u){if(D.indexOf(u)===-1){var f=I[u].channels;S.prototype[u]=function(){if(this.model===u)return new S(this);if(arguments.length)return new S(arguments,u);var g=typeof arguments[f]=="number"?f:this.valpha;return new S(b(I[this.model][u].raw(this.color)).concat(g),u)},S[u]=function(g){return typeof g=="number"&&(g=P(H.call(arguments),f)),new S(g,u)}}});function O(u,f){return Number(u.toFixed(f))}function d(u){return function(f){return O(f,u)}}function m(u,f,g){return u=Array.isArray(u)?u:[u],u.forEach(function(x){(A[x]||(A[x]=[]))[f]=g}),u=u[0],function(x){var _;return arguments.length?(g&&(x=g(x)),_=this[u](),_.color[f]=x,_):(_=this[u]().color[f],g&&(_=g(_)),_)}}function C(u){return function(f){return Math.max(0,Math.min(u,f))}}function b(u){return Array.isArray(u)?u:[u]}function P(u,f){for(var g=0;g<f;g++)typeof u[g]!="number"&&(u[g]=0);return u}L.exports=S},7394:(L,M)=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0}),M.default=w;function w(T,I){for(var H=T<0?"-":"",D=Math.abs(T).toString();D.length<I;)D="0"+D;return H+D}L.exports=M.default},8609:(L,M)=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0}),M.default=w;function w(T,I){if(T==null)throw new TypeError("assign requires that input parameter not be null or undefined");for(var H in I)Object.prototype.hasOwnProperty.call(I,H)&&(T[H]=I[H]);return T}L.exports=M.default},6420:(L,M,w)=>{"use strict";var T=w(4836).default;Object.defineProperty(M,"__esModule",{value:!0}),M.default=H;var I=T(w(8609));function H(D){return(0,I.default)({},D)}L.exports=M.default},7561:(L,M,w)=>{"use strict";var T=w(4836).default;Object.defineProperty(M,"__esModule",{value:!0}),M.default=void 0;var I=T(w(2512)),H=I.default;M.default=H,L.exports=M.default},8729:(L,M)=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0}),M.getDefaultOptions=T,M.setDefaultOptions=I;var w={};function T(){return w}function I(H){w=H}},7100:(L,M,w)=>{"use strict";var T=w(4836).default;Object.defineProperty(M,"__esModule",{value:!0}),M.default=void 0;var I=T(w(1603)),H=T(w(1354)),D=T(w(1370)),F=T(w(623)),A=T(w(6226)),S=T(w(7394)),O=T(w(2699)),d={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},m={G:function(g,x,_){var B=g.getUTCFullYear()>0?1:0;switch(x){case"G":case"GG":case"GGG":return _.era(B,{width:"abbreviated"});case"GGGGG":return _.era(B,{width:"narrow"});case"GGGG":default:return _.era(B,{width:"wide"})}},y:function(g,x,_){if(x==="yo"){var B=g.getUTCFullYear(),W=B>0?B:1-B;return _.ordinalNumber(W,{unit:"year"})}return O.default.y(g,x)},Y:function(g,x,_,B){var W=(0,A.default)(g,B),j=W>0?W:1-W;if(x==="YY"){var ee=j%100;return(0,S.default)(ee,2)}return x==="Yo"?_.ordinalNumber(j,{unit:"year"}):(0,S.default)(j,x.length)},R:function(g,x){var _=(0,D.default)(g);return(0,S.default)(_,x.length)},u:function(g,x){var _=g.getUTCFullYear();return(0,S.default)(_,x.length)},Q:function(g,x,_){var B=Math.ceil((g.getUTCMonth()+1)/3);switch(x){case"Q":return String(B);case"QQ":return(0,S.default)(B,2);case"Qo":return _.ordinalNumber(B,{unit:"quarter"});case"QQQ":return _.quarter(B,{width:"abbreviated",context:"formatting"});case"QQQQQ":return _.quarter(B,{width:"narrow",context:"formatting"});case"QQQQ":default:return _.quarter(B,{width:"wide",context:"formatting"})}},q:function(g,x,_){var B=Math.ceil((g.getUTCMonth()+1)/3);switch(x){case"q":return String(B);case"qq":return(0,S.default)(B,2);case"qo":return _.ordinalNumber(B,{unit:"quarter"});case"qqq":return _.quarter(B,{width:"abbreviated",context:"standalone"});case"qqqqq":return _.quarter(B,{width:"narrow",context:"standalone"});case"qqqq":default:return _.quarter(B,{width:"wide",context:"standalone"})}},M:function(g,x,_){var B=g.getUTCMonth();switch(x){case"M":case"MM":return O.default.M(g,x);case"Mo":return _.ordinalNumber(B+1,{unit:"month"});case"MMM":return _.month(B,{width:"abbreviated",context:"formatting"});case"MMMMM":return _.month(B,{width:"narrow",context:"formatting"});case"MMMM":default:return _.month(B,{width:"wide",context:"formatting"})}},L:function(g,x,_){var B=g.getUTCMonth();switch(x){case"L":return String(B+1);case"LL":return(0,S.default)(B+1,2);case"Lo":return _.ordinalNumber(B+1,{unit:"month"});case"LLL":return _.month(B,{width:"abbreviated",context:"standalone"});case"LLLLL":return _.month(B,{width:"narrow",context:"standalone"});case"LLLL":default:return _.month(B,{width:"wide",context:"standalone"})}},w:function(g,x,_,B){var W=(0,F.default)(g,B);return x==="wo"?_.ordinalNumber(W,{unit:"week"}):(0,S.default)(W,x.length)},I:function(g,x,_){var B=(0,H.default)(g);return x==="Io"?_.ordinalNumber(B,{unit:"week"}):(0,S.default)(B,x.length)},d:function(g,x,_){return x==="do"?_.ordinalNumber(g.getUTCDate(),{unit:"date"}):O.default.d(g,x)},D:function(g,x,_){var B=(0,I.default)(g);return x==="Do"?_.ordinalNumber(B,{unit:"dayOfYear"}):(0,S.default)(B,x.length)},E:function(g,x,_){var B=g.getUTCDay();switch(x){case"E":case"EE":case"EEE":return _.day(B,{width:"abbreviated",context:"formatting"});case"EEEEE":return _.day(B,{width:"narrow",context:"formatting"});case"EEEEEE":return _.day(B,{width:"short",context:"formatting"});case"EEEE":default:return _.day(B,{width:"wide",context:"formatting"})}},e:function(g,x,_,B){var W=g.getUTCDay(),j=(W-B.weekStartsOn+8)%7||7;switch(x){case"e":return String(j);case"ee":return(0,S.default)(j,2);case"eo":return _.ordinalNumber(j,{unit:"day"});case"eee":return _.day(W,{width:"abbreviated",context:"formatting"});case"eeeee":return _.day(W,{width:"narrow",context:"formatting"});case"eeeeee":return _.day(W,{width:"short",context:"formatting"});case"eeee":default:return _.day(W,{width:"wide",context:"formatting"})}},c:function(g,x,_,B){var W=g.getUTCDay(),j=(W-B.weekStartsOn+8)%7||7;switch(x){case"c":return String(j);case"cc":return(0,S.default)(j,x.length);case"co":return _.ordinalNumber(j,{unit:"day"});case"ccc":return _.day(W,{width:"abbreviated",context:"standalone"});case"ccccc":return _.day(W,{width:"narrow",context:"standalone"});case"cccccc":return _.day(W,{width:"short",context:"standalone"});case"cccc":default:return _.day(W,{width:"wide",context:"standalone"})}},i:function(g,x,_){var B=g.getUTCDay(),W=B===0?7:B;switch(x){case"i":return String(W);case"ii":return(0,S.default)(W,x.length);case"io":return _.ordinalNumber(W,{unit:"day"});case"iii":return _.day(B,{width:"abbreviated",context:"formatting"});case"iiiii":return _.day(B,{width:"narrow",context:"formatting"});case"iiiiii":return _.day(B,{width:"short",context:"formatting"});case"iiii":default:return _.day(B,{width:"wide",context:"formatting"})}},a:function(g,x,_){var B=g.getUTCHours(),W=B/12>=1?"pm":"am";switch(x){case"a":case"aa":return _.dayPeriod(W,{width:"abbreviated",context:"formatting"});case"aaa":return _.dayPeriod(W,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return _.dayPeriod(W,{width:"narrow",context:"formatting"});case"aaaa":default:return _.dayPeriod(W,{width:"wide",context:"formatting"})}},b:function(g,x,_){var B=g.getUTCHours(),W;switch(B===12?W=d.noon:B===0?W=d.midnight:W=B/12>=1?"pm":"am",x){case"b":case"bb":return _.dayPeriod(W,{width:"abbreviated",context:"formatting"});case"bbb":return _.dayPeriod(W,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return _.dayPeriod(W,{width:"narrow",context:"formatting"});case"bbbb":default:return _.dayPeriod(W,{width:"wide",context:"formatting"})}},B:function(g,x,_){var B=g.getUTCHours(),W;switch(B>=17?W=d.evening:B>=12?W=d.afternoon:B>=4?W=d.morning:W=d.night,x){case"B":case"BB":case"BBB":return _.dayPeriod(W,{width:"abbreviated",context:"formatting"});case"BBBBB":return _.dayPeriod(W,{width:"narrow",context:"formatting"});case"BBBB":default:return _.dayPeriod(W,{width:"wide",context:"formatting"})}},h:function(g,x,_){if(x==="ho"){var B=g.getUTCHours()%12;return B===0&&(B=12),_.ordinalNumber(B,{unit:"hour"})}return O.default.h(g,x)},H:function(g,x,_){return x==="Ho"?_.ordinalNumber(g.getUTCHours(),{unit:"hour"}):O.default.H(g,x)},K:function(g,x,_){var B=g.getUTCHours()%12;return x==="Ko"?_.ordinalNumber(B,{unit:"hour"}):(0,S.default)(B,x.length)},k:function(g,x,_){var B=g.getUTCHours();return B===0&&(B=24),x==="ko"?_.ordinalNumber(B,{unit:"hour"}):(0,S.default)(B,x.length)},m:function(g,x,_){return x==="mo"?_.ordinalNumber(g.getUTCMinutes(),{unit:"minute"}):O.default.m(g,x)},s:function(g,x,_){return x==="so"?_.ordinalNumber(g.getUTCSeconds(),{unit:"second"}):O.default.s(g,x)},S:function(g,x){return O.default.S(g,x)},X:function(g,x,_,B){var W=B._originalDate||g,j=W.getTimezoneOffset();if(j===0)return"Z";switch(x){case"X":return b(j);case"XXXX":case"XX":return P(j);case"XXXXX":case"XXX":default:return P(j,":")}},x:function(g,x,_,B){var W=B._originalDate||g,j=W.getTimezoneOffset();switch(x){case"x":return b(j);case"xxxx":case"xx":return P(j);case"xxxxx":case"xxx":default:return P(j,":")}},O:function(g,x,_,B){var W=B._originalDate||g,j=W.getTimezoneOffset();switch(x){case"O":case"OO":case"OOO":return"GMT"+C(j,":");case"OOOO":default:return"GMT"+P(j,":")}},z:function(g,x,_,B){var W=B._originalDate||g,j=W.getTimezoneOffset();switch(x){case"z":case"zz":case"zzz":return"GMT"+C(j,":");case"zzzz":default:return"GMT"+P(j,":")}},t:function(g,x,_,B){var W=B._originalDate||g,j=Math.floor(W.getTime()/1e3);return(0,S.default)(j,x.length)},T:function(g,x,_,B){var W=B._originalDate||g,j=W.getTime();return(0,S.default)(j,x.length)}};function C(f,g){var x=f>0?"-":"+",_=Math.abs(f),B=Math.floor(_/60),W=_%60;if(W===0)return x+String(B);var j=g||"";return x+String(B)+j+(0,S.default)(W,2)}function b(f,g){if(f%60===0){var x=f>0?"-":"+";return x+(0,S.default)(Math.abs(f)/60,2)}return P(f,g)}function P(f,g){var x=g||"",_=f>0?"-":"+",B=Math.abs(f),W=(0,S.default)(Math.floor(B/60),2),j=(0,S.default)(B%60,2);return _+W+x+j}var u=m;M.default=u,L.exports=M.default},2699:(L,M,w)=>{"use strict";var T=w(4836).default;Object.defineProperty(M,"__esModule",{value:!0}),M.default=void 0;var I=T(w(7394)),H={y:function(A,S){var O=A.getUTCFullYear(),d=O>0?O:1-O;return(0,I.default)(S==="yy"?d%100:d,S.length)},M:function(A,S){var O=A.getUTCMonth();return S==="M"?String(O+1):(0,I.default)(O+1,2)},d:function(A,S){return(0,I.default)(A.getUTCDate(),S.length)},a:function(A,S){var O=A.getUTCHours()/12>=1?"pm":"am";switch(S){case"a":case"aa":return O.toUpperCase();case"aaa":return O;case"aaaaa":return O[0];case"aaaa":default:return O==="am"?"a.m.":"p.m."}},h:function(A,S){return(0,I.default)(A.getUTCHours()%12||12,S.length)},H:function(A,S){return(0,I.default)(A.getUTCHours(),S.length)},m:function(A,S){return(0,I.default)(A.getUTCMinutes(),S.length)},s:function(A,S){return(0,I.default)(A.getUTCSeconds(),S.length)},S:function(A,S){var O=S.length,d=A.getUTCMilliseconds(),m=Math.floor(d*Math.pow(10,O-3));return(0,I.default)(m,S.length)}},D=H;M.default=D,L.exports=M.default},5209:(L,M)=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0}),M.default=void 0;var w=function(A,S){switch(A){case"P":return S.date({width:"short"});case"PP":return S.date({width:"medium"});case"PPP":return S.date({width:"long"});case"PPPP":default:return S.date({width:"full"})}},T=function(A,S){switch(A){case"p":return S.time({width:"short"});case"pp":return S.time({width:"medium"});case"ppp":return S.time({width:"long"});case"pppp":default:return S.time({width:"full"})}},I=function(A,S){var O=A.match(/(P+)(p+)?/)||[],d=O[1],m=O[2];if(!m)return w(A,S);var C;switch(d){case"P":C=S.dateTime({width:"short"});break;case"PP":C=S.dateTime({width:"medium"});break;case"PPP":C=S.dateTime({width:"long"});break;case"PPPP":default:C=S.dateTime({width:"full"});break}return C.replace("{{date}}",w(d,S)).replace("{{time}}",T(m,S))},H={p:T,P:I},D=H;M.default=D,L.exports=M.default},3561:(L,M)=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0}),M.default=w;function w(T){var I=new Date(Date.UTC(T.getFullYear(),T.getMonth(),T.getDate(),T.getHours(),T.getMinutes(),T.getSeconds(),T.getMilliseconds()));return I.setUTCFullYear(T.getFullYear()),T.getTime()-I.getTime()}L.exports=M.default},1603:(L,M,w)=>{"use strict";var T=w(4836).default;Object.defineProperty(M,"__esModule",{value:!0}),M.default=F;var I=T(w(1171)),H=T(w(8734)),D=864e5;function F(A){(0,H.default)(1,arguments);var S=(0,I.default)(A),O=S.getTime();S.setUTCMonth(0,1),S.setUTCHours(0,0,0,0);var d=S.getTime(),m=O-d;return Math.floor(m/D)+1}L.exports=M.default},1354:(L,M,w)=>{"use strict";var T=w(4836).default;Object.defineProperty(M,"__esModule",{value:!0}),M.default=S;var I=T(w(1171)),H=T(w(79)),D=T(w(4275)),F=T(w(8734)),A=6048e5;function S(O){(0,F.default)(1,arguments);var d=(0,I.default)(O),m=(0,H.default)(d).getTime()-(0,D.default)(d).getTime();return Math.round(m/A)+1}L.exports=M.default},1370:(L,M,w)=>{"use strict";var T=w(4836).default;Object.defineProperty(M,"__esModule",{value:!0}),M.default=F;var I=T(w(1171)),H=T(w(8734)),D=T(w(79));function F(A){(0,H.default)(1,arguments);var S=(0,I.default)(A),O=S.getUTCFullYear(),d=new Date(0);d.setUTCFullYear(O+1,0,4),d.setUTCHours(0,0,0,0);var m=(0,D.default)(d),C=new Date(0);C.setUTCFullYear(O,0,4),C.setUTCHours(0,0,0,0);var b=(0,D.default)(C);return S.getTime()>=m.getTime()?O+1:S.getTime()>=b.getTime()?O:O-1}L.exports=M.default},623:(L,M,w)=>{"use strict";var T=w(4836).default;Object.defineProperty(M,"__esModule",{value:!0}),M.default=S;var I=T(w(1171)),H=T(w(9209)),D=T(w(4118)),F=T(w(8734)),A=6048e5;function S(O,d){(0,F.default)(1,arguments);var m=(0,I.default)(O),C=(0,H.default)(m,d).getTime()-(0,D.default)(m,d).getTime();return Math.round(C/A)+1}L.exports=M.default},6226:(L,M,w)=>{"use strict";var T=w(4836).default;Object.defineProperty(M,"__esModule",{value:!0}),M.default=S;var I=T(w(1171)),H=T(w(8734)),D=T(w(9209)),F=T(w(2084)),A=w(8729);function S(O,d){var m,C,b,P,u,f,g,x;(0,H.default)(1,arguments);var _=(0,I.default)(O),B=_.getUTCFullYear(),W=(0,A.getDefaultOptions)(),j=(0,F.default)((m=(C=(b=(P=d==null?void 0:d.firstWeekContainsDate)!==null&&P!==void 0?P:d==null||(u=d.locale)===null||u===void 0||(f=u.options)===null||f===void 0?void 0:f.firstWeekContainsDate)!==null&&b!==void 0?b:W.firstWeekContainsDate)!==null&&C!==void 0?C:(g=W.locale)===null||g===void 0||(x=g.options)===null||x===void 0?void 0:x.firstWeekContainsDate)!==null&&m!==void 0?m:1);if(!(j>=1&&j<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var ee=new Date(0);ee.setUTCFullYear(B+1,0,j),ee.setUTCHours(0,0,0,0);var V=(0,D.default)(ee,d),z=new Date(0);z.setUTCFullYear(B,0,j),z.setUTCHours(0,0,0,0);var X=(0,D.default)(z,d);return _.getTime()>=V.getTime()?B+1:_.getTime()>=X.getTime()?B:B-1}L.exports=M.default},6736:(L,M)=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0}),M.isProtectedDayOfYearToken=I,M.isProtectedWeekYearToken=H,M.throwProtectedError=D;var w=["D","DD"],T=["YY","YYYY"];function I(F){return w.indexOf(F)!==-1}function H(F){return T.indexOf(F)!==-1}function D(F,A,S){if(F==="YYYY")throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(A,"`) for formatting years to the input `").concat(S,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(F==="YY")throw new RangeError("Use `yy` instead of `YY` (in `".concat(A,"`) for formatting years to the input `").concat(S,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(F==="D")throw new RangeError("Use `d` instead of `D` (in `".concat(A,"`) for formatting days of the month to the input `").concat(S,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(F==="DD")throw new RangeError("Use `dd` instead of `DD` (in `".concat(A,"`) for formatting days of the month to the input `").concat(S,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"))}},8734:(L,M)=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0}),M.default=w;function w(T,I){if(I.length<T)throw new TypeError(T+" argument"+(T>1?"s":"")+" required, but only "+I.length+" present")}L.exports=M.default},79:(L,M,w)=>{"use strict";var T=w(4836).default;Object.defineProperty(M,"__esModule",{value:!0}),M.default=D;var I=T(w(1171)),H=T(w(8734));function D(F){(0,H.default)(1,arguments);var A=1,S=(0,I.default)(F),O=S.getUTCDay(),d=(O<A?7:0)+O-A;return S.setUTCDate(S.getUTCDate()-d),S.setUTCHours(0,0,0,0),S}L.exports=M.default},4275:(L,M,w)=>{"use strict";var T=w(4836).default;Object.defineProperty(M,"__esModule",{value:!0}),M.default=F;var I=T(w(1370)),H=T(w(79)),D=T(w(8734));function F(A){(0,D.default)(1,arguments);var S=(0,I.default)(A),O=new Date(0);O.setUTCFullYear(S,0,4),O.setUTCHours(0,0,0,0);var d=(0,H.default)(O);return d}L.exports=M.default},9209:(L,M,w)=>{"use strict";var T=w(4836).default;Object.defineProperty(M,"__esModule",{value:!0}),M.default=A;var I=T(w(1171)),H=T(w(8734)),D=T(w(2084)),F=w(8729);function A(S,O){var d,m,C,b,P,u,f,g;(0,H.default)(1,arguments);var x=(0,F.getDefaultOptions)(),_=(0,D.default)((d=(m=(C=(b=O==null?void 0:O.weekStartsOn)!==null&&b!==void 0?b:O==null||(P=O.locale)===null||P===void 0||(u=P.options)===null||u===void 0?void 0:u.weekStartsOn)!==null&&C!==void 0?C:x.weekStartsOn)!==null&&m!==void 0?m:(f=x.locale)===null||f===void 0||(g=f.options)===null||g===void 0?void 0:g.weekStartsOn)!==null&&d!==void 0?d:0);if(!(_>=0&&_<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var B=(0,I.default)(S),W=B.getUTCDay(),j=(W<_?7:0)+W-_;return B.setUTCDate(B.getUTCDate()-j),B.setUTCHours(0,0,0,0),B}L.exports=M.default},4118:(L,M,w)=>{"use strict";var T=w(4836).default;Object.defineProperty(M,"__esModule",{value:!0}),M.default=S;var I=T(w(6226)),H=T(w(8734)),D=T(w(9209)),F=T(w(2084)),A=w(8729);function S(O,d){var m,C,b,P,u,f,g,x;(0,H.default)(1,arguments);var _=(0,A.getDefaultOptions)(),B=(0,F.default)((m=(C=(b=(P=d==null?void 0:d.firstWeekContainsDate)!==null&&P!==void 0?P:d==null||(u=d.locale)===null||u===void 0||(f=u.options)===null||f===void 0?void 0:f.firstWeekContainsDate)!==null&&b!==void 0?b:_.firstWeekContainsDate)!==null&&C!==void 0?C:(g=_.locale)===null||g===void 0||(x=g.options)===null||x===void 0?void 0:x.firstWeekContainsDate)!==null&&m!==void 0?m:1),W=(0,I.default)(O,d),j=new Date(0);j.setUTCFullYear(W,0,B),j.setUTCHours(0,0,0,0);var ee=(0,D.default)(j,d);return ee}L.exports=M.default},2084:(L,M)=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0}),M.default=w;function w(T){if(T===null||T===!0||T===!1)return NaN;var I=Number(T);return isNaN(I)?I:I<0?Math.ceil(I):Math.floor(I)}L.exports=M.default},5065:(L,M,w)=>{"use strict";var T=w(4836).default;Object.defineProperty(M,"__esModule",{value:!0}),M.default=F;var I=T(w(2084)),H=T(w(1171)),D=T(w(8734));function F(A,S){(0,D.default)(2,arguments);var O=(0,H.default)(A).getTime(),d=(0,I.default)(S);return new Date(O+d)}L.exports=M.default},5616:(L,M,w)=>{"use strict";var T=w(4836).default;Object.defineProperty(M,"__esModule",{value:!0}),M.default=_;var I=T(w(9989)),H=T(w(3239)),D=T(w(1171)),F=T(w(7100)),A=T(w(5209)),S=T(w(3561)),O=w(6736),d=T(w(2084)),m=T(w(8734)),C=w(8729),b=T(w(7561)),P=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,u=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,f=/^'([^]*?)'?$/,g=/''/g,x=/[a-zA-Z]/;function _(W,j,ee){var V,z,X,Q,ie,ge,Se,Ae,Ce,Ne,De,Ee,ke,st,xt,Mt,Lt,It;(0,m.default)(2,arguments);var Tn=String(j),Ze=(0,C.getDefaultOptions)(),Le=(V=(z=ee==null?void 0:ee.locale)!==null&&z!==void 0?z:Ze.locale)!==null&&V!==void 0?V:b.default,it=(0,d.default)((X=(Q=(ie=(ge=ee==null?void 0:ee.firstWeekContainsDate)!==null&&ge!==void 0?ge:ee==null||(Se=ee.locale)===null||Se===void 0||(Ae=Se.options)===null||Ae===void 0?void 0:Ae.firstWeekContainsDate)!==null&&ie!==void 0?ie:Ze.firstWeekContainsDate)!==null&&Q!==void 0?Q:(Ce=Ze.locale)===null||Ce===void 0||(Ne=Ce.options)===null||Ne===void 0?void 0:Ne.firstWeekContainsDate)!==null&&X!==void 0?X:1);if(!(it>=1&&it<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var Ot=(0,d.default)((De=(Ee=(ke=(st=ee==null?void 0:ee.weekStartsOn)!==null&&st!==void 0?st:ee==null||(xt=ee.locale)===null||xt===void 0||(Mt=xt.options)===null||Mt===void 0?void 0:Mt.weekStartsOn)!==null&&ke!==void 0?ke:Ze.weekStartsOn)!==null&&Ee!==void 0?Ee:(Lt=Ze.locale)===null||Lt===void 0||(It=Lt.options)===null||It===void 0?void 0:It.weekStartsOn)!==null&&De!==void 0?De:0);if(!(Ot>=0&&Ot<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!Le.localize)throw new RangeError("locale must contain localize property");if(!Le.formatLong)throw new RangeError("locale must contain formatLong property");var at=(0,D.default)(W);if(!(0,I.default)(at))throw new RangeError("Invalid time value");var _n=(0,S.default)(at),Bt=(0,H.default)(at,_n),An={firstWeekContainsDate:it,weekStartsOn:Ot,locale:Le,_originalDate:at},ft=Tn.match(u).map(function(be){var je=be[0];if(je==="p"||je==="P"){var ot=A.default[je];return ot(be,Le.formatLong)}return be}).join("").match(P).map(function(be){if(be==="''")return"'";var je=be[0];if(je==="'")return B(be);var ot=F.default[je];if(ot)return!(ee!=null&&ee.useAdditionalWeekYearTokens)&&(0,O.isProtectedWeekYearToken)(be)&&(0,O.throwProtectedError)(be,j,String(W)),!(ee!=null&&ee.useAdditionalDayOfYearTokens)&&(0,O.isProtectedDayOfYearToken)(be)&&(0,O.throwProtectedError)(be,j,String(W)),ot(Bt,be,Le.localize,An);if(je.match(x))throw new RangeError("Format string contains an unescaped latin alphabet character `"+je+"`");return be}).join("");return ft}function B(W){var j=W.match(f);return j?j[1].replace(g,"'"):W}L.exports=M.default},2382:(L,M,w)=>{"use strict";var T=w(4836).default;Object.defineProperty(M,"__esModule",{value:!0}),M.default=D;var I=T(w(8698)),H=T(w(8734));function D(F){return(0,H.default)(1,arguments),F instanceof Date||(0,I.default)(F)==="object"&&Object.prototype.toString.call(F)==="[object Date]"}L.exports=M.default},9989:(L,M,w)=>{"use strict";var T=w(4836).default;Object.defineProperty(M,"__esModule",{value:!0}),M.default=F;var I=T(w(2382)),H=T(w(1171)),D=T(w(8734));function F(A){if((0,D.default)(1,arguments),!(0,I.default)(A)&&typeof A!="number")return!1;var S=(0,H.default)(A);return!isNaN(Number(S))}L.exports=M.default},289:(L,M)=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0}),M.default=w;function w(T){return function(){var I=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},H=I.width?String(I.width):T.defaultWidth,D=T.formats[H]||T.formats[T.defaultWidth];return D}}L.exports=M.default},6245:(L,M)=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0}),M.default=w;function w(T){return function(I,H){var D=H!=null&&H.context?String(H.context):"standalone",F;if(D==="formatting"&&T.formattingValues){var A=T.defaultFormattingWidth||T.defaultWidth,S=H!=null&&H.width?String(H.width):A;F=T.formattingValues[S]||T.formattingValues[A]}else{var O=T.defaultWidth,d=H!=null&&H.width?String(H.width):T.defaultWidth;F=T.values[d]||T.values[O]}var m=T.argumentCallback?T.argumentCallback(I):I;return F[m]}}L.exports=M.default},3421:(L,M)=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0}),M.default=w;function w(H){return function(D){var F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},A=F.width,S=A&&H.matchPatterns[A]||H.matchPatterns[H.defaultMatchWidth],O=D.match(S);if(!O)return null;var d=O[0],m=A&&H.parsePatterns[A]||H.parsePatterns[H.defaultParseWidth],C=Array.isArray(m)?I(m,function(u){return u.test(d)}):T(m,function(u){return u.test(d)}),b;b=H.valueCallback?H.valueCallback(C):C,b=F.valueCallback?F.valueCallback(b):b;var P=D.slice(d.length);return{value:b,rest:P}}}function T(H,D){for(var F in H)if(H.hasOwnProperty(F)&&D(H[F]))return F}function I(H,D){for(var F=0;F<H.length;F++)if(D(H[F]))return F}L.exports=M.default},8926:(L,M)=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0}),M.default=w;function w(T){return function(I){var H=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},D=I.match(T.matchPattern);if(!D)return null;var F=D[0],A=I.match(T.parsePattern);if(!A)return null;var S=T.valueCallback?T.valueCallback(A[0]):A[0];S=H.valueCallback?H.valueCallback(S):S;var O=I.slice(F.length);return{value:S,rest:O}}}L.exports=M.default},1924:(L,M)=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0}),M.default=void 0;var w={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},T=function(D,F,A){var S,O=w[D];return typeof O=="string"?S=O:F===1?S=O.one:S=O.other.replace("{{count}}",F.toString()),A!=null&&A.addSuffix?A.comparison&&A.comparison>0?"in "+S:S+" ago":S},I=T;M.default=I,L.exports=M.default},5062:(L,M,w)=>{"use strict";var T=w(4836).default;Object.defineProperty(M,"__esModule",{value:!0}),M.default=void 0;var I=T(w(289)),H={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},D={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},F={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},A={date:(0,I.default)({formats:H,defaultWidth:"full"}),time:(0,I.default)({formats:D,defaultWidth:"full"}),dateTime:(0,I.default)({formats:F,defaultWidth:"full"})},S=A;M.default=S,L.exports=M.default},5102:(L,M)=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0}),M.default=void 0;var w={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},T=function(D,F,A,S){return w[D]},I=T;M.default=I,L.exports=M.default},7839:(L,M,w)=>{"use strict";var T=w(4836).default;Object.defineProperty(M,"__esModule",{value:!0}),M.default=void 0;var I=T(w(6245)),H={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},D={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},F={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},A={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},S={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},O={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},d=function(P,u){var f=Number(P),g=f%100;if(g>20||g<10)switch(g%10){case 1:return f+"st";case 2:return f+"nd";case 3:return f+"rd"}return f+"th"},m={ordinalNumber:d,era:(0,I.default)({values:H,defaultWidth:"wide"}),quarter:(0,I.default)({values:D,defaultWidth:"wide",argumentCallback:function(P){return P-1}}),month:(0,I.default)({values:F,defaultWidth:"wide"}),day:(0,I.default)({values:A,defaultWidth:"wide"}),dayPeriod:(0,I.default)({values:S,defaultWidth:"wide",formattingValues:O,defaultFormattingWidth:"wide"})},C=m;M.default=C,L.exports=M.default},9796:(L,M,w)=>{"use strict";var T=w(4836).default;Object.defineProperty(M,"__esModule",{value:!0}),M.default=void 0;var I=T(w(3421)),H=T(w(8926)),D=/^(\d+)(th|st|nd|rd)?/i,F=/\d+/i,A={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},S={any:[/^b/i,/^(a|c)/i]},O={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},d={any:[/1/i,/2/i,/3/i,/4/i]},m={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},C={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},b={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},P={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},u={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},f={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},g={ordinalNumber:(0,H.default)({matchPattern:D,parsePattern:F,valueCallback:function(B){return parseInt(B,10)}}),era:(0,I.default)({matchPatterns:A,defaultMatchWidth:"wide",parsePatterns:S,defaultParseWidth:"any"}),quarter:(0,I.default)({matchPatterns:O,defaultMatchWidth:"wide",parsePatterns:d,defaultParseWidth:"any",valueCallback:function(B){return B+1}}),month:(0,I.default)({matchPatterns:m,defaultMatchWidth:"wide",parsePatterns:C,defaultParseWidth:"any"}),day:(0,I.default)({matchPatterns:b,defaultMatchWidth:"wide",parsePatterns:P,defaultParseWidth:"any"}),dayPeriod:(0,I.default)({matchPatterns:u,defaultMatchWidth:"any",parsePatterns:f,defaultParseWidth:"any"})},x=g;M.default=x,L.exports=M.default},2512:(L,M,w)=>{"use strict";var T=w(4836).default;Object.defineProperty(M,"__esModule",{value:!0}),M.default=void 0;var I=T(w(1924)),H=T(w(5062)),D=T(w(5102)),F=T(w(7839)),A=T(w(9796)),S={code:"en-US",formatDistance:I.default,formatLong:H.default,formatRelative:D.default,localize:F.default,match:A.default,options:{weekStartsOn:0,firstWeekContainsDate:1}},O=S;M.default=O,L.exports=M.default},3239:(L,M,w)=>{"use strict";var T=w(4836).default;Object.defineProperty(M,"__esModule",{value:!0}),M.default=F;var I=T(w(5065)),H=T(w(8734)),D=T(w(2084));function F(A,S){(0,H.default)(2,arguments);var O=(0,D.default)(S);return(0,I.default)(A,-O)}L.exports=M.default},1171:(L,M,w)=>{"use strict";var T=w(4836).default;Object.defineProperty(M,"__esModule",{value:!0}),M.default=D;var I=T(w(8698)),H=T(w(8734));function D(F){(0,H.default)(1,arguments);var A=Object.prototype.toString.call(F);return F instanceof Date||(0,I.default)(F)==="object"&&A==="[object Date]"?new Date(F.getTime()):typeof F=="number"||A==="[object Number]"?new Date(F):((typeof F=="string"||A==="[object String]")&&typeof console!="undefined"&&(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"),console.warn(new Error().stack)),new Date(NaN))}L.exports=M.default},5171:L=>{L.exports=function(w){return!w||typeof w=="string"?!1:w instanceof Array||Array.isArray(w)||w.length>=0&&(w.splice instanceof Function||Object.getOwnPropertyDescriptor(w,w.length-1)&&w.constructor.name!=="String")}},6851:(L,M,w)=>{"use strict";var T=w(5171),I=Array.prototype.concat,H=Array.prototype.slice,D=L.exports=function(A){for(var S=[],O=0,d=A.length;O<d;O++){var m=A[O];T(m)?S=I.call(S,H.call(m)):S.push(m)}return S};D.wrap=function(F){return function(){return F(D(arguments))}}},4836:L=>{function M(w){return w&&w.__esModule?w:{default:w}}L.exports=M,L.exports.__esModule=!0,L.exports.default=L.exports},8698:L=>{function M(w){"@babel/helpers - typeof";return L.exports=M=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(T){return typeof T}:function(T){return T&&typeof Symbol=="function"&&T.constructor===Symbol&&T!==Symbol.prototype?"symbol":typeof T},L.exports.__esModule=!0,L.exports.default=L.exports,M(w)}L.exports=M,L.exports.__esModule=!0,L.exports.default=L.exports},5721:(L,M)=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0}),M.default=w;function w(T,I,H,D,F,A,S){var O=new Date(0);return O.setUTCFullYear(T,I,H),O.setUTCHours(D,F,A,S),O}L.exports=M.default},5855:(L,M)=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0}),M.default=w;function w(D,F,A){var S=H(D,A.timeZone,A.locale);return S.formatToParts?T(S,F):I(S,F)}function T(D,F){for(var A=D.formatToParts(F),S=A.length-1;S>=0;--S)if(A[S].type==="timeZoneName")return A[S].value}function I(D,F){var A=D.format(F).replace(/\u200E/g,""),S=/ [\w-+ ]+$/.exec(A);return S?S[0].substr(1):""}function H(D,F,A){if(A&&!A.code)throw new Error("date-fns-tz error: Please set a language code on the locale object imported from date-fns, e.g. `locale.code = 'en-US'`");return new Intl.DateTimeFormat(A?[A.code,"en-US"]:void 0,{timeZone:F,timeZoneName:D})}L.exports=M.default},2734:(L,M,w)=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0}),M.default=S;var T=H(w(2712)),I=H(w(5721));function H(u){return u&&u.__esModule?u:{default:u}}var D=36e5,F=6e4,A={timezone:/([Z+-].*)$/,timezoneZ:/^(Z)$/,timezoneHH:/^([+-]\d{2})$/,timezoneHHMM:/^([+-]\d{2}):?(\d{2})$/};function S(u,f,g){var x,_;if(!u||(x=A.timezoneZ.exec(u),x))return 0;var B;if(x=A.timezoneHH.exec(u),x)return B=parseInt(x[1],10),C(B)?-(B*D):NaN;if(x=A.timezoneHHMM.exec(u),x){B=parseInt(x[1],10);var W=parseInt(x[2],10);return C(B,W)?(_=Math.abs(B)*D+W*F,B>0?-_:_):NaN}if(P(u)){f=new Date(f||Date.now());var j=g?f:O(f),ee=d(j,u),V=g?ee:m(f,ee,u);return-V}return NaN}function O(u){return(0,I.default)(u.getFullYear(),u.getMonth(),u.getDate(),u.getHours(),u.getMinutes(),u.getSeconds(),u.getMilliseconds())}function d(u,f){var g=(0,T.default)(u,f),x=(0,I.default)(g[0],g[1]-1,g[2],g[3]%24,g[4],g[5],0).getTime(),_=u.getTime(),B=_%1e3;return _-=B>=0?B:1e3+B,x-_}function m(u,f,g){var x=u.getTime(),_=x-f,B=d(new Date(_),g);if(f===B)return f;_-=B-f;var W=d(new Date(_),g);return B===W?B:Math.max(B,W)}function C(u,f){return-23<=u&&u<=23&&(f==null||0<=f&&f<=59)}var b={};function P(u){if(b[u])return!0;try{return new Intl.DateTimeFormat(void 0,{timeZone:u}),b[u]=!0,!0}catch(f){return!1}}L.exports=M.default},7048:(L,M)=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0}),M.default=void 0;var w=/(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/,T=w;M.default=T,L.exports=M.default},2712:(L,M)=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0}),M.default=w;function w(A,S){var O=F(S);return O.formatToParts?I(O,A):H(O,A)}var T={year:0,month:1,day:2,hour:3,minute:4,second:5};function I(A,S){try{for(var O=A.formatToParts(S),d=[],m=0;m<O.length;m++){var C=T[O[m].type];C>=0&&(d[C]=parseInt(O[m].value,10))}return d}catch(b){if(b instanceof RangeError)return[NaN];throw b}}function H(A,S){var O=A.format(S).replace(/\u200E/g,""),d=/(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(O);return[d[3],d[1],d[2],d[4],d[5],d[6]]}var D={};function F(A){if(!D[A]){var S=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:"America/New_York",year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date("2014-06-25T04:00:00.123Z")),O=S==="06/25/2014, 00:00:00"||S==="\u200E06\u200E/\u200E25\u200E/\u200E2014\u200E \u200E00\u200E:\u200E00\u200E:\u200E00";D[A]=O?new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:A,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:A,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})}return D[A]}L.exports=M.default},3826:(L,M,w)=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0}),M.default=void 0;var T=H(w(5855)),I=H(w(2734));function H(b){return b&&b.__esModule?b:{default:b}}var D=60*1e3,F={X:function(b,P,u,f){var g=A(f.timeZone,f._originalDate||b);if(g===0)return"Z";switch(P){case"X":return d(g);case"XXXX":case"XX":return O(g);case"XXXXX":case"XXX":default:return O(g,":")}},x:function(b,P,u,f){var g=A(f.timeZone,f._originalDate||b);switch(P){case"x":return d(g);case"xxxx":case"xx":return O(g);case"xxxxx":case"xxx":default:return O(g,":")}},O:function(b,P,u,f){var g=A(f.timeZone,f._originalDate||b);switch(P){case"O":case"OO":case"OOO":return"GMT"+m(g,":");case"OOOO":default:return"GMT"+O(g,":")}},z:function(b,P,u,f){var g=f._originalDate||b;switch(P){case"z":case"zz":case"zzz":return(0,T.default)("short",g,f);case"zzzz":default:return(0,T.default)("long",g,f)}}};function A(b,P){var u=b?(0,I.default)(b,P,!0)/D:P.getTimezoneOffset();if(Number.isNaN(u))throw new RangeError("Invalid time zone specified: "+b);return u}function S(b,P){for(var u=b<0?"-":"",f=Math.abs(b).toString();f.length<P;)f="0"+f;return u+f}function O(b,P){var u=P||"",f=b>0?"-":"+",g=Math.abs(b),x=S(Math.floor(g/60),2),_=S(Math.floor(g%60),2);return f+x+u+_}function d(b,P){if(b%60===0){var u=b>0?"-":"+";return u+S(Math.abs(b)/60,2)}return O(b,P)}function m(b,P){var u=b>0?"-":"+",f=Math.abs(b),g=Math.floor(f/60),x=f%60;if(x===0)return u+String(g);var _=P||"";return u+String(g)+_+S(x,2)}var C=F;M.default=C,L.exports=M.default},6558:(L,M,w)=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0}),M.default=A;var T=D(w(5616)),I=D(w(3826)),H=D(w(1476));function D(S){return S&&S.__esModule?S:{default:S}}var F=/([xXOz]+)|''|'(''|[^'])+('|$)/g;function A(S,O,d){var m=String(O),C=d||{},b=m.match(F);if(b){var P=(0,H.default)(S,C);m=b.reduce(function(u,f){if(f[0]==="'")return u;var g=u.indexOf(f),x=u[g-1]==="'",_=u.replace(f,"'"+I.default[f[0]](P,f,null,C)+"'");return x?_.substring(0,g-1)+_.substring(g+1):_},m)}return(0,T.default)(S,m,C)}L.exports=M.default},6645:(L,M,w)=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0}),M.default=F;var T=D(w(6420)),I=D(w(6558)),H=D(w(1132));function D(A){return A&&A.__esModule?A:{default:A}}function F(A,S,O,d){var m=(0,T.default)(d);return m.timeZone=S,(0,I.default)((0,H.default)(A,S),O,m)}L.exports=M.default},4992:(L,M,w)=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0}),M.default=H;var T=I(w(2734));function I(D){return D&&D.__esModule?D:{default:D}}function H(D,F){return-(0,T.default)(D,F)}L.exports=M.default},722:(L,M,w)=>{"use strict";L.exports={format:w(6558),formatInTimeZone:w(6645),getTimezoneOffset:w(4992),toDate:w(1476),utcToZonedTime:w(1132),zonedTimeToUtc:w(8516)}},1476:(L,M,w)=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0}),M.default=m;var T=F(w(2084)),I=F(w(3561)),H=F(w(2734)),D=F(w(7048));function F(V){return V&&V.__esModule?V:{default:V}}var A=36e5,S=6e4,O=2,d={dateTimePattern:/^([0-9W+-]+)(T| )(.*)/,datePattern:/^([0-9W+-]+)(.*)/,plainTime:/:/,YY:/^(\d{2})$/,YYY:[/^([+-]\d{2})$/,/^([+-]\d{3})$/,/^([+-]\d{4})$/],YYYY:/^(\d{4})/,YYYYY:[/^([+-]\d{4})/,/^([+-]\d{5})/,/^([+-]\d{6})/],MM:/^-(\d{2})$/,DDD:/^-?(\d{3})$/,MMDD:/^-?(\d{2})-?(\d{2})$/,Www:/^-?W(\d{2})$/,WwwD:/^-?W(\d{2})-?(\d{1})$/,HH:/^(\d{2}([.,]\d*)?)$/,HHMM:/^(\d{2}):?(\d{2}([.,]\d*)?)$/,HHMMSS:/^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/,timeZone:D.default};function m(V,z){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");if(V===null)return new Date(NaN);var X=z||{},Q=X.additionalDigits==null?O:(0,T.default)(X.additionalDigits);if(Q!==2&&Q!==1&&Q!==0)throw new RangeError("additionalDigits must be 0, 1 or 2");if(V instanceof Date||typeof V=="object"&&Object.prototype.toString.call(V)==="[object Date]")return new Date(V.getTime());if(typeof V=="number"||Object.prototype.toString.call(V)==="[object Number]")return new Date(V);if(!(typeof V=="string"||Object.prototype.toString.call(V)==="[object String]"))return new Date(NaN);var ie=C(V),ge=b(ie.date,Q),Se=ge.year,Ae=ge.restDateString,Ce=P(Ae,Se);if(isNaN(Ce))return new Date(NaN);if(Ce){var Ne=Ce.getTime(),De=0,Ee;if(ie.time&&(De=u(ie.time),isNaN(De)))return new Date(NaN);if(ie.timeZone||X.timeZone){if(Ee=(0,H.default)(ie.timeZone||X.timeZone,new Date(Ne+De)),isNaN(Ee))return new Date(NaN)}else Ee=(0,I.default)(new Date(Ne+De)),Ee=(0,I.default)(new Date(Ne+De+Ee));return new Date(Ne+De+Ee)}else return new Date(NaN)}function C(V){var z={},X=d.dateTimePattern.exec(V),Q;if(X?(z.date=X[1],Q=X[3]):(X=d.datePattern.exec(V),X?(z.date=X[1],Q=X[2]):(z.date=null,Q=V)),Q){var ie=d.timeZone.exec(Q);ie?(z.time=Q.replace(ie[1],""),z.timeZone=ie[1].trim()):z.time=Q}return z}function b(V,z){var X=d.YYY[z],Q=d.YYYYY[z],ie;if(ie=d.YYYY.exec(V)||Q.exec(V),ie){var ge=ie[1];return{year:parseInt(ge,10),restDateString:V.slice(ge.length)}}if(ie=d.YY.exec(V)||X.exec(V),ie){var Se=ie[1];return{year:parseInt(Se,10)*100,restDateString:V.slice(Se.length)}}return{year:null}}function P(V,z){if(z===null)return null;var X,Q,ie,ge;if(V.length===0)return Q=new Date(0),Q.setUTCFullYear(z),Q;if(X=d.MM.exec(V),X)return Q=new Date(0),ie=parseInt(X[1],10)-1,B(z,ie)?(Q.setUTCFullYear(z,ie),Q):new Date(NaN);if(X=d.DDD.exec(V),X){Q=new Date(0);var Se=parseInt(X[1],10);return W(z,Se)?(Q.setUTCFullYear(z,0,Se),Q):new Date(NaN)}if(X=d.MMDD.exec(V),X){Q=new Date(0),ie=parseInt(X[1],10)-1;var Ae=parseInt(X[2],10);return B(z,ie,Ae)?(Q.setUTCFullYear(z,ie,Ae),Q):new Date(NaN)}if(X=d.Www.exec(V),X)return ge=parseInt(X[1],10)-1,j(z,ge)?f(z,ge):new Date(NaN);if(X=d.WwwD.exec(V),X){ge=parseInt(X[1],10)-1;var Ce=parseInt(X[2],10)-1;return j(z,ge,Ce)?f(z,ge,Ce):new Date(NaN)}return null}function u(V){var z,X,Q;if(z=d.HH.exec(V),z)return X=parseFloat(z[1].replace(",",".")),ee(X)?X%24*A:NaN;if(z=d.HHMM.exec(V),z)return X=parseInt(z[1],10),Q=parseFloat(z[2].replace(",",".")),ee(X,Q)?X%24*A+Q*S:NaN;if(z=d.HHMMSS.exec(V),z){X=parseInt(z[1],10),Q=parseInt(z[2],10);var ie=parseFloat(z[3].replace(",","."));return ee(X,Q,ie)?X%24*A+Q*S+ie*1e3:NaN}return null}function f(V,z,X){z=z||0,X=X||0;var Q=new Date(0);Q.setUTCFullYear(V,0,4);var ie=Q.getUTCDay()||7,ge=z*7+X+1-ie;return Q.setUTCDate(Q.getUTCDate()+ge),Q}var g=[31,28,31,30,31,30,31,31,30,31,30,31],x=[31,29,31,30,31,30,31,31,30,31,30,31];function _(V){return V%400===0||V%4===0&&V%100!==0}function B(V,z,X){if(z<0||z>11)return!1;if(X!=null){if(X<1)return!1;var Q=_(V);if(Q&&X>x[z]||!Q&&X>g[z])return!1}return!0}function W(V,z){if(z<1)return!1;var X=_(V);return!(X&&z>366||!X&&z>365)}function j(V,z,X){return!(z<0||z>52||X!=null&&(X<0||X>6))}function ee(V,z,X){return!(V!=null&&(V<0||V>=25)||z!=null&&(z<0||z>=60)||X!=null&&(X<0||X>=60))}L.exports=M.default},1132:(L,M,w)=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0}),M.default=D;var T=H(w(2734)),I=H(w(1476));function H(F){return F&&F.__esModule?F:{default:F}}function D(F,A,S){var O=(0,I.default)(F,S),d=(0,T.default)(A,O,!0),m=new Date(O.getTime()-d),C=new Date(0);return C.setFullYear(m.getUTCFullYear(),m.getUTCMonth(),m.getUTCDate()),C.setHours(m.getUTCHours(),m.getUTCMinutes(),m.getUTCSeconds(),m.getUTCMilliseconds()),C}L.exports=M.default},8516:(L,M,w)=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0}),M.default=S;var T=A(w(6420)),I=A(w(1476)),H=A(w(7048)),D=A(w(2734)),F=A(w(5721));function A(O){return O&&O.__esModule?O:{default:O}}function S(O,d,m){if(typeof O=="string"&&!O.match(H.default)){var C=(0,T.default)(m);return C.timeZone=d,(0,I.default)(O,C)}var b=(0,I.default)(O,m),P=(0,F.default)(b.getFullYear(),b.getMonth(),b.getDate(),b.getHours(),b.getMinutes(),b.getSeconds(),b.getMilliseconds()).getTime(),u=(0,D.default)(d,new Date(P));return new Date(P+u)}L.exports=M.default}},Sr={};function _e(L){var M=Sr[L];if(M!==void 0)return M.exports;var w=Sr[L]={exports:{}};return Ra[L](w,w.exports,_e),w.exports}_e.n=L=>{var M=L&&L.__esModule?()=>L.default:()=>L;return _e.d(M,{a:M}),M},_e.d=(L,M)=>{for(var w in M)_e.o(M,w)&&!_e.o(L,w)&&Object.defineProperty(L,w,{enumerable:!0,get:M[w]})},_e.o=(L,M)=>Object.prototype.hasOwnProperty.call(L,M),_e.r=L=>{typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(L,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(L,"__esModule",{value:!0})};var Pn={};(()=>{"use strict";_e.r(Pn),_e.d(Pn,{ChartBootstrap:()=>Zt,createChart:()=>Ba});function L(n){return typeof n=="function"}function M(n){return L(n==null?void 0:n.lift)}function w(n){return function(e){if(M(e))return e.lift(function(t){try{return n(t,this)}catch(r){this.error(r)}});throw new TypeError("Unable to lift unknown Observable type")}}var T=function(n,e){return T=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(t[s]=r[s])},T(n,e)};function I(n,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");T(n,e);function t(){this.constructor=n}n.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var H=function(){return H=Object.assign||function(e){for(var t,r=1,s=arguments.length;r<s;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},H.apply(this,arguments)};function D(n,e){var t={};for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&e.indexOf(r)<0&&(t[r]=n[r]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(n);s<r.length;s++)e.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(n,r[s])&&(t[r[s]]=n[r[s]]);return t}function F(n,e,t,r){var s=arguments.length,i=s<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(n,e,t,r);else for(var o=n.length-1;o>=0;o--)(a=n[o])&&(i=(s<3?a(i):s>3?a(e,t,i):a(e,t))||i);return s>3&&i&&Object.defineProperty(e,t,i),i}function A(n,e){return function(t,r){e(t,r,n)}}function S(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)}function O(n,e,t,r){function s(i){return i instanceof t?i:new t(function(a){a(i)})}return new(t||(t=Promise))(function(i,a){function o(h){try{c(r.next(h))}catch(v){a(v)}}function l(h){try{c(r.throw(h))}catch(v){a(v)}}function c(h){h.done?i(h.value):s(h.value).then(o,l)}c((r=r.apply(n,e||[])).next())})}function d(n,e){var t={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,s,i,a;return a={next:o(0),throw:o(1),return:o(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function o(c){return function(h){return l([c,h])}}function l(c){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(t=0)),t;)try{if(r=1,s&&(i=c[0]&2?s.return:c[0]?s.throw||((i=s.return)&&i.call(s),0):s.next)&&!(i=i.call(s,c[1])).done)return i;switch(s=0,i&&(c=[c[0]&2,i.value]),c[0]){case 0:case 1:i=c;break;case 4:return t.label++,{value:c[1],done:!1};case 5:t.label++,s=c[1],c=[0];continue;case 7:c=t.ops.pop(),t.trys.pop();continue;default:if(i=t.trys,!(i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){t=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){t.label=c[1];break}if(c[0]===6&&t.label<i[1]){t.label=i[1],i=c;break}if(i&&t.label<i[2]){t.label=i[2],t.ops.push(c);break}i[2]&&t.ops.pop(),t.trys.pop();continue}c=e.call(n,t)}catch(h){c=[6,h],s=0}finally{r=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}var m=Object.create?function(n,e,t,r){r===void 0&&(r=t);var s=Object.getOwnPropertyDescriptor(e,t);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(n,r,s)}:function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]};function C(n,e){for(var t in n)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&m(e,n,t)}function b(n){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&n[e],r=0;if(t)return t.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&r>=n.length&&(n=void 0),{value:n&&n[r++],done:!n}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function P(n,e){var t=typeof Symbol=="function"&&n[Symbol.iterator];if(!t)return n;var r=t.call(n),s,i=[],a;try{for(;(e===void 0||e-- >0)&&!(s=r.next()).done;)i.push(s.value)}catch(o){a={error:o}}finally{try{s&&!s.done&&(t=r.return)&&t.call(r)}finally{if(a)throw a.error}}return i}function u(){for(var n=[],e=0;e<arguments.length;e++)n=n.concat(P(arguments[e]));return n}function f(){for(var n=0,e=0,t=arguments.length;e<t;e++)n+=arguments[e].length;for(var r=Array(n),s=0,e=0;e<t;e++)for(var i=arguments[e],a=0,o=i.length;a<o;a++,s++)r[s]=i[a];return r}function g(n,e,t){if(t||arguments.length===2)for(var r=0,s=e.length,i;r<s;r++)(i||!(r in e))&&(i||(i=Array.prototype.slice.call(e,0,r)),i[r]=e[r]);return n.concat(i||Array.prototype.slice.call(e))}function x(n){return this instanceof x?(this.v=n,this):new x(n)}function _(n,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=t.apply(n,e||[]),s,i=[];return s={},a("next"),a("throw"),a("return"),s[Symbol.asyncIterator]=function(){return this},s;function a(p){r[p]&&(s[p]=function(y){return new Promise(function(E,R){i.push([p,y,E,R])>1||o(p,y)})})}function o(p,y){try{l(r[p](y))}catch(E){v(i[0][3],E)}}function l(p){p.value instanceof x?Promise.resolve(p.value.v).then(c,h):v(i[0][2],p)}function c(p){o("next",p)}function h(p){o("throw",p)}function v(p,y){p(y),i.shift(),i.length&&o(i[0][0],i[0][1])}}function B(n){var e,t;return e={},r("next"),r("throw",function(s){throw s}),r("return"),e[Symbol.iterator]=function(){return this},e;function r(s,i){e[s]=n[s]?function(a){return(t=!t)?{value:x(n[s](a)),done:s==="return"}:i?i(a):a}:i}}function W(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=n[Symbol.asyncIterator],t;return e?e.call(n):(n=typeof b=="function"?b(n):n[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(i){t[i]=n[i]&&function(a){return new Promise(function(o,l){a=n[i](a),s(o,l,a.done,a.value)})}}function s(i,a,o,l){Promise.resolve(l).then(function(c){i({value:c,done:o})},a)}}function j(n,e){return Object.defineProperty?Object.defineProperty(n,"raw",{value:e}):n.raw=e,n}var ee=Object.create?function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}:function(n,e){n.default=e};function V(n){if(n&&n.__esModule)return n;var e={};if(n!=null)for(var t in n)t!=="default"&&Object.prototype.hasOwnProperty.call(n,t)&&m(e,n,t);return ee(e,n),e}function z(n){return n&&n.__esModule?n:{default:n}}function X(n,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?n!==e||!r:!e.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(n):r?r.value:e.get(n)}function Q(n,e,t,r,s){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?n!==e||!s:!e.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?s.call(n,t):s?s.value=t:e.set(n,t),t}function ie(n,e){if(e===null||typeof e!="object"&&typeof e!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof n=="function"?e===n:n.has(e)}function ge(n){var e=function(r){Error.call(r),r.stack=new Error().stack},t=n(e);return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var Se=ge(function(n){return function(t){n(this),this.message=t?t.length+` errors occurred during unsubscription:
|
|
6
|
+
(()=>{var rv;(()=>{var Ra={8168:(L,M,w)=>{var T=w(9092),I={};for(var H in T)T.hasOwnProperty(H)&&(I[T[H]]=H);var D=L.exports={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};for(var F in D)if(D.hasOwnProperty(F)){if(!("channels"in D[F]))throw new Error("missing channels property: "+F);if(!("labels"in D[F]))throw new Error("missing channel labels property: "+F);if(D[F].labels.length!==D[F].channels)throw new Error("channel and label counts mismatch: "+F);var A=D[F].channels,S=D[F].labels;delete D[F].channels,delete D[F].labels,Object.defineProperty(D[F],"channels",{value:A}),Object.defineProperty(D[F],"labels",{value:S})}D.rgb.hsl=function(d){var m=d[0]/255,C=d[1]/255,b=d[2]/255,P=Math.min(m,C,b),u=Math.max(m,C,b),f=u-P,g,x,_;return u===P?g=0:m===u?g=(C-b)/f:C===u?g=2+(b-m)/f:b===u&&(g=4+(m-C)/f),g=Math.min(g*60,360),g<0&&(g+=360),_=(P+u)/2,u===P?x=0:_<=.5?x=f/(u+P):x=f/(2-u-P),[g,x*100,_*100]},D.rgb.hsv=function(d){var m,C,b,P,u,f=d[0]/255,g=d[1]/255,x=d[2]/255,_=Math.max(f,g,x),B=_-Math.min(f,g,x),W=function(j){return(_-j)/6/B+1/2};return B===0?P=u=0:(u=B/_,m=W(f),C=W(g),b=W(x),f===_?P=b-C:g===_?P=.3333333333333333+m-b:x===_&&(P=.6666666666666666+C-m),P<0?P+=1:P>1&&(P-=1)),[P*360,u*100,_*100]},D.rgb.hwb=function(d){var m=d[0],C=d[1],b=d[2],P=D.rgb.hsl(d)[0],u=1/255*Math.min(m,Math.min(C,b));return b=1-.00392156862745098*Math.max(m,Math.max(C,b)),[P,u*100,b*100]},D.rgb.cmyk=function(d){var m=d[0]/255,C=d[1]/255,b=d[2]/255,P,u,f,g;return g=Math.min(1-m,1-C,1-b),P=(1-m-g)/(1-g)||0,u=(1-C-g)/(1-g)||0,f=(1-b-g)/(1-g)||0,[P*100,u*100,f*100,g*100]};function O(d,m){return Math.pow(d[0]-m[0],2)+Math.pow(d[1]-m[1],2)+Math.pow(d[2]-m[2],2)}D.rgb.keyword=function(d){var m=I[d];if(m)return m;var C=1/0,b;for(var P in T)if(T.hasOwnProperty(P)){var u=T[P],f=O(d,u);f<C&&(C=f,b=P)}return b},D.keyword.rgb=function(d){return T[d]},D.rgb.xyz=function(d){var m=d[0]/255,C=d[1]/255,b=d[2]/255;m=m>.04045?Math.pow((m+.055)/1.055,2.4):m/12.92,C=C>.04045?Math.pow((C+.055)/1.055,2.4):C/12.92,b=b>.04045?Math.pow((b+.055)/1.055,2.4):b/12.92;var P=m*.4124+C*.3576+b*.1805,u=m*.2126+C*.7152+b*.0722,f=m*.0193+C*.1192+b*.9505;return[P*100,u*100,f*100]},D.rgb.lab=function(d){var m=D.rgb.xyz(d),C=m[0],b=m[1],P=m[2],u,f,g;return C/=95.047,b/=100,P/=108.883,C=C>.008856?Math.pow(C,.3333333333333333):7.787*C+.13793103448275862,b=b>.008856?Math.pow(b,.3333333333333333):7.787*b+.13793103448275862,P=P>.008856?Math.pow(P,.3333333333333333):7.787*P+.13793103448275862,u=116*b-16,f=500*(C-b),g=200*(b-P),[u,f,g]},D.hsl.rgb=function(d){var m=d[0]/360,C=d[1]/100,b=d[2]/100,P,u,f,g,x;if(C===0)return x=b*255,[x,x,x];b<.5?u=b*(1+C):u=b+C-b*C,P=2*b-u,g=[0,0,0];for(var _=0;_<3;_++)f=m+.3333333333333333*-(_-1),f<0&&f++,f>1&&f--,6*f<1?x=P+(u-P)*6*f:2*f<1?x=u:3*f<2?x=P+(u-P)*(.6666666666666666-f)*6:x=P,g[_]=x*255;return g},D.hsl.hsv=function(d){var m=d[0],C=d[1]/100,b=d[2]/100,P=C,u=Math.max(b,.01),f,g;return b*=2,C*=b<=1?b:2-b,P*=u<=1?u:2-u,g=(b+C)/2,f=b===0?2*P/(u+P):2*C/(b+C),[m,f*100,g*100]},D.hsv.rgb=function(d){var m=d[0]/60,C=d[1]/100,b=d[2]/100,P=Math.floor(m)%6,u=m-Math.floor(m),f=255*b*(1-C),g=255*b*(1-C*u),x=255*b*(1-C*(1-u));switch(b*=255,P){case 0:return[b,x,f];case 1:return[g,b,f];case 2:return[f,b,x];case 3:return[f,g,b];case 4:return[x,f,b];case 5:return[b,f,g]}},D.hsv.hsl=function(d){var m=d[0],C=d[1]/100,b=d[2]/100,P=Math.max(b,.01),u,f,g;return g=(2-C)*b,u=(2-C)*P,f=C*P,f/=u<=1?u:2-u,f=f||0,g/=2,[m,f*100,g*100]},D.hwb.rgb=function(d){var m=d[0]/360,C=d[1]/100,b=d[2]/100,P=C+b,u,f,g,x;P>1&&(C/=P,b/=P),u=Math.floor(6*m),f=1-b,g=6*m-u,u&1&&(g=1-g),x=C+g*(f-C);var _,B,W;switch(u){default:case 6:case 0:_=f,B=x,W=C;break;case 1:_=x,B=f,W=C;break;case 2:_=C,B=f,W=x;break;case 3:_=C,B=x,W=f;break;case 4:_=x,B=C,W=f;break;case 5:_=f,B=C,W=x;break}return[_*255,B*255,W*255]},D.cmyk.rgb=function(d){var m=d[0]/100,C=d[1]/100,b=d[2]/100,P=d[3]/100,u,f,g;return u=1-Math.min(1,m*(1-P)+P),f=1-Math.min(1,C*(1-P)+P),g=1-Math.min(1,b*(1-P)+P),[u*255,f*255,g*255]},D.xyz.rgb=function(d){var m=d[0]/100,C=d[1]/100,b=d[2]/100,P,u,f;return P=m*3.2406+C*-1.5372+b*-.4986,u=m*-.9689+C*1.8758+b*.0415,f=m*.0557+C*-.204+b*1.057,P=P>.0031308?1.055*Math.pow(P,.4166666666666667)-.055:P*12.92,u=u>.0031308?1.055*Math.pow(u,.4166666666666667)-.055:u*12.92,f=f>.0031308?1.055*Math.pow(f,.4166666666666667)-.055:f*12.92,P=Math.min(Math.max(0,P),1),u=Math.min(Math.max(0,u),1),f=Math.min(Math.max(0,f),1),[P*255,u*255,f*255]},D.xyz.lab=function(d){var m=d[0],C=d[1],b=d[2],P,u,f;return m/=95.047,C/=100,b/=108.883,m=m>.008856?Math.pow(m,.3333333333333333):7.787*m+.13793103448275862,C=C>.008856?Math.pow(C,.3333333333333333):7.787*C+.13793103448275862,b=b>.008856?Math.pow(b,.3333333333333333):7.787*b+.13793103448275862,P=116*C-16,u=500*(m-C),f=200*(C-b),[P,u,f]},D.lab.xyz=function(d){var m=d[0],C=d[1],b=d[2],P,u,f;u=(m+16)/116,P=C/500+u,f=u-b/200;var g=Math.pow(u,3),x=Math.pow(P,3),_=Math.pow(f,3);return u=g>.008856?g:(u-.13793103448275862)/7.787,P=x>.008856?x:(P-.13793103448275862)/7.787,f=_>.008856?_:(f-.13793103448275862)/7.787,P*=95.047,u*=100,f*=108.883,[P,u,f]},D.lab.lch=function(d){var m=d[0],C=d[1],b=d[2],P,u,f;return P=Math.atan2(b,C),u=P*360/2/Math.PI,u<0&&(u+=360),f=Math.sqrt(C*C+b*b),[m,f,u]},D.lch.lab=function(d){var m=d[0],C=d[1],b=d[2],P,u,f;return f=b/360*2*Math.PI,P=C*Math.cos(f),u=C*Math.sin(f),[m,P,u]},D.rgb.ansi16=function(d){var m=d[0],C=d[1],b=d[2],P=1 in arguments?arguments[1]:D.rgb.hsv(d)[2];if(P=Math.round(P/50),P===0)return 30;var u=30+(Math.round(b/255)<<2|Math.round(C/255)<<1|Math.round(m/255));return P===2&&(u+=60),u},D.hsv.ansi16=function(d){return D.rgb.ansi16(D.hsv.rgb(d),d[2])},D.rgb.ansi256=function(d){var m=d[0],C=d[1],b=d[2];if(m===C&&C===b)return m<8?16:m>248?231:Math.round((m-8)/247*24)+232;var P=16+36*Math.round(m/255*5)+6*Math.round(C/255*5)+Math.round(b/255*5);return P},D.ansi16.rgb=function(d){var m=d%10;if(m===0||m===7)return d>50&&(m+=3.5),m=m/10.5*255,[m,m,m];var C=(~~(d>50)+1)*.5,b=(m&1)*C*255,P=(m>>1&1)*C*255,u=(m>>2&1)*C*255;return[b,P,u]},D.ansi256.rgb=function(d){if(d>=232){var m=(d-232)*10+8;return[m,m,m]}d-=16;var C,b=Math.floor(d/36)/5*255,P=Math.floor((C=d%36)/6)/5*255,u=C%6/5*255;return[b,P,u]},D.rgb.hex=function(d){var m=((Math.round(d[0])&255)<<16)+((Math.round(d[1])&255)<<8)+(Math.round(d[2])&255),C=m.toString(16).toUpperCase();return"000000".substring(C.length)+C},D.hex.rgb=function(d){var m=d.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!m)return[0,0,0];var C=m[0];m[0].length===3&&(C=C.split("").map(function(g){return g+g}).join(""));var b=parseInt(C,16),P=b>>16&255,u=b>>8&255,f=b&255;return[P,u,f]},D.rgb.hcg=function(d){var m=d[0]/255,C=d[1]/255,b=d[2]/255,P=Math.max(Math.max(m,C),b),u=Math.min(Math.min(m,C),b),f=P-u,g,x;return f<1?g=u/(1-f):g=0,f<=0?x=0:P===m?x=(C-b)/f%6:P===C?x=2+(b-m)/f:x=4+(m-C)/f+4,x/=6,x%=1,[x*360,f*100,g*100]},D.hsl.hcg=function(d){var m=d[1]/100,C=d[2]/100,b=1,P=0;return C<.5?b=2*m*C:b=2*m*(1-C),b<1&&(P=(C-.5*b)/(1-b)),[d[0],b*100,P*100]},D.hsv.hcg=function(d){var m=d[1]/100,C=d[2]/100,b=m*C,P=0;return b<1&&(P=(C-b)/(1-b)),[d[0],b*100,P*100]},D.hcg.rgb=function(d){var m=d[0]/360,C=d[1]/100,b=d[2]/100;if(C===0)return[b*255,b*255,b*255];var P=[0,0,0],u=m%1*6,f=u%1,g=1-f,x=0;switch(Math.floor(u)){case 0:P[0]=1,P[1]=f,P[2]=0;break;case 1:P[0]=g,P[1]=1,P[2]=0;break;case 2:P[0]=0,P[1]=1,P[2]=f;break;case 3:P[0]=0,P[1]=g,P[2]=1;break;case 4:P[0]=f,P[1]=0,P[2]=1;break;default:P[0]=1,P[1]=0,P[2]=g}return x=(1-C)*b,[(C*P[0]+x)*255,(C*P[1]+x)*255,(C*P[2]+x)*255]},D.hcg.hsv=function(d){var m=d[1]/100,C=d[2]/100,b=m+C*(1-m),P=0;return b>0&&(P=m/b),[d[0],P*100,b*100]},D.hcg.hsl=function(d){var m=d[1]/100,C=d[2]/100,b=C*(1-m)+.5*m,P=0;return b>0&&b<.5?P=m/(2*b):b>=.5&&b<1&&(P=m/(2*(1-b))),[d[0],P*100,b*100]},D.hcg.hwb=function(d){var m=d[1]/100,C=d[2]/100,b=m+C*(1-m);return[d[0],(b-m)*100,(1-b)*100]},D.hwb.hcg=function(d){var m=d[1]/100,C=d[2]/100,b=1-C,P=b-m,u=0;return P<1&&(u=(b-P)/(1-P)),[d[0],P*100,u*100]},D.apple.rgb=function(d){return[d[0]/65535*255,d[1]/65535*255,d[2]/65535*255]},D.rgb.apple=function(d){return[d[0]/255*65535,d[1]/255*65535,d[2]/255*65535]},D.gray.rgb=function(d){return[d[0]/100*255,d[0]/100*255,d[0]/100*255]},D.gray.hsl=D.gray.hsv=function(d){return[0,0,d[0]]},D.gray.hwb=function(d){return[0,100,d[0]]},D.gray.cmyk=function(d){return[0,0,0,d[0]]},D.gray.lab=function(d){return[d[0],0,0]},D.gray.hex=function(d){var m=Math.round(d[0]/100*255)&255,C=(m<<16)+(m<<8)+m,b=C.toString(16).toUpperCase();return"000000".substring(b.length)+b},D.rgb.gray=function(d){var m=(d[0]+d[1]+d[2])/3;return[m/255*100]}},2085:(L,M,w)=>{var T=w(8168),I=w(4111),H={},D=Object.keys(T);function F(S){var O=function(d){return d==null?d:(arguments.length>1&&(d=Array.prototype.slice.call(arguments)),S(d))};return"conversion"in S&&(O.conversion=S.conversion),O}function A(S){var O=function(d){if(d==null)return d;arguments.length>1&&(d=Array.prototype.slice.call(arguments));var m=S(d);if(typeof m=="object")for(var C=m.length,b=0;b<C;b++)m[b]=Math.round(m[b]);return m};return"conversion"in S&&(O.conversion=S.conversion),O}D.forEach(function(S){H[S]={},Object.defineProperty(H[S],"channels",{value:T[S].channels}),Object.defineProperty(H[S],"labels",{value:T[S].labels});var O=I(S),d=Object.keys(O);d.forEach(function(m){var C=O[m];H[S][m]=A(C),H[S][m].raw=F(C)})}),L.exports=H},9092:L=>{"use strict";L.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}},4111:(L,M,w)=>{var T=w(8168);function I(){for(var A={},S=Object.keys(T),O=S.length,d=0;d<O;d++)A[S[d]]={distance:-1,parent:null};return A}function H(A){var S=I(),O=[A];for(S[A].distance=0;O.length;)for(var d=O.pop(),m=Object.keys(T[d]),C=m.length,b=0;b<C;b++){var P=m[b],u=S[P];u.distance===-1&&(u.distance=S[d].distance+1,u.parent=d,O.unshift(P))}return S}function D(A,S){return function(O){return S(A(O))}}function F(A,S){for(var O=[S[A].parent,A],d=T[S[A].parent][A],m=S[A].parent;S[m].parent;)O.unshift(S[m].parent),d=D(T[S[m].parent][m],d),m=S[m].parent;return d.conversion=O,d}L.exports=function(A){for(var S=H(A),O={},d=Object.keys(S),m=d.length,C=0;C<m;C++){var b=d[C],P=S[b];P.parent!==null&&(O[b]=F(b,S))}return O}},8874:L=>{"use strict";L.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}},9818:(L,M,w)=>{var T=w(8874),I=w(6851),H=Object.hasOwnProperty,D=Object.create(null);for(var F in T)H.call(T,F)&&(D[T[F]]=F);var A=L.exports={to:{},get:{}};A.get=function(d){var m=d.substring(0,3).toLowerCase(),C,b;switch(m){case"hsl":C=A.get.hsl(d),b="hsl";break;case"hwb":C=A.get.hwb(d),b="hwb";break;default:C=A.get.rgb(d),b="rgb";break}return C?{model:b,value:C}:null},A.get.rgb=function(d){if(!d)return null;var m=/^#([a-f0-9]{3,4})$/i,C=/^#([a-f0-9]{6})([a-f0-9]{2})?$/i,b=/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,P=/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,u=/^(\w+)$/,f=[0,0,0,1],g,x,_;if(g=d.match(C)){for(_=g[2],g=g[1],x=0;x<3;x++){var B=x*2;f[x]=parseInt(g.slice(B,B+2),16)}_&&(f[3]=parseInt(_,16)/255)}else if(g=d.match(m)){for(g=g[1],_=g[3],x=0;x<3;x++)f[x]=parseInt(g[x]+g[x],16);_&&(f[3]=parseInt(_+_,16)/255)}else if(g=d.match(b)){for(x=0;x<3;x++)f[x]=parseInt(g[x+1],0);g[4]&&(g[5]?f[3]=parseFloat(g[4])*.01:f[3]=parseFloat(g[4]))}else if(g=d.match(P)){for(x=0;x<3;x++)f[x]=Math.round(parseFloat(g[x+1])*2.55);g[4]&&(g[5]?f[3]=parseFloat(g[4])*.01:f[3]=parseFloat(g[4]))}else return(g=d.match(u))?g[1]==="transparent"?[0,0,0,0]:H.call(T,g[1])?(f=T[g[1]],f[3]=1,f):null:null;for(x=0;x<3;x++)f[x]=S(f[x],0,255);return f[3]=S(f[3],0,1),f},A.get.hsl=function(d){if(!d)return null;var m=/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/,C=d.match(m);if(C){var b=parseFloat(C[4]),P=(parseFloat(C[1])%360+360)%360,u=S(parseFloat(C[2]),0,100),f=S(parseFloat(C[3]),0,100),g=S(isNaN(b)?1:b,0,1);return[P,u,f,g]}return null},A.get.hwb=function(d){if(!d)return null;var m=/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/,C=d.match(m);if(C){var b=parseFloat(C[4]),P=(parseFloat(C[1])%360+360)%360,u=S(parseFloat(C[2]),0,100),f=S(parseFloat(C[3]),0,100),g=S(isNaN(b)?1:b,0,1);return[P,u,f,g]}return null},A.to.hex=function(){var d=I(arguments);return"#"+O(d[0])+O(d[1])+O(d[2])+(d[3]<1?O(Math.round(d[3]*255)):"")},A.to.rgb=function(){var d=I(arguments);return d.length<4||d[3]===1?"rgb("+Math.round(d[0])+", "+Math.round(d[1])+", "+Math.round(d[2])+")":"rgba("+Math.round(d[0])+", "+Math.round(d[1])+", "+Math.round(d[2])+", "+d[3]+")"},A.to.rgb.percent=function(){var d=I(arguments),m=Math.round(d[0]/255*100),C=Math.round(d[1]/255*100),b=Math.round(d[2]/255*100);return d.length<4||d[3]===1?"rgb("+m+"%, "+C+"%, "+b+"%)":"rgba("+m+"%, "+C+"%, "+b+"%, "+d[3]+")"},A.to.hsl=function(){var d=I(arguments);return d.length<4||d[3]===1?"hsl("+d[0]+", "+d[1]+"%, "+d[2]+"%)":"hsla("+d[0]+", "+d[1]+"%, "+d[2]+"%, "+d[3]+")"},A.to.hwb=function(){var d=I(arguments),m="";return d.length>=4&&d[3]!==1&&(m=", "+d[3]),"hwb("+d[0]+", "+d[1]+"%, "+d[2]+"%"+m+")"},A.to.keyword=function(d){return D[d.slice(0,3)]};function S(d,m,C){return Math.min(Math.max(m,d),C)}function O(d){var m=Math.round(d).toString(16).toUpperCase();return m.length<2?"0"+m:m}},6767:(L,M,w)=>{"use strict";var T=w(9818),I=w(2085),H=[].slice,D=["keyword","gray","hex"],F={};Object.keys(I).forEach(function(u){F[H.call(I[u].labels).sort().join("")]=u});var A={};function S(u,f){if(!(this instanceof S))return new S(u,f);if(f&&f in D&&(f=null),f&&!(f in I))throw new Error("Unknown model: "+f);var g,x;if(u==null)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(u instanceof S)this.model=u.model,this.color=u.color.slice(),this.valpha=u.valpha;else if(typeof u=="string"){var _=T.get(u);if(_===null)throw new Error("Unable to parse color from string: "+u);this.model=_.model,x=I[this.model].channels,this.color=_.value.slice(0,x),this.valpha=typeof _.value[x]=="number"?_.value[x]:1}else if(u.length){this.model=f||"rgb",x=I[this.model].channels;var B=H.call(u,0,x);this.color=P(B,x),this.valpha=typeof u[x]=="number"?u[x]:1}else if(typeof u=="number")u&=16777215,this.model="rgb",this.color=[u>>16&255,u>>8&255,u&255],this.valpha=1;else{this.valpha=1;var W=Object.keys(u);"alpha"in u&&(W.splice(W.indexOf("alpha"),1),this.valpha=typeof u.alpha=="number"?u.alpha:0);var j=W.sort().join("");if(!(j in F))throw new Error("Unable to parse color from object: "+JSON.stringify(u));this.model=F[j];var ee=I[this.model].labels,V=[];for(g=0;g<ee.length;g++)V.push(u[ee[g]]);this.color=P(V)}if(A[this.model])for(x=I[this.model].channels,g=0;g<x;g++){var z=A[this.model][g];z&&(this.color[g]=z(this.color[g]))}this.valpha=Math.max(0,Math.min(1,this.valpha)),Object.freeze&&Object.freeze(this)}S.prototype={toString:function(){return this.string()},toJSON:function(){return this[this.model]()},string:function(u){var f=this.model in T.to?this:this.rgb();f=f.round(typeof u=="number"?u:1);var g=f.valpha===1?f.color:f.color.concat(this.valpha);return T.to[f.model](g)},percentString:function(u){var f=this.rgb().round(typeof u=="number"?u:1),g=f.valpha===1?f.color:f.color.concat(this.valpha);return T.to.rgb.percent(g)},array:function(){return this.valpha===1?this.color.slice():this.color.concat(this.valpha)},object:function(){for(var u={},f=I[this.model].channels,g=I[this.model].labels,x=0;x<f;x++)u[g[x]]=this.color[x];return this.valpha!==1&&(u.alpha=this.valpha),u},unitArray:function(){var u=this.rgb().color;return u[0]/=255,u[1]/=255,u[2]/=255,this.valpha!==1&&u.push(this.valpha),u},unitObject:function(){var u=this.rgb().object();return u.r/=255,u.g/=255,u.b/=255,this.valpha!==1&&(u.alpha=this.valpha),u},round:function(u){return u=Math.max(u||0,0),new S(this.color.map(d(u)).concat(this.valpha),this.model)},alpha:function(u){return arguments.length?new S(this.color.concat(Math.max(0,Math.min(1,u))),this.model):this.valpha},red:m("rgb",0,C(255)),green:m("rgb",1,C(255)),blue:m("rgb",2,C(255)),hue:m(["hsl","hsv","hsl","hwb","hcg"],0,function(u){return(u%360+360)%360}),saturationl:m("hsl",1,C(100)),lightness:m("hsl",2,C(100)),saturationv:m("hsv",1,C(100)),value:m("hsv",2,C(100)),chroma:m("hcg",1,C(100)),gray:m("hcg",2,C(100)),white:m("hwb",1,C(100)),wblack:m("hwb",2,C(100)),cyan:m("cmyk",0,C(100)),magenta:m("cmyk",1,C(100)),yellow:m("cmyk",2,C(100)),black:m("cmyk",3,C(100)),x:m("xyz",0,C(100)),y:m("xyz",1,C(100)),z:m("xyz",2,C(100)),l:m("lab",0,C(100)),a:m("lab",1),b:m("lab",2),keyword:function(u){return arguments.length?new S(u):I[this.model].keyword(this.color)},hex:function(u){return arguments.length?new S(u):T.to.hex(this.rgb().round().color)},rgbNumber:function(){var u=this.rgb().color;return(u[0]&255)<<16|(u[1]&255)<<8|u[2]&255},luminosity:function(){for(var u=this.rgb().color,f=[],g=0;g<u.length;g++){var x=u[g]/255;f[g]=x<=.03928?x/12.92:Math.pow((x+.055)/1.055,2.4)}return .2126*f[0]+.7152*f[1]+.0722*f[2]},contrast:function(u){var f=this.luminosity(),g=u.luminosity();return f>g?(f+.05)/(g+.05):(g+.05)/(f+.05)},level:function(u){var f=this.contrast(u);return f>=7.1?"AAA":f>=4.5?"AA":""},isDark:function(){var u=this.rgb().color,f=(u[0]*299+u[1]*587+u[2]*114)/1e3;return f<128},isLight:function(){return!this.isDark()},negate:function(){for(var u=this.rgb(),f=0;f<3;f++)u.color[f]=255-u.color[f];return u},lighten:function(u){var f=this.hsl();return f.color[2]+=f.color[2]*u,f},darken:function(u){var f=this.hsl();return f.color[2]-=f.color[2]*u,f},saturate:function(u){var f=this.hsl();return f.color[1]+=f.color[1]*u,f},desaturate:function(u){var f=this.hsl();return f.color[1]-=f.color[1]*u,f},whiten:function(u){var f=this.hwb();return f.color[1]+=f.color[1]*u,f},blacken:function(u){var f=this.hwb();return f.color[2]+=f.color[2]*u,f},grayscale:function(){var u=this.rgb().color,f=u[0]*.3+u[1]*.59+u[2]*.11;return S.rgb(f,f,f)},fade:function(u){return this.alpha(this.valpha-this.valpha*u)},opaquer:function(u){return this.alpha(this.valpha+this.valpha*u)},rotate:function(u){var f=this.hsl(),g=f.color[0];return g=(g+u)%360,g=g<0?360+g:g,f.color[0]=g,f},mix:function(u,f){if(!u||!u.rgb)throw new Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof u);var g=u.rgb(),x=this.rgb(),_=f===void 0?.5:f,B=2*_-1,W=g.alpha()-x.alpha(),j=((B*W===-1?B:(B+W)/(1+B*W))+1)/2,ee=1-j;return S.rgb(j*g.red()+ee*x.red(),j*g.green()+ee*x.green(),j*g.blue()+ee*x.blue(),g.alpha()*_+x.alpha()*(1-_))}},Object.keys(I).forEach(function(u){if(D.indexOf(u)===-1){var f=I[u].channels;S.prototype[u]=function(){if(this.model===u)return new S(this);if(arguments.length)return new S(arguments,u);var g=typeof arguments[f]=="number"?f:this.valpha;return new S(b(I[this.model][u].raw(this.color)).concat(g),u)},S[u]=function(g){return typeof g=="number"&&(g=P(H.call(arguments),f)),new S(g,u)}}});function O(u,f){return Number(u.toFixed(f))}function d(u){return function(f){return O(f,u)}}function m(u,f,g){return u=Array.isArray(u)?u:[u],u.forEach(function(x){(A[x]||(A[x]=[]))[f]=g}),u=u[0],function(x){var _;return arguments.length?(g&&(x=g(x)),_=this[u](),_.color[f]=x,_):(_=this[u]().color[f],g&&(_=g(_)),_)}}function C(u){return function(f){return Math.max(0,Math.min(u,f))}}function b(u){return Array.isArray(u)?u:[u]}function P(u,f){for(var g=0;g<f;g++)typeof u[g]!="number"&&(u[g]=0);return u}L.exports=S},7394:(L,M)=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0}),M.default=w;function w(T,I){for(var H=T<0?"-":"",D=Math.abs(T).toString();D.length<I;)D="0"+D;return H+D}L.exports=M.default},8609:(L,M)=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0}),M.default=w;function w(T,I){if(T==null)throw new TypeError("assign requires that input parameter not be null or undefined");for(var H in I)Object.prototype.hasOwnProperty.call(I,H)&&(T[H]=I[H]);return T}L.exports=M.default},6420:(L,M,w)=>{"use strict";var T=w(4836).default;Object.defineProperty(M,"__esModule",{value:!0}),M.default=H;var I=T(w(8609));function H(D){return(0,I.default)({},D)}L.exports=M.default},7561:(L,M,w)=>{"use strict";var T=w(4836).default;Object.defineProperty(M,"__esModule",{value:!0}),M.default=void 0;var I=T(w(2512)),H=I.default;M.default=H,L.exports=M.default},8729:(L,M)=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0}),M.getDefaultOptions=T,M.setDefaultOptions=I;var w={};function T(){return w}function I(H){w=H}},7100:(L,M,w)=>{"use strict";var T=w(4836).default;Object.defineProperty(M,"__esModule",{value:!0}),M.default=void 0;var I=T(w(1603)),H=T(w(1354)),D=T(w(1370)),F=T(w(623)),A=T(w(6226)),S=T(w(7394)),O=T(w(2699)),d={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},m={G:function(g,x,_){var B=g.getUTCFullYear()>0?1:0;switch(x){case"G":case"GG":case"GGG":return _.era(B,{width:"abbreviated"});case"GGGGG":return _.era(B,{width:"narrow"});case"GGGG":default:return _.era(B,{width:"wide"})}},y:function(g,x,_){if(x==="yo"){var B=g.getUTCFullYear(),W=B>0?B:1-B;return _.ordinalNumber(W,{unit:"year"})}return O.default.y(g,x)},Y:function(g,x,_,B){var W=(0,A.default)(g,B),j=W>0?W:1-W;if(x==="YY"){var ee=j%100;return(0,S.default)(ee,2)}return x==="Yo"?_.ordinalNumber(j,{unit:"year"}):(0,S.default)(j,x.length)},R:function(g,x){var _=(0,D.default)(g);return(0,S.default)(_,x.length)},u:function(g,x){var _=g.getUTCFullYear();return(0,S.default)(_,x.length)},Q:function(g,x,_){var B=Math.ceil((g.getUTCMonth()+1)/3);switch(x){case"Q":return String(B);case"QQ":return(0,S.default)(B,2);case"Qo":return _.ordinalNumber(B,{unit:"quarter"});case"QQQ":return _.quarter(B,{width:"abbreviated",context:"formatting"});case"QQQQQ":return _.quarter(B,{width:"narrow",context:"formatting"});case"QQQQ":default:return _.quarter(B,{width:"wide",context:"formatting"})}},q:function(g,x,_){var B=Math.ceil((g.getUTCMonth()+1)/3);switch(x){case"q":return String(B);case"qq":return(0,S.default)(B,2);case"qo":return _.ordinalNumber(B,{unit:"quarter"});case"qqq":return _.quarter(B,{width:"abbreviated",context:"standalone"});case"qqqqq":return _.quarter(B,{width:"narrow",context:"standalone"});case"qqqq":default:return _.quarter(B,{width:"wide",context:"standalone"})}},M:function(g,x,_){var B=g.getUTCMonth();switch(x){case"M":case"MM":return O.default.M(g,x);case"Mo":return _.ordinalNumber(B+1,{unit:"month"});case"MMM":return _.month(B,{width:"abbreviated",context:"formatting"});case"MMMMM":return _.month(B,{width:"narrow",context:"formatting"});case"MMMM":default:return _.month(B,{width:"wide",context:"formatting"})}},L:function(g,x,_){var B=g.getUTCMonth();switch(x){case"L":return String(B+1);case"LL":return(0,S.default)(B+1,2);case"Lo":return _.ordinalNumber(B+1,{unit:"month"});case"LLL":return _.month(B,{width:"abbreviated",context:"standalone"});case"LLLLL":return _.month(B,{width:"narrow",context:"standalone"});case"LLLL":default:return _.month(B,{width:"wide",context:"standalone"})}},w:function(g,x,_,B){var W=(0,F.default)(g,B);return x==="wo"?_.ordinalNumber(W,{unit:"week"}):(0,S.default)(W,x.length)},I:function(g,x,_){var B=(0,H.default)(g);return x==="Io"?_.ordinalNumber(B,{unit:"week"}):(0,S.default)(B,x.length)},d:function(g,x,_){return x==="do"?_.ordinalNumber(g.getUTCDate(),{unit:"date"}):O.default.d(g,x)},D:function(g,x,_){var B=(0,I.default)(g);return x==="Do"?_.ordinalNumber(B,{unit:"dayOfYear"}):(0,S.default)(B,x.length)},E:function(g,x,_){var B=g.getUTCDay();switch(x){case"E":case"EE":case"EEE":return _.day(B,{width:"abbreviated",context:"formatting"});case"EEEEE":return _.day(B,{width:"narrow",context:"formatting"});case"EEEEEE":return _.day(B,{width:"short",context:"formatting"});case"EEEE":default:return _.day(B,{width:"wide",context:"formatting"})}},e:function(g,x,_,B){var W=g.getUTCDay(),j=(W-B.weekStartsOn+8)%7||7;switch(x){case"e":return String(j);case"ee":return(0,S.default)(j,2);case"eo":return _.ordinalNumber(j,{unit:"day"});case"eee":return _.day(W,{width:"abbreviated",context:"formatting"});case"eeeee":return _.day(W,{width:"narrow",context:"formatting"});case"eeeeee":return _.day(W,{width:"short",context:"formatting"});case"eeee":default:return _.day(W,{width:"wide",context:"formatting"})}},c:function(g,x,_,B){var W=g.getUTCDay(),j=(W-B.weekStartsOn+8)%7||7;switch(x){case"c":return String(j);case"cc":return(0,S.default)(j,x.length);case"co":return _.ordinalNumber(j,{unit:"day"});case"ccc":return _.day(W,{width:"abbreviated",context:"standalone"});case"ccccc":return _.day(W,{width:"narrow",context:"standalone"});case"cccccc":return _.day(W,{width:"short",context:"standalone"});case"cccc":default:return _.day(W,{width:"wide",context:"standalone"})}},i:function(g,x,_){var B=g.getUTCDay(),W=B===0?7:B;switch(x){case"i":return String(W);case"ii":return(0,S.default)(W,x.length);case"io":return _.ordinalNumber(W,{unit:"day"});case"iii":return _.day(B,{width:"abbreviated",context:"formatting"});case"iiiii":return _.day(B,{width:"narrow",context:"formatting"});case"iiiiii":return _.day(B,{width:"short",context:"formatting"});case"iiii":default:return _.day(B,{width:"wide",context:"formatting"})}},a:function(g,x,_){var B=g.getUTCHours(),W=B/12>=1?"pm":"am";switch(x){case"a":case"aa":return _.dayPeriod(W,{width:"abbreviated",context:"formatting"});case"aaa":return _.dayPeriod(W,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return _.dayPeriod(W,{width:"narrow",context:"formatting"});case"aaaa":default:return _.dayPeriod(W,{width:"wide",context:"formatting"})}},b:function(g,x,_){var B=g.getUTCHours(),W;switch(B===12?W=d.noon:B===0?W=d.midnight:W=B/12>=1?"pm":"am",x){case"b":case"bb":return _.dayPeriod(W,{width:"abbreviated",context:"formatting"});case"bbb":return _.dayPeriod(W,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return _.dayPeriod(W,{width:"narrow",context:"formatting"});case"bbbb":default:return _.dayPeriod(W,{width:"wide",context:"formatting"})}},B:function(g,x,_){var B=g.getUTCHours(),W;switch(B>=17?W=d.evening:B>=12?W=d.afternoon:B>=4?W=d.morning:W=d.night,x){case"B":case"BB":case"BBB":return _.dayPeriod(W,{width:"abbreviated",context:"formatting"});case"BBBBB":return _.dayPeriod(W,{width:"narrow",context:"formatting"});case"BBBB":default:return _.dayPeriod(W,{width:"wide",context:"formatting"})}},h:function(g,x,_){if(x==="ho"){var B=g.getUTCHours()%12;return B===0&&(B=12),_.ordinalNumber(B,{unit:"hour"})}return O.default.h(g,x)},H:function(g,x,_){return x==="Ho"?_.ordinalNumber(g.getUTCHours(),{unit:"hour"}):O.default.H(g,x)},K:function(g,x,_){var B=g.getUTCHours()%12;return x==="Ko"?_.ordinalNumber(B,{unit:"hour"}):(0,S.default)(B,x.length)},k:function(g,x,_){var B=g.getUTCHours();return B===0&&(B=24),x==="ko"?_.ordinalNumber(B,{unit:"hour"}):(0,S.default)(B,x.length)},m:function(g,x,_){return x==="mo"?_.ordinalNumber(g.getUTCMinutes(),{unit:"minute"}):O.default.m(g,x)},s:function(g,x,_){return x==="so"?_.ordinalNumber(g.getUTCSeconds(),{unit:"second"}):O.default.s(g,x)},S:function(g,x){return O.default.S(g,x)},X:function(g,x,_,B){var W=B._originalDate||g,j=W.getTimezoneOffset();if(j===0)return"Z";switch(x){case"X":return b(j);case"XXXX":case"XX":return P(j);case"XXXXX":case"XXX":default:return P(j,":")}},x:function(g,x,_,B){var W=B._originalDate||g,j=W.getTimezoneOffset();switch(x){case"x":return b(j);case"xxxx":case"xx":return P(j);case"xxxxx":case"xxx":default:return P(j,":")}},O:function(g,x,_,B){var W=B._originalDate||g,j=W.getTimezoneOffset();switch(x){case"O":case"OO":case"OOO":return"GMT"+C(j,":");case"OOOO":default:return"GMT"+P(j,":")}},z:function(g,x,_,B){var W=B._originalDate||g,j=W.getTimezoneOffset();switch(x){case"z":case"zz":case"zzz":return"GMT"+C(j,":");case"zzzz":default:return"GMT"+P(j,":")}},t:function(g,x,_,B){var W=B._originalDate||g,j=Math.floor(W.getTime()/1e3);return(0,S.default)(j,x.length)},T:function(g,x,_,B){var W=B._originalDate||g,j=W.getTime();return(0,S.default)(j,x.length)}};function C(f,g){var x=f>0?"-":"+",_=Math.abs(f),B=Math.floor(_/60),W=_%60;if(W===0)return x+String(B);var j=g||"";return x+String(B)+j+(0,S.default)(W,2)}function b(f,g){if(f%60===0){var x=f>0?"-":"+";return x+(0,S.default)(Math.abs(f)/60,2)}return P(f,g)}function P(f,g){var x=g||"",_=f>0?"-":"+",B=Math.abs(f),W=(0,S.default)(Math.floor(B/60),2),j=(0,S.default)(B%60,2);return _+W+x+j}var u=m;M.default=u,L.exports=M.default},2699:(L,M,w)=>{"use strict";var T=w(4836).default;Object.defineProperty(M,"__esModule",{value:!0}),M.default=void 0;var I=T(w(7394)),H={y:function(A,S){var O=A.getUTCFullYear(),d=O>0?O:1-O;return(0,I.default)(S==="yy"?d%100:d,S.length)},M:function(A,S){var O=A.getUTCMonth();return S==="M"?String(O+1):(0,I.default)(O+1,2)},d:function(A,S){return(0,I.default)(A.getUTCDate(),S.length)},a:function(A,S){var O=A.getUTCHours()/12>=1?"pm":"am";switch(S){case"a":case"aa":return O.toUpperCase();case"aaa":return O;case"aaaaa":return O[0];case"aaaa":default:return O==="am"?"a.m.":"p.m."}},h:function(A,S){return(0,I.default)(A.getUTCHours()%12||12,S.length)},H:function(A,S){return(0,I.default)(A.getUTCHours(),S.length)},m:function(A,S){return(0,I.default)(A.getUTCMinutes(),S.length)},s:function(A,S){return(0,I.default)(A.getUTCSeconds(),S.length)},S:function(A,S){var O=S.length,d=A.getUTCMilliseconds(),m=Math.floor(d*Math.pow(10,O-3));return(0,I.default)(m,S.length)}},D=H;M.default=D,L.exports=M.default},5209:(L,M)=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0}),M.default=void 0;var w=function(A,S){switch(A){case"P":return S.date({width:"short"});case"PP":return S.date({width:"medium"});case"PPP":return S.date({width:"long"});case"PPPP":default:return S.date({width:"full"})}},T=function(A,S){switch(A){case"p":return S.time({width:"short"});case"pp":return S.time({width:"medium"});case"ppp":return S.time({width:"long"});case"pppp":default:return S.time({width:"full"})}},I=function(A,S){var O=A.match(/(P+)(p+)?/)||[],d=O[1],m=O[2];if(!m)return w(A,S);var C;switch(d){case"P":C=S.dateTime({width:"short"});break;case"PP":C=S.dateTime({width:"medium"});break;case"PPP":C=S.dateTime({width:"long"});break;case"PPPP":default:C=S.dateTime({width:"full"});break}return C.replace("{{date}}",w(d,S)).replace("{{time}}",T(m,S))},H={p:T,P:I},D=H;M.default=D,L.exports=M.default},3561:(L,M)=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0}),M.default=w;function w(T){var I=new Date(Date.UTC(T.getFullYear(),T.getMonth(),T.getDate(),T.getHours(),T.getMinutes(),T.getSeconds(),T.getMilliseconds()));return I.setUTCFullYear(T.getFullYear()),T.getTime()-I.getTime()}L.exports=M.default},1603:(L,M,w)=>{"use strict";var T=w(4836).default;Object.defineProperty(M,"__esModule",{value:!0}),M.default=F;var I=T(w(1171)),H=T(w(8734)),D=864e5;function F(A){(0,H.default)(1,arguments);var S=(0,I.default)(A),O=S.getTime();S.setUTCMonth(0,1),S.setUTCHours(0,0,0,0);var d=S.getTime(),m=O-d;return Math.floor(m/D)+1}L.exports=M.default},1354:(L,M,w)=>{"use strict";var T=w(4836).default;Object.defineProperty(M,"__esModule",{value:!0}),M.default=S;var I=T(w(1171)),H=T(w(79)),D=T(w(4275)),F=T(w(8734)),A=6048e5;function S(O){(0,F.default)(1,arguments);var d=(0,I.default)(O),m=(0,H.default)(d).getTime()-(0,D.default)(d).getTime();return Math.round(m/A)+1}L.exports=M.default},1370:(L,M,w)=>{"use strict";var T=w(4836).default;Object.defineProperty(M,"__esModule",{value:!0}),M.default=F;var I=T(w(1171)),H=T(w(8734)),D=T(w(79));function F(A){(0,H.default)(1,arguments);var S=(0,I.default)(A),O=S.getUTCFullYear(),d=new Date(0);d.setUTCFullYear(O+1,0,4),d.setUTCHours(0,0,0,0);var m=(0,D.default)(d),C=new Date(0);C.setUTCFullYear(O,0,4),C.setUTCHours(0,0,0,0);var b=(0,D.default)(C);return S.getTime()>=m.getTime()?O+1:S.getTime()>=b.getTime()?O:O-1}L.exports=M.default},623:(L,M,w)=>{"use strict";var T=w(4836).default;Object.defineProperty(M,"__esModule",{value:!0}),M.default=S;var I=T(w(1171)),H=T(w(9209)),D=T(w(4118)),F=T(w(8734)),A=6048e5;function S(O,d){(0,F.default)(1,arguments);var m=(0,I.default)(O),C=(0,H.default)(m,d).getTime()-(0,D.default)(m,d).getTime();return Math.round(C/A)+1}L.exports=M.default},6226:(L,M,w)=>{"use strict";var T=w(4836).default;Object.defineProperty(M,"__esModule",{value:!0}),M.default=S;var I=T(w(1171)),H=T(w(8734)),D=T(w(9209)),F=T(w(2084)),A=w(8729);function S(O,d){var m,C,b,P,u,f,g,x;(0,H.default)(1,arguments);var _=(0,I.default)(O),B=_.getUTCFullYear(),W=(0,A.getDefaultOptions)(),j=(0,F.default)((m=(C=(b=(P=d==null?void 0:d.firstWeekContainsDate)!==null&&P!==void 0?P:d==null||(u=d.locale)===null||u===void 0||(f=u.options)===null||f===void 0?void 0:f.firstWeekContainsDate)!==null&&b!==void 0?b:W.firstWeekContainsDate)!==null&&C!==void 0?C:(g=W.locale)===null||g===void 0||(x=g.options)===null||x===void 0?void 0:x.firstWeekContainsDate)!==null&&m!==void 0?m:1);if(!(j>=1&&j<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var ee=new Date(0);ee.setUTCFullYear(B+1,0,j),ee.setUTCHours(0,0,0,0);var V=(0,D.default)(ee,d),z=new Date(0);z.setUTCFullYear(B,0,j),z.setUTCHours(0,0,0,0);var X=(0,D.default)(z,d);return _.getTime()>=V.getTime()?B+1:_.getTime()>=X.getTime()?B:B-1}L.exports=M.default},6736:(L,M)=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0}),M.isProtectedDayOfYearToken=I,M.isProtectedWeekYearToken=H,M.throwProtectedError=D;var w=["D","DD"],T=["YY","YYYY"];function I(F){return w.indexOf(F)!==-1}function H(F){return T.indexOf(F)!==-1}function D(F,A,S){if(F==="YYYY")throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(A,"`) for formatting years to the input `").concat(S,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(F==="YY")throw new RangeError("Use `yy` instead of `YY` (in `".concat(A,"`) for formatting years to the input `").concat(S,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(F==="D")throw new RangeError("Use `d` instead of `D` (in `".concat(A,"`) for formatting days of the month to the input `").concat(S,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(F==="DD")throw new RangeError("Use `dd` instead of `DD` (in `".concat(A,"`) for formatting days of the month to the input `").concat(S,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"))}},8734:(L,M)=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0}),M.default=w;function w(T,I){if(I.length<T)throw new TypeError(T+" argument"+(T>1?"s":"")+" required, but only "+I.length+" present")}L.exports=M.default},79:(L,M,w)=>{"use strict";var T=w(4836).default;Object.defineProperty(M,"__esModule",{value:!0}),M.default=D;var I=T(w(1171)),H=T(w(8734));function D(F){(0,H.default)(1,arguments);var A=1,S=(0,I.default)(F),O=S.getUTCDay(),d=(O<A?7:0)+O-A;return S.setUTCDate(S.getUTCDate()-d),S.setUTCHours(0,0,0,0),S}L.exports=M.default},4275:(L,M,w)=>{"use strict";var T=w(4836).default;Object.defineProperty(M,"__esModule",{value:!0}),M.default=F;var I=T(w(1370)),H=T(w(79)),D=T(w(8734));function F(A){(0,D.default)(1,arguments);var S=(0,I.default)(A),O=new Date(0);O.setUTCFullYear(S,0,4),O.setUTCHours(0,0,0,0);var d=(0,H.default)(O);return d}L.exports=M.default},9209:(L,M,w)=>{"use strict";var T=w(4836).default;Object.defineProperty(M,"__esModule",{value:!0}),M.default=A;var I=T(w(1171)),H=T(w(8734)),D=T(w(2084)),F=w(8729);function A(S,O){var d,m,C,b,P,u,f,g;(0,H.default)(1,arguments);var x=(0,F.getDefaultOptions)(),_=(0,D.default)((d=(m=(C=(b=O==null?void 0:O.weekStartsOn)!==null&&b!==void 0?b:O==null||(P=O.locale)===null||P===void 0||(u=P.options)===null||u===void 0?void 0:u.weekStartsOn)!==null&&C!==void 0?C:x.weekStartsOn)!==null&&m!==void 0?m:(f=x.locale)===null||f===void 0||(g=f.options)===null||g===void 0?void 0:g.weekStartsOn)!==null&&d!==void 0?d:0);if(!(_>=0&&_<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var B=(0,I.default)(S),W=B.getUTCDay(),j=(W<_?7:0)+W-_;return B.setUTCDate(B.getUTCDate()-j),B.setUTCHours(0,0,0,0),B}L.exports=M.default},4118:(L,M,w)=>{"use strict";var T=w(4836).default;Object.defineProperty(M,"__esModule",{value:!0}),M.default=S;var I=T(w(6226)),H=T(w(8734)),D=T(w(9209)),F=T(w(2084)),A=w(8729);function S(O,d){var m,C,b,P,u,f,g,x;(0,H.default)(1,arguments);var _=(0,A.getDefaultOptions)(),B=(0,F.default)((m=(C=(b=(P=d==null?void 0:d.firstWeekContainsDate)!==null&&P!==void 0?P:d==null||(u=d.locale)===null||u===void 0||(f=u.options)===null||f===void 0?void 0:f.firstWeekContainsDate)!==null&&b!==void 0?b:_.firstWeekContainsDate)!==null&&C!==void 0?C:(g=_.locale)===null||g===void 0||(x=g.options)===null||x===void 0?void 0:x.firstWeekContainsDate)!==null&&m!==void 0?m:1),W=(0,I.default)(O,d),j=new Date(0);j.setUTCFullYear(W,0,B),j.setUTCHours(0,0,0,0);var ee=(0,D.default)(j,d);return ee}L.exports=M.default},2084:(L,M)=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0}),M.default=w;function w(T){if(T===null||T===!0||T===!1)return NaN;var I=Number(T);return isNaN(I)?I:I<0?Math.ceil(I):Math.floor(I)}L.exports=M.default},5065:(L,M,w)=>{"use strict";var T=w(4836).default;Object.defineProperty(M,"__esModule",{value:!0}),M.default=F;var I=T(w(2084)),H=T(w(1171)),D=T(w(8734));function F(A,S){(0,D.default)(2,arguments);var O=(0,H.default)(A).getTime(),d=(0,I.default)(S);return new Date(O+d)}L.exports=M.default},5616:(L,M,w)=>{"use strict";var T=w(4836).default;Object.defineProperty(M,"__esModule",{value:!0}),M.default=_;var I=T(w(9989)),H=T(w(3239)),D=T(w(1171)),F=T(w(7100)),A=T(w(5209)),S=T(w(3561)),O=w(6736),d=T(w(2084)),m=T(w(8734)),C=w(8729),b=T(w(7561)),P=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,u=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,f=/^'([^]*?)'?$/,g=/''/g,x=/[a-zA-Z]/;function _(W,j,ee){var V,z,X,Q,ie,ge,Se,Ae,Ce,Ne,De,Ee,ke,st,xt,Mt,It,Ot;(0,m.default)(2,arguments);var Tn=String(j),Ze=(0,C.getDefaultOptions)(),Le=(V=(z=ee==null?void 0:ee.locale)!==null&&z!==void 0?z:Ze.locale)!==null&&V!==void 0?V:b.default,it=(0,d.default)((X=(Q=(ie=(ge=ee==null?void 0:ee.firstWeekContainsDate)!==null&&ge!==void 0?ge:ee==null||(Se=ee.locale)===null||Se===void 0||(Ae=Se.options)===null||Ae===void 0?void 0:Ae.firstWeekContainsDate)!==null&&ie!==void 0?ie:Ze.firstWeekContainsDate)!==null&&Q!==void 0?Q:(Ce=Ze.locale)===null||Ce===void 0||(Ne=Ce.options)===null||Ne===void 0?void 0:Ne.firstWeekContainsDate)!==null&&X!==void 0?X:1);if(!(it>=1&&it<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var Bt=(0,d.default)((De=(Ee=(ke=(st=ee==null?void 0:ee.weekStartsOn)!==null&&st!==void 0?st:ee==null||(xt=ee.locale)===null||xt===void 0||(Mt=xt.options)===null||Mt===void 0?void 0:Mt.weekStartsOn)!==null&&ke!==void 0?ke:Ze.weekStartsOn)!==null&&Ee!==void 0?Ee:(It=Ze.locale)===null||It===void 0||(Ot=It.options)===null||Ot===void 0?void 0:Ot.weekStartsOn)!==null&&De!==void 0?De:0);if(!(Bt>=0&&Bt<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!Le.localize)throw new RangeError("locale must contain localize property");if(!Le.formatLong)throw new RangeError("locale must contain formatLong property");var at=(0,D.default)(W);if(!(0,I.default)(at))throw new RangeError("Invalid time value");var _n=(0,S.default)(at),Rt=(0,H.default)(at,_n),An={firstWeekContainsDate:it,weekStartsOn:Bt,locale:Le,_originalDate:at},vt=Tn.match(u).map(function(be){var je=be[0];if(je==="p"||je==="P"){var ot=A.default[je];return ot(be,Le.formatLong)}return be}).join("").match(P).map(function(be){if(be==="''")return"'";var je=be[0];if(je==="'")return B(be);var ot=F.default[je];if(ot)return!(ee!=null&&ee.useAdditionalWeekYearTokens)&&(0,O.isProtectedWeekYearToken)(be)&&(0,O.throwProtectedError)(be,j,String(W)),!(ee!=null&&ee.useAdditionalDayOfYearTokens)&&(0,O.isProtectedDayOfYearToken)(be)&&(0,O.throwProtectedError)(be,j,String(W)),ot(Rt,be,Le.localize,An);if(je.match(x))throw new RangeError("Format string contains an unescaped latin alphabet character `"+je+"`");return be}).join("");return vt}function B(W){var j=W.match(f);return j?j[1].replace(g,"'"):W}L.exports=M.default},2382:(L,M,w)=>{"use strict";var T=w(4836).default;Object.defineProperty(M,"__esModule",{value:!0}),M.default=D;var I=T(w(8698)),H=T(w(8734));function D(F){return(0,H.default)(1,arguments),F instanceof Date||(0,I.default)(F)==="object"&&Object.prototype.toString.call(F)==="[object Date]"}L.exports=M.default},9989:(L,M,w)=>{"use strict";var T=w(4836).default;Object.defineProperty(M,"__esModule",{value:!0}),M.default=F;var I=T(w(2382)),H=T(w(1171)),D=T(w(8734));function F(A){if((0,D.default)(1,arguments),!(0,I.default)(A)&&typeof A!="number")return!1;var S=(0,H.default)(A);return!isNaN(Number(S))}L.exports=M.default},289:(L,M)=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0}),M.default=w;function w(T){return function(){var I=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},H=I.width?String(I.width):T.defaultWidth,D=T.formats[H]||T.formats[T.defaultWidth];return D}}L.exports=M.default},6245:(L,M)=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0}),M.default=w;function w(T){return function(I,H){var D=H!=null&&H.context?String(H.context):"standalone",F;if(D==="formatting"&&T.formattingValues){var A=T.defaultFormattingWidth||T.defaultWidth,S=H!=null&&H.width?String(H.width):A;F=T.formattingValues[S]||T.formattingValues[A]}else{var O=T.defaultWidth,d=H!=null&&H.width?String(H.width):T.defaultWidth;F=T.values[d]||T.values[O]}var m=T.argumentCallback?T.argumentCallback(I):I;return F[m]}}L.exports=M.default},3421:(L,M)=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0}),M.default=w;function w(H){return function(D){var F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},A=F.width,S=A&&H.matchPatterns[A]||H.matchPatterns[H.defaultMatchWidth],O=D.match(S);if(!O)return null;var d=O[0],m=A&&H.parsePatterns[A]||H.parsePatterns[H.defaultParseWidth],C=Array.isArray(m)?I(m,function(u){return u.test(d)}):T(m,function(u){return u.test(d)}),b;b=H.valueCallback?H.valueCallback(C):C,b=F.valueCallback?F.valueCallback(b):b;var P=D.slice(d.length);return{value:b,rest:P}}}function T(H,D){for(var F in H)if(H.hasOwnProperty(F)&&D(H[F]))return F}function I(H,D){for(var F=0;F<H.length;F++)if(D(H[F]))return F}L.exports=M.default},8926:(L,M)=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0}),M.default=w;function w(T){return function(I){var H=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},D=I.match(T.matchPattern);if(!D)return null;var F=D[0],A=I.match(T.parsePattern);if(!A)return null;var S=T.valueCallback?T.valueCallback(A[0]):A[0];S=H.valueCallback?H.valueCallback(S):S;var O=I.slice(F.length);return{value:S,rest:O}}}L.exports=M.default},1924:(L,M)=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0}),M.default=void 0;var w={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},T=function(D,F,A){var S,O=w[D];return typeof O=="string"?S=O:F===1?S=O.one:S=O.other.replace("{{count}}",F.toString()),A!=null&&A.addSuffix?A.comparison&&A.comparison>0?"in "+S:S+" ago":S},I=T;M.default=I,L.exports=M.default},5062:(L,M,w)=>{"use strict";var T=w(4836).default;Object.defineProperty(M,"__esModule",{value:!0}),M.default=void 0;var I=T(w(289)),H={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},D={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},F={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},A={date:(0,I.default)({formats:H,defaultWidth:"full"}),time:(0,I.default)({formats:D,defaultWidth:"full"}),dateTime:(0,I.default)({formats:F,defaultWidth:"full"})},S=A;M.default=S,L.exports=M.default},5102:(L,M)=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0}),M.default=void 0;var w={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},T=function(D,F,A,S){return w[D]},I=T;M.default=I,L.exports=M.default},7839:(L,M,w)=>{"use strict";var T=w(4836).default;Object.defineProperty(M,"__esModule",{value:!0}),M.default=void 0;var I=T(w(6245)),H={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},D={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},F={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},A={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},S={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},O={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},d=function(P,u){var f=Number(P),g=f%100;if(g>20||g<10)switch(g%10){case 1:return f+"st";case 2:return f+"nd";case 3:return f+"rd"}return f+"th"},m={ordinalNumber:d,era:(0,I.default)({values:H,defaultWidth:"wide"}),quarter:(0,I.default)({values:D,defaultWidth:"wide",argumentCallback:function(P){return P-1}}),month:(0,I.default)({values:F,defaultWidth:"wide"}),day:(0,I.default)({values:A,defaultWidth:"wide"}),dayPeriod:(0,I.default)({values:S,defaultWidth:"wide",formattingValues:O,defaultFormattingWidth:"wide"})},C=m;M.default=C,L.exports=M.default},9796:(L,M,w)=>{"use strict";var T=w(4836).default;Object.defineProperty(M,"__esModule",{value:!0}),M.default=void 0;var I=T(w(3421)),H=T(w(8926)),D=/^(\d+)(th|st|nd|rd)?/i,F=/\d+/i,A={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},S={any:[/^b/i,/^(a|c)/i]},O={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},d={any:[/1/i,/2/i,/3/i,/4/i]},m={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},C={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},b={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},P={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},u={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},f={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},g={ordinalNumber:(0,H.default)({matchPattern:D,parsePattern:F,valueCallback:function(B){return parseInt(B,10)}}),era:(0,I.default)({matchPatterns:A,defaultMatchWidth:"wide",parsePatterns:S,defaultParseWidth:"any"}),quarter:(0,I.default)({matchPatterns:O,defaultMatchWidth:"wide",parsePatterns:d,defaultParseWidth:"any",valueCallback:function(B){return B+1}}),month:(0,I.default)({matchPatterns:m,defaultMatchWidth:"wide",parsePatterns:C,defaultParseWidth:"any"}),day:(0,I.default)({matchPatterns:b,defaultMatchWidth:"wide",parsePatterns:P,defaultParseWidth:"any"}),dayPeriod:(0,I.default)({matchPatterns:u,defaultMatchWidth:"any",parsePatterns:f,defaultParseWidth:"any"})},x=g;M.default=x,L.exports=M.default},2512:(L,M,w)=>{"use strict";var T=w(4836).default;Object.defineProperty(M,"__esModule",{value:!0}),M.default=void 0;var I=T(w(1924)),H=T(w(5062)),D=T(w(5102)),F=T(w(7839)),A=T(w(9796)),S={code:"en-US",formatDistance:I.default,formatLong:H.default,formatRelative:D.default,localize:F.default,match:A.default,options:{weekStartsOn:0,firstWeekContainsDate:1}},O=S;M.default=O,L.exports=M.default},3239:(L,M,w)=>{"use strict";var T=w(4836).default;Object.defineProperty(M,"__esModule",{value:!0}),M.default=F;var I=T(w(5065)),H=T(w(8734)),D=T(w(2084));function F(A,S){(0,H.default)(2,arguments);var O=(0,D.default)(S);return(0,I.default)(A,-O)}L.exports=M.default},1171:(L,M,w)=>{"use strict";var T=w(4836).default;Object.defineProperty(M,"__esModule",{value:!0}),M.default=D;var I=T(w(8698)),H=T(w(8734));function D(F){(0,H.default)(1,arguments);var A=Object.prototype.toString.call(F);return F instanceof Date||(0,I.default)(F)==="object"&&A==="[object Date]"?new Date(F.getTime()):typeof F=="number"||A==="[object Number]"?new Date(F):((typeof F=="string"||A==="[object String]")&&typeof console!="undefined"&&(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"),console.warn(new Error().stack)),new Date(NaN))}L.exports=M.default},5171:L=>{L.exports=function(w){return!w||typeof w=="string"?!1:w instanceof Array||Array.isArray(w)||w.length>=0&&(w.splice instanceof Function||Object.getOwnPropertyDescriptor(w,w.length-1)&&w.constructor.name!=="String")}},6851:(L,M,w)=>{"use strict";var T=w(5171),I=Array.prototype.concat,H=Array.prototype.slice,D=L.exports=function(A){for(var S=[],O=0,d=A.length;O<d;O++){var m=A[O];T(m)?S=I.call(S,H.call(m)):S.push(m)}return S};D.wrap=function(F){return function(){return F(D(arguments))}}},4836:L=>{function M(w){return w&&w.__esModule?w:{default:w}}L.exports=M,L.exports.__esModule=!0,L.exports.default=L.exports},8698:L=>{function M(w){"@babel/helpers - typeof";return L.exports=M=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(T){return typeof T}:function(T){return T&&typeof Symbol=="function"&&T.constructor===Symbol&&T!==Symbol.prototype?"symbol":typeof T},L.exports.__esModule=!0,L.exports.default=L.exports,M(w)}L.exports=M,L.exports.__esModule=!0,L.exports.default=L.exports},5721:(L,M)=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0}),M.default=w;function w(T,I,H,D,F,A,S){var O=new Date(0);return O.setUTCFullYear(T,I,H),O.setUTCHours(D,F,A,S),O}L.exports=M.default},5855:(L,M)=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0}),M.default=w;function w(D,F,A){var S=H(D,A.timeZone,A.locale);return S.formatToParts?T(S,F):I(S,F)}function T(D,F){for(var A=D.formatToParts(F),S=A.length-1;S>=0;--S)if(A[S].type==="timeZoneName")return A[S].value}function I(D,F){var A=D.format(F).replace(/\u200E/g,""),S=/ [\w-+ ]+$/.exec(A);return S?S[0].substr(1):""}function H(D,F,A){if(A&&!A.code)throw new Error("date-fns-tz error: Please set a language code on the locale object imported from date-fns, e.g. `locale.code = 'en-US'`");return new Intl.DateTimeFormat(A?[A.code,"en-US"]:void 0,{timeZone:F,timeZoneName:D})}L.exports=M.default},2734:(L,M,w)=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0}),M.default=S;var T=H(w(2712)),I=H(w(5721));function H(u){return u&&u.__esModule?u:{default:u}}var D=36e5,F=6e4,A={timezone:/([Z+-].*)$/,timezoneZ:/^(Z)$/,timezoneHH:/^([+-]\d{2})$/,timezoneHHMM:/^([+-]\d{2}):?(\d{2})$/};function S(u,f,g){var x,_;if(!u||(x=A.timezoneZ.exec(u),x))return 0;var B;if(x=A.timezoneHH.exec(u),x)return B=parseInt(x[1],10),C(B)?-(B*D):NaN;if(x=A.timezoneHHMM.exec(u),x){B=parseInt(x[1],10);var W=parseInt(x[2],10);return C(B,W)?(_=Math.abs(B)*D+W*F,B>0?-_:_):NaN}if(P(u)){f=new Date(f||Date.now());var j=g?f:O(f),ee=d(j,u),V=g?ee:m(f,ee,u);return-V}return NaN}function O(u){return(0,I.default)(u.getFullYear(),u.getMonth(),u.getDate(),u.getHours(),u.getMinutes(),u.getSeconds(),u.getMilliseconds())}function d(u,f){var g=(0,T.default)(u,f),x=(0,I.default)(g[0],g[1]-1,g[2],g[3]%24,g[4],g[5],0).getTime(),_=u.getTime(),B=_%1e3;return _-=B>=0?B:1e3+B,x-_}function m(u,f,g){var x=u.getTime(),_=x-f,B=d(new Date(_),g);if(f===B)return f;_-=B-f;var W=d(new Date(_),g);return B===W?B:Math.max(B,W)}function C(u,f){return-23<=u&&u<=23&&(f==null||0<=f&&f<=59)}var b={};function P(u){if(b[u])return!0;try{return new Intl.DateTimeFormat(void 0,{timeZone:u}),b[u]=!0,!0}catch(f){return!1}}L.exports=M.default},7048:(L,M)=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0}),M.default=void 0;var w=/(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/,T=w;M.default=T,L.exports=M.default},2712:(L,M)=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0}),M.default=w;function w(A,S){var O=F(S);return O.formatToParts?I(O,A):H(O,A)}var T={year:0,month:1,day:2,hour:3,minute:4,second:5};function I(A,S){try{for(var O=A.formatToParts(S),d=[],m=0;m<O.length;m++){var C=T[O[m].type];C>=0&&(d[C]=parseInt(O[m].value,10))}return d}catch(b){if(b instanceof RangeError)return[NaN];throw b}}function H(A,S){var O=A.format(S).replace(/\u200E/g,""),d=/(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(O);return[d[3],d[1],d[2],d[4],d[5],d[6]]}var D={};function F(A){if(!D[A]){var S=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:"America/New_York",year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date("2014-06-25T04:00:00.123Z")),O=S==="06/25/2014, 00:00:00"||S==="\u200E06\u200E/\u200E25\u200E/\u200E2014\u200E \u200E00\u200E:\u200E00\u200E:\u200E00";D[A]=O?new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:A,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:A,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})}return D[A]}L.exports=M.default},3826:(L,M,w)=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0}),M.default=void 0;var T=H(w(5855)),I=H(w(2734));function H(b){return b&&b.__esModule?b:{default:b}}var D=60*1e3,F={X:function(b,P,u,f){var g=A(f.timeZone,f._originalDate||b);if(g===0)return"Z";switch(P){case"X":return d(g);case"XXXX":case"XX":return O(g);case"XXXXX":case"XXX":default:return O(g,":")}},x:function(b,P,u,f){var g=A(f.timeZone,f._originalDate||b);switch(P){case"x":return d(g);case"xxxx":case"xx":return O(g);case"xxxxx":case"xxx":default:return O(g,":")}},O:function(b,P,u,f){var g=A(f.timeZone,f._originalDate||b);switch(P){case"O":case"OO":case"OOO":return"GMT"+m(g,":");case"OOOO":default:return"GMT"+O(g,":")}},z:function(b,P,u,f){var g=f._originalDate||b;switch(P){case"z":case"zz":case"zzz":return(0,T.default)("short",g,f);case"zzzz":default:return(0,T.default)("long",g,f)}}};function A(b,P){var u=b?(0,I.default)(b,P,!0)/D:P.getTimezoneOffset();if(Number.isNaN(u))throw new RangeError("Invalid time zone specified: "+b);return u}function S(b,P){for(var u=b<0?"-":"",f=Math.abs(b).toString();f.length<P;)f="0"+f;return u+f}function O(b,P){var u=P||"",f=b>0?"-":"+",g=Math.abs(b),x=S(Math.floor(g/60),2),_=S(Math.floor(g%60),2);return f+x+u+_}function d(b,P){if(b%60===0){var u=b>0?"-":"+";return u+S(Math.abs(b)/60,2)}return O(b,P)}function m(b,P){var u=b>0?"-":"+",f=Math.abs(b),g=Math.floor(f/60),x=f%60;if(x===0)return u+String(g);var _=P||"";return u+String(g)+_+S(x,2)}var C=F;M.default=C,L.exports=M.default},6558:(L,M,w)=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0}),M.default=A;var T=D(w(5616)),I=D(w(3826)),H=D(w(1476));function D(S){return S&&S.__esModule?S:{default:S}}var F=/([xXOz]+)|''|'(''|[^'])+('|$)/g;function A(S,O,d){var m=String(O),C=d||{},b=m.match(F);if(b){var P=(0,H.default)(S,C);m=b.reduce(function(u,f){if(f[0]==="'")return u;var g=u.indexOf(f),x=u[g-1]==="'",_=u.replace(f,"'"+I.default[f[0]](P,f,null,C)+"'");return x?_.substring(0,g-1)+_.substring(g+1):_},m)}return(0,T.default)(S,m,C)}L.exports=M.default},6645:(L,M,w)=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0}),M.default=F;var T=D(w(6420)),I=D(w(6558)),H=D(w(1132));function D(A){return A&&A.__esModule?A:{default:A}}function F(A,S,O,d){var m=(0,T.default)(d);return m.timeZone=S,(0,I.default)((0,H.default)(A,S),O,m)}L.exports=M.default},4992:(L,M,w)=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0}),M.default=H;var T=I(w(2734));function I(D){return D&&D.__esModule?D:{default:D}}function H(D,F){return-(0,T.default)(D,F)}L.exports=M.default},722:(L,M,w)=>{"use strict";L.exports={format:w(6558),formatInTimeZone:w(6645),getTimezoneOffset:w(4992),toDate:w(1476),utcToZonedTime:w(1132),zonedTimeToUtc:w(8516)}},1476:(L,M,w)=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0}),M.default=m;var T=F(w(2084)),I=F(w(3561)),H=F(w(2734)),D=F(w(7048));function F(V){return V&&V.__esModule?V:{default:V}}var A=36e5,S=6e4,O=2,d={dateTimePattern:/^([0-9W+-]+)(T| )(.*)/,datePattern:/^([0-9W+-]+)(.*)/,plainTime:/:/,YY:/^(\d{2})$/,YYY:[/^([+-]\d{2})$/,/^([+-]\d{3})$/,/^([+-]\d{4})$/],YYYY:/^(\d{4})/,YYYYY:[/^([+-]\d{4})/,/^([+-]\d{5})/,/^([+-]\d{6})/],MM:/^-(\d{2})$/,DDD:/^-?(\d{3})$/,MMDD:/^-?(\d{2})-?(\d{2})$/,Www:/^-?W(\d{2})$/,WwwD:/^-?W(\d{2})-?(\d{1})$/,HH:/^(\d{2}([.,]\d*)?)$/,HHMM:/^(\d{2}):?(\d{2}([.,]\d*)?)$/,HHMMSS:/^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/,timeZone:D.default};function m(V,z){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");if(V===null)return new Date(NaN);var X=z||{},Q=X.additionalDigits==null?O:(0,T.default)(X.additionalDigits);if(Q!==2&&Q!==1&&Q!==0)throw new RangeError("additionalDigits must be 0, 1 or 2");if(V instanceof Date||typeof V=="object"&&Object.prototype.toString.call(V)==="[object Date]")return new Date(V.getTime());if(typeof V=="number"||Object.prototype.toString.call(V)==="[object Number]")return new Date(V);if(!(typeof V=="string"||Object.prototype.toString.call(V)==="[object String]"))return new Date(NaN);var ie=C(V),ge=b(ie.date,Q),Se=ge.year,Ae=ge.restDateString,Ce=P(Ae,Se);if(isNaN(Ce))return new Date(NaN);if(Ce){var Ne=Ce.getTime(),De=0,Ee;if(ie.time&&(De=u(ie.time),isNaN(De)))return new Date(NaN);if(ie.timeZone||X.timeZone){if(Ee=(0,H.default)(ie.timeZone||X.timeZone,new Date(Ne+De)),isNaN(Ee))return new Date(NaN)}else Ee=(0,I.default)(new Date(Ne+De)),Ee=(0,I.default)(new Date(Ne+De+Ee));return new Date(Ne+De+Ee)}else return new Date(NaN)}function C(V){var z={},X=d.dateTimePattern.exec(V),Q;if(X?(z.date=X[1],Q=X[3]):(X=d.datePattern.exec(V),X?(z.date=X[1],Q=X[2]):(z.date=null,Q=V)),Q){var ie=d.timeZone.exec(Q);ie?(z.time=Q.replace(ie[1],""),z.timeZone=ie[1].trim()):z.time=Q}return z}function b(V,z){var X=d.YYY[z],Q=d.YYYYY[z],ie;if(ie=d.YYYY.exec(V)||Q.exec(V),ie){var ge=ie[1];return{year:parseInt(ge,10),restDateString:V.slice(ge.length)}}if(ie=d.YY.exec(V)||X.exec(V),ie){var Se=ie[1];return{year:parseInt(Se,10)*100,restDateString:V.slice(Se.length)}}return{year:null}}function P(V,z){if(z===null)return null;var X,Q,ie,ge;if(V.length===0)return Q=new Date(0),Q.setUTCFullYear(z),Q;if(X=d.MM.exec(V),X)return Q=new Date(0),ie=parseInt(X[1],10)-1,B(z,ie)?(Q.setUTCFullYear(z,ie),Q):new Date(NaN);if(X=d.DDD.exec(V),X){Q=new Date(0);var Se=parseInt(X[1],10);return W(z,Se)?(Q.setUTCFullYear(z,0,Se),Q):new Date(NaN)}if(X=d.MMDD.exec(V),X){Q=new Date(0),ie=parseInt(X[1],10)-1;var Ae=parseInt(X[2],10);return B(z,ie,Ae)?(Q.setUTCFullYear(z,ie,Ae),Q):new Date(NaN)}if(X=d.Www.exec(V),X)return ge=parseInt(X[1],10)-1,j(z,ge)?f(z,ge):new Date(NaN);if(X=d.WwwD.exec(V),X){ge=parseInt(X[1],10)-1;var Ce=parseInt(X[2],10)-1;return j(z,ge,Ce)?f(z,ge,Ce):new Date(NaN)}return null}function u(V){var z,X,Q;if(z=d.HH.exec(V),z)return X=parseFloat(z[1].replace(",",".")),ee(X)?X%24*A:NaN;if(z=d.HHMM.exec(V),z)return X=parseInt(z[1],10),Q=parseFloat(z[2].replace(",",".")),ee(X,Q)?X%24*A+Q*S:NaN;if(z=d.HHMMSS.exec(V),z){X=parseInt(z[1],10),Q=parseInt(z[2],10);var ie=parseFloat(z[3].replace(",","."));return ee(X,Q,ie)?X%24*A+Q*S+ie*1e3:NaN}return null}function f(V,z,X){z=z||0,X=X||0;var Q=new Date(0);Q.setUTCFullYear(V,0,4);var ie=Q.getUTCDay()||7,ge=z*7+X+1-ie;return Q.setUTCDate(Q.getUTCDate()+ge),Q}var g=[31,28,31,30,31,30,31,31,30,31,30,31],x=[31,29,31,30,31,30,31,31,30,31,30,31];function _(V){return V%400===0||V%4===0&&V%100!==0}function B(V,z,X){if(z<0||z>11)return!1;if(X!=null){if(X<1)return!1;var Q=_(V);if(Q&&X>x[z]||!Q&&X>g[z])return!1}return!0}function W(V,z){if(z<1)return!1;var X=_(V);return!(X&&z>366||!X&&z>365)}function j(V,z,X){return!(z<0||z>52||X!=null&&(X<0||X>6))}function ee(V,z,X){return!(V!=null&&(V<0||V>=25)||z!=null&&(z<0||z>=60)||X!=null&&(X<0||X>=60))}L.exports=M.default},1132:(L,M,w)=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0}),M.default=D;var T=H(w(2734)),I=H(w(1476));function H(F){return F&&F.__esModule?F:{default:F}}function D(F,A,S){var O=(0,I.default)(F,S),d=(0,T.default)(A,O,!0),m=new Date(O.getTime()-d),C=new Date(0);return C.setFullYear(m.getUTCFullYear(),m.getUTCMonth(),m.getUTCDate()),C.setHours(m.getUTCHours(),m.getUTCMinutes(),m.getUTCSeconds(),m.getUTCMilliseconds()),C}L.exports=M.default},8516:(L,M,w)=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0}),M.default=S;var T=A(w(6420)),I=A(w(1476)),H=A(w(7048)),D=A(w(2734)),F=A(w(5721));function A(O){return O&&O.__esModule?O:{default:O}}function S(O,d,m){if(typeof O=="string"&&!O.match(H.default)){var C=(0,T.default)(m);return C.timeZone=d,(0,I.default)(O,C)}var b=(0,I.default)(O,m),P=(0,F.default)(b.getFullYear(),b.getMonth(),b.getDate(),b.getHours(),b.getMinutes(),b.getSeconds(),b.getMilliseconds()).getTime(),u=(0,D.default)(d,new Date(P));return new Date(P+u)}L.exports=M.default}},Sr={};function _e(L){var M=Sr[L];if(M!==void 0)return M.exports;var w=Sr[L]={exports:{}};return Ra[L](w,w.exports,_e),w.exports}_e.n=L=>{var M=L&&L.__esModule?()=>L.default:()=>L;return _e.d(M,{a:M}),M},_e.d=(L,M)=>{for(var w in M)_e.o(M,w)&&!_e.o(L,w)&&Object.defineProperty(L,w,{enumerable:!0,get:M[w]})},_e.o=(L,M)=>Object.prototype.hasOwnProperty.call(L,M),_e.r=L=>{typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(L,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(L,"__esModule",{value:!0})};var Pn={};(()=>{"use strict";_e.r(Pn),_e.d(Pn,{ChartBootstrap:()=>Zt,createChart:()=>Ba});function L(n){return typeof n=="function"}function M(n){return L(n==null?void 0:n.lift)}function w(n){return function(e){if(M(e))return e.lift(function(t){try{return n(t,this)}catch(r){this.error(r)}});throw new TypeError("Unable to lift unknown Observable type")}}var T=function(n,e){return T=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(t[s]=r[s])},T(n,e)};function I(n,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");T(n,e);function t(){this.constructor=n}n.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var H=function(){return H=Object.assign||function(e){for(var t,r=1,s=arguments.length;r<s;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},H.apply(this,arguments)};function D(n,e){var t={};for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&e.indexOf(r)<0&&(t[r]=n[r]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(n);s<r.length;s++)e.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(n,r[s])&&(t[r[s]]=n[r[s]]);return t}function F(n,e,t,r){var s=arguments.length,i=s<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(n,e,t,r);else for(var o=n.length-1;o>=0;o--)(a=n[o])&&(i=(s<3?a(i):s>3?a(e,t,i):a(e,t))||i);return s>3&&i&&Object.defineProperty(e,t,i),i}function A(n,e){return function(t,r){e(t,r,n)}}function S(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)}function O(n,e,t,r){function s(i){return i instanceof t?i:new t(function(a){a(i)})}return new(t||(t=Promise))(function(i,a){function o(h){try{c(r.next(h))}catch(v){a(v)}}function l(h){try{c(r.throw(h))}catch(v){a(v)}}function c(h){h.done?i(h.value):s(h.value).then(o,l)}c((r=r.apply(n,e||[])).next())})}function d(n,e){var t={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,s,i,a;return a={next:o(0),throw:o(1),return:o(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function o(c){return function(h){return l([c,h])}}function l(c){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(t=0)),t;)try{if(r=1,s&&(i=c[0]&2?s.return:c[0]?s.throw||((i=s.return)&&i.call(s),0):s.next)&&!(i=i.call(s,c[1])).done)return i;switch(s=0,i&&(c=[c[0]&2,i.value]),c[0]){case 0:case 1:i=c;break;case 4:return t.label++,{value:c[1],done:!1};case 5:t.label++,s=c[1],c=[0];continue;case 7:c=t.ops.pop(),t.trys.pop();continue;default:if(i=t.trys,!(i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){t=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){t.label=c[1];break}if(c[0]===6&&t.label<i[1]){t.label=i[1],i=c;break}if(i&&t.label<i[2]){t.label=i[2],t.ops.push(c);break}i[2]&&t.ops.pop(),t.trys.pop();continue}c=e.call(n,t)}catch(h){c=[6,h],s=0}finally{r=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}var m=Object.create?function(n,e,t,r){r===void 0&&(r=t);var s=Object.getOwnPropertyDescriptor(e,t);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(n,r,s)}:function(n,e,t,r){r===void 0&&(r=t),n[r]=e[t]};function C(n,e){for(var t in n)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&m(e,n,t)}function b(n){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&n[e],r=0;if(t)return t.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&r>=n.length&&(n=void 0),{value:n&&n[r++],done:!n}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function P(n,e){var t=typeof Symbol=="function"&&n[Symbol.iterator];if(!t)return n;var r=t.call(n),s,i=[],a;try{for(;(e===void 0||e-- >0)&&!(s=r.next()).done;)i.push(s.value)}catch(o){a={error:o}}finally{try{s&&!s.done&&(t=r.return)&&t.call(r)}finally{if(a)throw a.error}}return i}function u(){for(var n=[],e=0;e<arguments.length;e++)n=n.concat(P(arguments[e]));return n}function f(){for(var n=0,e=0,t=arguments.length;e<t;e++)n+=arguments[e].length;for(var r=Array(n),s=0,e=0;e<t;e++)for(var i=arguments[e],a=0,o=i.length;a<o;a++,s++)r[s]=i[a];return r}function g(n,e,t){if(t||arguments.length===2)for(var r=0,s=e.length,i;r<s;r++)(i||!(r in e))&&(i||(i=Array.prototype.slice.call(e,0,r)),i[r]=e[r]);return n.concat(i||Array.prototype.slice.call(e))}function x(n){return this instanceof x?(this.v=n,this):new x(n)}function _(n,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=t.apply(n,e||[]),s,i=[];return s={},a("next"),a("throw"),a("return"),s[Symbol.asyncIterator]=function(){return this},s;function a(p){r[p]&&(s[p]=function(y){return new Promise(function(E,R){i.push([p,y,E,R])>1||o(p,y)})})}function o(p,y){try{l(r[p](y))}catch(E){v(i[0][3],E)}}function l(p){p.value instanceof x?Promise.resolve(p.value.v).then(c,h):v(i[0][2],p)}function c(p){o("next",p)}function h(p){o("throw",p)}function v(p,y){p(y),i.shift(),i.length&&o(i[0][0],i[0][1])}}function B(n){var e,t;return e={},r("next"),r("throw",function(s){throw s}),r("return"),e[Symbol.iterator]=function(){return this},e;function r(s,i){e[s]=n[s]?function(a){return(t=!t)?{value:x(n[s](a)),done:s==="return"}:i?i(a):a}:i}}function W(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=n[Symbol.asyncIterator],t;return e?e.call(n):(n=typeof b=="function"?b(n):n[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(i){t[i]=n[i]&&function(a){return new Promise(function(o,l){a=n[i](a),s(o,l,a.done,a.value)})}}function s(i,a,o,l){Promise.resolve(l).then(function(c){i({value:c,done:o})},a)}}function j(n,e){return Object.defineProperty?Object.defineProperty(n,"raw",{value:e}):n.raw=e,n}var ee=Object.create?function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}:function(n,e){n.default=e};function V(n){if(n&&n.__esModule)return n;var e={};if(n!=null)for(var t in n)t!=="default"&&Object.prototype.hasOwnProperty.call(n,t)&&m(e,n,t);return ee(e,n),e}function z(n){return n&&n.__esModule?n:{default:n}}function X(n,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?n!==e||!r:!e.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(n):r?r.value:e.get(n)}function Q(n,e,t,r,s){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?n!==e||!s:!e.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?s.call(n,t):s?s.value=t:e.set(n,t),t}function ie(n,e){if(e===null||typeof e!="object"&&typeof e!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof n=="function"?e===n:n.has(e)}function ge(n){var e=function(r){Error.call(r),r.stack=new Error().stack},t=n(e);return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var Se=ge(function(n){return function(t){n(this),this.message=t?t.length+` errors occurred during unsubscription:
|
|
7
7
|
`+t.map(function(r,s){return s+1+") "+r.toString()}).join(`
|
|
8
|
-
`):"",this.name="UnsubscriptionError",this.errors=t}});function Ae(n,e){if(n){var t=n.indexOf(e);0<=t&&n.splice(t,1)}}var Ce=function(){function n(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return n.prototype.unsubscribe=function(){var e,t,r,s,i;if(!this.closed){this.closed=!0;var a=this._parentage;if(a)if(this._parentage=null,Array.isArray(a))try{for(var o=b(a),l=o.next();!l.done;l=o.next()){var c=l.value;c.remove(this)}}catch(R){e={error:R}}finally{try{l&&!l.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}else a.remove(this);var h=this.initialTeardown;if(L(h))try{h()}catch(R){i=R instanceof Se?R.errors:[R]}var v=this._finalizers;if(v){this._finalizers=null;try{for(var p=b(v),y=p.next();!y.done;y=p.next()){var E=y.value;try{Ee(E)}catch(R){i=i!=null?i:[],R instanceof Se?i=g(g([],P(i)),P(R.errors)):i.push(R)}}}catch(R){r={error:R}}finally{try{y&&!y.done&&(s=p.return)&&s.call(p)}finally{if(r)throw r.error}}}if(i)throw new Se(i)}},n.prototype.add=function(e){var t;if(e&&e!==this)if(this.closed)Ee(e);else{if(e instanceof n){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(t=this._finalizers)!==null&&t!==void 0?t:[]).push(e)}},n.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},n.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},n.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&Ae(t,e)},n.prototype.remove=function(e){var t=this._finalizers;t&&Ae(t,e),e instanceof n&&e._removeParent(this)},n.EMPTY=function(){var e=new n;return e.closed=!0,e}(),n}(),Ne=Ce.EMPTY;function De(n){return n instanceof Ce||n&&"closed"in n&&L(n.remove)&&L(n.add)&&L(n.unsubscribe)}function Ee(n){L(n)?n():n.unsubscribe()}var ke={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},st={setTimeout:function(n,e){for(var t=[],r=2;r<arguments.length;r++)t[r-2]=arguments[r];var s=st.delegate;return s!=null&&s.setTimeout?s.setTimeout.apply(s,g([n,e],P(t))):setTimeout.apply(void 0,g([n,e],P(t)))},clearTimeout:function(n){var e=st.delegate;return((e==null?void 0:e.clearTimeout)||clearTimeout)(n)},delegate:void 0};function xt(n){st.setTimeout(function(){var e=ke.onUnhandledError;if(e)e(n);else throw n})}function Mt(){}var Lt=function(){return Ze("C",void 0,void 0)}();function It(n){return Ze("E",void 0,n)}function Tn(n){return Ze("N",n,void 0)}function Ze(n,e,t){return{kind:n,value:e,error:t}}var Le=null;function it(n){if(ke.useDeprecatedSynchronousErrorHandling){var e=!Le;if(e&&(Le={errorThrown:!1,error:null}),n(),e){var t=Le,r=t.errorThrown,s=t.error;if(Le=null,r)throw s}}else n()}function Ot(n){ke.useDeprecatedSynchronousErrorHandling&&Le&&(Le.errorThrown=!0,Le.error=n)}var at=function(n){I(e,n);function e(t){var r=n.call(this)||this;return r.isStopped=!1,t?(r.destination=t,De(t)&&t.add(r)):r.destination=Fa,r}return e.create=function(t,r,s){return new ft(t,r,s)},e.prototype.next=function(t){this.isStopped?ot(Tn(t),this):this._next(t)},e.prototype.error=function(t){this.isStopped?ot(It(t),this):(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped?ot(Lt,this):(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,n.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(t){this.destination.next(t)},e.prototype._error=function(t){try{this.destination.error(t)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e}(Ce),_n=Function.prototype.bind;function Bt(n,e){return _n.call(n,e)}var An=function(){function n(e){this.partialObserver=e}return n.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(r){be(r)}},n.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(r){be(r)}else be(e)},n.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(t){be(t)}},n}(),ft=function(n){I(e,n);function e(t,r,s){var i=n.call(this)||this,a;if(L(t)||!t)a={next:t!=null?t:void 0,error:r!=null?r:void 0,complete:s!=null?s:void 0};else{var o;i&&ke.useDeprecatedNextContext?(o=Object.create(t),o.unsubscribe=function(){return i.unsubscribe()},a={next:t.next&&Bt(t.next,o),error:t.error&&Bt(t.error,o),complete:t.complete&&Bt(t.complete,o)}):a=t}return i.destination=new An(a),i}return e}(at);function be(n){ke.useDeprecatedSynchronousErrorHandling?Ot(n):xt(n)}function je(n){throw n}function ot(n,e){var t=ke.onStoppedNotification;t&&st.setTimeout(function(){return t(n,e)})}var Fa={closed:!0,next:Mt,error:je,complete:Mt};function We(n,e,t,r,s){return new Ya(n,e,t,r,s)}var Ya=function(n){I(e,n);function e(t,r,s,i,a,o){var l=n.call(this,t)||this;return l.onFinalize=a,l.shouldUnsubscribe=o,l._next=r?function(c){try{r(c)}catch(h){t.error(h)}}:n.prototype._next,l._error=i?function(c){try{i(c)}catch(h){t.error(h)}finally{this.unsubscribe()}}:n.prototype._error,l._complete=s?function(){try{s()}catch(c){t.error(c)}finally{this.unsubscribe()}}:n.prototype._complete,l}return e.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;n.prototype.unsubscribe.call(this),!r&&((t=this.onFinalize)===null||t===void 0||t.call(this))}},e}(at);function ye(n,e){return w(function(t,r){var s=0;t.subscribe(We(r,function(i){r.next(n.call(e,i,s++))}))})}var xr=function(n){return n&&typeof n.length=="number"&&typeof n!="function"};function Mr(n){return L(n==null?void 0:n.then)}var Dn=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function Pt(n){return n}function sv(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];return Pr(n)}function Pr(n){return n.length===0?Pt:n.length===1?n[0]:function(t){return n.reduce(function(r,s){return s(r)},t)}}var xe=function(){function n(e){e&&(this._subscribe=e)}return n.prototype.lift=function(e){var t=new n;return t.source=this,t.operator=e,t},n.prototype.subscribe=function(e,t,r){var s=this,i=Na(e)?e:new ft(e,t,r);return it(function(){var a=s,o=a.operator,l=a.source;i.add(o?o.call(i,l):l?s._subscribe(i):s._trySubscribe(i))}),i},n.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},n.prototype.forEach=function(e,t){var r=this;return t=Tr(t),new t(function(s,i){var a=new ft({next:function(o){try{e(o)}catch(l){i(l),a.unsubscribe()}},error:i,complete:s});r.subscribe(a)})},n.prototype._subscribe=function(e){var t;return(t=this.source)===null||t===void 0?void 0:t.subscribe(e)},n.prototype[Dn]=function(){return this},n.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Pr(e)(this)},n.prototype.toPromise=function(e){var t=this;return e=Tr(e),new e(function(r,s){var i;t.subscribe(function(a){return i=a},function(a){return s(a)},function(){return r(i)})})},n.create=function(e){return new n(e)},n}();function Tr(n){var e;return(e=n!=null?n:ke.Promise)!==null&&e!==void 0?e:Promise}function Ha(n){return n&&L(n.next)&&L(n.error)&&L(n.complete)}function Na(n){return n&&n instanceof at||Ha(n)&&De(n)}function _r(n){return L(n[Dn])}function Ar(n){return Symbol.asyncIterator&&L(n==null?void 0:n[Symbol.asyncIterator])}function Dr(n){return new TypeError("You provided "+(n!==null&&typeof n=="object"?"an invalid object":"'"+n+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function ka(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Er=ka();function Lr(n){return L(n==null?void 0:n[Er])}function Ir(n){return _(this,arguments,function(){var t,r,s,i;return d(this,function(a){switch(a.label){case 0:t=n.getReader(),a.label=1;case 1:a.trys.push([1,,9,10]),a.label=2;case 2:return[4,x(t.read())];case 3:return r=a.sent(),s=r.value,i=r.done,i?[4,x(void 0)]:[3,5];case 4:return[2,a.sent()];case 5:return[4,x(s)];case 6:return[4,a.sent()];case 7:return a.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}})})}function Or(n){return L(n==null?void 0:n.getReader)}function Ke(n){if(n instanceof xe)return n;if(n!=null){if(_r(n))return Wa(n);if(xr(n))return Ua(n);if(Mr(n))return za(n);if(Ar(n))return Br(n);if(Lr(n))return Xa(n);if(Or(n))return ja(n)}throw Dr(n)}function Wa(n){return new xe(function(e){var t=n[Dn]();if(L(t.subscribe))return t.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function Ua(n){return new xe(function(e){for(var t=0;t<n.length&&!e.closed;t++)e.next(n[t]);e.complete()})}function za(n){return new xe(function(e){n.then(function(t){e.closed||(e.next(t),e.complete())},function(t){return e.error(t)}).then(null,xt)})}function Xa(n){return new xe(function(e){var t,r;try{for(var s=b(n),i=s.next();!i.done;i=s.next()){var a=i.value;if(e.next(a),e.closed)return}}catch(o){t={error:o}}finally{try{i&&!i.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}e.complete()})}function Br(n){return new xe(function(e){Va(n,e).catch(function(t){return e.error(t)})})}function ja(n){return Br(Ir(n))}function Va(n,e){var t,r,s,i;return O(this,void 0,void 0,function(){var a,o;return d(this,function(l){switch(l.label){case 0:l.trys.push([0,5,6,11]),t=W(n),l.label=1;case 1:return[4,t.next()];case 2:if(r=l.sent(),!!r.done)return[3,4];if(a=r.value,e.next(a),e.closed)return[2];l.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return o=l.sent(),s={error:o},[3,11];case 6:return l.trys.push([6,,9,10]),r&&!r.done&&(i=t.return)?[4,i.call(t)]:[3,8];case 7:l.sent(),l.label=8;case 8:return[3,10];case 9:if(s)throw s.error;return[7];case 10:return[7];case 11:return e.complete(),[2]}})})}function qe(n,e,t,r,s){r===void 0&&(r=0),s===void 0&&(s=!1);var i=e.schedule(function(){t(),s?n.add(this.schedule(null,r)):this.unsubscribe()},r);if(n.add(i),!s)return i}function Ga(n,e,t,r,s,i,a,o){var l=[],c=0,h=0,v=!1,p=function(){v&&!l.length&&!c&&e.complete()},y=function(R){return c<r?E(R):l.push(R)},E=function(R){i&&e.next(R),c++;var N=!1;Ke(t(R,h++)).subscribe(We(e,function(k){s==null||s(k),i?y(k):e.next(k)},function(){N=!0},void 0,function(){if(N)try{c--;for(var k=function(){var U=l.shift();a?qe(e,a,function(){return E(U)}):E(U)};l.length&&c<r;)k();p()}catch(U){e.error(U)}}))};return n.subscribe(We(e,y,function(){v=!0,p()})),function(){o==null||o()}}function Rr(n,e,t){return t===void 0&&(t=1/0),L(e)?Rr(function(r,s){return ye(function(i,a){return e(r,i,s,a)})(Ke(n(r,s)))},t):(typeof e=="number"&&(t=e),w(function(r,s){return Ga(r,s,n,t)}))}function Fr(n){return n===void 0&&(n=1/0),Rr(Pt,n)}var Yr=new xe(function(n){return n.complete()});function iv(n){return n?$a(n):Yr}function $a(n){return new Observable(function(e){return n.schedule(function(){return e.complete()})})}function Hr(n){return n&&L(n.schedule)}function En(n){return n[n.length-1]}function Za(n){return L(En(n))?n.pop():void 0}function Kt(n){return Hr(En(n))?n.pop():void 0}function Ka(n,e){return typeof En(n)=="number"?n.pop():e}function Nr(n,e){return e===void 0&&(e=0),w(function(t,r){t.subscribe(We(r,function(s){return qe(r,n,function(){return r.next(s)},e)},function(){return qe(r,n,function(){return r.complete()},e)},function(s){return qe(r,n,function(){return r.error(s)},e)}))})}function kr(n,e){return e===void 0&&(e=0),w(function(t,r){r.add(n.schedule(function(){return t.subscribe(r)},e))})}function qa(n,e){return Ke(n).pipe(kr(e),Nr(e))}function Ja(n,e){return Ke(n).pipe(kr(e),Nr(e))}function Qa(n,e){return new xe(function(t){var r=0;return e.schedule(function(){r===n.length?t.complete():(t.next(n[r++]),t.closed||this.schedule())})})}function eo(n,e){return new xe(function(t){var r;return qe(t,e,function(){r=n[Er](),qe(t,e,function(){var s,i,a;try{s=r.next(),i=s.value,a=s.done}catch(o){t.error(o);return}a?t.complete():t.next(i)},0,!0)}),function(){return L(r==null?void 0:r.return)&&r.return()}})}function Wr(n,e){if(!n)throw new Error("Iterable cannot be null");return new xe(function(t){qe(t,e,function(){var r=n[Symbol.asyncIterator]();qe(t,e,function(){r.next().then(function(s){s.done?t.complete():t.next(s.value)})},0,!0)})})}function to(n,e){return Wr(Ir(n),e)}function no(n,e){if(n!=null){if(_r(n))return qa(n,e);if(xr(n))return Qa(n,e);if(Mr(n))return Ja(n,e);if(Ar(n))return Wr(n,e);if(Lr(n))return eo(n,e);if(Or(n))return to(n,e)}throw Dr(n)}function qt(n,e){return e?no(n,e):Ke(n)}function Me(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];var t=Kt(n),r=Ka(n,1/0),s=n;return s.length?s.length===1?Ke(s[0]):Fr(r)(qt(s,t)):Yr}class Ln{constructor(e,t){this.onTickFunction=t,this.animationTimeLeft=0,this.animationInProgress=!1,this.animationTime=e.duration,this.animationTimeLeft=e.timeLeft===void 0?e.duration:e.timeLeft,this.animationInProgress=!0}tick(){this.animationTimeLeft<=0?this.animationInProgress=!1:this.animationTimeLeft--,this.onTickFunction&&this.onTickFunction()}getProgress(){return 1-this.animationTimeLeft/this.animationTime}finishAnimation(){this.animationInProgress=!1,this.animationTimeLeft=0}}var vt=_e(6767),Jt=_e.n(vt);class ro extends Ln{constructor(e,t,r=()=>{}){super(e,r),this.colorConfigs=t,t.forEach(s=>{s.rgbColor=vt.rgb(s.color),s.initialAlpha=s.rgbColor.valpha,s.currentAnimationColor=s.rgbColor})}tick(){super.tick(),this.animationInProgress&&this.colorConfigs.forEach(e=>{e.initialAlpha===void 0||e.rgbColor===void 0||(e.type==="fading"?e.currentAnimationColor=e.rgbColor.alpha(e.initialAlpha*this.animationTimeLeft/this.animationTime):e.type==="appearing"&&(e.currentAnimationColor=e.rgbColor.alpha(e.initialAlpha*(1-this.animationTimeLeft/this.animationTime))))})}getColor(e){var t,r;return(r=(t=this.colorConfigs[e].currentAnimationColor)==null?void 0:t.toString())!=null?r:"#FFFFFF"}revert(){this.animationTimeLeft=Math.max(this.animationTime-this.animationTimeLeft,1),this.colorConfigs.forEach(e=>{e.type==="fading"?e.type="appearing":e.type="fading"})}}class so extends Ln{constructor(e,t,r=()=>{}){super(e,r),this.colorConfigs=t,t.forEach(s=>{s.rgbStartColor=vt.rgb(s.startColor),s.rgbEndColor=vt.rgb(s.endColor),s.currentAnimationColor=s.type==="appearing"?s.rgbStartColor:s.rgbEndColor})}tick(){super.tick(),this.animationInProgress&&this.colorConfigs.forEach(e=>{const t=1-this.animationTimeLeft/this.animationTime;!e.rgbStartColor||!e.rgbEndColor||(e.type==="fading"?e.currentAnimationColor=this.calculateTransitionColor(e.rgbEndColor,e.rgbStartColor,t):e.type==="appearing"&&(e.currentAnimationColor=this.calculateTransitionColor(e.rgbStartColor,e.rgbEndColor,t)))})}getColor(e){var t,r;return(r=(t=this.colorConfigs[e].currentAnimationColor)==null?void 0:t.toString())!=null?r:"#FFFFFF"}revert(){this.animationTimeLeft=Math.max(this.animationTime-this.animationTimeLeft,1),this.colorConfigs.forEach(e=>{e.type==="fading"?e.type="appearing":e.type="fading"})}moveToLastTick(){this.animationTimeLeft=1}calculateTransitionColor(e,t,r){const s=e.red()-(e.red()-t.red())*r,i=e.green()-(e.green()-t.green())*r,a=e.blue()-(e.blue()-t.blue())*r;return vt.rgb(s,i,a)}}var io=Math.pow;const Qt=14,en=[];for(let n=0;n<Qt+1;n++)en.push(io(10,n));const In=5e-13;class we{static roundToNearest(e,t){return isFinite(e)?we.isZero(e)?0:(e>0?e+=In:e<0&&(e-=In),we.roundDecimal(Math.round(we.roundDecimal(e/t))*t)):e}static roundUpToNearest(e,t){return we.roundDecimal(Math.ceil(e/t))*t}static roundDecimal(e){if(isNaN(e)||e===Math.floor(e))return e;const t=Math.sign(e),r=Math.abs(e),s=Math.min(Qt,Qt-1-Math.floor(Math.log10(r)));for(let i=s;i>=0;i--){const a=Math.floor(en[i]*r+.5);if(a<en[Qt])return t*a/en[i]}return Math.round(e)}static makeDecimal(e,t,r){if(isFinite(e)){const s=e.toFixed(t);return r?s.replace(".",r):s}else return""}static compare(e,t,r){return e>t+r?1:e<t-r?-1:(isNaN(e)?1:0)-(isNaN(t)?1:0)}static isZero(e){return we.compare(e,0,In)===0}static cutNumber(e,t,r=0){return{K:i=>i/1e3,M:i=>i/1e6}[t](e).toFixed(r)+t}}function ao(n,e,t){const r=n/e;return r>=t||r<=1/t}function Ur(n,e,t){return Math.max(e,Math.min(n,t))}function oo(n){return 1-(Math.pow(2,-10*n)-.0009765625)*1.0009775171065494}function Rt(...n){for(const e of n)if(e!==void 0&&isFinite(e))return e;return NaN}const ve=n=>~~n,lo=n=>~~(n+1),gt=n=>~~(n+.5),co=(n,e)=>n>>e;function Je(){const n=()=>Math.random().toString(16).slice(-4);return`${n()+n()}-${n()}-${n()}-${n()}-${n()+n()+n()}`}class ho extends Ln{constructor(e,t,r){var s;super(t,r),this.viewportModel=e,this.animationConfig=t,this.id=Je(),this.xStart=e.xStart,this.xEnd=e.xEnd,this.yStart=e.yStart,this.yEnd=e.yEnd,this.zoomX=e.zoomX,this.zoomY=e.zoomY,this.easingFn=(s=t.easingFn)!=null?s:oo}tick(){if(super.tick(),this.animationInProgress){const e=this.easingFn(this.getProgress()),t=this.xStart+(this.animationConfig.targetXStart-this.xStart)*e,r=this.xEnd+(this.animationConfig.targetXEnd-this.xEnd)*e,s=this.yStart+(this.animationConfig.targetYStart-this.yStart)*e,i=this.yEnd+(this.animationConfig.targetYEnd-this.yEnd)*e,a=this.zoomX+(this.animationConfig.targetZoomX-this.zoomX)*e,o=this.zoomY+(this.animationConfig.targetZoomY-this.zoomY)*e;this.viewportModel.apply({xStart:t,xEnd:r,yStart:s,yEnd:i,zoomX:a,zoomY:o,inverseY:this.viewportModel.inverseY})}}finishAnimation(){super.finishAnimation(),this.viewportModel.apply({xStart:this.animationConfig.targetXStart,xEnd:this.animationConfig.targetXEnd,yStart:this.animationConfig.targetYStart,yEnd:this.animationConfig.targetYEnd,zoomX:this.animationConfig.targetZoomX,zoomY:this.animationConfig.targetZoomY,inverseY:this.viewportModel.inverseY})}}var uo=Object.defineProperty,fo=Object.defineProperties,vo=Object.getOwnPropertyDescriptors,zr=Object.getOwnPropertySymbols,go=Object.prototype.hasOwnProperty,po=Object.prototype.propertyIsEnumerable,Xr=(n,e,t)=>e in n?uo(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,mo=(n,e)=>{for(var t in e||(e={}))go.call(e,t)&&Xr(n,t,e[t]);if(zr)for(var t of zr(e))po.call(e,t)&&Xr(n,t,e[t]);return n},bo=(n,e)=>fo(n,vo(e));const jr=10,On="VIEWPORT_ANIMATION";class Co{constructor(e){this.eventBus=e,this.animations={}}startViewportMovementAnimation(e,t,r=On,s){const i=new ho(e,t,s);return this.animations[r]=i,this.ensureIntervalStarted(),i}startColorAlphaAnimation(e,t,r,s){const i=new ro(bo(mo({},s),{duration:s&&s.duration||jr}),t,r);return this.animations[e]=i,this.ensureIntervalStarted(),i}startColorTransitionAnimation(e,t,r=jr,s){const i=new so({duration:r},t,s);return this.animations[e]=i,this.ensureIntervalStarted(),i}getAnimation(e){return this.animations[e]}getColorAlphaAnimation(e){return this.getAnimation(e)}getColorTransitionAnimation(e){return this.getAnimation(e)}forceStopAnimation(e){const t=this.animations[e];t&&(t.animationTimeLeft=-1,t.animationInProgress=!1)}ensureIntervalStarted(){this.animationIntervalId||(this.animationIntervalId=window.setInterval(()=>this.tick(),20))}tick(){let e=!0;for(const t of Object.keys(this.animations)){const r=this.animations[t];r.tick(),r.animationInProgress&&(e=!1)}e?this.stopInterval():this.eventBus.fireDraw()}stopInterval(){clearInterval(this.animationIntervalId),this.animationIntervalId=void 0}}var yo=ge(function(n){return function(){n(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),G=function(n){I(e,n);function e(){var t=n.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return e.prototype.lift=function(t){var r=new Vr(this,this);return r.operator=t,r},e.prototype._throwIfClosed=function(){if(this.closed)throw new yo},e.prototype.next=function(t){var r=this;it(function(){var s,i;if(r._throwIfClosed(),!r.isStopped){r.currentObservers||(r.currentObservers=Array.from(r.observers));try{for(var a=b(r.currentObservers),o=a.next();!o.done;o=a.next()){var l=o.value;l.next(t)}}catch(c){s={error:c}}finally{try{o&&!o.done&&(i=a.return)&&i.call(a)}finally{if(s)throw s.error}}}})},e.prototype.error=function(t){var r=this;it(function(){if(r._throwIfClosed(),!r.isStopped){r.hasError=r.isStopped=!0,r.thrownError=t;for(var s=r.observers;s.length;)s.shift().error(t)}})},e.prototype.complete=function(){var t=this;it(function(){if(t._throwIfClosed(),!t.isStopped){t.isStopped=!0;for(var r=t.observers;r.length;)r.shift().complete()}})},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(e.prototype,"observed",{get:function(){var t;return((t=this.observers)===null||t===void 0?void 0:t.length)>0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(t){return this._throwIfClosed(),n.prototype._trySubscribe.call(this,t)},e.prototype._subscribe=function(t){return this._throwIfClosed(),this._checkFinalizedStatuses(t),this._innerSubscribe(t)},e.prototype._innerSubscribe=function(t){var r=this,s=this,i=s.hasError,a=s.isStopped,o=s.observers;return i||a?Ne:(this.currentObservers=null,o.push(t),new Ce(function(){r.currentObservers=null,Ae(o,t)}))},e.prototype._checkFinalizedStatuses=function(t){var r=this,s=r.hasError,i=r.thrownError,a=r.isStopped;s?t.error(i):a&&t.complete()},e.prototype.asObservable=function(){var t=new xe;return t.source=this,t},e.create=function(t,r){return new Vr(t,r)},e}(xe),Vr=function(n){I(e,n);function e(t,r){var s=n.call(this)||this;return s.destination=t,s.source=r,s}return e.prototype.next=function(t){var r,s;(s=(r=this.destination)===null||r===void 0?void 0:r.next)===null||s===void 0||s.call(r,t)},e.prototype.error=function(t){var r,s;(s=(r=this.destination)===null||r===void 0?void 0:r.error)===null||s===void 0||s.call(r,t)},e.prototype.complete=function(){var t,r;(r=(t=this.destination)===null||t===void 0?void 0:t.complete)===null||r===void 0||r.call(t)},e.prototype._subscribe=function(t){var r,s;return(s=(r=this.source)===null||r===void 0?void 0:r.subscribe(t))!==null&&s!==void 0?s:Ne},e}(G),pt=function(n){I(e,n);function e(t){var r=n.call(this)||this;return r._value=t,r}return Object.defineProperty(e.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),e.prototype._subscribe=function(t){var r=n.prototype._subscribe.call(this,t);return!r.closed&&t.next(this._value),r},e.prototype.getValue=function(){var t=this,r=t.hasError,s=t.thrownError,i=t._value;if(r)throw s;return this._throwIfClosed(),i},e.prototype.next=function(t){n.prototype.next.call(this,this._value=t)},e}(G);function Ve(n,e){return e===void 0&&(e=Pt),n=n!=null?n:wo,w(function(t,r){var s,i=!0;t.subscribe(We(r,function(a){var o=e(a);(i||!n(s,o))&&(i=!1,s=o,r.next(a))}))})}function wo(n,e){return n===e}function So(n){return function(){n.forEach(t=>typeof t=="function"&&t()),n.length=0}}function Bn(n){return n}function Gr(n){return n!=null}const av=()=>{};function ov(n){return n!=null}function xo(n,e,t=Mo,r=!0){const s=n.filter(i=>e.some(a=>t(i,a)));return r?s.filter((i,a,o)=>o.indexOf(i)===a):s}const $r=(n,e)=>{const t=e.slice().filter(r=>n.find(s=>s===r));return n.map(r=>{var s;return e.indexOf(r)>=0&&(s=t.shift())!=null?s:r})},Mo=(n,e)=>n===e,lv=(n,e,t)=>n.filter(r=>e.filter(s=>t(r,s)).length===0),Po=(n,e)=>n===e,Zr=(n,e,t=Po)=>n.length===e.length&&n.every((r,s)=>t(r,e[s]));function cv(n,e,t){const r=n.slice(),s=r[e];return r.splice(e,1),r.splice(t,0,s),r}function Rn(n,e,t){const r=n.length,s=Ur(e,0,r-1),i=Ur(t,0,r-1),a=n[s];return n.splice(s,1),n.splice(i,0,a),n}function hv(n,e,t){const r=n.slice(),s=r.findIndex(e);return s!==-1&&(r.splice(s,1),r.splice(s,0,t)),r}const dv=n=>{const e={};return n.filter(t=>e[t]?!1:e[t]=!0)},uv=(n,e)=>n.reduce((t,r)=>((t[r[e]]=t[r[e]]||[]).push(r),t),{}),fv=(n,e)=>[].concat(...n.map(t=>[t,e])).slice(0,-1),vv=n=>Array.isArray(n[0]),Kr=n=>Array.isArray(n[0])?n:[n],To=(n,e,t)=>{const r=[];let s=0;for(const i of n){const a=Math.max(e-s,0),o=Math.max(t-s,-1),l=i.slice(a,o+1);l.length>0&&r.push(l),s+=i.length}return r},_o=(n,e)=>n>=0?e[n]:e[e.length+n],Ie=n=>Array.prototype.flat?n.flat():Ft(n,Bn),Ft=(n,e)=>{if(Array.prototype.flatMap)return n.flatMap(e);const t=[];for(let r=0;r<n.length;r++){const s=n[r];t.push(...e(s,r,n))}return t};function lt(n,e,t){const r=t!=null?t:Bn;return!n.length||e!==e?{index:-1,exact:!0}:Fn(n,e,0,n.length,r)}function Fn(n,e,t,r,s){const i=co(t+r,1),a=s(n[i]);return e===a?{index:i,exact:!0}:t===i?{index:t,exact:!1}:e<a?Fn(n,e,t,i,s):Fn(n,e,i,r,s)}function Ue(n){if(n&&n.length)return n[n.length-1]}function Ao(n){const e=this.indexOf(n);return e!==-1&&this.splice(e,1),this}function Do(n,e){if(!n)return;const t=n.indexOf(e);t!==-1&&n.splice(t,1)}function Yt(n){if(n)return n[0]}function Eo(n){function e(t,r){const s=n(r);return s==null||!isFinite(s)?t:[Math.max(t[0],s),Math.min(t[1],s)]}return function(t){const r=[Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY];return t?t.reduce(e,r):r}}function Lo(n,e,t,r=()=>0){const s=(a,o)=>{let l=0,c=a.length-1;for(;c>=l;){const h=Math.ceil((l+c)/2);r(a[h])<=o?l=h+1:c=h-1}return c},i=(a,o)=>{let l=0,c=a.length-1;for(;c>=l;){const h=Math.ceil((l+c)/2);r(a[h])>=o?c=h-1:l=h+1}return l};return n.slice(i(n,e),s(n,t)+1)}let Yn;const Hn=()=>(Yn||(Yn=!!navigator.userAgent.match(/Android|iPhone|Opera Mini/)||!1),Yn);function qr(n,e){let t="";e.textStyle&&(e.textStyle.italic&&(t+="italic "),e.textStyle.bold&&(t+="bold ")),n.font=t+(e.textSize||12)+" "+(e.textFontFamily||"monospace"),n.fillStyle=e.textFill||"#FFFFFF",e.rtl?n.textAlign="right":n.textAlign="start"}function Nn(n){const e=n.font.match(/(\d+.)?\d+(px|pt)/gi);let t="10px";return e&&e.length&&(e[0].includes("pt")?t=+e[0].slice(0,e[0].indexOf("pt"))*96/72+"px":t=e[0]),parseInt(t,10)*1.33}function Jr(n,e,t){n.save(),qr(n,t);const r=Math.ceil(Math.max.apply(Math,e.map(a=>n.measureText(a).width))),s=Nn(n),i=s*e.length;return n.restore(),[r,i,s]}function Qr(n){return(n||"").split(/\r\n|\r|\n/)}function Io(n,e,t,r,s){n.save();const[i,,a]=Jr(n,e,s);e.forEach((o,l)=>{var c,h,v;const p=n.measureText(o).width,y=Oo(t,i,p,(c=s.textAlign)!=null?c:"left");s.textStyle&&s.textStyle.underline&&Bo(n,o,y,r+a*l,(h=s.textFill)!=null?h:"",(v=s.textSize)!=null?v:""),n.fillText(o,y,r+a*l)}),n.restore()}function Oo(n,e,t,r){switch(r){case"left":return n;case"right":return n+e-t;default:return n}}function Bo(n,e,t,r,s,i){n.save();const a=n.measureText(e).width,o=t,l=t+a,c=r+2,h=c;let v=parseInt(i,10)/15;v<1&&(v=1),n.beginPath(),n.strokeStyle=s,n.lineWidth=v,n.moveTo(o,c),n.lineTo(l,h),n.stroke(),n.restore()}function gv(n){return`${n}px`}function Ht(n,e,t){const r=vt.rgb(n).array(),s=r[0],i=r[1],a=r[2];return(s*299+i*587+a*114)/1e3<128?e:t}function Ro(n,e,t,r){const s=r.components.navigationMap.timeLabels,i=s.padding,a=es(e,s.dateFormat,t),o=Qr(a),l={textFontFamily:s.fontFamily,textSize:`${s.fontSize}px`},[c,h]=Jr(n,o,l);return[c+i.x*2,h+i.y*2]}function es(n,e,t){return t(e)(n).split(" ").join(`
|
|
9
|
-
`)}const ts={};function Qe(n,e){let t=ts[n];return t!==void 0||(e.save(),e.font=n,t=e.measureText("M").width,ts[n]=t,e.restore()),t}const ns=new Map;function Re(n,e,t){const r=t+n;let s=ns.get(r);return s||(e.save(),e.font=t,s=e.measureText(n).width,ns.set(r,s),e.restore()),s}function Ge(n,e,t=rs){function r(s,i){for(const a in i)a in s?typeof s[a]=="object"&&s[a]!==null&&!Array.isArray(s[a])?r(s[a],i[a]):t!=null&&t.overrideExisting&&(s[a]=i[a]):t!=null&&t.addIfMissing&&(s[a]=i[a]);return s}return r(n,e)}function pv(n,e,t,r=!1){!n||!e||e.length===0||e.forEach(s=>{const i=t(s),a=n.findIndex(o=>t(o)===i);a===-1?n.push(s):r?Ge(n[a],s,{overrideExisting:!0,addIfMissing:!0}):n.splice(a,1,s)})}const rs={overrideExisting:!1,addIfMissing:!0};var Fo=Object.defineProperty,ss=Object.getOwnPropertySymbols,Yo=Object.prototype.hasOwnProperty,Ho=Object.prototype.propertyIsEnumerable,is=(n,e,t)=>e in n?Fo(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,No=(n,e)=>{for(var t in e||(e={}))Yo.call(e,t)&&is(n,t,e[t]);if(ss)for(var t of ss(e))Ho.call(e,t)&&is(n,t,e[t]);return n};const as="Open Sans Semibold, sans-serif",ko=null,Wo=["candle","line","area","bar","scatterPlot","trend","hollow","histogram","baseline"],mv=n=>ko.find(e=>e===n)!==void 0,tn=()=>({devexpertsPromoLink:!0,useUTCTimeOverride:!1,shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],rtl:!1,scale:{keepZoomXOnYAxisChange:!0,auto:!0,zoomToCursor:!1,lockPriceToBarRatio:!1,autoScaleOnCandles:!0,autoScaleDisableOnDrag:{enabled:!0,edgeAngle:Math.PI/15,yDiff:80},inverse:!1,zoomSensitivity:.25,defaultViewportItems:100},timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,components:{chart:{type:"candle",showCandlesBorder:!0,showActiveCandlesBorder:!0,showWicks:!0,candleLineWidth:1,lineWidth:1,areaLineWidth:1,barLineWidth:1,minWidth:.5,minCandles:10,candlePaddingPercent:.25,highlightActiveCandle:!0,cursor:"default",selectedWidth:3,minCandlesOffset:2,defaultZoomCandleWidth:7,zoomStep:0,histogram:{barCapSize:1}},yAxis:{type:"regular",visible:!0,labelHeight:23,zeroPercentLine:!0,customScale:!0,customScaleDblClick:!0,align:"right",fontSize:12,fontFamily:as,cursor:"ns-resize",resizeDisabledCursor:"default",labelBoxMargin:{top:4,bottom:4,end:8,start:10},typeConfig:{badge:{rounded:!0,paddings:{top:4,bottom:4,end:4,start:4}},plain:{},rectangle:{rounded:!1,paddings:{top:4,bottom:4,end:4,start:4}}},labels:{descriptions:!1,settings:{lastPrice:{mode:"label",type:"badge"},countdownToBarClose:{mode:"none",type:"rectangle"}}}},xAxis:{visible:!0,formatsForLabelsConfig:{lessThanSecond:"HH:mm:ss",second_1:"HH:mm:ss",minute_1:"HH:mm",minute_5:"HH:mm",minute_30:"HH:mm",hour_1:"HH:mm",day_1:"dd.MM",month_1:"MMM",year_1:"YYYY"},fontSize:12,fontFamily:as,cursor:"ew-resize",padding:{top:8,bottom:16},fontStyle:""},events:{visible:!1,eventsVisibility:{"conference-calls":!0,dividends:!0,splits:!0,earnings:!0},height:20,cursor:"default",xAxisLabelFormat:[{format:"d MMM"}],icons:{earnings:{normal:'<svg width="13" height="13" viewBox="0 0 13 13" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M1.06066 6.5L6.5 1.06066L11.9393 6.5L6.5 11.9393L1.06066 6.5Z" stroke="#D92C40" stroke-width="1.5"/></svg>',hover:'<svg width="13" height="13" viewBox="0 0 13 13" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M1.06066 6.5L6.5 1.06066L11.9393 6.5L6.5 11.9393L1.06066 6.5Z" fill="#D92C40" stroke="#D92C40" stroke-width="1.5"/></svg>'}}},offsets:{visible:!0,right:10,top:10,bottom:20,left:0},waterMark:{visible:!1,fontFamily:"Open Sans, sans-serif",firstRowFontSize:80,firstRowBottomPadding:10,secondRowFontSize:40,secondRowBottomPadding:25,thirdRowFontSize:40,thirdRowBottomPadding:15,position:"center",offsetX:20,offsetY:20,logoWidth:20,logoHeight:20},highLow:{visible:!1,font:"12px sans-serif"},highlights:{visible:!1,fontFamily:"Open Sans",fontSize:13,border:{width:1,dash:[8,4]}},crossTool:{type:"cross-and-labels",discrete:!1,magnetTarget:"none",lineDash:[4,6],xAxisLabelFormat:[{format:"dd.MM.YYYY",showWhen:{periodMoreThen:846e5}},{format:"dd.MM.YYYY HH:mm",showWhen:{periodLessThen:846e5,periodMoreThen:6e3}},{format:"dd.MM.YYYY HH:mm:ss",showWhen:{periodLessThen:6e3}}],xLabel:{padding:{top:4,bottom:4,right:8,left:8},margin:{top:4}},yLabel:{padding:{top:4,bottom:4,end:4,start:4},type:"badge"}},grid:{visible:!0,horizontal:!1,vertical:!0,width:1,dash:[0,0],color:"#FFFFFF"},volumes:{visible:!0,showSeparately:!1,valueLines:15,barCapSize:1,volumeBarSpace:0,volumeFillColor:"#FFFFFF"},navigationMap:{visible:!1,allCandlesHistory:!0,timeLabels:{visible:!1,dateFormat:"dd.MM.YYYY HH:mm",fontFamily:"Open Sans",fontSize:13,padding:{x:10,y:1}},minSliderWindowWidth:10,cursors:{chart:"default",buttonLeft:"pointer",buttonRight:"pointer",leftResizer:"ew-resize",rightResizer:"ew-resize",slider:"grab"},knots:{height:35,width:7,border:0,lineWidth:1}},baseline:{cursor:"ns-resize",dragZone:3,height:1},paneResizer:{cursor:"ns-resize",height:1,visible:!0,fixedMode:!1,dragZone:3}},colors:{candleTheme:{upColor:"rgba(77,153,83,1)",downColor:"rgba(217,44,64,1)",noneColor:"rgba(255,255,255,1)",upWickColor:"rgba(77,153,83,1)",downWickColor:"rgba(217,44,64,1)",noneWickColor:"rgba(255,255,255,1)",borderOpacity:1},barTheme:{upColor:"rgba(77,153,83,1)",downColor:"rgba(217,44,64,1)",noneColor:"rgba(255,255,255,1)"},lineTheme:{upColor:"rgba(77,153,83,1)",downColor:"rgba(217,44,64,1)",noneColor:"rgba(255,255,255,1)"},chartAreaTheme:{backgroundMode:"regular",backgroundColor:"rgba(20,20,19,1)",backgroundGradientTopColor:"red",backgroundGradientBottomColor:"blue",axisColor:"rgba(128,128,128,1)",gridColor:"rgba(37,37,36,1)"},scatterPlot:{mainColor:"rgba(255,255,255,1)"},areaTheme:{lineColor:"rgba(127,120,214,1)",startColor:"rgba(169,38,251,1)",stopColor:"rgba(169,38,251,0.8)"},baseLineTheme:{lowerSectionStrokeColor:"rgba(217,44,64,1)",upperSectionStrokeColor:"rgba(77,153,83,1)",lowerSectionFillColor:"rgba(217, 44, 64, 0.07)",upperSectionFillColor:"rgba(77, 153, 83, 0.07)",baselineColor:"rgba(55,55,54,1)"},histogram:{upCap:"rgba(77,153,83,1)",upBottom:"rgba(77,153,83,0.1)",upBright:"rgba(77,153,83,0.4)",downCap:"rgba(217,44,64,1)",downBottom:"rgba(217,44,64,0.1)",downBright:"rgba(217,44,64,0.4)",noneCap:"rgba(255,255,255,1)",noneBottom:"rgba(255,255,255,0.1)",noneBright:"rgba(255,255,255,0.4)"},crossTool:{lineColor:"rgba(107,96,86,1)",labelBoxColor:"rgba(107,96,86,1)",labelTextColor:"rgba(255,255,255,1)"},waterMarkTheme:{firstRowColor:"rgba(255,255,255,0.2)",secondRowColor:"rgba(255,255,255,0.2)",thirdRowColor:"rgba(255,255,255,0.2)"},highlights:{NO_TRADING:{border:"rgba(107,96,86,1)",background:"transparent",label:"transparent"},AFTER_MARKET:{border:"rgba(107,96,86,1)",background:"rgba(38, 251, 149, 0.05)",label:"transparent"},PRE_MARKET:{border:"rgba(107,96,86,1)",background:"rgba(255, 170, 0, 0.05)",label:"transparent"},REGULAR:{border:"rgba(107,96,86,1)",background:"transparent",label:"transparent"}},activeCandleTheme:{upColor:"rgba(98,201,93,1)",downColor:"rgba(255,47,47,1)",noneColor:"rgba(255,255,255,1)",upWickColor:"rgba(98,201,93,1)",downWickColor:"rgba(255,47,47,1)",noneWickColor:"rgba(255,255,255,1)",borderOpacity:.5},volume:{downBarColor:"rgba(99,30,37,1)",upBarColor:"rgba(42,72,44,1)",noneBarColor:"rgba(255,255,255,0.4)",upCapColor:"rgba(42,72,44,1)",downCapColor:"rgba(99,30,37,1)",noneCapColor:"rgba(255,255,255,0.4)"},highLowTheme:{highColor:"rgba(223,222,223,1)",lowColor:"rgba(223,222,223,1)"},instrumentInfo:{textColor:"#aeb1b3"},paneResizer:{lineColor:"rgba(55,55,54,1)",bgColor:"rgba(20,20,19,1)",bgHoverColor:"rgba(55,55,54,0.6)"},events:{earnings:{color:"rgba(217,44,64,1)"},dividends:{color:"rgba(169,38,251,1)"},splits:{color:"rgba(244,187,63,1)"},"conference-calls":{color:"rgba(48,194,97,1)"}},secondaryChartTheme:[{lineTheme:{upColor:"rgba(226,61,25,1)",downColor:"rgba(226,61,25,1)",noneColor:"rgba(226,61,25,1)"},areaTheme:{lineColor:"rgba(226,61,25,1)",startColor:"rgba(226,61,25,0.8)",stopColor:"rgba(226,61,25,0)"}},{lineTheme:{upColor:"rgba(250,191,64,1)",downColor:"rgba(250,191,64,1)",noneColor:"rgba(250,191,64,1)"},areaTheme:{lineColor:"rgba(250,191,64,1)",startColor:"rgba(250,191,64,0.8)",stopColor:"rgba(250,191,64,0)"}},{lineTheme:{upColor:"rgba(169,38,251,1)",downColor:"rgba(169,38,251,1)",noneColor:"rgba(169,38,251,1)"},areaTheme:{lineColor:"rgba(169,38,251,1)",startColor:"rgba(169,38,251,0.8)",stopColor:"rgba(169,38,251,0)"}},{lineTheme:{upColor:"rgba(77,211,240,1)",downColor:"rgba(77,211,240,1)",noneColor:"rgba(77,211,240,1)"},areaTheme:{lineColor:"rgba(77,211,240,1)",startColor:"rgba(77,211,240,0.8)",stopColor:"rgba(77,211,240,0)"}},{lineTheme:{upColor:"rgba(59,203,91,1)",downColor:"rgba(59,203,91,1)",noneColor:"rgba(59,203,91,1)"},areaTheme:{lineColor:"rgba(59,203,91,1)",startColor:"rgba(59,203,91,0.8)",stopColor:"rgba(59,203,91,0)"}}],yAxis:{backgroundColor:"transparent",backgroundHoverColor:"rgba(20,20,19,1)",labelBoxColor:"rgba(20,20,19,1)",labelTextColor:"rgba(128,128,128,1)",labelInvertedTextColor:"rgba(20,20,19,1)",rectLabelTextColor:"rgba(255,255,255,1)",rectLabelInvertedTextColor:"rgba(20,20,19,1)",zeroPercentLine:"rgba(55,55,54,1)"},labels:{lastPrice:{textNegative:"rgba(255,255,255,1)",textPositive:"rgba(255,255,255,1)",textSelected:"rgba(0,0,0,1)",boxNegative:"rgba(217,44,64,1)",boxPositive:"rgba(77,153,83,1)",boxSelected:"rgba(255,255,255,1)"},countdownToBarClose:{textNegative:"rgba(255,255,255,1)",textPositive:"rgba(255,255,255,1)",textSelected:"rgba(255,255,255,1)",boxNegative:"rgba(217,44,64,1)",boxPositive:"rgba(77,153,83,1)",boxSelected:"rgba(255,255,255,1)"},highLow:{high:{boxColor:"rgba(107,96,86,1)",textColor:"rgba(255,255,255,1)",descriptionText:"High"},low:{boxColor:"rgba(107,96,86,1)",textColor:"rgba(255,255,255,1)",descriptionText:"Low"}},bidAsk:{bid:{boxColor:"rgba(77,153,83,1)",textColor:"rgba(255,255,255,1)",descriptionText:"Bid"},ask:{boxColor:"rgba(217,44,64,1)",textColor:"rgba(255,255,255,1)",descriptionText:"Ask"}},prePostMarket:{post:{boxColor:"rgba(38,251,149,1)",textColor:"rgba(20,20,19,1)",descriptionText:"Post"},pre:{boxColor:"rgba(255,170,0,1)",textColor:"rgba(20,20,19,1)",descriptionText:"Pre"}},prevDayClose:{boxColor:"rgba(107,96,86,1)",textColor:"rgba(255,255,255,1)"}},xAxis:{backgroundColor:"transparent",labelTextColor:"rgba(128,128,128,1)"},navigationMap:{backgroundColor:"transparent",buttonColor:"rgba(255,255,255,0.1)",buttonArrowColor:"rgba(212,212,211,1)",knotColor:"rgba(255,255,255,0.1)",knotLineColor:"rgba(212,212,211,1)",sliderColor:"rgba(255,255,255,0.08)",knotBorderColor:"#0b0d1a",timeLabelsTextColor:"rgba(128,128,128,1)",mapColor:"rgba(255,255,255,0.1)",mapFillColor:"rgba(255,255,255,0.1)",mapGradientTopColor:"rgba(255,255,255,0.1)",mapGradientBottomColor:"rgba(255,255,255,0.1)"}},animation:{moveDuration:1e3,candleDuration:200,paneResizer:{bgMode:!0,enabled:!0,duration:40},yAxis:{background:{enabled:!1,duration:40}}},drawingOrder:["OVER_SERIES_CLEAR","MAIN_CLEAR","SERIES_CLEAR","GRID","X_AXIS","Y_AXIS","UNDERLAY_VOLUMES_AREA","VOLUMES","DATA_SERIES","DRAWINGS","WATERMARK","N_MAP_CHART","EVENTS"]});function Uo(n,e=tn()){return Ge(n,e,rs),n}function bv(n,e=tn()){const t=No({},n);return merge(t,e,DEFAULT_MERGE_OPTIONS),t}function Cv(n,e){Object.keys(n).forEach(t=>delete n[t]),Object.keys(e).forEach(t=>n[t]=e[t])}function os(n){return typeof n=="object"&&n!==null}function ls(n,e){return[...n].map(r=>kn(r,e))}const zo=n=>Array.isArray(n);function kn(n,e){if(!os(n))return n;if(zo(n))return ls(n,e);{const t=cs({},n,e);return Object.setPrototypeOf(t,Object.getPrototypeOf(n)),t}}function cs(n,e,t){if(!os(n))return t.overrideExisting?e:n;if(Array.isArray(n)&&Array.isArray(e)){const s=t.overrideExisting?e:n;return ls(s,t)}const r=Object.create(Object.getPrototypeOf(n));return Object.keys(n).forEach(s=>r[s]=kn(n[s],t)),Object.keys(e).forEach(s=>{s in n?r[s]=cs(n[s],e[s],t):t.addIfMissing&&(r[s]=kn(e[s],t))}),r}const mt=n=>`${n.fontSize}px ${n.fontFamily}`;class Xo{constructor(e,t){this.config=e,this.mainCanvasModel=t,this.extentsOrder=new Map,this.yAxisWidthContributors=[]}registerYAxisWidthContributor(e){this.yAxisWidthContributors.push(e)}removeYAxisWidthContributor(e){this.yAxisWidthContributors=this.yAxisWidthContributors.filter(t=>t!==e)}getTextWidth(e){const t=mt(this.config.components.yAxis);return Re(e,this.mainCanvasModel.ctx,t)}getYAxisWidths(){this.extentsOrder.clear();const e=[],t=[],r=this.config.components.yAxis.labelBoxMargin.start+this.config.components.yAxis.labelBoxMargin.end;return this.yAxisWidthContributors.forEach(s=>{var i,a,o;const l=this.getTextWidth(s.getLargestLabel())+r,c=s.getYAxisIndex(),h=s.getPaneUUID(),v=(i=this.extentsOrder.get(h))!=null?i:{left:[],right:[]};if(s.getYAxisAlign()==="left"){const p=v.left.length;e[p]=Math.max((a=e[p])!=null?a:0,l),v.left.push(c)}else{const p=v.right.length;t[p]=Math.max((o=t[p])!=null?o:0,l),v.right.push(c)}this.extentsOrder.set(h,v)}),{left:e,right:t}}}var jo=Object.defineProperty,Vo=Object.defineProperties,Go=Object.getOwnPropertyDescriptors,hs=Object.getOwnPropertySymbols,$o=Object.prototype.hasOwnProperty,Zo=Object.prototype.propertyIsEnumerable,ds=(n,e,t)=>e in n?jo(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,et=(n,e)=>{for(var t in e||(e={}))$o.call(e,t)&&ds(n,t,e[t]);if(hs)for(var t of hs(e))Zo.call(e,t)&&ds(n,t,e[t]);return n},us=(n,e)=>Vo(n,Go(e));const ae="CHART",Wn=class{};let Y=Wn;Y.CANVAS="CANVAS",Y.N_MAP="N_MAP",Y.X_AXIS="X_AXIS",Y.N_MAP_KNOT_L="N_MAP_KNOT_L",Y.N_MAP_KNOT_R="N_MAP_KNOT_R",Y.N_MAP_BTN_L="N_MAP_BTN_L",Y.N_MAP_BTN_R="N_MAP_BTN_R",Y.N_MAP_SLIDER_WINDOW="N_MAP_SLIDER_WINDOW",Y.N_MAP_CHART="N_MAP_CHART",Y.N_MAP_LABEL_R="N_MAP_LABEL_R",Y.N_MAP_LABEL_L="N_MAP_LABEL_L",Y.PANE_UUID=n=>"PANE_"+n,Y.PANE_UUID_Y_AXIS=(n,e=0)=>"PANE_"+n+"_Y_AXIS_"+e,Y.PANE_UUID_RESIZER=n=>"PANE_"+n+"_RESIZER",Y.ALL_PANES="ALL_PANES",Y.CHART_WITH_Y_AXIS="CHART_WITH_Y_AXIS",Y.EVENTS="EVENTS",Y.CHART=Wn.PANE_UUID(ae),Y.Y_AXIS=Wn.PANE_UUID_Y_AXIS(ae);const fs={x:0,y:0,pageX:0,pageY:0,width:0,height:0},Ko=20,vs=35,Un=15,gs=1.5,zn=Hn()?8*gs:8,qo=1e-6;class Xn{constructor(e,t,r,s,i){this.config=e,this.eventBus=t,this.canvasModel=r,this.formatterFactory=s,this.bounds={},this.canvasOnPageLocation={x:0,y:0,pageX:0,pageY:0,width:0,height:0},this.panesOrder=[],this.panesOrderChangedSubject=new G,this.xAxisHeight=void 0,this.yAxisWidths={right:[0],left:[0]},this.leftRatio=0,this.rightRatio=0,this.boundsChangedSubject=new G,this.barResizerChangedSubject=new G,this._graphsHeightRatio={chart:1},this.graphsHeightRatioChangedSubject=new G,this.boundsChangedSubscriptions={},i.canvasResized.subscribe(a=>{let o=a;o||(o=this.canvasModel.canvas.getBoundingClientRect()),this.updateCanvasOnPageLocation(o),this.recalculateBounds()}),this.yAxisBoundsContainer=new Xo(this.config,this.canvasModel)}get graphsHeightRatio(){return this._graphsHeightRatio}updateYAxisWidths(){const e=this.yAxisBoundsContainer.getYAxisWidths();this.setYAxisWidths(e)}addPaneBounds(e,t){if(this.panesOrder.indexOf(e)===-1){if(this.panesOrder.push(e),t!==void 0){const r=this.panesOrder.indexOf(e);Rn(this.panesOrder,r,t)}this.recalculatePanesHeightRatios(),this.panesOrderChangedSubject.next(this.panesOrder)}}overrideChartHeightRatios(e){const t=et(et({},this.graphsHeightRatio),e),r=Object.values(t).reduce((s,i)=>s+i,0);Math.abs(r-1)<qo?(this._graphsHeightRatio=t,this.recalculateBounds()):console.error(`Result ratio should be equal 1, but equal ${r}`)}movePaneUp(e){const t=this.panesOrder.indexOf(e);t!==-1&&(Rn(this.panesOrder,t,t-1),this.recalculateBounds(),this.eventBus.fireDraw(),this.panesOrderChangedSubject.next(this.panesOrder))}movePaneDown(e){const t=this.panesOrder.indexOf(e);t!==-1&&(Rn(this.panesOrder,t,t+1),this.recalculateBounds(),this.eventBus.fireDraw(),this.panesOrderChangedSubject.next(this.panesOrder))}reorderPanes(e){this.panesOrder=$r(this.panesOrder,e),this.recalculateBounds(),this.panesOrderChangedSubject.next(this.panesOrder)}removedPaneBounds(e){Do(this.panesOrder,e),delete this.graphsHeightRatio[e],delete this.bounds[Y.PANE_UUID(e)],this.yAxisWidths.left.concat(this.yAxisWidths.right).forEach((t,r)=>delete this.bounds[Y.PANE_UUID_Y_AXIS(e,r)]),delete this.bounds[Y.PANE_UUID_RESIZER(e)],this.recalculatePanesHeightRatios(),this.panesOrderChangedSubject.next(this.panesOrder)}recalculateBounds(){const e=this.canvasOnPageLocation.width,t=this.canvasOnPageLocation.height,r=this.config.components.paneResizer.height,s=this.getBounds(Y.CANVAS);s.x=0,s.y=0,s.width=e,s.height=t;const i=this.getYAxisWidth(),a=this.getNavMapBounds(s),o=this.getXAxisBounds(a,s),l=t-o.height-a.height,c=i.left.reduce((K,q)=>K+q,0),h=i.right.reduce((K,q)=>K+q,0),v=0,p=s.width-h,y=v+c,E=0,R=s.width-c-h;let N=E;this.panesOrder.forEach((K,q)=>{var $;const J=this.graphsHeightRatio[this.panesOrder[q]],ne=this.config.components.paneResizer.visible;ne&&(q!==0?Tt(this.bounds,Y.PANE_UUID_RESIZER(K),0,N,s.width,r,this.canvasOnPageLocation):Tt(this.bounds,Y.PANE_UUID_RESIZER(K),0,0,0,0,this.canvasOnPageLocation));const oe=Tt(this.bounds,Y.PANE_UUID(K),y,ne?N+r:N,R,ne?l*J-this.config.components.paneResizer.height:l*J,this.canvasOnPageLocation);if(this.config.components.yAxis.visible){const le=this.yAxisBoundsContainer.extentsOrder.get(K);if(le===void 0)return;const re=ne?N+r:N,ce=ne?l*J-r:l*J;let fe=y-(($=i.left[0])!=null?$:0),de=p;le.left.forEach((ue,pe)=>{var me;Tt(this.bounds,Y.PANE_UUID_Y_AXIS(K,ue),fe,re,i.left[pe],ce,this.canvasOnPageLocation),fe-=(me=i.left[pe+1])!=null?me:0}),le.right.forEach((ue,pe)=>{Tt(this.bounds,Y.PANE_UUID_Y_AXIS(K,ue),de,re,i.right[pe],ce,this.canvasOnPageLocation),de+=i.right[pe]})}else Tt(this.bounds,Y.PANE_UUID_Y_AXIS(K),0,0,0,0,this.canvasOnPageLocation);N=oe.y+oe.height});const k=this.getBounds(Y.ALL_PANES);k.x=y,k.y=E,k.width=R,k.height=N;const U=this.getBounds(Y.CHART_WITH_Y_AXIS),Z=this.getBounds(Y.PANE_UUID(ae));this.getEventsBounds(Z),this.copyBounds(Z,U),U.width=s.width,this.recalculateNavigationMapElementBounds(),this.updateAllBoundsPageCoordinates(),this.notifyBoundsSubscribers()}updateCanvasOnPageLocation(e){this.canvasOnPageLocation=us(et({},this.canvasOnPageLocation),{x:e.x,y:e.y,width:e.width,height:e.height})}updateAllBoundsPageCoordinates(){for(const e of Object.keys(this.bounds)){const t=this.bounds[e];t.pageX=t.x+this.canvasOnPageLocation.x,t.pageY=t.y+this.canvasOnPageLocation.y}}getEventsBounds(e){const t=this.getBounds(Y.EVENTS);return this.config.components.events.visible?(t.x=0,t.y=e.y+e.height-this.config.components.events.height,t.width=e.width,t.height=this.config.components.events.height):this.applyDefaultBounds(t),t}getNavMapBounds(e){const t=this.getBounds(Y.N_MAP);return this.config.components.navigationMap.visible?(t.x=0,t.y=e.height-vs,t.width=e.width,t.height=vs):this.applyDefaultBounds(t),t}getXAxisBounds(e,t){const r=this.getBounds(Y.X_AXIS);return this.config.components.xAxis.visible?(r.x=0,r.y=t.height-this.getXAxisHeight()-e.height,r.width=t.width,r.height=this.getXAxisHeight()):this.applyDefaultBounds(r),r}getXAxisHeight(){var e,t;if(!this.xAxisHeight){const r=this.config.components.xAxis.fontSize+"px "+this.config.components.xAxis.fontFamily,s=Qe(r,this.canvasModel.ctx);this.xAxisHeight=s+((e=this.config.components.xAxis.padding.top)!=null?e:0)+((t=this.config.components.xAxis.padding.bottom)!=null?t:0)}return this.xAxisHeight}setYAxisWidths(e){(!Zr(this.yAxisWidths.left,e.left)||!Zr(this.yAxisWidths.right,e.right))&&(this.yAxisWidths=e,this.recalculateBounds())}setXAxisHeight(e){e!==this.xAxisHeight&&(this.xAxisHeight=e,this.recalculateBounds())}setPanesOrder(e){this.panesOrder=e,this.recalculateBounds()}getYAxisWidth(){return this.config.components.yAxis.visible?this.yAxisWidths:{right:[0],left:[0]}}recalculatePanesHeightRatios(){this.calculateGraphsHeightRatios(),this.recalculateBounds()}calculateGraphsHeightRatios(){let e=this.graphsHeightRatio[ae];const t=[];t.push(...this.panesOrder.filter(v=>v!==ae)),this.panesOrder.forEach(v=>{this.graphsHeightRatio[v]===0&&delete this.graphsHeightRatio[v]});const r=t.map(v=>this.graphsHeightRatio[v]===void 0?void 0:this.graphsHeightRatio[v]),s=r.filter(v=>v!==void 0).length,i=r.filter(v=>v===void 0).length;let a=0,o=0,l=1,c=0;i>0&&([l,c]=Qo(t.length),e*=l),s===0&&(e=1-c*i),o=1-e-c*i,r.forEach(v=>{v&&(o-=v*l)}),a=o/(t.length+1);const h=r.map(v=>v?v*l+a:c+a);e+=a,this._graphsHeightRatio={},this.graphsHeightRatio[ae]=e,h.forEach((v,p)=>{const y=t[p];this.graphsHeightRatio[y]=v})}recalculateNavigationMapElementBounds(){var e,t,r,s;if(this.config.components.navigationMap.visible){const i=this.getBounds(Y.N_MAP),{height:a,width:o}=this.config.components.navigationMap.knots,l=a!=null?a:0,c=Hn()?o*gs:o!=null?o:0,h=l?i.y+(i.height-l)/2:i.y,v=(t=(e=this.config.components.navigationMap)==null?void 0:e.timeLabels)==null?void 0:t.visible,p=J=>Ro(this.canvasModel.ctx,J,this.formatterFactory,this.config)[0],y=Ie((s=(r=this.mainCandleSeries)==null?void 0:r.getSeriesInViewport())!=null?s:[]),E=v&&y.length?p(y[0].candle.timestamp):0,R=v&&y.length?p(y[y.length-1].candle.timestamp):0,N=Math.max(E,R);if(v){const J=this.getBounds(Y.N_MAP_LABEL_L);J.x=i.x,J.y=i.y,J.width=N,J.height=i.height;const ne=this.getBounds(Y.N_MAP_LABEL_R);ne.x=i.x+i.width-N,ne.y=i.y,ne.width=N,ne.height=i.height}const k=this.getBounds(Y.N_MAP_BTN_L);k.x=i.x+N,k.y=i.y,k.width=Un,k.height=i.height;const U=this.getBounds(Y.N_MAP_BTN_R);U.x=i.x+i.width-Un-N,U.y=i.y,U.width=Un,U.height=i.height;const Z=this.getBounds(Y.N_MAP_KNOT_L);Z.x=(U.x-k.x-k.width)*this.leftRatio+k.x+k.width,Z.y=h,Z.width=c!=null?c:zn,Z.height=l!=null?l:i.height;const K=this.getBounds(Y.N_MAP_KNOT_R);K.x=(U.x-k.x-k.width)*this.rightRatio+k.x+k.width-zn,K.y=h,K.width=c!=null?c:zn,K.height=l!=null?l:i.height;const q=this.getBounds(Y.N_MAP_SLIDER_WINDOW);q.x=Z.x+Z.width,q.y=i.y,q.width=K.x-q.x,q.height=i.height;const $=this.getBounds(Y.N_MAP_CHART);$.x=k.x+k.width,$.y=i.y,$.width=U.x-$.x,$.height=i.height}}isVolumesInSeparatePane(){return this.config.components.volumes.visible&&this.config.components.volumes.showSeparately}getBounds(e){return this.bounds[e]===void 0&&(this.bounds[e]=this.copyOf(fs)),this.bounds[e]}getCanvasOnPageLocation(){return this.canvasOnPageLocation}getBoundsPanes(){return this.panesOrder.reduce((e,t)=>us(et({},e),{[t]:this.bounds[Y.PANE_UUID(t)]}),{})}getBoundsHitTest(e,t=nn){const{extensionX:r,extensionY:s,wholePage:i}=et(et({},nn),t);return i?(a,o)=>{const l=this.getBounds(e);return a>l.pageX-r&&a<l.pageX+l.width+r&&o>l.pageY-s&&o<l.pageY+l.height+s}:(a,o)=>{const l=this.getBounds(e);return a>l.x-r&&a<l.x+l.width+r&&o>l.y-s&&o<l.y+l.height+s}}static hitTestOf(e,t=nn){const{extensionX:r,extensionY:s,wholePage:i}=et(et({},nn),t);return i?(a,o)=>a>e.pageX-r&&a<e.pageX+e.width+r&&o>e.pageY-s&&o<e.pageY+e.height+s:(a,o)=>a>e.x-r&&a<e.x+e.width+r&&o>e.y-s&&o<e.y+e.height+s}isChartBoundsAvailable(){const e=this.getBounds(Y.CANVAS);return e.width>0&&e.height>0}resizePaneVertically(e,t){const r=this.panesOrder.indexOf(e),s=this.getBounds(Y.PANE_UUID_RESIZER(e));this.doResizePaneVertically(r,s.y-t),this.barResizerChangedSubject.next()}doResizePaneVertically(e,t){const r=e-1,s=this.getBounds(Y.ALL_PANES).height,i=this.config.components.paneResizer.height+Ko,a=s*this.graphsHeightRatio[this.panesOrder[e]],o=s*this.graphsHeightRatio[this.panesOrder[r]],l=a+t>i,c=o-t>i;if(l&&c){const h=t/s;this.graphsHeightRatio[this.panesOrder[e]]+=h,this.graphsHeightRatio[this.panesOrder[r]]-=h,this.recalculateBounds()}}notifyBoundsSubscribers(){Object.keys(this.boundsChangedSubscriptions).forEach(e=>{this.boundsChangedSubscriptions[e].next(this.getBounds(e))}),this.boundsChangedSubject.next()}observeBoundsChanged(e){let t=this.boundsChangedSubscriptions[e];return t||(t=new pt(this.getBounds(e)),this.boundsChangedSubscriptions[e]=t),t.pipe(ye(r=>this.copyOf(r)),Ve((r,s)=>this.sameBounds(r,s)))}observeAnyBoundsChanged(){return this.boundsChangedSubject.asObservable()}copyOf(e){return et({},e)}copyBounds(e,t){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height}sameBounds(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}applyDefaultBounds(e){this.copyBounds(fs,e)}setMainCandleSeries(e){this.mainCandleSeries=e}}const Jo={0:1,1:.8,2:.6,3:.5,4:.4,5:.2},Qo=n=>{var e;const t=(e=Jo[n])!=null?e:.4,r=(1-t)/n;return[t,r]},yv=(n,e)=>n.x>e.x&&n.x<e.x+e.width&&n.y>e.y&&n.y<e.y+e.height,el=(n,e)=>n>e.y&&n<e.y+e.height,Tt=(n,e,t,r,s,i,a)=>{const o=n[e];if(o)return o.x=t,o.y=r,o.pageX=t+a.x,o.pageY=r+a.y,o.width=s,o.height=i,o;const l={x:t,y:r,pageX:t+a.x,pageY:r+a.y,width:s,height:i};return n[e]=l,l},ps=(n,e)=>Math.min(Math.max(n,e.y),e.y+e.height),nn={extensionX:0,extensionY:0,wholePage:!1},ms=(n,e)=>n.width===e.width&&n.height===e.height;var tl=function(n){I(e,n);function e(t,r){return n.call(this)||this}return e.prototype.schedule=function(t,r){return r===void 0&&(r=0),this},e}(Ce),rn={setInterval:function(n,e){for(var t=[],r=2;r<arguments.length;r++)t[r-2]=arguments[r];var s=rn.delegate;return s!=null&&s.setInterval?s.setInterval.apply(s,g([n,e],P(t))):setInterval.apply(void 0,g([n,e],P(t)))},clearInterval:function(n){var e=rn.delegate;return((e==null?void 0:e.clearInterval)||clearInterval)(n)},delegate:void 0},nl=function(n){I(e,n);function e(t,r){var s=n.call(this,t,r)||this;return s.scheduler=t,s.work=r,s.pending=!1,s}return e.prototype.schedule=function(t,r){var s;if(r===void 0&&(r=0),this.closed)return this;this.state=t;var i=this.id,a=this.scheduler;return i!=null&&(this.id=this.recycleAsyncId(a,i,r)),this.pending=!0,this.delay=r,this.id=(s=this.id)!==null&&s!==void 0?s:this.requestAsyncId(a,this.id,r),this},e.prototype.requestAsyncId=function(t,r,s){return s===void 0&&(s=0),rn.setInterval(t.flush.bind(t,this),s)},e.prototype.recycleAsyncId=function(t,r,s){if(s===void 0&&(s=0),s!=null&&this.delay===s&&this.pending===!1)return r;r!=null&&rn.clearInterval(r)},e.prototype.execute=function(t,r){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var s=this._execute(t,r);if(s)return s;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},e.prototype._execute=function(t,r){var s=!1,i;try{this.work(t)}catch(a){s=!0,i=a||new Error("Scheduled action threw falsy error")}if(s)return this.unsubscribe(),i},e.prototype.unsubscribe=function(){if(!this.closed){var t=this,r=t.id,s=t.scheduler,i=s.actions;this.work=this.state=this.scheduler=null,this.pending=!1,Ae(i,this),r!=null&&(this.id=this.recycleAsyncId(s,r,null)),this.delay=null,n.prototype.unsubscribe.call(this)}},e}(tl),jn={now:function(){return(jn.delegate||Date).now()},delegate:void 0},bs=function(){function n(e,t){t===void 0&&(t=n.now),this.schedulerActionCtor=e,this.now=t}return n.prototype.schedule=function(e,t,r){return t===void 0&&(t=0),new this.schedulerActionCtor(this,e).schedule(r,t)},n.now=jn.now,n}(),rl=function(n){I(e,n);function e(t,r){r===void 0&&(r=bs.now);var s=n.call(this,t,r)||this;return s.actions=[],s._active=!1,s}return e.prototype.flush=function(t){var r=this.actions;if(this._active){r.push(t);return}var s;this._active=!0;do if(s=t.execute(t.state,t.delay))break;while(t=r.shift());if(this._active=!1,s){for(;t=r.shift();)t.unsubscribe();throw s}},e}(bs),Cs=new rl(nl),sl=Cs;function il(n,e){return w(function(t,r){var s=e!=null?e:{},i=s.leading,a=i===void 0?!0:i,o=s.trailing,l=o===void 0?!1:o,c=!1,h=null,v=null,p=!1,y=function(){v==null||v.unsubscribe(),v=null,l&&(N(),p&&r.complete())},E=function(){v=null,p&&r.complete()},R=function(k){return v=Ke(n(k)).subscribe(We(r,y,E))},N=function(){if(c){c=!1;var k=h;h=null,r.next(k),!p&&R(k)}};t.subscribe(We(r,function(k){c=!0,h=k,!(v&&!v.closed)&&(a?N():R(k))},function(){p=!0,!(l&&c&&v&&!v.closed)&&r.complete()}))})}function al(n){return n instanceof Date&&!isNaN(n)}function ol(n,e,t){n===void 0&&(n=0),t===void 0&&(t=sl);var r=-1;return e!=null&&(Hr(e)?t=e:r=e),new xe(function(s){var i=al(n)?+n-t.now():n;i<0&&(i=0);var a=0;return t.schedule(function(){s.closed||(s.next(a++),0<=r?this.schedule(void 0,r):s.complete())},i)})}function Nt(n,e,t){e===void 0&&(e=Cs);var r=ol(n,e);return il(function(){return r},t)}class te{constructor(){this.subscriptions=[],this._state="initial",this.entities=[]}doActivate(){}doDeactivate(){this.subscriptions.forEach(e=>e()),this.subscriptions=[]}enable(){this._state!=="active"&&(this._state="deactivated",this.activate())}disable(){this._state!=="disabled"&&(this.deactivate(),this._state="disabled")}activate(){this._state!=="disabled"&&(this._state!=="active"&&(this.doActivate(),this._state="active"),this.entities.forEach(e=>e.activate()))}deactivate(){this._state!=="disabled"&&(this._state!=="deactivated"&&(this.doDeactivate(),this._state="deactivated"),this.entities.forEach(e=>e.deactivate()))}getState(){return this._state}addSubscription(e){this.subscriptions.push(e)}addRxSubscription(e){e&&this.subscriptions.push(e.unsubscribe.bind(e))}addChildEntity(e){this.entities.push(e),this._state==="active"&&e.activate()}removeChildEntity(e){this.entities=this.entities.filter(t=>t!==e)}}class ll extends te{constructor(e,t,r,s){super(),this.element=e,this.canvasInputListener=t,this.canvasBoundsContainer=r,this.hitTestCanvasModel=s,this.normalLayer=new Map,this.extensionLayer=new Map,this.cursorChangedSubject=new G}doActivate(){super.doActivate(),this.canvasInputListener.observeMouseMoveNoDrag().pipe(Nt(100,void 0,{trailing:!0})).subscribe(e=>{const t=this.hitTestCanvasModel.resolveCursor(e);if(t!==void 0){this.updateCursor(t);return}e&&(this.normalLayer.forEach(r=>{r.hitTest(e.x,e.y)&&this.updateCursor(r.cursor)}),this.extensionLayer.forEach(r=>{r.hitTest(e.x,e.y)&&this.updateCursor(r.cursor)}))})}setCursorForBounds(e,t,r,s=0){const i=Xn.hitTestOf(t,{extensionY:s});s?this.extensionLayer.set(e,{cursor:r,hitTest:i}):this.normalLayer.set(e,{cursor:r,hitTest:i})}setCursorForCanvasEl(e,t,r){this.observeCursorType(e,t,r)}removeCursorForCanvasEl(e){this.normalLayer.delete(e),this.extensionLayer.delete(e)}observeCursorChanged(){return this.cursorChangedSubject.pipe(Ve())}observeCursorType(e,t,r){const s=r?this.canvasBoundsContainer.getBoundsHitTest(e,{extensionY:r}):this.canvasBoundsContainer.getBoundsHitTest(e);r?this.extensionLayer.set(e,{cursor:t,hitTest:s}):this.normalLayer.set(e,{cursor:t,hitTest:s})}updateCursor(e){this.element.style.cursor!==e&&(this.element.style.cursor=e,this.cursorChangedSubject.next(e))}}const cl=n=>{const e=n.canvasArea!==null,t=n.snapshotCanvas!==null,r=n.backgroundCanvas!==null,s=n.mainCanvas!==null,i=n.overDataSeriesCanvas!==null,a=n.staticDrawingCanvas!==null,o=n.dynamicDrawingCanvas!==null,l=n.yAxisLabelsCanvas!==null,c=n.crossToolCanvas!==null,h=n.hitTestCanvas!==null,v=n.chartResizer!==null,p=n.chartContainer!==null,y=n.dataSeriesCanvas!==null;return e&&t&&r&&s&&i&&a&&o&&l&&c&&h&&v&&p&&y},hl=n=>`<div data-element="chartResizer" style="position: relative; min-height: 20px; height: 100%; width: 100%; touch-action: manipulation; z-index: 0;">
|
|
8
|
+
`):"",this.name="UnsubscriptionError",this.errors=t}});function Ae(n,e){if(n){var t=n.indexOf(e);0<=t&&n.splice(t,1)}}var Ce=function(){function n(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return n.prototype.unsubscribe=function(){var e,t,r,s,i;if(!this.closed){this.closed=!0;var a=this._parentage;if(a)if(this._parentage=null,Array.isArray(a))try{for(var o=b(a),l=o.next();!l.done;l=o.next()){var c=l.value;c.remove(this)}}catch(R){e={error:R}}finally{try{l&&!l.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}else a.remove(this);var h=this.initialTeardown;if(L(h))try{h()}catch(R){i=R instanceof Se?R.errors:[R]}var v=this._finalizers;if(v){this._finalizers=null;try{for(var p=b(v),y=p.next();!y.done;y=p.next()){var E=y.value;try{Ee(E)}catch(R){i=i!=null?i:[],R instanceof Se?i=g(g([],P(i)),P(R.errors)):i.push(R)}}}catch(R){r={error:R}}finally{try{y&&!y.done&&(s=p.return)&&s.call(p)}finally{if(r)throw r.error}}}if(i)throw new Se(i)}},n.prototype.add=function(e){var t;if(e&&e!==this)if(this.closed)Ee(e);else{if(e instanceof n){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(t=this._finalizers)!==null&&t!==void 0?t:[]).push(e)}},n.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},n.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},n.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&Ae(t,e)},n.prototype.remove=function(e){var t=this._finalizers;t&&Ae(t,e),e instanceof n&&e._removeParent(this)},n.EMPTY=function(){var e=new n;return e.closed=!0,e}(),n}(),Ne=Ce.EMPTY;function De(n){return n instanceof Ce||n&&"closed"in n&&L(n.remove)&&L(n.add)&&L(n.unsubscribe)}function Ee(n){L(n)?n():n.unsubscribe()}var ke={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},st={setTimeout:function(n,e){for(var t=[],r=2;r<arguments.length;r++)t[r-2]=arguments[r];var s=st.delegate;return s!=null&&s.setTimeout?s.setTimeout.apply(s,g([n,e],P(t))):setTimeout.apply(void 0,g([n,e],P(t)))},clearTimeout:function(n){var e=st.delegate;return((e==null?void 0:e.clearTimeout)||clearTimeout)(n)},delegate:void 0};function xt(n){st.setTimeout(function(){var e=ke.onUnhandledError;if(e)e(n);else throw n})}function Mt(){}var It=function(){return Ze("C",void 0,void 0)}();function Ot(n){return Ze("E",void 0,n)}function Tn(n){return Ze("N",n,void 0)}function Ze(n,e,t){return{kind:n,value:e,error:t}}var Le=null;function it(n){if(ke.useDeprecatedSynchronousErrorHandling){var e=!Le;if(e&&(Le={errorThrown:!1,error:null}),n(),e){var t=Le,r=t.errorThrown,s=t.error;if(Le=null,r)throw s}}else n()}function Bt(n){ke.useDeprecatedSynchronousErrorHandling&&Le&&(Le.errorThrown=!0,Le.error=n)}var at=function(n){I(e,n);function e(t){var r=n.call(this)||this;return r.isStopped=!1,t?(r.destination=t,De(t)&&t.add(r)):r.destination=Fa,r}return e.create=function(t,r,s){return new vt(t,r,s)},e.prototype.next=function(t){this.isStopped?ot(Tn(t),this):this._next(t)},e.prototype.error=function(t){this.isStopped?ot(Ot(t),this):(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped?ot(It,this):(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,n.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(t){this.destination.next(t)},e.prototype._error=function(t){try{this.destination.error(t)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e}(Ce),_n=Function.prototype.bind;function Rt(n,e){return _n.call(n,e)}var An=function(){function n(e){this.partialObserver=e}return n.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(r){be(r)}},n.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(r){be(r)}else be(e)},n.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(t){be(t)}},n}(),vt=function(n){I(e,n);function e(t,r,s){var i=n.call(this)||this,a;if(L(t)||!t)a={next:t!=null?t:void 0,error:r!=null?r:void 0,complete:s!=null?s:void 0};else{var o;i&&ke.useDeprecatedNextContext?(o=Object.create(t),o.unsubscribe=function(){return i.unsubscribe()},a={next:t.next&&Rt(t.next,o),error:t.error&&Rt(t.error,o),complete:t.complete&&Rt(t.complete,o)}):a=t}return i.destination=new An(a),i}return e}(at);function be(n){ke.useDeprecatedSynchronousErrorHandling?Bt(n):xt(n)}function je(n){throw n}function ot(n,e){var t=ke.onStoppedNotification;t&&st.setTimeout(function(){return t(n,e)})}var Fa={closed:!0,next:Mt,error:je,complete:Mt};function We(n,e,t,r,s){return new Ya(n,e,t,r,s)}var Ya=function(n){I(e,n);function e(t,r,s,i,a,o){var l=n.call(this,t)||this;return l.onFinalize=a,l.shouldUnsubscribe=o,l._next=r?function(c){try{r(c)}catch(h){t.error(h)}}:n.prototype._next,l._error=i?function(c){try{i(c)}catch(h){t.error(h)}finally{this.unsubscribe()}}:n.prototype._error,l._complete=s?function(){try{s()}catch(c){t.error(c)}finally{this.unsubscribe()}}:n.prototype._complete,l}return e.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;n.prototype.unsubscribe.call(this),!r&&((t=this.onFinalize)===null||t===void 0||t.call(this))}},e}(at);function ye(n,e){return w(function(t,r){var s=0;t.subscribe(We(r,function(i){r.next(n.call(e,i,s++))}))})}var xr=function(n){return n&&typeof n.length=="number"&&typeof n!="function"};function Mr(n){return L(n==null?void 0:n.then)}var Dn=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function Pt(n){return n}function sv(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];return Pr(n)}function Pr(n){return n.length===0?Pt:n.length===1?n[0]:function(t){return n.reduce(function(r,s){return s(r)},t)}}var xe=function(){function n(e){e&&(this._subscribe=e)}return n.prototype.lift=function(e){var t=new n;return t.source=this,t.operator=e,t},n.prototype.subscribe=function(e,t,r){var s=this,i=Na(e)?e:new vt(e,t,r);return it(function(){var a=s,o=a.operator,l=a.source;i.add(o?o.call(i,l):l?s._subscribe(i):s._trySubscribe(i))}),i},n.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},n.prototype.forEach=function(e,t){var r=this;return t=Tr(t),new t(function(s,i){var a=new vt({next:function(o){try{e(o)}catch(l){i(l),a.unsubscribe()}},error:i,complete:s});r.subscribe(a)})},n.prototype._subscribe=function(e){var t;return(t=this.source)===null||t===void 0?void 0:t.subscribe(e)},n.prototype[Dn]=function(){return this},n.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Pr(e)(this)},n.prototype.toPromise=function(e){var t=this;return e=Tr(e),new e(function(r,s){var i;t.subscribe(function(a){return i=a},function(a){return s(a)},function(){return r(i)})})},n.create=function(e){return new n(e)},n}();function Tr(n){var e;return(e=n!=null?n:ke.Promise)!==null&&e!==void 0?e:Promise}function Ha(n){return n&&L(n.next)&&L(n.error)&&L(n.complete)}function Na(n){return n&&n instanceof at||Ha(n)&&De(n)}function _r(n){return L(n[Dn])}function Ar(n){return Symbol.asyncIterator&&L(n==null?void 0:n[Symbol.asyncIterator])}function Dr(n){return new TypeError("You provided "+(n!==null&&typeof n=="object"?"an invalid object":"'"+n+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function ka(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Er=ka();function Lr(n){return L(n==null?void 0:n[Er])}function Ir(n){return _(this,arguments,function(){var t,r,s,i;return d(this,function(a){switch(a.label){case 0:t=n.getReader(),a.label=1;case 1:a.trys.push([1,,9,10]),a.label=2;case 2:return[4,x(t.read())];case 3:return r=a.sent(),s=r.value,i=r.done,i?[4,x(void 0)]:[3,5];case 4:return[2,a.sent()];case 5:return[4,x(s)];case 6:return[4,a.sent()];case 7:return a.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}})})}function Or(n){return L(n==null?void 0:n.getReader)}function Ke(n){if(n instanceof xe)return n;if(n!=null){if(_r(n))return Wa(n);if(xr(n))return Ua(n);if(Mr(n))return za(n);if(Ar(n))return Br(n);if(Lr(n))return Xa(n);if(Or(n))return ja(n)}throw Dr(n)}function Wa(n){return new xe(function(e){var t=n[Dn]();if(L(t.subscribe))return t.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function Ua(n){return new xe(function(e){for(var t=0;t<n.length&&!e.closed;t++)e.next(n[t]);e.complete()})}function za(n){return new xe(function(e){n.then(function(t){e.closed||(e.next(t),e.complete())},function(t){return e.error(t)}).then(null,xt)})}function Xa(n){return new xe(function(e){var t,r;try{for(var s=b(n),i=s.next();!i.done;i=s.next()){var a=i.value;if(e.next(a),e.closed)return}}catch(o){t={error:o}}finally{try{i&&!i.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}e.complete()})}function Br(n){return new xe(function(e){Va(n,e).catch(function(t){return e.error(t)})})}function ja(n){return Br(Ir(n))}function Va(n,e){var t,r,s,i;return O(this,void 0,void 0,function(){var a,o;return d(this,function(l){switch(l.label){case 0:l.trys.push([0,5,6,11]),t=W(n),l.label=1;case 1:return[4,t.next()];case 2:if(r=l.sent(),!!r.done)return[3,4];if(a=r.value,e.next(a),e.closed)return[2];l.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return o=l.sent(),s={error:o},[3,11];case 6:return l.trys.push([6,,9,10]),r&&!r.done&&(i=t.return)?[4,i.call(t)]:[3,8];case 7:l.sent(),l.label=8;case 8:return[3,10];case 9:if(s)throw s.error;return[7];case 10:return[7];case 11:return e.complete(),[2]}})})}function qe(n,e,t,r,s){r===void 0&&(r=0),s===void 0&&(s=!1);var i=e.schedule(function(){t(),s?n.add(this.schedule(null,r)):this.unsubscribe()},r);if(n.add(i),!s)return i}function Ga(n,e,t,r,s,i,a,o){var l=[],c=0,h=0,v=!1,p=function(){v&&!l.length&&!c&&e.complete()},y=function(R){return c<r?E(R):l.push(R)},E=function(R){i&&e.next(R),c++;var N=!1;Ke(t(R,h++)).subscribe(We(e,function(k){s==null||s(k),i?y(k):e.next(k)},function(){N=!0},void 0,function(){if(N)try{c--;for(var k=function(){var U=l.shift();a?qe(e,a,function(){return E(U)}):E(U)};l.length&&c<r;)k();p()}catch(U){e.error(U)}}))};return n.subscribe(We(e,y,function(){v=!0,p()})),function(){o==null||o()}}function Rr(n,e,t){return t===void 0&&(t=1/0),L(e)?Rr(function(r,s){return ye(function(i,a){return e(r,i,s,a)})(Ke(n(r,s)))},t):(typeof e=="number"&&(t=e),w(function(r,s){return Ga(r,s,n,t)}))}function Fr(n){return n===void 0&&(n=1/0),Rr(Pt,n)}var Yr=new xe(function(n){return n.complete()});function iv(n){return n?$a(n):Yr}function $a(n){return new Observable(function(e){return n.schedule(function(){return e.complete()})})}function Hr(n){return n&&L(n.schedule)}function En(n){return n[n.length-1]}function Za(n){return L(En(n))?n.pop():void 0}function Kt(n){return Hr(En(n))?n.pop():void 0}function Ka(n,e){return typeof En(n)=="number"?n.pop():e}function Nr(n,e){return e===void 0&&(e=0),w(function(t,r){t.subscribe(We(r,function(s){return qe(r,n,function(){return r.next(s)},e)},function(){return qe(r,n,function(){return r.complete()},e)},function(s){return qe(r,n,function(){return r.error(s)},e)}))})}function kr(n,e){return e===void 0&&(e=0),w(function(t,r){r.add(n.schedule(function(){return t.subscribe(r)},e))})}function qa(n,e){return Ke(n).pipe(kr(e),Nr(e))}function Ja(n,e){return Ke(n).pipe(kr(e),Nr(e))}function Qa(n,e){return new xe(function(t){var r=0;return e.schedule(function(){r===n.length?t.complete():(t.next(n[r++]),t.closed||this.schedule())})})}function eo(n,e){return new xe(function(t){var r;return qe(t,e,function(){r=n[Er](),qe(t,e,function(){var s,i,a;try{s=r.next(),i=s.value,a=s.done}catch(o){t.error(o);return}a?t.complete():t.next(i)},0,!0)}),function(){return L(r==null?void 0:r.return)&&r.return()}})}function Wr(n,e){if(!n)throw new Error("Iterable cannot be null");return new xe(function(t){qe(t,e,function(){var r=n[Symbol.asyncIterator]();qe(t,e,function(){r.next().then(function(s){s.done?t.complete():t.next(s.value)})},0,!0)})})}function to(n,e){return Wr(Ir(n),e)}function no(n,e){if(n!=null){if(_r(n))return qa(n,e);if(xr(n))return Qa(n,e);if(Mr(n))return Ja(n,e);if(Ar(n))return Wr(n,e);if(Lr(n))return eo(n,e);if(Or(n))return to(n,e)}throw Dr(n)}function qt(n,e){return e?no(n,e):Ke(n)}function Me(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];var t=Kt(n),r=Ka(n,1/0),s=n;return s.length?s.length===1?Ke(s[0]):Fr(r)(qt(s,t)):Yr}class Ln{constructor(e,t){this.onTickFunction=t,this.animationTimeLeft=0,this.animationInProgress=!1,this.animationTime=e.duration,this.animationTimeLeft=e.timeLeft===void 0?e.duration:e.timeLeft,this.animationInProgress=!0}tick(){this.animationTimeLeft<=0?this.animationInProgress=!1:this.animationTimeLeft--,this.onTickFunction&&this.onTickFunction()}getProgress(){return 1-this.animationTimeLeft/this.animationTime}finishAnimation(){this.animationInProgress=!1,this.animationTimeLeft=0}}var gt=_e(6767),Jt=_e.n(gt);class ro extends Ln{constructor(e,t,r=()=>{}){super(e,r),this.colorConfigs=t,t.forEach(s=>{s.rgbColor=gt.rgb(s.color),s.initialAlpha=s.rgbColor.valpha,s.currentAnimationColor=s.rgbColor})}tick(){super.tick(),this.animationInProgress&&this.colorConfigs.forEach(e=>{e.initialAlpha===void 0||e.rgbColor===void 0||(e.type==="fading"?e.currentAnimationColor=e.rgbColor.alpha(e.initialAlpha*this.animationTimeLeft/this.animationTime):e.type==="appearing"&&(e.currentAnimationColor=e.rgbColor.alpha(e.initialAlpha*(1-this.animationTimeLeft/this.animationTime))))})}getColor(e){var t,r;return(r=(t=this.colorConfigs[e].currentAnimationColor)==null?void 0:t.toString())!=null?r:"#FFFFFF"}revert(){this.animationTimeLeft=Math.max(this.animationTime-this.animationTimeLeft,1),this.colorConfigs.forEach(e=>{e.type==="fading"?e.type="appearing":e.type="fading"})}}class so extends Ln{constructor(e,t,r=()=>{}){super(e,r),this.colorConfigs=t,t.forEach(s=>{s.rgbStartColor=gt.rgb(s.startColor),s.rgbEndColor=gt.rgb(s.endColor),s.currentAnimationColor=s.type==="appearing"?s.rgbStartColor:s.rgbEndColor})}tick(){super.tick(),this.animationInProgress&&this.colorConfigs.forEach(e=>{const t=1-this.animationTimeLeft/this.animationTime;!e.rgbStartColor||!e.rgbEndColor||(e.type==="fading"?e.currentAnimationColor=this.calculateTransitionColor(e.rgbEndColor,e.rgbStartColor,t):e.type==="appearing"&&(e.currentAnimationColor=this.calculateTransitionColor(e.rgbStartColor,e.rgbEndColor,t)))})}getColor(e){var t,r;return(r=(t=this.colorConfigs[e].currentAnimationColor)==null?void 0:t.toString())!=null?r:"#FFFFFF"}revert(){this.animationTimeLeft=Math.max(this.animationTime-this.animationTimeLeft,1),this.colorConfigs.forEach(e=>{e.type==="fading"?e.type="appearing":e.type="fading"})}moveToLastTick(){this.animationTimeLeft=1}calculateTransitionColor(e,t,r){const s=e.red()-(e.red()-t.red())*r,i=e.green()-(e.green()-t.green())*r,a=e.blue()-(e.blue()-t.blue())*r;return gt.rgb(s,i,a)}}var io=Math.pow;const Qt=14,en=[];for(let n=0;n<Qt+1;n++)en.push(io(10,n));const In=5e-13;class we{static roundToNearest(e,t){return isFinite(e)?we.isZero(e)?0:(e>0?e+=In:e<0&&(e-=In),we.roundDecimal(Math.round(we.roundDecimal(e/t))*t)):e}static roundUpToNearest(e,t){return we.roundDecimal(Math.ceil(e/t))*t}static roundDecimal(e){if(isNaN(e)||e===Math.floor(e))return e;const t=Math.sign(e),r=Math.abs(e),s=Math.min(Qt,Qt-1-Math.floor(Math.log10(r)));for(let i=s;i>=0;i--){const a=Math.floor(en[i]*r+.5);if(a<en[Qt])return t*a/en[i]}return Math.round(e)}static makeDecimal(e,t,r){if(isFinite(e)){const s=e.toFixed(t);return r?s.replace(".",r):s}else return""}static compare(e,t,r){return e>t+r?1:e<t-r?-1:(isNaN(e)?1:0)-(isNaN(t)?1:0)}static isZero(e){return we.compare(e,0,In)===0}static cutNumber(e,t,r=0){return{K:i=>i/1e3,M:i=>i/1e6}[t](e).toFixed(r)+t}}function ao(n,e,t){const r=n/e;return r>=t||r<=1/t}function Ur(n,e,t){return Math.max(e,Math.min(n,t))}function oo(n){return 1-(Math.pow(2,-10*n)-.0009765625)*1.0009775171065494}function Ft(...n){for(const e of n)if(e!==void 0&&isFinite(e))return e;return NaN}const ve=n=>~~n,lo=n=>~~(n+1),pt=n=>~~(n+.5),co=(n,e)=>n>>e;function Je(){const n=()=>Math.random().toString(16).slice(-4);return`${n()+n()}-${n()}-${n()}-${n()}-${n()+n()+n()}`}class ho extends Ln{constructor(e,t,r){var s;super(t,r),this.viewportModel=e,this.animationConfig=t,this.id=Je(),this.xStart=e.xStart,this.xEnd=e.xEnd,this.yStart=e.yStart,this.yEnd=e.yEnd,this.zoomX=e.zoomX,this.zoomY=e.zoomY,this.easingFn=(s=t.easingFn)!=null?s:oo}tick(){if(super.tick(),this.animationInProgress){const e=this.easingFn(this.getProgress()),t=this.xStart+(this.animationConfig.targetXStart-this.xStart)*e,r=this.xEnd+(this.animationConfig.targetXEnd-this.xEnd)*e,s=this.yStart+(this.animationConfig.targetYStart-this.yStart)*e,i=this.yEnd+(this.animationConfig.targetYEnd-this.yEnd)*e,a=this.zoomX+(this.animationConfig.targetZoomX-this.zoomX)*e,o=this.zoomY+(this.animationConfig.targetZoomY-this.zoomY)*e;this.viewportModel.apply({xStart:t,xEnd:r,yStart:s,yEnd:i,zoomX:a,zoomY:o,inverseY:this.viewportModel.inverseY})}}finishAnimation(){super.finishAnimation(),this.viewportModel.apply({xStart:this.animationConfig.targetXStart,xEnd:this.animationConfig.targetXEnd,yStart:this.animationConfig.targetYStart,yEnd:this.animationConfig.targetYEnd,zoomX:this.animationConfig.targetZoomX,zoomY:this.animationConfig.targetZoomY,inverseY:this.viewportModel.inverseY})}}var uo=Object.defineProperty,fo=Object.defineProperties,vo=Object.getOwnPropertyDescriptors,zr=Object.getOwnPropertySymbols,go=Object.prototype.hasOwnProperty,po=Object.prototype.propertyIsEnumerable,Xr=(n,e,t)=>e in n?uo(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,mo=(n,e)=>{for(var t in e||(e={}))go.call(e,t)&&Xr(n,t,e[t]);if(zr)for(var t of zr(e))po.call(e,t)&&Xr(n,t,e[t]);return n},bo=(n,e)=>fo(n,vo(e));const jr=10,On="VIEWPORT_ANIMATION";class Co{constructor(e){this.eventBus=e,this.animations={}}startViewportMovementAnimation(e,t,r=On,s){const i=new ho(e,t,s);return this.animations[r]=i,this.ensureIntervalStarted(),i}startColorAlphaAnimation(e,t,r,s){const i=new ro(bo(mo({},s),{duration:s&&s.duration||jr}),t,r);return this.animations[e]=i,this.ensureIntervalStarted(),i}startColorTransitionAnimation(e,t,r=jr,s){const i=new so({duration:r},t,s);return this.animations[e]=i,this.ensureIntervalStarted(),i}getAnimation(e){return this.animations[e]}getColorAlphaAnimation(e){return this.getAnimation(e)}getColorTransitionAnimation(e){return this.getAnimation(e)}forceStopAnimation(e){const t=this.animations[e];t&&(t.animationTimeLeft=-1,t.animationInProgress=!1)}ensureIntervalStarted(){this.animationIntervalId||(this.animationIntervalId=window.setInterval(()=>this.tick(),20))}tick(){let e=!0;for(const t of Object.keys(this.animations)){const r=this.animations[t];r.tick(),r.animationInProgress&&(e=!1)}e?this.stopInterval():this.eventBus.fireDraw()}stopInterval(){clearInterval(this.animationIntervalId),this.animationIntervalId=void 0}}var yo=ge(function(n){return function(){n(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),G=function(n){I(e,n);function e(){var t=n.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return e.prototype.lift=function(t){var r=new Vr(this,this);return r.operator=t,r},e.prototype._throwIfClosed=function(){if(this.closed)throw new yo},e.prototype.next=function(t){var r=this;it(function(){var s,i;if(r._throwIfClosed(),!r.isStopped){r.currentObservers||(r.currentObservers=Array.from(r.observers));try{for(var a=b(r.currentObservers),o=a.next();!o.done;o=a.next()){var l=o.value;l.next(t)}}catch(c){s={error:c}}finally{try{o&&!o.done&&(i=a.return)&&i.call(a)}finally{if(s)throw s.error}}}})},e.prototype.error=function(t){var r=this;it(function(){if(r._throwIfClosed(),!r.isStopped){r.hasError=r.isStopped=!0,r.thrownError=t;for(var s=r.observers;s.length;)s.shift().error(t)}})},e.prototype.complete=function(){var t=this;it(function(){if(t._throwIfClosed(),!t.isStopped){t.isStopped=!0;for(var r=t.observers;r.length;)r.shift().complete()}})},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(e.prototype,"observed",{get:function(){var t;return((t=this.observers)===null||t===void 0?void 0:t.length)>0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(t){return this._throwIfClosed(),n.prototype._trySubscribe.call(this,t)},e.prototype._subscribe=function(t){return this._throwIfClosed(),this._checkFinalizedStatuses(t),this._innerSubscribe(t)},e.prototype._innerSubscribe=function(t){var r=this,s=this,i=s.hasError,a=s.isStopped,o=s.observers;return i||a?Ne:(this.currentObservers=null,o.push(t),new Ce(function(){r.currentObservers=null,Ae(o,t)}))},e.prototype._checkFinalizedStatuses=function(t){var r=this,s=r.hasError,i=r.thrownError,a=r.isStopped;s?t.error(i):a&&t.complete()},e.prototype.asObservable=function(){var t=new xe;return t.source=this,t},e.create=function(t,r){return new Vr(t,r)},e}(xe),Vr=function(n){I(e,n);function e(t,r){var s=n.call(this)||this;return s.destination=t,s.source=r,s}return e.prototype.next=function(t){var r,s;(s=(r=this.destination)===null||r===void 0?void 0:r.next)===null||s===void 0||s.call(r,t)},e.prototype.error=function(t){var r,s;(s=(r=this.destination)===null||r===void 0?void 0:r.error)===null||s===void 0||s.call(r,t)},e.prototype.complete=function(){var t,r;(r=(t=this.destination)===null||t===void 0?void 0:t.complete)===null||r===void 0||r.call(t)},e.prototype._subscribe=function(t){var r,s;return(s=(r=this.source)===null||r===void 0?void 0:r.subscribe(t))!==null&&s!==void 0?s:Ne},e}(G),lt=function(n){I(e,n);function e(t){var r=n.call(this)||this;return r._value=t,r}return Object.defineProperty(e.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),e.prototype._subscribe=function(t){var r=n.prototype._subscribe.call(this,t);return!r.closed&&t.next(this._value),r},e.prototype.getValue=function(){var t=this,r=t.hasError,s=t.thrownError,i=t._value;if(r)throw s;return this._throwIfClosed(),i},e.prototype.next=function(t){n.prototype.next.call(this,this._value=t)},e}(G);function Ve(n,e){return e===void 0&&(e=Pt),n=n!=null?n:wo,w(function(t,r){var s,i=!0;t.subscribe(We(r,function(a){var o=e(a);(i||!n(s,o))&&(i=!1,s=o,r.next(a))}))})}function wo(n,e){return n===e}function So(n){return function(){n.forEach(t=>typeof t=="function"&&t()),n.length=0}}function Bn(n){return n}function Gr(n){return n!=null}const av=()=>{};function ov(n){return n!=null}function xo(n,e,t=Mo,r=!0){const s=n.filter(i=>e.some(a=>t(i,a)));return r?s.filter((i,a,o)=>o.indexOf(i)===a):s}const $r=(n,e)=>{const t=e.slice().filter(r=>n.find(s=>s===r));return n.map(r=>{var s;return e.indexOf(r)>=0&&(s=t.shift())!=null?s:r})},Mo=(n,e)=>n===e,lv=(n,e,t)=>n.filter(r=>e.filter(s=>t(r,s)).length===0),Po=(n,e)=>n===e,Zr=(n,e,t=Po)=>n.length===e.length&&n.every((r,s)=>t(r,e[s]));function cv(n,e,t){const r=n.slice(),s=r[e];return r.splice(e,1),r.splice(t,0,s),r}function Rn(n,e,t){const r=n.length,s=Ur(e,0,r-1),i=Ur(t,0,r-1),a=n[s];return n.splice(s,1),n.splice(i,0,a),n}function hv(n,e,t){const r=n.slice(),s=r.findIndex(e);return s!==-1&&(r.splice(s,1),r.splice(s,0,t)),r}const dv=n=>{const e={};return n.filter(t=>e[t]?!1:e[t]=!0)},uv=(n,e)=>n.reduce((t,r)=>((t[r[e]]=t[r[e]]||[]).push(r),t),{}),fv=(n,e)=>[].concat(...n.map(t=>[t,e])).slice(0,-1),vv=n=>Array.isArray(n[0]),Kr=n=>Array.isArray(n[0])?n:[n],To=(n,e,t)=>{const r=[];let s=0;for(const i of n){const a=Math.max(e-s,0),o=Math.max(t-s,-1),l=i.slice(a,o+1);l.length>0&&r.push(l),s+=i.length}return r},_o=(n,e)=>n>=0?e[n]:e[e.length+n],Ie=n=>Array.prototype.flat?n.flat():Tt(n,Bn),Tt=(n,e)=>{if(Array.prototype.flatMap)return n.flatMap(e);const t=[];for(let r=0;r<n.length;r++){const s=n[r];t.push(...e(s,r,n))}return t};function ct(n,e,t){const r=t!=null?t:Bn;return!n.length||e!==e?{index:-1,exact:!0}:Fn(n,e,0,n.length,r)}function Fn(n,e,t,r,s){const i=co(t+r,1),a=s(n[i]);return e===a?{index:i,exact:!0}:t===i?{index:t,exact:!1}:e<a?Fn(n,e,t,i,s):Fn(n,e,i,r,s)}function Ue(n){if(n&&n.length)return n[n.length-1]}function Ao(n){const e=this.indexOf(n);return e!==-1&&this.splice(e,1),this}function Do(n,e){if(!n)return;const t=n.indexOf(e);t!==-1&&n.splice(t,1)}function Yt(n){if(n)return n[0]}function Eo(n){function e(t,r){const s=n(r);return s==null||!isFinite(s)?t:[Math.max(t[0],s),Math.min(t[1],s)]}return function(t){const r=[Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY];return t?t.reduce(e,r):r}}function Lo(n,e,t,r=()=>0){const s=(a,o)=>{let l=0,c=a.length-1;for(;c>=l;){const h=Math.ceil((l+c)/2);r(a[h])<=o?l=h+1:c=h-1}return c},i=(a,o)=>{let l=0,c=a.length-1;for(;c>=l;){const h=Math.ceil((l+c)/2);r(a[h])>=o?c=h-1:l=h+1}return l};return n.slice(i(n,e),s(n,t)+1)}let Yn;const Hn=()=>(Yn||(Yn=!!navigator.userAgent.match(/Android|iPhone|Opera Mini/)||!1),Yn);function qr(n,e){let t="";e.textStyle&&(e.textStyle.italic&&(t+="italic "),e.textStyle.bold&&(t+="bold ")),n.font=t+(e.textSize||12)+" "+(e.textFontFamily||"monospace"),n.fillStyle=e.textFill||"#FFFFFF",e.rtl?n.textAlign="right":n.textAlign="start"}function Nn(n){const e=n.font.match(/(\d+.)?\d+(px|pt)/gi);let t="10px";return e&&e.length&&(e[0].includes("pt")?t=+e[0].slice(0,e[0].indexOf("pt"))*96/72+"px":t=e[0]),parseInt(t,10)*1.33}function Jr(n,e,t){n.save(),qr(n,t);const r=Math.ceil(Math.max.apply(Math,e.map(a=>n.measureText(a).width))),s=Nn(n),i=s*e.length;return n.restore(),[r,i,s]}function Qr(n){return(n||"").split(/\r\n|\r|\n/)}function Io(n,e,t,r,s){n.save();const[i,,a]=Jr(n,e,s);e.forEach((o,l)=>{var c,h,v;const p=n.measureText(o).width,y=Oo(t,i,p,(c=s.textAlign)!=null?c:"left");s.textStyle&&s.textStyle.underline&&Bo(n,o,y,r+a*l,(h=s.textFill)!=null?h:"",(v=s.textSize)!=null?v:""),n.fillText(o,y,r+a*l)}),n.restore()}function Oo(n,e,t,r){switch(r){case"left":return n;case"right":return n+e-t;default:return n}}function Bo(n,e,t,r,s,i){n.save();const a=n.measureText(e).width,o=t,l=t+a,c=r+2,h=c;let v=parseInt(i,10)/15;v<1&&(v=1),n.beginPath(),n.strokeStyle=s,n.lineWidth=v,n.moveTo(o,c),n.lineTo(l,h),n.stroke(),n.restore()}function gv(n){return`${n}px`}function Ht(n,e,t){const r=gt.rgb(n).array(),s=r[0],i=r[1],a=r[2];return(s*299+i*587+a*114)/1e3<128?e:t}function Ro(n,e,t,r){const s=r.components.navigationMap.timeLabels,i=s.padding,a=es(e,s.dateFormat,t),o=Qr(a),l={textFontFamily:s.fontFamily,textSize:`${s.fontSize}px`},[c,h]=Jr(n,o,l);return[c+i.x*2,h+i.y*2]}function es(n,e,t){return t(e)(n).split(" ").join(`
|
|
9
|
+
`)}const ts={};function Qe(n,e){let t=ts[n];return t!==void 0||(e.save(),e.font=n,t=e.measureText("M").width,ts[n]=t,e.restore()),t}const ns=new Map;function Re(n,e,t){const r=t+n;let s=ns.get(r);return s||(e.save(),e.font=t,s=e.measureText(n).width,ns.set(r,s),e.restore()),s}function Ge(n,e,t=rs){function r(s,i){for(const a in i)a in s?typeof s[a]=="object"&&s[a]!==null&&!Array.isArray(s[a])?r(s[a],i[a]):t!=null&&t.overrideExisting&&(s[a]=i[a]):t!=null&&t.addIfMissing&&(s[a]=i[a]);return s}return r(n,e)}function pv(n,e,t,r=!1){!n||!e||e.length===0||e.forEach(s=>{const i=t(s),a=n.findIndex(o=>t(o)===i);a===-1?n.push(s):r?Ge(n[a],s,{overrideExisting:!0,addIfMissing:!0}):n.splice(a,1,s)})}const rs={overrideExisting:!1,addIfMissing:!0};var Fo=Object.defineProperty,ss=Object.getOwnPropertySymbols,Yo=Object.prototype.hasOwnProperty,Ho=Object.prototype.propertyIsEnumerable,is=(n,e,t)=>e in n?Fo(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,No=(n,e)=>{for(var t in e||(e={}))Yo.call(e,t)&&is(n,t,e[t]);if(ss)for(var t of ss(e))Ho.call(e,t)&&is(n,t,e[t]);return n};const as="Open Sans Semibold, sans-serif",ko=null,Wo=["candle","line","area","bar","scatterPlot","trend","hollow","histogram","baseline"],mv=n=>ko.find(e=>e===n)!==void 0,tn=()=>({devexpertsPromoLink:!0,useUTCTimeOverride:!1,shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],rtl:!1,scale:{keepZoomXOnYAxisChange:!0,auto:!0,zoomToCursor:!1,lockPriceToBarRatio:!1,autoScaleOnCandles:!0,autoScaleDisableOnDrag:{enabled:!0,edgeAngle:Math.PI/15,yDiff:80},inverse:!1,zoomSensitivity:.25,defaultViewportItems:100},timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,components:{chart:{type:"candle",showCandlesBorder:!0,showActiveCandlesBorder:!0,showWicks:!0,candleLineWidth:1,lineWidth:1,areaLineWidth:1,barLineWidth:1,minWidth:.5,minCandles:10,candlePaddingPercent:.25,highlightActiveCandle:!0,cursor:"default",selectedWidth:3,minCandlesOffset:2,defaultZoomCandleWidth:7,zoomStep:0,histogram:{barCapSize:1}},yAxis:{type:"regular",visible:!0,labelHeight:23,zeroPercentLine:!0,customScale:!0,customScaleDblClick:!0,align:"right",fontSize:12,fontFamily:as,cursor:"ns-resize",resizeDisabledCursor:"default",labelBoxMargin:{top:4,bottom:4,end:8,start:10},typeConfig:{badge:{rounded:!0,paddings:{top:4,bottom:4,end:4,start:4}},plain:{},rectangle:{rounded:!1,paddings:{top:4,bottom:4,end:4,start:4}}},labels:{descriptions:!1,settings:{lastPrice:{mode:"label",type:"badge"},countdownToBarClose:{mode:"none",type:"rectangle"}}}},xAxis:{visible:!0,formatsForLabelsConfig:{lessThanSecond:"HH:mm:ss",second_1:"HH:mm:ss",minute_1:"HH:mm",minute_5:"HH:mm",minute_30:"HH:mm",hour_1:"HH:mm",day_1:"dd.MM",month_1:"MMM",year_1:"YYYY"},fontSize:12,fontFamily:as,cursor:"ew-resize",padding:{top:8,bottom:16},fontStyle:""},events:{visible:!1,eventsVisibility:{"conference-calls":!0,dividends:!0,splits:!0,earnings:!0},height:20,cursor:"default",xAxisLabelFormat:[{format:"d MMM"}],icons:{earnings:{normal:'<svg width="13" height="13" viewBox="0 0 13 13" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M1.06066 6.5L6.5 1.06066L11.9393 6.5L6.5 11.9393L1.06066 6.5Z" stroke="#D92C40" stroke-width="1.5"/></svg>',hover:'<svg width="13" height="13" viewBox="0 0 13 13" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M1.06066 6.5L6.5 1.06066L11.9393 6.5L6.5 11.9393L1.06066 6.5Z" fill="#D92C40" stroke="#D92C40" stroke-width="1.5"/></svg>'}}},offsets:{visible:!0,right:10,top:10,bottom:20,left:0},waterMark:{visible:!1,fontFamily:"Open Sans, sans-serif",firstRowFontSize:80,firstRowBottomPadding:10,secondRowFontSize:40,secondRowBottomPadding:25,thirdRowFontSize:40,thirdRowBottomPadding:15,position:"center",offsetX:20,offsetY:20,logoWidth:20,logoHeight:20},highLow:{visible:!1,font:"12px sans-serif"},highlights:{visible:!1,fontFamily:"Open Sans",fontSize:13,border:{width:1,dash:[8,4]}},crossTool:{type:"cross-and-labels",discrete:!1,magnetTarget:"none",lineDash:[4,6],xAxisLabelFormat:[{format:"dd.MM.YYYY",showWhen:{periodMoreThen:846e5}},{format:"dd.MM.YYYY HH:mm",showWhen:{periodLessThen:846e5,periodMoreThen:6e3}},{format:"dd.MM.YYYY HH:mm:ss",showWhen:{periodLessThen:6e3}}],xLabel:{padding:{top:4,bottom:4,right:8,left:8},margin:{top:4}},yLabel:{padding:{top:4,bottom:4,end:4,start:4},type:"badge"}},grid:{visible:!0,horizontal:!1,vertical:!0,width:1,dash:[0,0],color:"#FFFFFF"},volumes:{visible:!0,showSeparately:!1,valueLines:15,barCapSize:1,volumeBarSpace:0,volumeFillColor:"#FFFFFF"},navigationMap:{visible:!1,allCandlesHistory:!0,timeLabels:{visible:!1,dateFormat:"dd.MM.YYYY HH:mm",fontFamily:"Open Sans",fontSize:13,padding:{x:10,y:1}},minSliderWindowWidth:10,cursors:{chart:"default",buttonLeft:"pointer",buttonRight:"pointer",leftResizer:"ew-resize",rightResizer:"ew-resize",slider:"grab"},knots:{height:35,width:7,border:0,lineWidth:1}},baseline:{cursor:"ns-resize",dragZone:3,height:1},paneResizer:{cursor:"ns-resize",height:1,visible:!0,fixedMode:!1,dragZone:3}},colors:{candleTheme:{upColor:"rgba(77,153,83,1)",downColor:"rgba(217,44,64,1)",noneColor:"rgba(255,255,255,1)",upWickColor:"rgba(77,153,83,1)",downWickColor:"rgba(217,44,64,1)",noneWickColor:"rgba(255,255,255,1)",borderOpacity:1},barTheme:{upColor:"rgba(77,153,83,1)",downColor:"rgba(217,44,64,1)",noneColor:"rgba(255,255,255,1)"},lineTheme:{upColor:"rgba(77,153,83,1)",downColor:"rgba(217,44,64,1)",noneColor:"rgba(255,255,255,1)"},chartAreaTheme:{backgroundMode:"regular",backgroundColor:"rgba(20,20,19,1)",backgroundGradientTopColor:"red",backgroundGradientBottomColor:"blue",axisColor:"rgba(128,128,128,1)",gridColor:"rgba(37,37,36,1)"},scatterPlot:{mainColor:"rgba(255,255,255,1)"},areaTheme:{lineColor:"rgba(127,120,214,1)",startColor:"rgba(169,38,251,1)",stopColor:"rgba(169,38,251,0.8)"},baseLineTheme:{lowerSectionStrokeColor:"rgba(217,44,64,1)",upperSectionStrokeColor:"rgba(77,153,83,1)",lowerSectionFillColor:"rgba(217, 44, 64, 0.07)",upperSectionFillColor:"rgba(77, 153, 83, 0.07)",baselineColor:"rgba(55,55,54,1)"},histogram:{upCap:"rgba(77,153,83,1)",upBottom:"rgba(77,153,83,0.1)",upBright:"rgba(77,153,83,0.4)",downCap:"rgba(217,44,64,1)",downBottom:"rgba(217,44,64,0.1)",downBright:"rgba(217,44,64,0.4)",noneCap:"rgba(255,255,255,1)",noneBottom:"rgba(255,255,255,0.1)",noneBright:"rgba(255,255,255,0.4)"},crossTool:{lineColor:"rgba(107,96,86,1)",labelBoxColor:"rgba(107,96,86,1)",labelTextColor:"rgba(255,255,255,1)"},waterMarkTheme:{firstRowColor:"rgba(255,255,255,0.2)",secondRowColor:"rgba(255,255,255,0.2)",thirdRowColor:"rgba(255,255,255,0.2)"},highlights:{NO_TRADING:{border:"rgba(107,96,86,1)",background:"transparent",label:"transparent"},AFTER_MARKET:{border:"rgba(107,96,86,1)",background:"rgba(38, 251, 149, 0.05)",label:"transparent"},PRE_MARKET:{border:"rgba(107,96,86,1)",background:"rgba(255, 170, 0, 0.05)",label:"transparent"},REGULAR:{border:"rgba(107,96,86,1)",background:"transparent",label:"transparent"}},activeCandleTheme:{upColor:"rgba(98,201,93,1)",downColor:"rgba(255,47,47,1)",noneColor:"rgba(255,255,255,1)",upWickColor:"rgba(98,201,93,1)",downWickColor:"rgba(255,47,47,1)",noneWickColor:"rgba(255,255,255,1)",borderOpacity:.5},volume:{downBarColor:"rgba(99,30,37,1)",upBarColor:"rgba(42,72,44,1)",noneBarColor:"rgba(255,255,255,0.4)",upCapColor:"rgba(42,72,44,1)",downCapColor:"rgba(99,30,37,1)",noneCapColor:"rgba(255,255,255,0.4)"},highLowTheme:{highColor:"rgba(223,222,223,1)",lowColor:"rgba(223,222,223,1)"},instrumentInfo:{textColor:"#aeb1b3"},paneResizer:{lineColor:"rgba(55,55,54,1)",bgColor:"rgba(20,20,19,1)",bgHoverColor:"rgba(55,55,54,0.6)"},events:{earnings:{color:"rgba(217,44,64,1)"},dividends:{color:"rgba(169,38,251,1)"},splits:{color:"rgba(244,187,63,1)"},"conference-calls":{color:"rgba(48,194,97,1)"}},secondaryChartTheme:[{lineTheme:{upColor:"rgba(226,61,25,1)",downColor:"rgba(226,61,25,1)",noneColor:"rgba(226,61,25,1)"},areaTheme:{lineColor:"rgba(226,61,25,1)",startColor:"rgba(226,61,25,0.8)",stopColor:"rgba(226,61,25,0)"}},{lineTheme:{upColor:"rgba(250,191,64,1)",downColor:"rgba(250,191,64,1)",noneColor:"rgba(250,191,64,1)"},areaTheme:{lineColor:"rgba(250,191,64,1)",startColor:"rgba(250,191,64,0.8)",stopColor:"rgba(250,191,64,0)"}},{lineTheme:{upColor:"rgba(169,38,251,1)",downColor:"rgba(169,38,251,1)",noneColor:"rgba(169,38,251,1)"},areaTheme:{lineColor:"rgba(169,38,251,1)",startColor:"rgba(169,38,251,0.8)",stopColor:"rgba(169,38,251,0)"}},{lineTheme:{upColor:"rgba(77,211,240,1)",downColor:"rgba(77,211,240,1)",noneColor:"rgba(77,211,240,1)"},areaTheme:{lineColor:"rgba(77,211,240,1)",startColor:"rgba(77,211,240,0.8)",stopColor:"rgba(77,211,240,0)"}},{lineTheme:{upColor:"rgba(59,203,91,1)",downColor:"rgba(59,203,91,1)",noneColor:"rgba(59,203,91,1)"},areaTheme:{lineColor:"rgba(59,203,91,1)",startColor:"rgba(59,203,91,0.8)",stopColor:"rgba(59,203,91,0)"}}],yAxis:{backgroundColor:"transparent",backgroundHoverColor:"rgba(20,20,19,1)",labelBoxColor:"rgba(20,20,19,1)",labelTextColor:"rgba(128,128,128,1)",labelInvertedTextColor:"rgba(20,20,19,1)",rectLabelTextColor:"rgba(255,255,255,1)",rectLabelInvertedTextColor:"rgba(20,20,19,1)",zeroPercentLine:"rgba(55,55,54,1)"},labels:{lastPrice:{textNegative:"rgba(255,255,255,1)",textPositive:"rgba(255,255,255,1)",textSelected:"rgba(0,0,0,1)",boxNegative:"rgba(217,44,64,1)",boxPositive:"rgba(77,153,83,1)",boxSelected:"rgba(255,255,255,1)"},countdownToBarClose:{textNegative:"rgba(255,255,255,1)",textPositive:"rgba(255,255,255,1)",textSelected:"rgba(255,255,255,1)",boxNegative:"rgba(217,44,64,1)",boxPositive:"rgba(77,153,83,1)",boxSelected:"rgba(255,255,255,1)"},highLow:{high:{boxColor:"rgba(107,96,86,1)",textColor:"rgba(255,255,255,1)",descriptionText:"High"},low:{boxColor:"rgba(107,96,86,1)",textColor:"rgba(255,255,255,1)",descriptionText:"Low"}},bidAsk:{bid:{boxColor:"rgba(77,153,83,1)",textColor:"rgba(255,255,255,1)",descriptionText:"Bid"},ask:{boxColor:"rgba(217,44,64,1)",textColor:"rgba(255,255,255,1)",descriptionText:"Ask"}},prePostMarket:{post:{boxColor:"rgba(38,251,149,1)",textColor:"rgba(20,20,19,1)",descriptionText:"Post"},pre:{boxColor:"rgba(255,170,0,1)",textColor:"rgba(20,20,19,1)",descriptionText:"Pre"}},prevDayClose:{boxColor:"rgba(107,96,86,1)",textColor:"rgba(255,255,255,1)"}},xAxis:{backgroundColor:"transparent",labelTextColor:"rgba(128,128,128,1)"},navigationMap:{backgroundColor:"transparent",buttonColor:"rgba(255,255,255,0.1)",buttonArrowColor:"rgba(212,212,211,1)",knotColor:"rgba(255,255,255,0.1)",knotLineColor:"rgba(212,212,211,1)",sliderColor:"rgba(255,255,255,0.08)",knotBorderColor:"#0b0d1a",timeLabelsTextColor:"rgba(128,128,128,1)",mapColor:"rgba(255,255,255,0.1)",mapFillColor:"rgba(255,255,255,0.1)",mapGradientTopColor:"rgba(255,255,255,0.1)",mapGradientBottomColor:"rgba(255,255,255,0.1)"}},animation:{moveDuration:1e3,candleDuration:200,paneResizer:{bgMode:!0,enabled:!0,duration:40},yAxis:{background:{enabled:!1,duration:40}}},drawingOrder:["OVER_SERIES_CLEAR","MAIN_CLEAR","SERIES_CLEAR","GRID","X_AXIS","Y_AXIS","UNDERLAY_VOLUMES_AREA","VOLUMES","DATA_SERIES","DRAWINGS","WATERMARK","N_MAP_CHART","EVENTS"]});function Uo(n,e=tn()){return Ge(n,e,rs),n}function bv(n,e=tn()){const t=No({},n);return merge(t,e,DEFAULT_MERGE_OPTIONS),t}function Cv(n,e){Object.keys(n).forEach(t=>delete n[t]),Object.keys(e).forEach(t=>n[t]=e[t])}function os(n){return typeof n=="object"&&n!==null}function ls(n,e){return[...n].map(r=>kn(r,e))}const zo=n=>Array.isArray(n);function kn(n,e){if(!os(n))return n;if(zo(n))return ls(n,e);{const t=cs({},n,e);return Object.setPrototypeOf(t,Object.getPrototypeOf(n)),t}}function cs(n,e,t){if(!os(n))return t.overrideExisting?e:n;if(Array.isArray(n)&&Array.isArray(e)){const s=t.overrideExisting?e:n;return ls(s,t)}const r=Object.create(Object.getPrototypeOf(n));return Object.keys(n).forEach(s=>r[s]=kn(n[s],t)),Object.keys(e).forEach(s=>{s in n?r[s]=cs(n[s],e[s],t):t.addIfMissing&&(r[s]=kn(e[s],t))}),r}const mt=n=>`${n.fontSize}px ${n.fontFamily}`;class Xo{constructor(e,t){this.config=e,this.mainCanvasModel=t,this.extentsOrder=new Map,this.yAxisWidthContributors=[]}registerYAxisWidthContributor(e){this.yAxisWidthContributors.push(e)}removeYAxisWidthContributor(e){this.yAxisWidthContributors=this.yAxisWidthContributors.filter(t=>t!==e)}getTextWidth(e){const t=mt(this.config.components.yAxis);return Re(e,this.mainCanvasModel.ctx,t)}getYAxisWidths(){this.extentsOrder.clear();const e=[],t=[],r=this.config.components.yAxis.labelBoxMargin.start+this.config.components.yAxis.labelBoxMargin.end;return this.yAxisWidthContributors.forEach(s=>{var i,a,o;const l=this.getTextWidth(s.getLargestLabel())+r,c=s.getYAxisIndex(),h=s.getPaneUUID(),v=(i=this.extentsOrder.get(h))!=null?i:{left:[],right:[]};if(s.getYAxisAlign()==="left"){const p=v.left.length;e[p]=Math.max((a=e[p])!=null?a:0,l),v.left.push(c)}else{const p=v.right.length;t[p]=Math.max((o=t[p])!=null?o:0,l),v.right.push(c)}this.extentsOrder.set(h,v)}),{left:e,right:t}}}var jo=Object.defineProperty,Vo=Object.defineProperties,Go=Object.getOwnPropertyDescriptors,hs=Object.getOwnPropertySymbols,$o=Object.prototype.hasOwnProperty,Zo=Object.prototype.propertyIsEnumerable,ds=(n,e,t)=>e in n?jo(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,et=(n,e)=>{for(var t in e||(e={}))$o.call(e,t)&&ds(n,t,e[t]);if(hs)for(var t of hs(e))Zo.call(e,t)&&ds(n,t,e[t]);return n},us=(n,e)=>Vo(n,Go(e));const ae="CHART",Wn=class{};let Y=Wn;Y.CANVAS="CANVAS",Y.N_MAP="N_MAP",Y.X_AXIS="X_AXIS",Y.N_MAP_KNOT_L="N_MAP_KNOT_L",Y.N_MAP_KNOT_R="N_MAP_KNOT_R",Y.N_MAP_BTN_L="N_MAP_BTN_L",Y.N_MAP_BTN_R="N_MAP_BTN_R",Y.N_MAP_SLIDER_WINDOW="N_MAP_SLIDER_WINDOW",Y.N_MAP_CHART="N_MAP_CHART",Y.N_MAP_LABEL_R="N_MAP_LABEL_R",Y.N_MAP_LABEL_L="N_MAP_LABEL_L",Y.PANE_UUID=n=>"PANE_"+n,Y.PANE_UUID_Y_AXIS=(n,e=0)=>"PANE_"+n+"_Y_AXIS_"+e,Y.PANE_UUID_RESIZER=n=>"PANE_"+n+"_RESIZER",Y.ALL_PANES="ALL_PANES",Y.CHART_WITH_Y_AXIS="CHART_WITH_Y_AXIS",Y.EVENTS="EVENTS",Y.CHART=Wn.PANE_UUID(ae),Y.Y_AXIS=Wn.PANE_UUID_Y_AXIS(ae);const fs={x:0,y:0,pageX:0,pageY:0,width:0,height:0},Ko=20,vs=35,Un=15,gs=1.5,zn=Hn()?8*gs:8,qo=1e-6;class Xn{constructor(e,t,r,s,i){this.config=e,this.eventBus=t,this.canvasModel=r,this.formatterFactory=s,this.bounds={},this.canvasOnPageLocation={x:0,y:0,pageX:0,pageY:0,width:0,height:0},this.panesOrder=[],this.panesOrderChangedSubject=new G,this.xAxisHeight=void 0,this.yAxisWidths={right:[0],left:[0]},this.leftRatio=0,this.rightRatio=0,this.boundsChangedSubject=new G,this.barResizerChangedSubject=new G,this._graphsHeightRatio={chart:1},this.graphsHeightRatioChangedSubject=new G,this.boundsChangedSubscriptions={},i.canvasResized.subscribe(a=>{let o=a;o||(o=this.canvasModel.canvas.getBoundingClientRect()),this.updateCanvasOnPageLocation(o),this.recalculateBounds()}),this.yAxisBoundsContainer=new Xo(this.config,this.canvasModel)}get graphsHeightRatio(){return this._graphsHeightRatio}updateYAxisWidths(){const e=this.yAxisBoundsContainer.getYAxisWidths();this.setYAxisWidths(e)}addPaneBounds(e,t){if(this.panesOrder.indexOf(e)===-1){if(this.panesOrder.push(e),t!==void 0){const r=this.panesOrder.indexOf(e);Rn(this.panesOrder,r,t)}this.recalculatePanesHeightRatios(),this.panesOrderChangedSubject.next(this.panesOrder)}}overrideChartHeightRatios(e){const t=et(et({},this.graphsHeightRatio),e),r=Object.values(t).reduce((s,i)=>s+i,0);Math.abs(r-1)<qo?(this._graphsHeightRatio=t,this.recalculateBounds()):console.error(`Result ratio should be equal 1, but equal ${r}`)}movePaneUp(e){const t=this.panesOrder.indexOf(e);t!==-1&&(Rn(this.panesOrder,t,t-1),this.recalculateBounds(),this.eventBus.fireDraw(),this.panesOrderChangedSubject.next(this.panesOrder))}movePaneDown(e){const t=this.panesOrder.indexOf(e);t!==-1&&(Rn(this.panesOrder,t,t+1),this.recalculateBounds(),this.eventBus.fireDraw(),this.panesOrderChangedSubject.next(this.panesOrder))}reorderPanes(e){this.panesOrder=$r(this.panesOrder,e),this.recalculateBounds(),this.panesOrderChangedSubject.next(this.panesOrder)}removedPaneBounds(e){Do(this.panesOrder,e),delete this.graphsHeightRatio[e],delete this.bounds[Y.PANE_UUID(e)],this.yAxisWidths.left.concat(this.yAxisWidths.right).forEach((t,r)=>delete this.bounds[Y.PANE_UUID_Y_AXIS(e,r)]),delete this.bounds[Y.PANE_UUID_RESIZER(e)],this.recalculatePanesHeightRatios(),this.panesOrderChangedSubject.next(this.panesOrder)}recalculateBounds(){const e=this.canvasOnPageLocation.width,t=this.canvasOnPageLocation.height,r=this.config.components.paneResizer.height,s=this.getBounds(Y.CANVAS);s.x=0,s.y=0,s.width=e,s.height=t;const i=this.getYAxisWidth(),a=this.getNavMapBounds(s),o=this.getXAxisBounds(a,s),l=t-o.height-a.height,c=i.left.reduce((K,q)=>K+q,0),h=i.right.reduce((K,q)=>K+q,0),v=0,p=s.width-h,y=v+c,E=0,R=s.width-c-h;let N=E;this.panesOrder.forEach((K,q)=>{var $;const J=this.graphsHeightRatio[this.panesOrder[q]],ne=this.config.components.paneResizer.visible;ne&&(q!==0?_t(this.bounds,Y.PANE_UUID_RESIZER(K),0,N,s.width,r,this.canvasOnPageLocation):_t(this.bounds,Y.PANE_UUID_RESIZER(K),0,0,0,0,this.canvasOnPageLocation));const oe=_t(this.bounds,Y.PANE_UUID(K),y,ne?N+r:N,R,ne?l*J-this.config.components.paneResizer.height:l*J,this.canvasOnPageLocation);if(this.config.components.yAxis.visible){const le=this.yAxisBoundsContainer.extentsOrder.get(K);if(le===void 0)return;const re=ne?N+r:N,ce=ne?l*J-r:l*J;let fe=y-(($=i.left[0])!=null?$:0),de=p;le.left.forEach((ue,pe)=>{var me;_t(this.bounds,Y.PANE_UUID_Y_AXIS(K,ue),fe,re,i.left[pe],ce,this.canvasOnPageLocation),fe-=(me=i.left[pe+1])!=null?me:0}),le.right.forEach((ue,pe)=>{_t(this.bounds,Y.PANE_UUID_Y_AXIS(K,ue),de,re,i.right[pe],ce,this.canvasOnPageLocation),de+=i.right[pe]})}else _t(this.bounds,Y.PANE_UUID_Y_AXIS(K),0,0,0,0,this.canvasOnPageLocation);N=oe.y+oe.height});const k=this.getBounds(Y.ALL_PANES);k.x=y,k.y=E,k.width=R,k.height=N;const U=this.getBounds(Y.CHART_WITH_Y_AXIS),Z=this.getBounds(Y.PANE_UUID(ae));this.getEventsBounds(Z),this.copyBounds(Z,U),U.width=s.width,this.recalculateNavigationMapElementBounds(),this.updateAllBoundsPageCoordinates(),this.notifyBoundsSubscribers()}updateCanvasOnPageLocation(e){this.canvasOnPageLocation=us(et({},this.canvasOnPageLocation),{x:e.x,y:e.y,width:e.width,height:e.height})}updateAllBoundsPageCoordinates(){for(const e of Object.keys(this.bounds)){const t=this.bounds[e];t.pageX=t.x+this.canvasOnPageLocation.x,t.pageY=t.y+this.canvasOnPageLocation.y}}getEventsBounds(e){const t=this.getBounds(Y.EVENTS);return this.config.components.events.visible?(t.x=0,t.y=e.y+e.height-this.config.components.events.height,t.width=e.width,t.height=this.config.components.events.height):this.applyDefaultBounds(t),t}getNavMapBounds(e){const t=this.getBounds(Y.N_MAP);return this.config.components.navigationMap.visible?(t.x=0,t.y=e.height-vs,t.width=e.width,t.height=vs):this.applyDefaultBounds(t),t}getXAxisBounds(e,t){const r=this.getBounds(Y.X_AXIS);return this.config.components.xAxis.visible?(r.x=0,r.y=t.height-this.getXAxisHeight()-e.height,r.width=t.width,r.height=this.getXAxisHeight()):this.applyDefaultBounds(r),r}getXAxisHeight(){var e,t;if(!this.xAxisHeight){const r=this.config.components.xAxis.fontSize+"px "+this.config.components.xAxis.fontFamily,s=Qe(r,this.canvasModel.ctx);this.xAxisHeight=s+((e=this.config.components.xAxis.padding.top)!=null?e:0)+((t=this.config.components.xAxis.padding.bottom)!=null?t:0)}return this.xAxisHeight}setYAxisWidths(e){(!Zr(this.yAxisWidths.left,e.left)||!Zr(this.yAxisWidths.right,e.right))&&(this.yAxisWidths=e,this.recalculateBounds())}setXAxisHeight(e){e!==this.xAxisHeight&&(this.xAxisHeight=e,this.recalculateBounds())}setPanesOrder(e){this.panesOrder=e,this.recalculateBounds()}getYAxisWidth(){return this.config.components.yAxis.visible?this.yAxisWidths:{right:[0],left:[0]}}recalculatePanesHeightRatios(){this.calculateGraphsHeightRatios(),this.recalculateBounds()}calculateGraphsHeightRatios(){let e=this.graphsHeightRatio[ae];const t=[];t.push(...this.panesOrder.filter(v=>v!==ae)),this.panesOrder.forEach(v=>{this.graphsHeightRatio[v]===0&&delete this.graphsHeightRatio[v]});const r=t.map(v=>this.graphsHeightRatio[v]===void 0?void 0:this.graphsHeightRatio[v]),s=r.filter(v=>v!==void 0).length,i=r.filter(v=>v===void 0).length;let a=0,o=0,l=1,c=0;i>0&&([l,c]=Qo(t.length),e*=l),s===0&&(e=1-c*i),o=1-e-c*i,r.forEach(v=>{v&&(o-=v*l)}),a=o/(t.length+1);const h=r.map(v=>v?v*l+a:c+a);e+=a,this._graphsHeightRatio={},this.graphsHeightRatio[ae]=e,h.forEach((v,p)=>{const y=t[p];this.graphsHeightRatio[y]=v})}recalculateNavigationMapElementBounds(){var e,t,r,s;if(this.config.components.navigationMap.visible){const i=this.getBounds(Y.N_MAP),{height:a,width:o}=this.config.components.navigationMap.knots,l=a!=null?a:0,c=Hn()?o*gs:o!=null?o:0,h=l?i.y+(i.height-l)/2:i.y,v=(t=(e=this.config.components.navigationMap)==null?void 0:e.timeLabels)==null?void 0:t.visible,p=J=>Ro(this.canvasModel.ctx,J,this.formatterFactory,this.config)[0],y=Ie((s=(r=this.mainCandleSeries)==null?void 0:r.getSeriesInViewport())!=null?s:[]),E=v&&y.length?p(y[0].candle.timestamp):0,R=v&&y.length?p(y[y.length-1].candle.timestamp):0,N=Math.max(E,R);if(v){const J=this.getBounds(Y.N_MAP_LABEL_L);J.x=i.x,J.y=i.y,J.width=N,J.height=i.height;const ne=this.getBounds(Y.N_MAP_LABEL_R);ne.x=i.x+i.width-N,ne.y=i.y,ne.width=N,ne.height=i.height}const k=this.getBounds(Y.N_MAP_BTN_L);k.x=i.x+N,k.y=i.y,k.width=Un,k.height=i.height;const U=this.getBounds(Y.N_MAP_BTN_R);U.x=i.x+i.width-Un-N,U.y=i.y,U.width=Un,U.height=i.height;const Z=this.getBounds(Y.N_MAP_KNOT_L);Z.x=(U.x-k.x-k.width)*this.leftRatio+k.x+k.width,Z.y=h,Z.width=c!=null?c:zn,Z.height=l!=null?l:i.height;const K=this.getBounds(Y.N_MAP_KNOT_R);K.x=(U.x-k.x-k.width)*this.rightRatio+k.x+k.width-zn,K.y=h,K.width=c!=null?c:zn,K.height=l!=null?l:i.height;const q=this.getBounds(Y.N_MAP_SLIDER_WINDOW);q.x=Z.x+Z.width,q.y=i.y,q.width=K.x-q.x,q.height=i.height;const $=this.getBounds(Y.N_MAP_CHART);$.x=k.x+k.width,$.y=i.y,$.width=U.x-$.x,$.height=i.height}}isVolumesInSeparatePane(){return this.config.components.volumes.visible&&this.config.components.volumes.showSeparately}getBounds(e){return this.bounds[e]===void 0&&(this.bounds[e]=this.copyOf(fs)),this.bounds[e]}getCanvasOnPageLocation(){return this.canvasOnPageLocation}getBoundsPanes(){return this.panesOrder.reduce((e,t)=>us(et({},e),{[t]:this.bounds[Y.PANE_UUID(t)]}),{})}getBoundsHitTest(e,t=nn){const{extensionX:r,extensionY:s,wholePage:i}=et(et({},nn),t);return i?(a,o)=>{const l=this.getBounds(e);return a>l.pageX-r&&a<l.pageX+l.width+r&&o>l.pageY-s&&o<l.pageY+l.height+s}:(a,o)=>{const l=this.getBounds(e);return a>l.x-r&&a<l.x+l.width+r&&o>l.y-s&&o<l.y+l.height+s}}static hitTestOf(e,t=nn){const{extensionX:r,extensionY:s,wholePage:i}=et(et({},nn),t);return i?(a,o)=>a>e.pageX-r&&a<e.pageX+e.width+r&&o>e.pageY-s&&o<e.pageY+e.height+s:(a,o)=>a>e.x-r&&a<e.x+e.width+r&&o>e.y-s&&o<e.y+e.height+s}isChartBoundsAvailable(){const e=this.getBounds(Y.CANVAS);return e.width>0&&e.height>0}resizePaneVertically(e,t){const r=this.panesOrder.indexOf(e),s=this.getBounds(Y.PANE_UUID_RESIZER(e));this.doResizePaneVertically(r,s.y-t),this.barResizerChangedSubject.next()}doResizePaneVertically(e,t){const r=e-1,s=this.getBounds(Y.ALL_PANES).height,i=this.config.components.paneResizer.height+Ko,a=s*this.graphsHeightRatio[this.panesOrder[e]],o=s*this.graphsHeightRatio[this.panesOrder[r]],l=a+t>i,c=o-t>i;if(l&&c){const h=t/s;this.graphsHeightRatio[this.panesOrder[e]]+=h,this.graphsHeightRatio[this.panesOrder[r]]-=h,this.recalculateBounds()}}notifyBoundsSubscribers(){Object.keys(this.boundsChangedSubscriptions).forEach(e=>{this.boundsChangedSubscriptions[e].next(this.getBounds(e))}),this.boundsChangedSubject.next()}observeBoundsChanged(e){let t=this.boundsChangedSubscriptions[e];return t||(t=new lt(this.getBounds(e)),this.boundsChangedSubscriptions[e]=t),t.pipe(ye(r=>this.copyOf(r)),Ve((r,s)=>this.sameBounds(r,s)))}observeAnyBoundsChanged(){return this.boundsChangedSubject.asObservable()}copyOf(e){return et({},e)}copyBounds(e,t){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height}sameBounds(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}applyDefaultBounds(e){this.copyBounds(fs,e)}setMainCandleSeries(e){this.mainCandleSeries=e}}const Jo={0:1,1:.8,2:.6,3:.5,4:.4,5:.2},Qo=n=>{var e;const t=(e=Jo[n])!=null?e:.4,r=(1-t)/n;return[t,r]},yv=(n,e)=>n.x>e.x&&n.x<e.x+e.width&&n.y>e.y&&n.y<e.y+e.height,el=(n,e)=>n>e.y&&n<e.y+e.height,_t=(n,e,t,r,s,i,a)=>{const o=n[e];if(o)return o.x=t,o.y=r,o.pageX=t+a.x,o.pageY=r+a.y,o.width=s,o.height=i,o;const l={x:t,y:r,pageX:t+a.x,pageY:r+a.y,width:s,height:i};return n[e]=l,l},ps=(n,e)=>Math.min(Math.max(n,e.y),e.y+e.height),nn={extensionX:0,extensionY:0,wholePage:!1},ms=(n,e)=>n.width===e.width&&n.height===e.height;var tl=function(n){I(e,n);function e(t,r){return n.call(this)||this}return e.prototype.schedule=function(t,r){return r===void 0&&(r=0),this},e}(Ce),rn={setInterval:function(n,e){for(var t=[],r=2;r<arguments.length;r++)t[r-2]=arguments[r];var s=rn.delegate;return s!=null&&s.setInterval?s.setInterval.apply(s,g([n,e],P(t))):setInterval.apply(void 0,g([n,e],P(t)))},clearInterval:function(n){var e=rn.delegate;return((e==null?void 0:e.clearInterval)||clearInterval)(n)},delegate:void 0},nl=function(n){I(e,n);function e(t,r){var s=n.call(this,t,r)||this;return s.scheduler=t,s.work=r,s.pending=!1,s}return e.prototype.schedule=function(t,r){var s;if(r===void 0&&(r=0),this.closed)return this;this.state=t;var i=this.id,a=this.scheduler;return i!=null&&(this.id=this.recycleAsyncId(a,i,r)),this.pending=!0,this.delay=r,this.id=(s=this.id)!==null&&s!==void 0?s:this.requestAsyncId(a,this.id,r),this},e.prototype.requestAsyncId=function(t,r,s){return s===void 0&&(s=0),rn.setInterval(t.flush.bind(t,this),s)},e.prototype.recycleAsyncId=function(t,r,s){if(s===void 0&&(s=0),s!=null&&this.delay===s&&this.pending===!1)return r;r!=null&&rn.clearInterval(r)},e.prototype.execute=function(t,r){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var s=this._execute(t,r);if(s)return s;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},e.prototype._execute=function(t,r){var s=!1,i;try{this.work(t)}catch(a){s=!0,i=a||new Error("Scheduled action threw falsy error")}if(s)return this.unsubscribe(),i},e.prototype.unsubscribe=function(){if(!this.closed){var t=this,r=t.id,s=t.scheduler,i=s.actions;this.work=this.state=this.scheduler=null,this.pending=!1,Ae(i,this),r!=null&&(this.id=this.recycleAsyncId(s,r,null)),this.delay=null,n.prototype.unsubscribe.call(this)}},e}(tl),jn={now:function(){return(jn.delegate||Date).now()},delegate:void 0},bs=function(){function n(e,t){t===void 0&&(t=n.now),this.schedulerActionCtor=e,this.now=t}return n.prototype.schedule=function(e,t,r){return t===void 0&&(t=0),new this.schedulerActionCtor(this,e).schedule(r,t)},n.now=jn.now,n}(),rl=function(n){I(e,n);function e(t,r){r===void 0&&(r=bs.now);var s=n.call(this,t,r)||this;return s.actions=[],s._active=!1,s}return e.prototype.flush=function(t){var r=this.actions;if(this._active){r.push(t);return}var s;this._active=!0;do if(s=t.execute(t.state,t.delay))break;while(t=r.shift());if(this._active=!1,s){for(;t=r.shift();)t.unsubscribe();throw s}},e}(bs),Cs=new rl(nl),sl=Cs;function il(n,e){return w(function(t,r){var s=e!=null?e:{},i=s.leading,a=i===void 0?!0:i,o=s.trailing,l=o===void 0?!1:o,c=!1,h=null,v=null,p=!1,y=function(){v==null||v.unsubscribe(),v=null,l&&(N(),p&&r.complete())},E=function(){v=null,p&&r.complete()},R=function(k){return v=Ke(n(k)).subscribe(We(r,y,E))},N=function(){if(c){c=!1;var k=h;h=null,r.next(k),!p&&R(k)}};t.subscribe(We(r,function(k){c=!0,h=k,!(v&&!v.closed)&&(a?N():R(k))},function(){p=!0,!(l&&c&&v&&!v.closed)&&r.complete()}))})}function al(n){return n instanceof Date&&!isNaN(n)}function ol(n,e,t){n===void 0&&(n=0),t===void 0&&(t=sl);var r=-1;return e!=null&&(Hr(e)?t=e:r=e),new xe(function(s){var i=al(n)?+n-t.now():n;i<0&&(i=0);var a=0;return t.schedule(function(){s.closed||(s.next(a++),0<=r?this.schedule(void 0,r):s.complete())},i)})}function Nt(n,e,t){e===void 0&&(e=Cs);var r=ol(n,e);return il(function(){return r},t)}class te{constructor(){this.subscriptions=[],this._state="initial",this.entities=[]}doActivate(){}doDeactivate(){this.subscriptions.forEach(e=>e()),this.subscriptions=[]}enable(){this._state!=="active"&&(this._state="deactivated",this.activate())}disable(){this._state!=="disabled"&&(this.deactivate(),this._state="disabled")}activate(){this._state!=="disabled"&&(this._state!=="active"&&(this.doActivate(),this._state="active"),this.entities.forEach(e=>e.activate()))}deactivate(){this._state!=="disabled"&&(this._state!=="deactivated"&&(this.doDeactivate(),this._state="deactivated"),this.entities.forEach(e=>e.deactivate()))}getState(){return this._state}addSubscription(e){this.subscriptions.push(e)}addRxSubscription(e){e&&this.subscriptions.push(e.unsubscribe.bind(e))}addChildEntity(e){this.entities.push(e),this._state==="active"&&e.activate()}removeChildEntity(e){this.entities=this.entities.filter(t=>t!==e)}}class ll extends te{constructor(e,t,r,s){super(),this.element=e,this.canvasInputListener=t,this.canvasBoundsContainer=r,this.hitTestCanvasModel=s,this.normalLayer=new Map,this.extensionLayer=new Map,this.cursorChangedSubject=new G}doActivate(){super.doActivate(),this.canvasInputListener.observeMouseMoveNoDrag().pipe(Nt(100,void 0,{trailing:!0})).subscribe(e=>{const t=this.hitTestCanvasModel.resolveCursor(e);if(t!==void 0){this.updateCursor(t);return}e&&(this.normalLayer.forEach(r=>{r.hitTest(e.x,e.y)&&this.updateCursor(r.cursor)}),this.extensionLayer.forEach(r=>{r.hitTest(e.x,e.y)&&this.updateCursor(r.cursor)}))})}setCursorForBounds(e,t,r,s=0){const i=Xn.hitTestOf(t,{extensionY:s});s?this.extensionLayer.set(e,{cursor:r,hitTest:i}):this.normalLayer.set(e,{cursor:r,hitTest:i})}setCursorForCanvasEl(e,t,r){this.observeCursorType(e,t,r)}removeCursorForCanvasEl(e){this.normalLayer.delete(e),this.extensionLayer.delete(e)}observeCursorChanged(){return this.cursorChangedSubject.pipe(Ve())}observeCursorType(e,t,r){const s=r?this.canvasBoundsContainer.getBoundsHitTest(e,{extensionY:r}):this.canvasBoundsContainer.getBoundsHitTest(e);r?this.extensionLayer.set(e,{cursor:t,hitTest:s}):this.normalLayer.set(e,{cursor:t,hitTest:s})}updateCursor(e){this.element.style.cursor!==e&&(this.element.style.cursor=e,this.cursorChangedSubject.next(e))}}const cl=n=>{const e=n.canvasArea!==null,t=n.snapshotCanvas!==null,r=n.backgroundCanvas!==null,s=n.mainCanvas!==null,i=n.overDataSeriesCanvas!==null,a=n.staticDrawingCanvas!==null,o=n.dynamicDrawingCanvas!==null,l=n.yAxisLabelsCanvas!==null,c=n.crossToolCanvas!==null,h=n.hitTestCanvas!==null,v=n.chartResizer!==null,p=n.chartContainer!==null,y=n.dataSeriesCanvas!==null;return e&&t&&r&&s&&i&&a&&o&&l&&c&&h&&v&&p&&y},hl=n=>`<div data-element="chartResizer" style="position: relative; min-height: 20px; height: 100%; width: 100%; touch-action: manipulation; z-index: 0;">
|
|
10
10
|
<div data-element="chartContainer" style="position: absolute; height: 100%; width: 100%;" class="chart chartArea--graph">
|
|
11
11
|
<div data-element="canvasArea" style="position: relative; height: 100%; width: 100%; touch-action: manipulation;">
|
|
12
12
|
<canvas data-element="snapshotCanvas" style="z-index: 0"></canvas>
|
|
@@ -23,4 +23,4 @@ ${n?` <p style="position: absolute; visibility: hidden;">If you have any sugge
|
|
|
23
23
|
`:""} </div>
|
|
24
24
|
</div>
|
|
25
25
|
</div>
|
|
26
|
-
`;function dl(n){const e=document.createElement("template");return e.innerHTML=hl(n.devexpertsPromoLink),e}function ul(n){const e={},t=Array.from(n.querySelectorAll("[data-element]"));if(t.length!==0&&t.forEach(r=>{var s;e[(s=r.getAttribute("data-element"))!=null?s:""]=r}),cl(e))return e;throw new Error("Some chart elements are missing")}function fl(n){if(n.length>1){const e=n.reduce((s,i,a)=>{if(a!==n.length-1){const o=n[a+1].timestamp-i.timestamp;s[o]?s[o]++:s[o]=1}return s},{});let t=0,r;for(const s of Object.keys(e)){const i=parseInt(s,10),a=e[i];a>t&&i>0&&(t=a,r=i)}if(r)return r}}const kt=(n,e,t,r=1e3)=>{var s,i,a,o;const l=(i=(s=Yt(t))==null?void 0:s.timestamp)!=null?i:0,c=(o=(a=Ue(t))==null?void 0:a.timestamp)!=null?o:0;return n>c?e?{index:t.length-1+Math.ceil((n-c)/r),exact:!0}:{index:t.length-1,exact:!0}:n<l?e?{index:ve((n-l)/r),exact:!0}:{index:-1,exact:!0}:lt(t,n,h=>h.timestamp)},Vn=1;function sn(n,e){return e===n?"none":e>n?"up":"down"}function vl(n,e){return e>n?"up":"down"}function gl(n,e,t=!1){const{expansion:r,impVolatility:s,vwap:i,volume:a,timestamp:o}=n;let l=n.hi,c=n.lo,h=n.open;const v=n.close;t&&(l=v,c=v,h=v);let p=n.idx;return e!==void 0&&(p=e),{hi:l,lo:c,open:h,close:v,timestamp:o,volume:a,expansion:r,idx:p,impVolatility:s,vwap:i}}const ys={color:"#FF00FF",lineWidth:1,hoveredLineWidth:2},ws={paintConfig:[ys],type:"LINEAR",highLowActive:!0,visible:!0,labelLastValue:"viewport",labelMode:"label",labelAppearanceType:"badge"};var pl=Object.defineProperty,Ss=Object.getOwnPropertySymbols,ml=Object.prototype.hasOwnProperty,bl=Object.prototype.propertyIsEnumerable,xs=(n,e,t)=>e in n?pl(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Cl=(n,e)=>{for(var t in e||(e={}))ml.call(e,t)&&xs(n,t,e[t]);if(Ss)for(var t of Ss(e))bl.call(e,t)&&xs(n,t,e[t]);return n};class yl{constructor(e,t,r,s){this.series=e,this.config=t,this.yAxisBoundsProvider=r,this.axisState=s}getUnorderedLabels(){if(this.config.visible){const t=this.config.labelLastValue==="series"?this.series.getLastDataSeriesPoint:this.series.getLastVisualSeriesPoint,r=this.yAxisBoundsProvider(),s=this.config.labelMode,i=this.config.labelAppearanceType,a=t();if(a!==void 0){const o=this.series.view.toY(a.close);if(isFinite(o)){const l=this.series.valueFormatter(a.close),c=this.getLabelDrawConfig();return[{labels:[Cl({y:o,description:this.series.name,mode:s,labelType:i,labelText:l},c)],axisState:this.axisState,bounds:r}]}}}return[]}getLabelDrawConfig(){var e;const t=this.series.config,s=((e=t.paintConfig[0])!=null?e:ys).color;return{textColor:Ht(s,"white","black"),bgColor:s,paddingBottom:t.labelPaddingBottom,paddingEnd:t.labelPaddingEnd,paddingTop:t.labelPaddingTop}}}let $e=window.devicePixelRatio,an=window.matchMedia(`screen and (resolution: ${window.devicePixelRatio}dppx)`);const Gn=()=>{an.removeEventListener("change",Gn),$e=window.devicePixelRatio,an=window.matchMedia(`screen and (resolution: ${window.devicePixelRatio}dppx)`),an.addEventListener("change",Gn)};an.addEventListener("change",Gn);const wl=()=>$e,Sl=n=>gt($e*n)/$e,se=n=>ve($e*n)/$e,Ms=n=>lo($e*n)/$e,Wt=n=>JSON.parse(JSON.stringify(n));function $n(n){return Object.entries(n)}const Ps=(n,e)=>{for(const[t,r]of Array.from(n.entries()))if(r===e)return t};function Ts(n){return Object.keys(n)}function _s(n,e){if(Object.is(n,e))return!0;if(typeof n!="object"||n===null||typeof e!="object"||e===null)return!1;const t=Object.keys(n),r=Object.keys(e);if(t.length!==r.length)return!1;for(let s=0,i=t.length;s<i;s++)if(!hasOwnProperty.call(e,t[s])||!_s(n[t[s]],e[t[s]]))return!1;return!0}function As(n){n===void 0&&(n={});var e=n.connector,t=e===void 0?function(){return new G}:e,r=n.resetOnError,s=r===void 0?!0:r,i=n.resetOnComplete,a=i===void 0?!0:i,o=n.resetOnRefCountZero,l=o===void 0?!0:o;return function(c){var h,v,p,y=0,E=!1,R=!1,N=function(){v==null||v.unsubscribe(),v=void 0},k=function(){N(),h=p=void 0,E=R=!1},U=function(){var Z=h;k(),Z==null||Z.unsubscribe()};return w(function(Z,K){y++,!R&&!E&&N();var q=p=p!=null?p:t();K.add(function(){y--,y===0&&!R&&!E&&(v=Zn(U,l))}),q.subscribe(K),!h&&y>0&&(h=new ft({next:function($){return q.next($)},error:function($){R=!0,N(),v=Zn(k,s,$),q.error($)},complete:function(){E=!0,N(),v=Zn(k,a),q.complete()}}),Ke(Z).subscribe(h))})(c)}}function Zn(n,e){for(var t=[],r=2;r<arguments.length;r++)t[r-2]=arguments[r];if(e===!0){n();return}if(e!==!1){var s=new ft({next:function(){s.unsubscribe(),n()}});return Ke(e.apply(void 0,g([],P(t)))).subscribe(s)}}const on=(n,e)=>n/e,Pe=(n,e)=>n/e,tt=(n,e)=>n*e,Ds=(n,e)=>(n-e)*100/e,Es=(n,e)=>n*e/100+e,Ls=n=>Math.log2(n),Kn=n=>Math.pow(2,n);class xl extends te{constructor(){super(...arguments),this._xStart=0,this._xEnd=0,this._yStart=0,this._yEnd=0,this._zoomX=1,this._zoomY=1,this._inverseY=!1,this.changed=new G,this.xChanged=this.changed.pipe(ye(()=>({start:this.xStart,end:this.xEnd})),Ve((e,t)=>e.start===t.start&&e.end===t.end),As()),this.yChanged=this.changed.pipe(ye(()=>({start:this.yStart,end:this.yEnd})),Ve((e,t)=>e.start===t.start&&e.end===t.end),As())}toX(e){return this.getBounds().x+Pe(e-this.xStart,this.zoomX)}xPixels(e){return Pe(e,this.zoomX)}toY(e){return this.inverseY?this.getBounds().y+Pe(e-this.yStart,this.zoomY):this.getBounds().y+this.getBounds().height-Pe(e-this.yStart,this.zoomY)}yPixels(e){return Pe(e,this.zoomY)}fromX(e){const t=e-this.getBounds().x;return tt(t+Pe(this.xStart,this.zoomX),this.zoomX)}fromY(e){const t=e-this.getBounds().y;return this.inverseY?tt(t+Pe(this.yStart,this.zoomY),this.zoomY):tt(this.getBounds().height-t+Pe(this.yStart,this.zoomY),this.zoomY)}recalculateZoomX(){this.zoomX=this.calculateZoomX(this.xStart,this.xEnd)}recalculateZoomY(){this.zoomY=this.calculateZoomY(this.yStart,this.yEnd)}calculateZoomX(e,t){return on(t-e,this.getBounds().width)}calculateZoomY(e,t){return on(t-e,this.getBounds().height)}recalculateZoom(e=!0){this.recalculateZoomX(),this.recalculateZoomY(),e&&this.fireChanged()}setXScale(e,t,r=!0){this.xStart=e,this.xEnd=t,this.recalculateZoomX(),r&&this.fireChanged()}setYScale(e,t,r=!0){this.yStart=e,this.yEnd=t,this.recalculateZoomY(),r&&this.fireChanged()}export(){return{xStart:this.xStart,xEnd:this.xEnd,yStart:this.yStart,yEnd:this.yEnd,zoomX:this.zoomX,zoomY:this.zoomY,inverseY:this.inverseY}}apply(e){this.xStart=e.xStart,this.xEnd=e.xEnd,this.yStart=e.yStart,this.yEnd=e.yEnd,this.zoomX=e.zoomX,this.zoomY=e.zoomY,this.inverseY=e.inverseY,this.fireChanged()}fireChanged(){this.changed.next()}get xStart(){return this._xStart}set xStart(e){this._xStart=e}get xEnd(){return this._xEnd}set xEnd(e){this._xEnd=e}get yStart(){return this._yStart}set yStart(e){this._yStart=e}get yEnd(){return this._yEnd}set yEnd(e){this._yEnd=e}get zoomX(){return this._zoomX}set zoomX(e){this._zoomX=e}get zoomY(){return this._zoomY}set zoomY(e){this._zoomY=e}get inverseY(){return this._inverseY}set inverseY(e){this._inverseY=e}isViewportValid(){return this.xStart!==this.xEnd&&this.yStart!==this.yEnd&&isFinite(this.yStart)&&isFinite(this.yEnd)}}const Ml=(n,e)=>!Ts(n).some(t=>n[t]!==e[t]);class Pl{constructor(e,t){this.scaleModel=e,this.dataSeries=t,this.prevAnimationId=""}getBaselineForPercent(e){const t=this.scaleModel.currentAnimation;let r;if(t!=null&&t.animationInProgress){t.id!==this.prevAnimationId&&(this.initialBaseline=void 0,this.targetBaseline=void 0,this.prevAnimationId=t.id);const s=t.easingFn(t.getProgress());this.initialBaseline===void 0&&(this.initialBaseline=e(lt(this.dataSeries.visualPoints,t.xStart,i=>i.centerUnit).index)),this.targetBaseline===void 0&&(this.targetBaseline=e(lt(this.dataSeries.visualPoints,t.animationConfig.targetXStart,i=>i.centerUnit).index)),r=this.initialBaseline+(this.targetBaseline-this.initialBaseline)*s}else r=e();return r}}class Is{constructor(e,t,r,s){this.dataSeries=e,this.scaleModel=t,this.getAxisType=r,this.getBaseLine=s,this.toY=i=>this.scaleModel.toY(this.toAxisUnits(i)),this.toX=i=>this.scaleModel.toX(i),this.xPixels=i=>this.scaleModel.xPixels(i),this.yPixels=i=>this.scaleModel.yPixels(i),this.percentAnimationHandler=new Pl(this.scaleModel,this.dataSeries)}toAxisUnits(e,t=this.getBaseLine){switch(this.getAxisType()){case"percent":const r=this.percentAnimationHandler.getBaselineForPercent(t);return Ds(e,r);case"logarithmic":return Ls(e);case"regular":return e}}priceFromY(e){const t=this.scaleModel.fromY(e);return this.fromAxisUnits(t)}fromAxisUnits(e){switch(this.getAxisType()){case"percent":return Es(e,this.getBaseLine());case"logarithmic":return Kn(e);case"regular":return e}}}var Tl=Object.defineProperty,_l=Object.defineProperties,Al=Object.getOwnPropertyDescriptors,Os=Object.getOwnPropertySymbols,Dl=Object.prototype.hasOwnProperty,El=Object.prototype.propertyIsEnumerable,Bs=(n,e,t)=>e in n?Tl(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Ll=(n,e)=>{for(var t in e||(e={}))Dl.call(e,t)&&Bs(n,t,e[t]);if(Os)for(var t of Os(e))El.call(e,t)&&Bs(n,t,e[t]);return n},Il=(n,e)=>_l(n,Al(e));class Ut{constructor(e,t){this.centerUnit=e,this.close=t}y(e){return se(e.toY(this.close))}x(e){return se(e.toX(this.centerUnit))}clone(){return new Ut(this.centerUnit,this.close)}}class Rs extends te{constructor(e,t,r=Wt(ws)){var s;super(),this.extentComponent=e,this.id=t,this.name="",this.hovered=!1,this._dataPoints=[],this.pricePrecisions=[2],this.linkedDataSeriesModels=[],this._dataPointsFlat=[],this._visualPoints=[],this._visualPointsFlat=[],this.dataIdxStart=0,this.dataIdxEnd=0,this.getPaintConfig=i=>{var a;return(a=this.config.paintConfig[i])!=null?a:this.config.paintConfig[0]},this.getBaseLine=(i=this.dataIdxStart)=>{var a,o;return(o=(a=this.visualPoints[i])==null?void 0:a.close)!=null?o:1},this.getTextForPoint=i=>`${i.close}`,this.getLastVisualSeriesPoint=()=>{const i=this.visualPoints,a=lt(i,this.scaleModel.xEnd,o=>o.centerUnit).index;return i[a]},this.getLastDataSeriesPoint=()=>{const i=this.visualPoints;return Ue(i)},this.config=Ge(r,ws),this.scaleModel=e.scaleModel,this.view=new Is(this,this.scaleModel,()=>this.extentComponent.getAxisType(),this.getBaseLine),this.yAxisLabelProvider=new yl(this,this.config,e.getYAxisBounds,(s=e.yAxisComponent)==null?void 0:s.state),this.highLowProvider=Bl(this),e.addDataSeries(this),this.activate()}get dataPoints2D(){return this._dataPoints}get dataPoints(){return this._dataPointsFlat}set dataPoints(e){this._dataPoints=Kr(e),this._dataPointsFlat=this._dataPoints.flat(),this.visualPoints=this._toVisualPoints(this._dataPoints)}get visualPoints(){return this._visualPointsFlat}get visualPoints2D(){return this._visualPoints}set visualPoints(e){this._visualPoints=Kr(e),this._visualPointsFlat=this._visualPoints.flat()}doActivate(){this.addRxSubscription(this.scaleModel.xChanged.subscribe(()=>this.recalculateDataViewportIndexes())),this.addRxSubscription(this.scaleModel.scaleInversedSubject.subscribe(()=>this.recalculateVisualPoints()))}setDataPoints(e){this.dataPoints=e,this.extentComponent.paneComponent.updateView()}_toVisualPoints(e){return e.map(t=>this.toVisualPoints(t))}moveToExtent(e){var t;this.extentComponent.removeDataSeries(this),this.extentComponent=e,this.scaleModel=e.scaleModel,this.view=new Is(this,this.scaleModel,()=>this.extentComponent.getAxisType(),this.getBaseLine),this.yAxisLabelProvider.yAxisBoundsProvider=e.getYAxisBounds,this.yAxisLabelProvider.axisState=(t=e.yAxisComponent)==null?void 0:t.state,this.deactivate(),this.activate(),e.addDataSeries(this)}toVisualPoints(e){return e.map((t,r)=>({centerUnit:r,close:t.close}))}setType(e){this.config.type=e,this.extentComponent.dataSeriesCanvasModel.fireDraw()}recalculateVisualPoints(){this.visualPoints=this._toVisualPoints(this.dataPoints2D)}recalculateDataViewportIndexes(e=this.scaleModel.xStart,t=this.scaleModel.xEnd){const{dataIdxStart:r,dataIdxEnd:s}=this.calculateDataViewportIndexes(e,t);this.dataIdxStart=r,this.dataIdxEnd=s}calculateDataViewportIndexes(e,t){const r=lt(this.visualPoints,e,i=>i.centerUnit).index,s=lt(this.visualPoints,t,i=>i.centerUnit).index;return{dataIdxStart:r,dataIdxEnd:s}}valueFormatter(e){return qn(e)}getSeriesInViewport(e,t){let r=this.dataIdxStart,s=this.dataIdxEnd;if(t!==void 0&&e!==void 0){const i=this.calculateDataViewportIndexes(e,t);r=i.dataIdxStart,s=i.dataIdxEnd}return To(this.visualPoints2D,r,s)}}const Ol=n=>{const e={high:Number.MIN_SAFE_INTEGER,low:Number.MAX_SAFE_INTEGER,highIdx:0,lowIdx:0};for(let t=0;t<n.length;t++){const r=n[t];r.close>e.high&&(e.high=r.close,e.highIdx=t),r.close<e.low&&(e.low=r.close,e.lowIdx=t)}return e},Bl=n=>({isHighLowActive:()=>n.config.highLowActive,calculateHighLow:e=>{const t=Ol(n.getSeriesInViewport(e==null?void 0:e.xStart,e==null?void 0:e.xEnd).flat());return Il(Ll({},t),{high:n.view.toAxisUnits(t.high),low:n.view.toAxisUnits(t.low)})}}),qn=n=>{const t=i=>Math.ceil(Math.log(Math.abs(i))*Math.LOG10E),s=((i,a=5)=>Math.max(0,a-Math.max(0,t(i))))(n);return we.makeDecimal(n,s)};class ln extends Ut{constructor(e,t,r,s,i,a,o,l,c=!1,h=!1,v=!1){super(e,s),this.startUnit=e-t/2,this.width=t,this.open=r,this.high=i,this.low=a,this.name=o,this.candle=l,this.hasBorder=c,this.isActive=h,this.isHollow=v}bodyHeight(e){return se(Math.abs(e.toY(this.open)-e.toY(this.close)))}candleHeight(e){return se(Math.abs(e.toY(this.high)-e.toY(this.low)))}bodyAsVLine(e){if(this.width<2)return[this.centerUnit,this.yLineStart(e),this.width,this.candleHeight(e)]}bodyRect(e){return[this.startUnit,this.yBodyStart(e),this.width,this.bodyHeight(e)]}getCandle(){return this.candle}yBodyKeyPoints(e){const t=se(e.toY(this.high)),r=se(e.toY(this.low)),s=se(e.toY(this.open)),i=se(e.toY(this.close)),[a,o]=s>i?[i,s]:[s,i],[l,c]=t>r?[r,t]:[t,r];return[l,a,o,c]}yLineEnd(e){return se(Math.max(e.toY(this.high),e.toY(this.low)))}yLineStart(e){return se(Math.min(e.toY(this.high),e.toY(this.low)))}yBodyStart(e){return se(Math.min(e.toY(this.open),e.toY(this.close)))}yBodyEnd(e){return se(Math.max(e.toY(this.open),e.toY(this.close)))}xCenter(e){return this.x(e)}xStart(e){return Sl(e.toX(this.startUnit))}}const _t=60,Fs=(n,e,t,r,s=_t)=>{const i=zt(n,r,s);i.volume=t;let a;if(e.length===0)a=0;else if(r>=e.length){const o=e[e.length-1],c=(r-(e.length-1))*t;a=o.centerUnit+c}else{const o=e[0],c=-r*t;a=o.centerUnit-c}return new ln(a,t,i.open,i.close,i.lo,i.hi,sn(i.open,i.close),i)},Rl=(n,e,t,r,s=_t)=>{const i=Fl(n,r,s);let a;if(e.length===0)a=0;else if(r>=e.length){const o=e[e.length-1],c=(r-(e.length-1))*t;a=o.centerUnit+c}else{const o=e[0],c=-r*t;a=o.centerUnit-c}return new Ut(a,i.close)},zt=(n,e,t=_t)=>({hi:NaN,lo:NaN,open:NaN,close:NaN,timestamp:Ys(n,e,t),volume:NaN,expansion:!0,idx:e}),Fl=(n,e,t=_t)=>({close:NaN,timestamp:Ys(n,e,t)});function Ys(n,e,t=_t){var r,s;const i=gt(e);if(n.length===0)return 0;const a=Ue(n);if(i>=n.length&&a)return Hs(a,n.length-1,i,t);const o=Yt(n);return i<0&&o?Hs(o,0,i,t):(s=(r=n[i])==null?void 0:r.timestamp)!=null?s:0}const Hs=(n,e,t,r=_t)=>n.timestamp+(t-(e!=null?e:0))*r;class Yl{constructor(e){this.type=e,this.mainDataPoints=[],this.mainVisualPoints=[],this.dataUpdatedSubject=new G,this.dataSetSubject=new G,this.dataRemovedSubject=new G,this.dataPrependSubject=new G,this.meanDataWidth=1,this.period=1}dataFromTimestamp(e,t=!0){const r=kt(e,t,this.mainDataPoints,this.period);return this.dataFromIdx(r.index)}recalculatePeriod(){const e=fl(this.mainDataPoints);e&&(this.period=e)}dataFromIdx(e){const t=this.mainVisualPoints[e];return t||(this.type==="candle"?Fs(this.mainDataPoints,this.mainVisualPoints,this.meanDataWidth,e,this.period):Rl(this.mainDataPoints,this.mainVisualPoints,this.meanDataWidth,e,this.period))}}var Hl=Object.defineProperty,Ns=Object.getOwnPropertySymbols,Nl=Object.prototype.hasOwnProperty,kl=Object.prototype.propertyIsEnumerable,ks=(n,e,t)=>e in n?Hl(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Wl=(n,e)=>{for(var t in e||(e={}))Nl.call(e,t)&&ks(n,t,e[t]);if(Ns)for(var t of Ns(e))kl.call(e,t)&&ks(n,t,e[t]);return n};class Ul{constructor(e,t){this.canvasModel=e,this.config=t,this.prevState={},this.prevWidth=0,this.prevHeight=0}draw(){if(_s(this.config.colors.chartAreaTheme,this.prevState)&&this.prevHeight===this.canvasModel.height&&this.prevWidth===this.canvasModel.width)return;this.canvasModel.clear();const e=this.canvasModel.ctx;if(this.config.colors.chartAreaTheme.backgroundMode==="gradient"){const t=e.createLinearGradient(0,0,this.canvasModel.width,this.canvasModel.height);t.addColorStop(0,this.config.colors.chartAreaTheme.backgroundGradientTopColor),t.addColorStop(1,this.config.colors.chartAreaTheme.backgroundGradientBottomColor),e.fillStyle=t}else e.fillStyle=this.config.colors.chartAreaTheme.backgroundColor;e.fillRect(0,0,this.canvasModel.width,this.canvasModel.height),this.prevState=Wl({},this.config.colors.chartAreaTheme),this.prevWidth=this.canvasModel.width,this.prevHeight=this.canvasModel.height}getCanvasIds(){return[this.canvasModel.canvasId]}}const cn=(n,e,t,r,s,i,a)=>{const o=wl(),l=[t*o,r*o,s*o,i*o];let c=n.getImageData(...l);if(a!==void 0){const h=c.data[3]/255;if(h===1)for(let v=3;v<c.data.length;v+=4)c.data[v]=ve(c.data[v]*a);else for(let v=0;v<c.data.length;v++){const p=c.data[v];c.data[v]=v%4===3?ve(p*a):ve(h*p)}c=new ImageData(c.data,c.width,c.height,{colorSpace:c.colorSpace})}e.putImageData(c,l[0],l[1])},Ws=(n,{x:e,width:t,activeCandle:r})=>new ln(e,t,n.open,n.close,n.hi,n.lo,sn(n.open,n.close),n,!0,Jn(n,r)),zl=(n,{x:e,width:t,activeCandle:r,prevCandle:s})=>{var i;return new ln(e,t,n.open,n.close,n.hi,n.lo,vl((i=s==null?void 0:s.close)!=null?i:n.close,n.close),n,!0,Jn(n,r),n.close>n.open)},Xl=(n,{x:e,width:t,activeCandle:r,prevCandle:s})=>{var i;return new ln(e,t,n.open,n.close,n.hi,n.lo,sn((i=s==null?void 0:s.close)!=null?i:n.close,n.close),n,!0,Jn(n,r),n.close>n.open)},Jn=(n,e)=>{const t=e&&e.idx===n.idx;return t!=null?t:!1},Us=()=>Vn,bt=class{static autoDetectIncrementOfValueRange(n){const e=this.getDigitsInNumber(n);return n===0?.01:Math.pow(10,e-3)}static getDigitsInNumber(n){const e=r=>ve(Math.log10((r^r>>31)-(r>>31)))+1;let t=e(n);return t===1&&n<1&&(t=e(n*1e9)-9),t}static getPriceIncrement(n,e=[]){if(!this.validatePriceIncrementsOrPrecisions(e))return this.DEFAULT_INCREMENT;if(isNaN(n))return Math.round(e[0]);n=Math.abs(n);let t=1;const r=1e-6;for(;t<e.length&&n>e[t]+Math.min(e[t-1],e[t+1])*r;)t+=2;return t>=e.length||n<e[t]-Math.min(e[t-1],e[t+1])*r?e[t-1]:Math.min(e[t-1],e[t+1])}static getPricePrecision(n,e){if(!this.validatePriceIncrementsOrPrecisions(e))return 0;if(isNaN(n))return Math.round(e[0]);n=Math.abs(n);let t=1;for(;t<e.length&&n>e[t];)t+=2;return Math.round(e[t-1])}static roundPriceToIncrement(n,e,t){const r=bt.getPriceIncrement(t||n,e);return we.roundToNearest(n,r)}static computePrecisions(n){const e=[...n];for(let t=0;t<n.length;t+=2)e[t]=bt.calculatePrecision(n[t]);for(let t=1;t<n.length;t+=2)e[t]=n[t]+Math.min(n[t-1],n[t+1])*bt.RELATIVE_EPS;return e}static calculatePrecision(n){let e=n>1?Math.abs(Math.floor(n)-n):n;for(let t=0;t<bt.MAXIMUM_PRECISION;t++){const r=Math.floor(e+.5),s=Math.abs(e*bt.RELATIVE_EPS);if(r>=e-s&&r<=e+s)return t;e*=10}return bt.MAXIMUM_PRECISION}static validatePriceIncrementsOrPrecisions(n){return!(n.length===0||!Array.isArray(n)||n.findIndex(e=>e!==0)===-1)}};let ze=bt;ze.DEFAULT_INCREMENT=.01,ze.DEFAULT_PRECISION=2,ze.RELATIVE_EPS=1e-8,ze.MAXIMUM_PRECISION=10;var jl=Object.defineProperty,Vl=Object.defineProperties,Gl=Object.getOwnPropertyDescriptors,zs=Object.getOwnPropertySymbols,$l=Object.prototype.hasOwnProperty,Zl=Object.prototype.propertyIsEnumerable,Xs=(n,e,t)=>e in n?jl(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Kl=(n,e)=>{for(var t in e||(e={}))$l.call(e,t)&&Xs(n,t,e[t]);if(zs)for(var t of zs(e))Zl.call(e,t)&&Xs(n,t,e[t]);return n},ql=(n,e)=>Vl(n,Gl(e));const Jl=n=>({isHighLowActive:()=>!0,calculateHighLow:e=>{const t=e?e.xStart:n.scaleModel.xStart,r=e?e.xEnd:n.scaleModel.xEnd,{dataIdxStart:s,dataIdxEnd:i}=n.calculateDataViewportIndexes(t,r),a=n.visualPoints.slice(s,i+1),o=js(a),l=()=>{var c,h;return(h=(c=n.visualPoints[s])==null?void 0:c.close)!=null?h:1};return ql(Kl({},o),{low:n.view.toAxisUnits(o.low,l),high:n.view.toAxisUnits(o.high,l)})}}),js=n=>{const e={high:Number.MIN_SAFE_INTEGER,low:Number.MAX_SAFE_INTEGER,highIdx:0,lowIdx:0};for(let t=0;t<n.length;t++){const r=n[t];r.high>e.high&&(e.high=r.high,e.highIdx=t),r.low<e.low&&(e.low=r.low,e.lowIdx=t)}return e},Ql=30,ec=(n,e,t)=>{const r=n.startViewportMovementAnimation(e,{duration:Ql,targetXStart:t.xStart,targetXEnd:t.xEnd,targetYStart:t.yStart,targetYEnd:t.yEnd,targetZoomX:t.zoomX,targetZoomY:t.zoomY});e.currentAnimation=r};class tc{constructor(e,t){this.delegate=e,this.auto=!0,this.highLowPostPorcessor={},this.highLowProviders=t!=null?t:{}}setHighLowProvider(e,t){this.highLowProviders[e]=t}deleteHighLowProvider(e){delete this.highLowProviders[e]}setHighLowPostProcessor(e,t){this.highLowPostPorcessor[e]=t}setAutoAndRecalculateState(e,t){this.auto=t,t&&nc(this.delegate,e,Object.values(this.highLowProviders),Object.values(this.highLowPostPorcessor))}}const nc=(n,e,t,r)=>{const s=t.filter(o=>o.isHighLowActive()).map(o=>o.calculateHighLow(e)),i=Vs(s),a=r.reduce((o,l)=>l(o),i);e.yStart=a.low,e.yEnd=a.high,e.zoomY=n.calculateZoomY(e.yStart,e.yEnd)};function Vs(n){if(n.length===0)return rc();let e=n[0].high,t=n[0].low;return n.forEach(r=>{isFinite(r.high)&&r.high>=e&&(e=r.high),isFinite(r.low)&&r.low<=t&&(t=r.low)}),{low:t,high:e}}const rc=()=>({high:Number.MIN_SAFE_INTEGER,low:Number.MAX_SAFE_INTEGER});var sc=Object.defineProperty,Gs=Object.getOwnPropertySymbols,ic=Object.prototype.hasOwnProperty,ac=Object.prototype.propertyIsEnumerable,$s=(n,e,t)=>e in n?sc(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Zs=(n,e)=>{for(var t in e||(e={}))ic.call(e,t)&&$s(n,t,e[t]);if(Gs)for(var t of Gs(e))ac.call(e,t)&&$s(n,t,e[t]);return n};const oc=(n,e,t,r)=>{var s,i,a,o;const l=Zs({},n),c=(i=(s=e[t])==null?void 0:s.startUnit)!=null?i:0,h=(o=(a=_o(-t,e))==null?void 0:a.startUnit)!=null?o:0;let v=n.xStart,p=n.xEnd;return l.xStart>=h&&(v=h,p=p-(l.xStart-h)),l.xEnd<c&&(v=c-tt(r.width,l.zoomX),p=c),l.xStart=v,l.xEnd=p,l},lc=(n,e,t,r)=>{const s=Zs({},e),i=r(),a=s.xEnd-s.xStart,o=a<t.minCandles,l=i.width/t.minWidth,c=a>l;if(i.width>0){if(c)return s.xStart=s.xEnd-l,s.zoomX=on(s.xEnd-s.xStart,i.width),s;if(o)return s.xEnd=n.xEnd,s.xStart=s.xEnd-t.minCandles,s.zoomX=on(s.xEnd-s.xStart,i.width),s}return s},cc=(n,e)=>n/e,hc=(n,e)=>n/e,wv=(n,e)=>n*e,Ks=(n,e)=>{const t=n.zoomY;n.zoomY=hc(n.zoomX,e);const r=n.zoomY/t,s=n.yEnd-n.yStart,a=s*r-s;n.yEnd=n.yEnd+a},dc=(n,e)=>{const t=n.xStart;n.xStart=e,n.xEnd=n.xEnd+(e-t)},uc=(n,e)=>{const t=n.yStart;n.yStart=e,n.yEnd=n.yEnd+(e-t)},qs=(n,e,t,r,s)=>{const i=(e.xEnd-e.xStart)*r,a=i*t,o=i*(1-t);return s?(e.xStart=e.xStart+a,e.xEnd=e.xEnd-o):(e.xStart=e.xStart-a,e.xEnd=e.xEnd+o),e.zoomX=n.calculateZoomX(e.xStart,e.xEnd),e},fc=(n,e,t,r)=>qs(n,e,1,t,r);var vc=Object.defineProperty,Js=Object.getOwnPropertySymbols,gc=Object.prototype.hasOwnProperty,pc=Object.prototype.propertyIsEnumerable,Qs=(n,e,t)=>e in n?vc(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,hn=(n,e)=>{for(var t in e||(e={}))gc.call(e,t)&&Qs(n,t,e[t]);if(Js)for(var t of Js(e))pc.call(e,t)&&Qs(n,t,e[t]);return n};const mc=()=>({high:Number.NEGATIVE_INFINITY,low:Number.POSITIVE_INFINITY,highIdx:0,lowIdx:0});class ei extends xl{constructor(e,t,r){super(),this.config=e,this.getBounds=t,this.canvasAnimation=r,this.scaleInversedSubject=new G,this.history=[],this.zoomXYRatio=0,this.xConstraints=[],this.scalePostProcessor=(s,i)=>this.xConstraints.reduce((a,o)=>o(s,a),i),this.state=Wt(e.scale),this.autoScaleModel=new tc(this),this.offsets=this.config.components.offsets,this.addXConstraint((s,i)=>lc(s,i,this.config.components.chart,this.getBounds))}addXConstraint(e){this.xConstraints=[...this.xConstraints,e]}updateOffsets(e){this.offsets=hn(hn({},this.offsets),e),this.doAutoScale(!0)}getOffsets(){return this.offsets}zoomXToPercent(e,t,r=!1,s=this.config.scale.zoomSensitivity){this.config.components.yAxis.type==="percent"&&this.haltAnimation();const i=this.export();qs(this,i,e,s,t),this.zoomXTo(i,r)}zoomXToEnd(e,t=this.config.scale.zoomSensitivity){this.config.components.yAxis.type==="percent"&&this.haltAnimation();const r=this.export();fc(this,r,t,e),this.zoomXTo(r)}haltAnimation(){var e;(e=this.currentAnimation)!=null&&e.animationInProgress&&(this.currentAnimation.finishAnimation(),this.doAutoScale())}zoomXTo(e,t){const r=hn({},e),s=this.scalePostProcessor(r,e);this.state.lockPriceToBarRatio&&Ks(s,this.zoomXYRatio),this.state.auto&&this.autoScaleModel.setAutoAndRecalculateState(s,!0),t?this.apply(s):ec(this.canvasAnimation,this,s)}setXScale(e,t){const r=this.export();super.setXScale(e,t,!1);const s=this.export(),i=this.scalePostProcessor(r,s);this.state.lockPriceToBarRatio&&Ks(i,this.zoomXYRatio),this.state.auto&&this.autoScaleModel.setAutoAndRecalculateState(i,!0),this.apply(i)}moveXStart(e){const t=this.export(),r=hn({},t);this.haltAnimation(),dc(t,e);const s=this.scalePostProcessor(r,t);this.state.auto&&this.autoScaleModel.setAutoAndRecalculateState(s,!0),this.apply(s)}moveYStart(e){if(this.haltAnimation(),!this.state.auto){const t=this.export();uc(t,e),this.apply(t)}}doAutoScale(e=!1){if(!this.isViewportAnimationInProgress()&&this.state.auto||e){const t=this.export();this.autoScaleModel.setAutoAndRecalculateState(t,!0),Ml(t,this.export())||this.apply(t)}}isViewportAnimationInProgress(){const e=this.currentAnimation;return e==null?void 0:e.animationInProgress}pushToHistory(e){this.history.push(e)}popFromHistory(){return this.history.pop()}clearHistory(){this.history=[]}isDefaultXBounds(){return this.xStart===0&&this.xEnd===0}isDefaultYBounds(){return this.yStart===0&&this.yEnd===0}isScaleReady(){return!this.isDefaultXBounds()&&!this.isDefaultYBounds()}autoScale(e=!0){this.config.components.yAxis.type==="percent"?this.state.auto=!0:this.state.auto=e,e&&(this.clearHistory(),this.doAutoScale())}setLockPriceToBarRatio(e=!1){const{type:t}=this.config.components.yAxis;if(t==="percent"||t==="logarithmic"){this.state.lockPriceToBarRatio=!1;return}e&&this.recalculateZoomXYRatio(),this.state.lockPriceToBarRatio=e}recalculateZoomXYRatio(){this.zoomXYRatio=cc(this.zoomX,this.zoomY)}}class bc extends ei{constructor(e,t,r,s){super(t,r,s),this.delegate=e,this.config=t,this.getBounds=r}doActivate(){this.addRxSubscription(this.delegate.xChanged.subscribe(()=>this.doAutoScale(this.state.auto)))}get xStart(){return this.delegate.xStart}set xStart(e){this.delegate.xStart=e}get xEnd(){return this.delegate.xEnd}set xEnd(e){this.delegate.xEnd=e}get zoomX(){return this.delegate.zoomX}set zoomX(e){this.delegate.zoomX=e}observeXChanged(){return this.delegate.xChanged}fireChanged(){this.delegate.changed.next(),this.changed.next()}}const Cc=tn().colors;class ct extends Rs{constructor(e,t,r,s,i,a,o,l=Cc){super(e,t),this.eventBus=r,this.candlesTransformersByChartType=a,this.candleWidthByChartType=o,this.colors=l,this.zippedHighLow=mc(),this.lastPriceMovement="none",this.lastVisualCandleChangedSubject=new G,this.meanCandleWidth=Vn,this._instrument=i,this.instrument=i,this.highLowProvider=Jl(this),this.scaleModel=s,this.name=i.symbol}get dataPoints(){return super.dataPoints}set dataPoints(e){super.dataPoints=e,this.applyPriceMovement()}get instrument(){return this._instrument}set instrument(e){var t;this._instrument=e,this.pricePrecisions=ze.computePrecisions((t=e.priceIncrements)!=null?t:[.01])}recalculateDataViewportIndexes(e=this.scaleModel.xStart,t=this.scaleModel.xEnd){super.recalculateDataViewportIndexes(e,t),this.recalculateZippedHighLow(),this.eventBus.fireDraw()}applyPriceMovement(){const e=Ue(this.dataPoints);e&&(this.lastPriceMovement=sn(e.open,e.close))}recalculateVisualPoints(){super.recalculateVisualPoints(),this.recalculateMeanCandleWidth(this.visualPoints)}recalculateZippedHighLow(){return this.zippedHighLow=js(this.visualPoints.slice(this.dataIdxStart,this.dataIdxEnd))}updateCurrentPrice(e){this.previousPrice=this.currentPrice||e,this.currentPrice=e,this.currentPrice!==this.previousPrice&&(this.lastPriceMovement=this.currentPrice>this.previousPrice?"up":"down")}updateCandleSeriesColors(e){this.colors=Ge(e,this.colors),this.recalculateVisualPoints()}observeLastVisualCandleChanged(){return this.lastVisualCandleChangedSubject.asObservable()}doDeactivate(){super.doDeactivate()}toVisualPoints(e,t=0){var r,s;if(e.length===0)return[];const i=this.config.type,a=[];let o=t;const l=(r=this.candleWidthByChartType[i])!=null?r:Us;for(let c=0;c<e.length;c++){const h=e[c],v=e[c-1],p=l(h),y=o+p/2,E=(s=this.candlesTransformersByChartType[i])!=null?s:Ws;a.push(E(h,{x:y,width:p,prevCandle:v,activeCandle:this.activeCandle})),o+=p}return a}recalculateMeanCandleWidth(e){e.length!==0?this.meanCandleWidth=e.reduce((t,r)=>t+r.width,0)/e.length:this.meanCandleWidth=Vn}setActiveCandle(e){this.activeCandle=e,this.recalculateVisualPoints()}clearData(){this.dataPoints=[],this.clearVisualCandles(),this.clearPrices()}clearPrices(){this.previousPrice=void 0,this.currentPrice=void 0,this.lastPriceMovement="none"}clearVisualCandles(){this.visualPoints=[]}}function Sv(n){switch(n){case"line":case"area":return!0;default:return!1}}class yc{constructor(e){this.config=e}draw(e,t,r,s){if(r instanceof ct){const i=Ie(t);if(i.length===0)return;s.singleColor?e.strokeStyle=s.singleColor:e.strokeStyle=r.colors.areaTheme.lineColor,r.hovered?e.lineWidth=this.config.selectedWidth:e.lineWidth=this.config.areaLineWidth;const a=r.extentComponent.getBounds(),o=i[0],l=r.view.toX(o.centerUnit);for(let c=0;c<i.length;c++){const h=i[c-1],v=i[c+1],p=i[c],y=r.view.toX(p.centerUnit),E=r.view.toY(p.close),R=a.y+a.height;if(h===void 0)e.beginPath(),e.lineTo(ve(y),R),e.moveTo(ve(y),E);else if(v===void 0){e.lineTo(ve(y),E),e.stroke(),e.lineTo(ve(y),R),e.lineTo(ve(l),R),e.closePath();let N;s.singleColor?e.fillStyle=s.singleColor:e.fillStyle=r.colors.areaTheme.startColor&&r.colors.areaTheme.stopColor?(N=e.createLinearGradient(0,0,0,a.height),N.addColorStop(0,r.colors.areaTheme.startColor),N.addColorStop(1,r.colors.areaTheme.stopColor),N):"",e.fill()}else e.lineTo(ve(y),E)}}}}function ti(n,e,t,r,s,i=4,a=!0,o=!1){n.save(),n.beginPath(),n.moveTo(e+i,t),n.lineTo(e+r-i,t),n.quadraticCurveTo(e+r,t,e+r,t+i),n.lineTo(e+r,t+s-i),n.quadraticCurveTo(e+r,t+s,e+r-i,t+s),n.lineTo(e+i,t+s),n.quadraticCurveTo(e,t+s,e,t+s-i),n.lineTo(e,t+i),n.quadraticCurveTo(e,t,e+i,t),n.closePath(),a&&n.fill(),o&&n.stroke(),n.restore()}function wc(n,e,t,r,s,i,a,o,l,c,h=4,v=!0,p=!1){const y=c==="right"?o:-o,E=c==="right"?h:-h,R=h;n.save(),n.beginPath(),l?n.moveTo(i+E,a):n.moveTo(i,a),l?(n.lineTo(i+y-E,a),n.quadraticCurveTo(i+y,a,i+y,a-R),n.lineTo(i+y,t+R),n.quadraticCurveTo(i+y,t,i+y-E,t),n.lineTo(e+E,t)):(n.lineTo(i+y,a),n.lineTo(i+y,t),n.lineTo(e,t)),l?(n.quadraticCurveTo(e,t,e-E/3,t+R/3),n.lineTo(r+E/3,s-R/3),n.quadraticCurveTo(r,s,r+E/3,s+R/3),n.lineTo(i-E/3,a-R/3),n.quadraticCurveTo(i,a,i+E/3,a)):(n.lineTo(r,s),n.lineTo(i,a)),n.closePath(),v&&n.fill(),p&&n.stroke(),n.restore()}function Sc(n,e,t,r,s,i=1){n.save(),n.lineWidth=i,n.beginPath(),n.moveTo(e,t),n.lineTo(r,s),n.stroke(),n.closePath(),n.restore()}function Ct(n,e){n.save(),n.lineWidth%2&&n.translate(.5,.5),e(),n.restore()}function ni(n,e,t){const r=Math.min(e.x,t.x)+.5,s=Math.min(e.y,t.y),i=Math.abs(e.x-t.x),a=Math.abs(e.y-t.y);n.fillRect(r,s,i,a)}const xv=n=>Array.isArray(n[0])?n:[n];class xc{constructor(e,t,r){this.paneManager=e,this.canvasModel=t,this.seriesDrawers=r}draw(){const e=this.canvasModel.ctx;Ft(Object.values(this.paneManager.paneComponents),t=>t.yExtentComponents).forEach(t=>{e.save(),yt(e,t.getBounds()),t.dataSeries.forEach(r=>this.drawSeries(e,r)),e.restore()})}drawSeries(e,t){if(t.config.visible){const r=t.config.type,s=this.seriesDrawers[r];if(s){const i=t.getSeriesInViewport(t.scaleModel.xStart-1,t.scaleModel.xEnd+1);i&&i.length>=1&&s.draw(e,i,t,{})}else console.error(`Data series drawer with type ${r} isn't registered!`)}}getCanvasIds(){return[this.canvasModel.canvasId]}}const yt=(n,e)=>{n.beginPath(),n.rect(e.x,e.y,e.width,e.height),n.clip(),n.closePath()},At=(n,e,t,r,s=e)=>{r.forceBold?n.lineWidth=r.forceBold:t.hovered?n.lineWidth=s:n.lineWidth=e};class Mc{constructor(e){this.config=e}setFillStyle(e,t,r,s){if(t.singleColor)e.strokeStyle=t.singleColor;else{const i=r.colors.barTheme;i&&(e.strokeStyle=i[`${s.name}Color`])}}draw(e,t,r,s){if(r instanceof ct){const i=Ie(t);At(e,this.config.barLineWidth,r,s),Ct(e,()=>{for(const a of i){this.setFillStyle(e,s,r,a),e.beginPath();const o=se(r.view.toX(a.centerUnit)),l=se(r.view.toX(a.startUnit)),[c,h,v,p]=a.yBodyKeyPoints(r.view),y=se(r.view.xPixels(a.width)/2),E=se(r.view.toY(a.close)),R=se(r.view.toY(a.open));this.config.showWicks?(e.moveTo(o,c),e.lineTo(o,p)):(e.moveTo(o,h),e.lineTo(o,v)),e.moveTo(o,E),e.lineTo(o+y,E),e.moveTo(l,R),e.lineTo(o,R),e.stroke()}})}}}class Pc{constructor(e,t){this.baseLineModel=e,this.canvasBoundContainer=t}draw(e,t,r,s){if(s!==void 0&&r instanceof ct){const i=Ie(t),a=this.baseLineModel.baselineYPercents,o=this.canvasBoundContainer.getBounds(Y.CHART),l=o.y+o.height*(a/100),c=i[0];for(let h=0;h<i.length;h++){const v=i[h],p=i[h-1],y=i[h+1],E=r.view.toX(c.centerUnit),R=r.view.toX(v.centerUnit),N=r.view.toY(v.close),k=p?r.view.toY(p.close)<l:!1,U=N<l;if(p!==void 0&&k!==U){ri(e,r,s,k);const Z=r.view.toX(p.centerUnit),K=r.view.toY(p.close),q=R-Z,$=N-K,J=q/$,ne=N-l,oe=J*ne,le=Z+(q-oe);e.lineTo(le,l),e.stroke(),e.lineTo(E,l),e.closePath(),e.fill(),e.beginPath(),e.moveTo(le,l)}p===void 0?(e.beginPath(),e.moveTo(R,N)):y===void 0?(ri(e,r,s,U),e.lineTo(R,N),e.stroke(),e.lineTo(R,l),e.lineTo(E,l),e.closePath(),e.fill(),e.beginPath(),e.moveTo(E,l),e.lineTo(R,l),e.strokeStyle=r.colors.baseLineTheme.baselineColor,e.stroke()):e.lineTo(R,N)}}}}const ri=(n,e,t,r)=>{t.singleColor?(n.fillStyle=t.singleColor,n.strokeStyle=t.singleColor):(n.fillStyle=r?e.colors.baseLineTheme.upperSectionFillColor:e.colors.baseLineTheme.lowerSectionFillColor,n.strokeStyle=r?e.colors.baseLineTheme.upperSectionStrokeColor:e.colors.baseLineTheme.lowerSectionStrokeColor)};class Tc{constructor(e){this.config=e,this.pixelLength=1,this.lineWidthCU=1,this.halfLineWidthCU=1}draw(e,t,r,s){if(r instanceof ct){const i=Ie(t);At(e,this.config.candleLineWidth,r,s,this.config.candleLineWidth),Ct(e,()=>{this.pixelLength=1/$e,this.halfLineWidthCU=e.lineWidth/2,this.lineWidthCU=e.lineWidth;for(const a of i){const{candleTheme:o,activeCandleTheme:l}=r.colors;o&&l&&this.drawCandle(e,s,r,a)}})}}drawCandle(e,t,r,s){const{candleTheme:i,activeCandleTheme:a}=r.colors,o=s.name,l=s.isActive?a:i,c=s.isHollow;t.singleColor?e.fillStyle=t.singleColor:c?e.fillStyle=l[`${o}WickColor`]:e.fillStyle=l[`${o}Color`];const h=se(r.view.toX(s.startUnit)),v=se(r.view.xPixels(s.width)),p=s.bodyHeight(r.view),[y,E,R,N]=s.yBodyKeyPoints(r.view),k=E===R?E+1:R,U=y===N?y+1:N,Z=l[`${o}Color`],K=o==="none"?Z:l[`${o}WickColor`];e.fillStyle=Z,t.singleColor?e.strokeStyle=t.singleColor:e.strokeStyle=K;const q=c||(s.hasBorder&&s.isActive?this.config.showActiveCandlesBorder:this.config.showCandlesBorder),$=this.config.showWicks;if(v<2)e.beginPath(),e.moveTo(h,$?y:E),e.lineTo(h,$?U:k),e.stroke();else if(v<3)e.beginPath(),e.moveTo(h,$?y:E),e.lineTo(h,$?U:k),e.moveTo(h+1,E),e.lineTo(h+1,k),e.stroke();else if(v===3){const J=v/$e;this.drawCandlesWicks(e,h+J,y,U,E,k),c||(e.beginPath(),e.moveTo(h+J,E),e.lineTo(h+J,k),e.stroke()),this.drawCandleBorder(e,t,l,s,h+this.halfLineWidthCU,E+this.halfLineWidthCU,v-this.lineWidthCU,p-this.lineWidthCU)}else{const J=se(r.view.toX(s.centerUnit));this.drawCandlesWicks(e,J,y,U,E,k-1);const ne=this.config.candlePaddingPercent,oe=Math.max(se(v*ne/2),this.pixelLength),le=h+oe,re=v-oe*2;c||(t.singleColor&&(e.fillStyle=t.singleColor),e.fillRect(le,E,re,p)),q&&this.drawCandleBorder(e,t,l,s,le+this.halfLineWidthCU,E+this.halfLineWidthCU,re-this.lineWidthCU,p-this.lineWidthCU)}}drawCandlesWicks(e,t,r,s,i,a){this.config.showWicks&&(e.beginPath(),e.moveTo(t,r),e.lineTo(t,i),e.moveTo(t,a),e.lineTo(t,s),e.stroke())}drawCandleBorder(e,t,r,s,i,a,o,l){if(t.singleColor)e.strokeStyle=t.singleColor;else{const c=s.name;e.strokeStyle=c==="none"?r[`${c}Color`]:r[`${c}WickColor`]}e.strokeRect(i,a,o,l)}}class _c{constructor(e){this.config=e}draw(e,t,r,s){if(r instanceof ct){const i=t.flat(),a=r.scaleModel.getBounds(),o=a.y+a.height;for(const l of i){e.beginPath();const c=l.name,h=this.config.barCapSize,v=r.colors.histogram;if(v===void 0)return;s.singleColor?e.fillStyle=s.singleColor:e.fillStyle=v[`${c}Bright`];const p=l.xStart(r.view),y=se(r.view.toY(l.close)),E=se(r.view.xPixels(l.width));e.fillRect(p,y,E,h);const R=e.createLinearGradient(0,y+h,0,o);s.singleColor?e.fillStyle=s.singleColor:(R.addColorStop(0,v[`${c}Cap`]),R.addColorStop(1,v[`${c}Bottom`]),e.fillStyle=R),E===0?(e.beginPath(),e.strokeStyle=R,e.moveTo(p,y+h),e.lineTo(p,o),e.stroke(),e.closePath()):e.fillRect(p,y+h,E,o-y-h)}}}}class Ac{constructor(e){this.config=e}draw(e,t,r,s){if(r instanceof ct){const i=Ie(t);At(e,this.config.lineWidth,r,s,this.config.selectedWidth);const a=r.colors.lineTheme;e.lineCap="round",s.singleColor&&(e.strokeStyle=s.singleColor);for(let o=1;o<i.length;o++){const l=i[o-1],c=i[o],h=c.name;s.singleColor||(e.strokeStyle=a[`${h}Color`]);const v=r.view.toX(l.centerUnit),p=r.view.toY(l.close),y=r.view.toX(c.centerUnit),E=r.view.toY(c.close);e.beginPath(),e.moveTo(v,p),e.lineTo(y,E),e.stroke()}}}}const Dc=1.5;class Ec{constructor(e){this.config=e}draw(e,t,r,s){var i;e.fillStyle=(i=s.singleColor)!=null?i:this.config.mainColor;for(const a of Ie(t)){e.beginPath();const o=se(r.view.toX(a.centerUnit)),l=se(r.view.toY(a.close));e.arc(o,l,Dc,0,Math.PI*2,!0),e.fill()}}}const Lc=["candle","bar","line","area","scatterPlot","hollow","histogram","baseline","trend"];class Ic{constructor(e,t,r){this.drawer=e,this.config=t,this.chartBounds=r}draw(e,t,r,s){this.isChartTypeAllowed()&&(this.beforeDraw(e),this.drawer.draw(e,t,r,s),this.afterDraw(e,r))}beforeDraw(e){e.restore(),e.save(),yt(e,this.chartBounds())}isChartTypeAllowed(){return Lc.includes(this.config.components.chart.type)}afterDraw(e,t){e.restore(),e.save(),yt(e,t.scaleModel.getBounds())}}class Oc{constructor(e){this.chartModel=e}draw(e,t,r,s){t.forEach((i,a)=>{var o;const l=r.getPaintConfig(a);e.fillStyle=(o=s.singleColor)!=null?o:l.color,i.forEach(c=>{const h=this.chartModel.getVisualCandle(gt(c.centerUnit)),v=c.close;if(h&&v===1){const p=this.chartModel.scaleModel.zoomX,y=se(Pe(h.width,p)),E=se(h.bodyHeight(this.chartModel.scaleModel)),R=h.xCenter(this.chartModel.scaleModel)-y/2,N=h.yBodyStart(this.chartModel.scaleModel),k=this.chartModel.config.components.chart.candlePaddingPercent,U=se(y*k/2),Z=R+U,K=y-U*2;e.fillRect(Z,N,K,E)}})})}}const si=(n,e,t)=>{n.length!==0&&n.forEach((r,s)=>{const{centerUnit:i,close:a}=r,o=t.toX(i),l=t.toY(a);s===0?e.moveTo(o,l):e.lineTo(o,l)})},Bc=/^(#)([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i,Rc=/^\s*(rgba?)\s*[(]\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*[\d.]+\s*)?[)]\s*$/i;function Fc(n){const e=Bc.exec(n)||Rc.exec(n);let t=[];return e&&(t=e.slice(2,5),e[1]==="#")?t.map(function(r){return parseInt(r,16)}):t}const ii={};function Yc(n,e){let t=ii[n+e];if(!t){const r=Fc(n);t=r&&"rgba("+r.join(",")+","+e+")",ii[n+e]=t}return t}class Hc{constructor(){}draw(e,t,r,s){r.config.visible&&(t.forEach((i,a)=>{var o;const l=r.getPaintConfig(a);At(e,l.lineWidth,r,s,l.hoveredLineWidth);const c=(o=s.singleColor)!=null?o:l.color;e.strokeStyle=c,this.drawLine(e,i,r.view)}),r.linkedDataSeriesModels.forEach((i,a)=>{if(oi(i.config.type)&&oi(r.config.type)&&i.config.visible){const o=[],l=r,c=l.getSeriesInViewport(l.scaleModel.xStart-1,l.scaleModel.xEnd+1),h=i.getSeriesInViewport(i.scaleModel.xStart-1,i.scaleModel.xEnd+1);c.forEach((v,p)=>{const y=Math.min(v.length,h[p].length);for(let N=0;N<y;N++){const k=[v[N].clone(),h[p][N].clone()];o.push({diffPoints:k})}const E=l.getPaintConfig(p).color,R=i.getPaintConfig(a).color;this.drawDifference(e,E,R,o,l,i,s)})}}))}drawLine(e,t,r){e.beginPath(),si(t,e,r),e.stroke()}drawDifference(e,t,r,s,i,a,o){const[l,c]=[[],[]];s.forEach(p=>{const[y,E]=p.diffPoints;l.push(y),c.push(E)});const h=ai(l,i.view),v=ai(c,a.view);this.fillCloud(e,r,h,v,o),this.fillCloud(e,t,v,h,o)}fillCloud(e,t,r,s,i){var a,o,l,c;e.save(),e.beginPath();const h=(o=(a=Yt(r))==null?void 0:a.x)!=null?o:0,v=(c=(l=Ue(r))==null?void 0:l.x)!=null?c:0;e.lineTo(h,0),r.forEach(p=>{e.lineTo(p.x,p.y)}),e.lineTo(v,0),e.closePath(),e.clip(),e.beginPath(),r.forEach((p,y)=>{y===0?e.moveTo(p.x,p.y):e.lineTo(p.x,p.y)}),s.slice().reverse().forEach(p=>{e.lineTo(p.x,p.y)}),e.closePath(),e.fillStyle=i.singleColor?i.singleColor:Yc(t||"#383838",.3),e.fill(),e.restore()}}const ai=(n,e)=>n.map(t=>{const{centerUnit:r,close:s}=t,i=e.toX(r),a=e.toY(s);return{x:i,y:a}}),oi=n=>n==="DIFFERENCE";class Nc{constructor(){}draw(e,t,r,s){const i=r.view.toY(0);t.forEach((a,o)=>{var l;const c=r.getPaintConfig(o);At(e,c.lineWidth,r,s,c.hoveredLineWidth),e.strokeStyle=(l=s.singleColor)!=null?l:c.color,e.beginPath(),a.forEach(h=>{const v=r.view.toX(h.centerUnit),p=r.view.toY(h.close);e.moveTo(v,ve(i)),e.lineTo(v,ve(p))}),e.stroke()})}}class kc{constructor(){}draw(e,t,r,s){t.forEach((i,a)=>{var o;const l=r.getPaintConfig(a);At(e,l.lineWidth,r,s,l.hoveredLineWidth),e.strokeStyle=(o=s.singleColor)!=null?o:l.color,this.drawLinePath(e,i,r.view)})}drawLinePath(e,t,r){e.beginPath(),si(t,e,r),e.stroke()}}class Wc{constructor(){}draw(e,t,r,s){t.forEach((i,a)=>{var o;const l=r.getPaintConfig(a),c=l.lineWidth;e.fillStyle=(o=s.singleColor)!=null?o:l.color,e.lineWidth=1,i.forEach(h=>{e.beginPath();const v=r.view.toX(h.centerUnit),p=r.view.toY(h.close);e.arc(v,p,c,0,Math.PI*2),e.fill()})})}}class Uc{constructor(e){this.config=e}draw(e,t,r,s){e.save(),t.forEach((i,a)=>{var o;const l=r.getPaintConfig(a);e.fillStyle=(o=s.singleColor)!=null?o:l.color;const c=l.lineWidth+"px "+this.config.components.yAxis.fontFamily;e.font=c,i.forEach(h=>{const v=r.getTextForPoint(h),p=Re(v,e,c),y=Qe(c,e),E=r.view.toX(h.centerUnit)-p/2,R=r.view.toY(h.close)+y;e.fillText(v,E,R)})}),e.restore()}}class zc{constructor(){}draw(e,t,r,s){t.forEach((i,a)=>{var o;const l=r.getPaintConfig(a);e.fillStyle=(o=s.singleColor)!=null?o:l.color,i.forEach(c=>{const h=r.view.toX(c.centerUnit),v=r.view.toY(c.close);this.drawCandleTriangle(e,h,v,l.lineWidth)})})}drawCandleTriangle(e,t,r,s){e.beginPath(),e.moveTo(t-s/2,r),e.lineTo(t,r-s),e.lineTo(t+s/2,r),e.fill()}}const Qn="resized_local",Xt="draw",Mv="draw_last_candle",Dt={width:20,height:20};class li{constructor(e,t,r,s,i,a={}){this.eventBus=e,this.canvas=t,this.drawingManager=r,this.resizer=i,this.width=0,this.height=0,this.prevHeight=0,this.prevWidth=0,this.type=er;var o;s.push(this),this.parent=Vc(t);const l=t.getContext("2d",a);if(l===null)throw new Error("Couldn't get 2d context????");this.context=l,this._canvasId=(o=t.getAttribute("data-element"))!=null?o:"",this.updateCanvasWidthHeight(t,this.getChartResizerElement().getBoundingClientRect())}updateDPR(e){const{width:t,height:r}=e,s=window.devicePixelRatio;this.canvas.style.height=r+"px",this.canvas.style.width=t+"px",this.canvas.width=t*s,this.canvas.height=r*s,this.width=t,this.height=r,this.ctx.scale(s,s)}get canvasId(){return this._canvasId}get ctx(){return this.context}clear(){this.context.clearRect(0,0,this.width,this.height)}isLinked(){var e,t;return(t=(e=this.type)==null?void 0:e.linked)!=null?t:!1}fireDraw(){this.eventBus.fireDraw([this.canvasId])}updateCanvasWidthHeight(e,t=this.getChartResizerElement().getBoundingClientRect()){e.clientWidth!==this.width&&(e.width=e.clientWidth,this.width=e.clientWidth);const r=t.height;r!==this.height&&(e.style.height=r+"px",this.height=r,e.height=r,this.prevHeight=r)}getChartResizerElement(){var e;return(e=this.resizer)!=null?e:this.parent}isReady(){return this.width>Dt.width&&this.height>Dt.height}}const er={name:"candle"},Xc={candle:er,bar:{name:"candle"},line:{name:"line",linked:!0},area:{name:"area",linked:!0}};function jc(n,e,t,r,s,i,a){var o;const l=wt(n,e,s,i,a,t);return l.type=(o=Xc[r])!=null?o:er,l}function wt(n,e,t,r,s,i,a){const o=new li(n,e,r,s,i,a);return ci(o,t),o}function ci(n,e){const t=n.canvas;e.fixedSize&&(t.width=e.fixedSize.width,t.height=e.fixedSize.height,t.style.width=e.fixedSize.width+"px",t.style.height=e.fixedSize.height+"px",n.width=e.fixedSize.width,n.height=e.fixedSize.height),t.style.position="absolute",t.style.top="0",t.style.left="0",t.style.direction="ltr"}function Vc(n){let e=n;for(;e;){if(e.nodeType===1&&e.hasAttribute("data-chart-container"))return e;if(e.parentElement!==null)e=e.parentElement;else break}return e}let tr=!1,nr=0;const dn=new Map,rr=new Map,hi=()=>{tr||(tr=!0,nr=requestAnimationFrame(()=>{rr.forEach((n,e)=>{n(),rr.delete(e)}),dn.forEach((n,e)=>{n(),dn.delete(e)}),tr=!1}))},di=(n,e)=>{dn.set(n,e),hi()},Av=n=>{dn.delete(n)},sr=(n,e)=>{rr.set(n,e),hi()},un="HIT_TEST_",Dv=null;class Gc{constructor(e,t){this.chartResizeHandler=t,this.drawingOrder=[],this.drawersMap={},this.canvasIdsList=[],this.animFrameId=`draw_${Je()}`,this.drawHitTestCanvas=()=>{this.drawingOrder.forEach(r=>{r.indexOf(un)!==-1&&this.drawersMap[r].draw()})},e.on(Xt,r=>{t.wasResized()&&(this.canvasIdsList&&(r&&r.length!==0?this.canvasIdsList=this.canvasIdsList.concat(r):this.canvasIdsList=void 0),di(this.animFrameId,()=>{this.forceDraw(this.canvasIdsList),this.canvasIdsList=[],this.drawHitTestCanvas()}))})}redrawCanvasesImmediate(){this.chartResizeHandler.fireUpdates(),this.forceDraw()}drawLastBar(){this.drawingOrder.forEach(e=>{if(e.indexOf(un)===-1){const t=this.drawersMap[e];t.drawLastBar&&t.drawLastBar()}})}forceDraw(e){this.isDrawable()&&this.drawingOrder.forEach(t=>{if(t.indexOf(un)===-1){const r=this.drawersMap[t];if(!e||e.length===0){r.draw();return}xo(e,r.getCanvasIds()).length&&r.draw()}})}isDrawable(){var e,t,r,s;return((t=(e=this.chartResizeHandler.previousBCR)==null?void 0:e.height)!=null?t:0)>Dt.width&&((s=(r=this.chartResizeHandler.previousBCR)==null?void 0:r.width)!=null?s:0)>Dt.height}drawHitTestOnly(){this.drawHitTestCanvas()}addDrawer(e,t=Je()){this.drawingOrder.indexOf(t)===-1&&this.drawingOrder.push(t),this.drawersMap[t]=e}addDrawerAfter(e,t,r){this.addDrawer(e,t);const s=this.drawingOrder.indexOf(t);this.drawingOrder.splice(s,1);const i=this.drawingOrder.indexOf(r);this.drawingOrder.splice(i+1,0,t),this.reorderDrawers(this.drawingOrder)}addDrawerBefore(e,t,r){this.addDrawer(e,t);const s=this.drawingOrder.indexOf(r);if(s!==-1){const i=this.drawingOrder.indexOf(t);return this.drawingOrder.splice(i,1),this.drawingOrder.splice(s,0,t),this.reorderDrawers(this.drawingOrder),!0}return!1}getDrawerByName(e){return this.drawersMap[e]}getNameByDrawer(e){for(const t in this.drawersMap)if(this.drawersMap[t]===e)return t}removeDrawerByName(e){const t=this.drawersMap[e];this.removeDrawer(t)}removeDrawer(e){Object.keys(this.drawersMap).forEach(t=>{if(this.drawersMap[t]===e){delete this.drawersMap[t];const r=this.drawingOrder.indexOf(t);r!==-1&&this.drawingOrder.splice(r,1)}})}reorderDrawers(e){this.drawingOrder=$r(this.drawingOrder,e)}}class ui{static paneResizer(e){return`PANE_RESIZER_${e}`}}class $c{constructor(e,t,r){this.seriesDrawers=e,this.canvasModel=t,this.paneManager=r}draw(){const e=this.canvasModel.ctx;Ft(Object.values(this.paneManager.paneComponents),t=>t.yExtentComponents).forEach(t=>{e.save(),yt(e,t.getBounds()),t.dataSeries.forEach(r=>this.drawSeries(e,r)),e.restore()})}drawSeries(e,t){if(t.config.visible){const r=t.config.type,s=this.seriesDrawers[r];if(s){const i={singleColor:this.canvasModel.idToColor(t.id),forceBold:7};s.draw(e,t.getSeriesInViewport(t.scaleModel.xStart-1,t.scaleModel.xEnd+1),t,i)}}}getCanvasIds(){return[this.canvasModel.canvasId]}}const fi={disableChartPanning:!0};class vi extends te{constructor(e,t,r,s,i){super(),this.hitTest=e,this.dragCallbacks=t,this.canvasInputListener=r,this.chartPanComponent=s,this.dragComponentOptions=i,this.dragging=!1,this.draggedPixels=0,this.onDragStart=a=>{this.dragging=!0,this.draggedPixels=0,this.dragCallbacks.onDragStart&&this.dragCallbacks.onDragStart(a),this.dragComponentOptions.disableChartPanning&&this.chartPanComponent.deactivatePanHandlers()},this.onDragTick=a=>{this.dragging&&(this.draggedPixels+=a,this.dragCallbacks.onDragTick({delta:a,draggedPixels:this.draggedPixels}))},this.onDragEnd=()=>{this.dragging&&(this.dragging=!1,this.dragCallbacks.onDragEnd&&this.dragCallbacks.onDragEnd(this.draggedPixels),this.dragComponentOptions.disableChartPanning&&this.chartPanComponent.activateChartPanHandlers())}}doActivate(){super.doActivate()}doDeactivate(){super.doDeactivate()}}class fn extends vi{constructor(e,t,r,s,i=fi){super(e,t,r,s,i)}doActivate(){super.doActivate(),this.addRxSubscription(this.canvasInputListener.observeYDragStart(this.hitTest).subscribe(this.onDragStart)),this.addRxSubscription(this.canvasInputListener.observeYDrag().subscribe(this.onDragTick)),this.addRxSubscription(this.canvasInputListener.observeYDragEnd().subscribe(this.onDragEnd))}doDeactivate(){super.doDeactivate()}}const Zc="BASELINE_RESIZER";class Kc extends te{constructor(e,t,r,s,i,a,o){super(),this.chartModel=e,this.canvasModel=r,this.canvasInputListener=s,this.config=i,this.canvasBoundContainer=a,this.cursorHandler=o,this.resizerBounds={x:0,y:0,pageX:0,pageY:0,height:0,width:0},this.baselineYPercents=50,this.ht=Xn.hitTestOf(this.resizerBounds,{extensionY:this.config.components.paneResizer.dragZone}),this.dragTickCb=c=>{const{delta:h}=c,v=this.canvasBoundContainer.getBounds(Y.CHART),p=this.canvasInputListener.getCurrentPoint().y;h!==0&&el(p,v)&&(this.moveBaseLine(p),this.canvasModel.fireDraw())};const l=new fn(this.ht,{onDragTick:this.dragTickCb},s,t);this.addChildEntity(l)}doActivate(){super.doActivate(),this.addRxSubscription(this.canvasBoundContainer.observeBoundsChanged(Y.CHART).subscribe(()=>this.recalculateBounds())),this.chartModel.chartTypeChanged.subscribe(e=>{e==="baseline"?this.cursorHandler.setCursorForBounds("BASELINE_RESIZER",this.resizerBounds,this.config.components.baseline.cursor,this.config.components.baseline.dragZone):this.cursorHandler.removeCursorForCanvasEl("BASELINE_RESIZER")})}recalculateBounds(){const e=this.canvasBoundContainer.getBounds(Y.CHART),t=this.canvasBoundContainer.getBounds(Y.Y_AXIS);this.resizerBounds.x=e.x,this.resizerBounds.width=e.width+t.width,this.resizerBounds.height=this.config.components.baseline.height;const r=e.y+e.height*(this.baselineYPercents/100);this.resizerBounds.y=r,this.canvasBoundContainer.bounds[Zc]=this.resizerBounds}moveBaseLine(e){const t=this.canvasBoundContainer.getBounds(Y.CHART);this.baselineYPercents=(e-t.y)*100/t.height,this.resizerBounds.y=e}doDeactivate(){super.doDeactivate()}}const vn=n=>{var e;const t=Rt(n.close,n.open,n.hi,n.lo);if(!isFinite(t))throw new Error("Received candle without any price");const r=Rt(n.hi,Math.max(n.open,n.close),t),s=Rt(n.lo,Math.min(n.open,n.close),t),i=Rt(n.open,n.lo,t),a=Rt(n.close,n.hi,t);return{hi:r,lo:s,open:i,close:a,timestamp:n.timestamp,volume:(e=n.volume)!=null?e:0,expansion:n.expansion,idx:n.idx,impVolatility:n.impVolatility}},gi=n=>{for(let e=0;e<n.length;++e)n[e].idx=e},pi=n=>{n.forEach(e=>{e.idx=void 0})};class qc{constructor(){}draw(e,t,r){const s=r.view.toY(0),i=Ie(t),a=[[],[]];i.forEach((o,l,c)=>{a[o.close<this.previousValue(c,l)?1:0].push(o)}),a.forEach((o,l)=>{const c=r.getPaintConfig(l);e.strokeStyle=l===0?c.color:c.aditionalColor||"#FF00FF",e.lineWidth=c.lineWidth,e.beginPath(),o.forEach(h=>{const v=r.view.toX(h.centerUnit),p=r.view.toY(h.close);e.moveTo(v,ve(s)),e.lineTo(v,ve(p))}),e.stroke()})}previousValue(e,t){do t--;while(t>=0&&!isFinite(e[t]&&e[t].close));return e[t]?e[t].close:Number.NaN}}var Jc=Object.defineProperty,mi=Object.getOwnPropertySymbols,Qc=Object.prototype.hasOwnProperty,eh=Object.prototype.propertyIsEnumerable,bi=(n,e,t)=>e in n?Jc(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,th=(n,e)=>{for(var t in e||(e={}))Qc.call(e,t)&&bi(n,t,e[t]);if(mi)for(var t of mi(e))eh.call(e,t)&&bi(n,t,e[t]);return n};class nh{constructor(){this.symbol="MOCK",this.priceIncrements=[.01]}}class rh extends te{constructor(e,t,r,s,i,a,o,l,c,h,v,p){super(),this.chartModel=e,this.canvasModel=t,this.config=r,this.scaleModel=s,this.canvasBoundsContainer=i,this.drawingManager=a,this.hitTestCanvasModel=o,this.canvasInputListener=l,this.dataSeriesDrawers={},this.strToBarType=E=>{var R;return(R=this.barTypeValues.find(N=>N===E))!=null?R:"candle"},this.addChildEntity(this.chartModel),this.registerDefaultCandlesTransformers(),this.baselineModel=new Kc(this.chartModel,h,this.canvasModel,this.canvasInputListener,this.config,this.canvasBoundsContainer,p),this.addChildEntity(this.baselineModel);const y=new $c(this.dataSeriesDrawers,this.hitTestCanvasModel,v);this.drawingManager.addDrawerBefore(y,un+"DATA_SERIES","HIT_TEST_EVENTS"),this.dataSeriesDrawer=new xc(v,t,this.dataSeriesDrawers),this.drawingManager.addDrawer(this.dataSeriesDrawer,"DATA_SERIES"),this.registerDefaultDataSeriesDrawers(),this.backgroundDrawer=new Ul(c,this.config),a.addDrawer(this.backgroundDrawer,"MAIN_BACKGROUND"),p.setCursorForCanvasEl(Y.PANE_UUID(ae),r.components.chart.cursor)}doActivate(){super.doActivate()}registerDefaultCandlesTransformers(){this.registerCandlesTransformer("candle",Ws),this.registerCandlesTransformer("trend",Xl),this.registerCandlesTransformer("hollow",zl)}get barTypeValues(){return Ts(this.dataSeriesDrawers)}registerCandlesTransformer(e,t){this.chartModel.registerCandlesTransformer(e,t)}registerLastCandleLabelHandler(e,t){this.chartModel.registerLastCandleLabelHandler(e,t)}registerCandlesWidthCalculator(e,t){this.chartModel.registerCandlesWidthCalculator(e,t)}registerDefaultDataSeriesDrawers(){const e=new Tc(this.config.components.chart);this.registerDataSeriesTypeDrawer("candle",e),this.registerDataSeriesTypeDrawer("trend",e),this.registerDataSeriesTypeDrawer("hollow",e),this.registerDataSeriesTypeDrawer("bar",new Mc(this.config.components.chart)),this.registerDataSeriesTypeDrawer("line",new Ac(this.config.components.chart)),this.registerDataSeriesTypeDrawer("scatterPlot",new Ec(this.config.colors.scatterPlot)),this.registerDataSeriesTypeDrawer("area",new yc(this.config.components.chart)),this.registerDataSeriesTypeDrawer("baseline",new Pc(this.baselineModel,this.canvasBoundsContainer)),this.registerDataSeriesTypeDrawer("histogram",new _c(this.config.components.chart.histogram));const t=()=>this.canvasBoundsContainer.getBounds(Y.PANE_UUID(ae));this.registerDataSeriesTypeDrawer("LINEAR",new kc),this.registerDataSeriesTypeDrawer("HISTOGRAM",new Nc),this.registerDataSeriesTypeDrawer("TREND_HISTOGRAM",new qc),this.registerDataSeriesTypeDrawer("POINTS",new Wc),this.registerDataSeriesTypeDrawer("COLOR_CANDLE",new Ic(new Oc(this.chartModel),this.config,t)),this.registerDataSeriesTypeDrawer("TEXT",new Uc(this.config)),this.registerDataSeriesTypeDrawer("TRIANGLE",new zc),this.registerDataSeriesTypeDrawer("DIFFERENCE",new Hc)}setChartType(e){this.config.components.chart.type=e,this.chartModel.rememberCurrentTimeframe(),this.chartModel.mainCandleSeries.setType(e),this.chartModel.mainCandleSeries.updateCandleSeriesColors(th({},this.config.colors)),this.chartModel.mainCandleSeries.recalculateVisualPoints(),this.chartModel.chartTypeChanged.next(e)}resetChartScale(){this.chartModel.doBasicScale()}setTimestampRange(e,t){return this.chartModel.setTimestampRange(e,t)}setXScale(e,t){return this.scaleModel.setXScale(e,t)}setShowWicks(e){this.config.components.chart.showWicks=e,this.canvasModel.fireDraw()}setMainSeries(e){var t;const r=(t=e.instrument)!=null?t:this.chartModel.mainCandleSeries.instrument;this.chartModel.mainCandleSeries.instrument=r,this.chartModel.setAllSeries({candles:e.candles,instrument:r},this.chartModel.getSecondarySeries().map(s=>{var i;const a=(i=s.instrument)!=null?i:this.chartModel.mainCandleSeries.instrument,o=s.dataPoints;return pi(o),{candles:o,instrument:a}})),this.updatePriceIncrementsIfNeeded(r)}setSecondarySeries(e){var t;const r=(t=e.instrument)!=null?t:this.chartModel.mainCandleSeries.instrument,s=this.chartModel.setSecondaryCandleSeries(e.candles,r);if(this.updatePriceIncrementsIfNeeded(r),s)return s}setAllSeries(e,t=[]){var r;const s=(r=e.instrument)!=null?r:this.chartModel.mainCandleSeries.instrument;this.updatePriceIncrementsIfNeeded(s),t.forEach(i=>{var a;const o=(a=i.instrument)!=null?a:this.chartModel.mainCandleSeries.instrument;this.updatePriceIncrementsIfNeeded(o)}),this.chartModel.setAllSeries(e,t)}toXFromCandleIndex(e){return this.chartModel.toX(e)}toXFromTimestamp(e){return this.chartModel.candleFromTimestamp(e).xCenter(this.chartModel.scaleModel)}toY(e){return this.chartModel.toY(e)}updateAllSeries(e,t=[]){this.chartModel.updateAllSeries(e,t),this.canvasModel.fireDraw()}removeDataFrom(e){this.chartModel.removeDataFrom(e)}removeSecondarySeries(e){this.chartModel.removeSecondaryCandleSeries(e)}prependCandles(e,t){this.chartModel.prependCandles(e,t)}addLastCandle(e,t){this.chartModel.addLastCandle(e,t)}updateLastCandle(e,t){this.chartModel.updateLastCandle(e,t)}updateCandles(e,t){this.chartModel.updateCandles(e,t)}setOffsets(e){this.chartModel.setOffsets(e)}getDataSeriesDrawer(e){return this.dataSeriesDrawers[e]}registerDataSeriesTypeDrawer(e,t){this.dataSeriesDrawers[e]=t}updatePriceIncrementsIfNeeded(e){(!e.priceIncrements||!ze.validatePriceIncrementsOrPrecisions(e.priceIncrements))&&(e.priceIncrements=[ze.autoDetectIncrementOfValueRange(this.scaleModel.yEnd-this.scaleModel.yStart)])}observeOffsetsChanged(){return this.chartModel.offsetsChanged}observeChartTypeChanged(){return this.chartModel.chartTypeChanged}observeCandlesChanged(){return this.chartModel.observeCandlesChanged()}observeCandlesUpdated(){return this.chartModel.candlesUpdatedSubject}observeCandlesPrepended(){return this.chartModel.candlesPrependSubject}}class sh extends ct{constructor(e,t,r,s,i,a,o,l,c){super(t,r,s,i,a,o,l,c),this.baseModel=e}set visualPoints(e){super.visualPoints=e,this.baseModel.mainVisualPoints=super.visualPoints}get visualPoints(){return super.visualPoints}set dataPoints(e){super.dataPoints=e,this.baseModel.mainDataPoints=super.dataPoints}get dataPoints(){return super.dataPoints}recalculateMeanCandleWidth(e){super.recalculateMeanCandleWidth(e),this.baseModel.meanDataWidth=this.meanCandleWidth}}const ih=n=>e=>{if(e.length!==0){const t=e.slice(Math.max(e.length-n.state.defaultViewportItems,0)),r=t[0],s=t[t.length-1];n.setXScale(r.startUnit,s.startUnit+s.width+n.offsets.right),n.doAutoScale(!0),n.recalculateZoomXYRatio(),n.fireChanged()}},ah=(n,e)=>(t,r=null)=>{const[s,i]=t,a=e.candleFromTimestamp(s).startUnit,o=e.candleFromTimestamp(i).startUnit,l=r===null?0:e.mainCandleSeries.meanCandleWidth*2,c=r?a-l:a+l,h=r?o+l:o-l;n.setXScale(c,h)};var oh=Object.defineProperty,lh=Object.defineProperties,ch=Object.getOwnPropertyDescriptors,Ci=Object.getOwnPropertySymbols,hh=Object.prototype.hasOwnProperty,dh=Object.prototype.propertyIsEnumerable,yi=(n,e,t)=>e in n?oh(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,jt=(n,e)=>{for(var t in e||(e={}))hh.call(e,t)&&yi(n,t,e[t]);if(Ci)for(var t of Ci(e))dh.call(e,t)&&yi(n,t,e[t]);return n},ir=(n,e)=>lh(n,ch(e));class uh{constructor(e){this.config=e,this.usedChartColors={},this.symbolsToColorKeys={},this.secondaryChartColorsPool=this.createColorPool(this.config.colors.secondaryChartTheme),this.usedChartColors=Object.keys(this.secondaryChartColorsPool).reduce((t,r)=>ir(jt({},t),{[r]:0}),{})}createColorPool(e){return e.reduce((t,r,s)=>(t[`color${s}`]=ir(jt({},Wt(this.config.colors)),{lineTheme:jt({},r.lineTheme),areaTheme:jt({},r.areaTheme)}),t),{})}takeColorFromPool(e){let t=Number.MAX_SAFE_INTEGER,r="";for(const[s,i]of Object.entries(this.usedChartColors))i<t&&(t=i,r=s);return this.usedChartColors[r]=this.usedChartColors[r]+1,this.symbolsToColorKeys[e]=r,this.secondaryChartColorsPool[r]}addColorToPool(e){const t=this.symbolsToColorKeys[e];this.usedChartColors[t]&&(this.usedChartColors[t]=this.usedChartColors[t]-1)}updateColorConfig(e,t){var r,s;const i=this.secondaryChartColorsPool[this.usedChartColors[e]];if(i){const a=t;this.secondaryChartColorsPool[this.usedChartColors[e]]=ir(jt({},t),{lineTheme:Object.assign(i.lineTheme,(r=a.lineTheme)!=null?r:{}),areaTheme:Object.assign(i.areaTheme,(s=a.areaTheme)!=null?s:{})})}}}var fh=Object.defineProperty,wi=Object.getOwnPropertySymbols,vh=Object.prototype.hasOwnProperty,gh=Object.prototype.propertyIsEnumerable,Si=(n,e,t)=>e in n?fh(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,gn=(n,e)=>{for(var t in e||(e={}))vh.call(e,t)&&Si(n,t,e[t]);if(wi)for(var t of wi(e))gh.call(e,t)&&Si(n,t,e[t]);return n};class ph extends te{constructor(e,t,r,s,i,a,o,l,c,h){super(),this.chartBaseModel=e,this.paneManager=t,this.bus=r,this.canvasModel=s,this.config=i,this.scaleModel=a,this.formatterFactory=o,this.mainCanvasParent=l,this.canvasBoundsContainer=c,this.chartResizeHandler=h,this.prevChartWidth=0,this.prevYWidth=0,this.candleSeries=[],this.nextCandleTimeStampSubject=new G,this.axisTypeSetSubject=new G,this.chartTypeChanged=new G,this.mainInstrumentChangedSubject=new G,this.scaleInversedSubject=new G,this.offsetsChanged=new G,this.candlesTransformersByChartType={},this.lastCandleLabelsByChartType={},this.candleWidthByChartType={},this.lastTimeFrame=[0,0],this.FAKE_CANDLES_DEFAULT=100,this.toY=p=>this.mainCandleSeries.view.toY(p),this.chartTypeChanged.next(this.config.components.chart.type),this.secondaryChartColors=new uh(this.config);const v=new sh(this.chartBaseModel,this.paneManager.paneComponents[ae].mainYExtentComponent,this.paneManager.hitTestController.getNewDataSeriesHitTestId(),this.bus,this.scaleModel,new nh,this.candlesTransformersByChartType,this.candleWidthByChartType,gn({},this.config.colors));v.config.type=this.config.components.chart.type,this.candleSeries.push(v),a.addXConstraint((p,y)=>oc(y,this.mainCandleSeries.visualPoints,this.config.components.chart.minCandlesOffset,a.getBounds())),this.basicScaleViewportTransformer=ih(a),this.timeFrameViewportTransformer=ah(a,this),this.pane=this.paneManager.paneComponents[ae]}get mainCandleSeries(){return this.candleSeries[0]}get secondaryCandleSeries(){return this.candleSeries.filter(e=>e!==this.mainCandleSeries)}get candlesUpdatedSubject(){return this.chartBaseModel.dataUpdatedSubject}get candlesSetSubject(){return this.chartBaseModel.dataSetSubject}get candlesRemovedSubject(){return this.chartBaseModel.dataRemovedSubject}get candlesPrependSubject(){return this.chartBaseModel.dataPrependSubject}doActivate(){super.doActivate(),this.addRxSubscription(this.canvasBoundsContainer.observeBoundsChanged(Y.PANE_UUID(ae)).pipe(Ve(ms)).subscribe(e=>{this.handleChartResize(e)}))}handleChartResize(e){if(e.width>Dt.width&&e.height>Dt.height){const t=this.getEffectiveChartWidth(),r=this.getEffectiveYAxisWidth();if(this.prevChartWidth===0){this.scaleModel.isViewportValid()?this.scaleModel.recalculateZoom():this.doBasicScale(),this.prevChartWidth=t,this.prevYWidth=r;return}if(r!==this.prevYWidth){if(this.config.scale.keepZoomXOnYAxisChange){const i=tt(r-this.prevYWidth,this.scaleModel.zoomX);this.scaleModel.setXScale(this.scaleModel.xStart,this.scaleModel.xEnd-i)}else this.scaleModel.recalculateZoomX();this.prevYWidth=r,this.prevChartWidth=t;return}const s=tt(t-this.prevChartWidth,this.scaleModel.zoomX);this.scaleModel.setXScale(this.scaleModel.xStart-s,this.scaleModel.xEnd),this.scaleModel.recalculateZoomY(),this.prevYWidth=r,this.prevChartWidth=t}}setMainCandleSeries(e,t){this.mainCandleSeries.instrument=t,this.setAllSeries({candles:e,instrument:t},this.getSecondarySeries().map(r=>{const s=r.dataPoints;return pi(s),{candles:s,instrument:r.instrument}}))}setSecondaryCandleSeries(e,t=this.mainCandleSeries.instrument,r=!0){const s=pn(e.map(vn)),i=this.reindexCandlesBasedOnSeries(this.mainCandleSeries.dataPoints,s),a=this.secondarySeriesAdjustments(this.mainCandleSeries.dataPoints,i),l=this.secondaryCandleSeries.some(c=>c.instrument.symbol===t.symbol)?this.secondaryCandleSeries.find(c=>c.instrument.symbol===t.symbol):this.createSecondaryCandleSeriesModel(t);if(l)return l.dataPoints=a,r&&(this.scaleModel.doAutoScale(),l.recalculateVisualPoints(),this.candlesSetSubject.next(),this.bus.fireDraw([this.canvasModel.canvasId])),l}setAllSeries(e,t=[]){var r;this.mainCandleSeries.instrument=(r=e.instrument)!=null?r:this.mainCandleSeries.instrument,e.instrument&&this.mainInstrumentChangedSubject.next(e.instrument),this.rememberCurrentTimeframe();const s=pn(e.candles.map(vn));this.mainCandleSeries.clearData(),gi(s),this.mainCandleSeries.dataPoints=s,this.secondaryCandleSeries.filter(i=>t.filter(a=>{var o;return((o=a.instrument)==null?void 0:o.symbol)===i.instrument.symbol}).length===0).forEach(i=>this.removeSecondaryCandleSeries(i)),t.map(i=>this.setSecondaryCandleSeries(i.candles,i.instrument,!1)),this.candleSeries.forEach(i=>{i.recalculateDataViewportIndexes(),i.recalculateVisualPoints()}),this.chartBaseModel.recalculatePeriod(),this.autoScaleOnCandles(),this.scaleModel.doAutoScale(),this.candlesSetSubject.next(),this.bus.fireDraw([this.canvasModel.canvasId])}autoScaleOnCandles(){this.scaleModel.state.autoScaleOnCandles&&(this.doBasicScale(),this.scaleModel.autoScale(!0))}doBasicScale(){this.basicScaleViewportTransformer(this.mainCandleSeries.visualPoints),this.bus.fireDraw()}doPreviousTimeFrameScale(e=null){this.timeFrameViewportTransformer(this.lastTimeFrame,e),this.scaleModel.state.autoScaleOnCandles&&this.scaleModel.doAutoScale(!0),this.bus.fireDraw()}rememberCurrentTimeframe(){this.mainCandleSeries.visualPoints.length!==0&&(this.lastTimeFrame=[this.candleFromX(this.scaleModel.toX(this.scaleModel.xStart),!0).timestamp,this.candleFromX(this.scaleModel.toX(this.scaleModel.xEnd),!0).timestamp])}updateAllSeries(e,t=[]){e=gn({},e),e.instrument||(e.instrument=this.mainCandleSeries.instrument);const r=[e,...t];if(!this.candleSeries.every(l=>r.find(c=>{var h;return((h=c.instrument)==null?void 0:h.symbol)===l.instrument.symbol}))||t.length!==this.secondaryCandleSeries.length){console.error("All series update failed. Instruments for series are different.");return}const s=pn(e.candles.map(vn)),i=Mi(this.mainCandleSeries.dataPoints,s),a=i.candles;gi(a),this.mainCandleSeries.dataPoints=a,t.map(l=>{var c,h,v,p;const y=pn(l.candles.map(vn)),E=Mi((p=(v=this.findSecondarySeriesBySymbol((h=(c=l.instrument)==null?void 0:c.symbol)!=null?h:""))==null?void 0:v.dataPoints)!=null?p:[],y).candles;return this.setSecondaryCandleSeries(E,l.instrument,!1)}),this.candleSeries.forEach(l=>{l.recalculateVisualPoints(),l.recalculateDataViewportIndexes()});const o=this.chartBaseModel.mainVisualPoints.slice(0,i.prepended).reduce((l,c)=>l+c.width,0);this.scaleModel.moveXStart(this.scaleModel.xStart+o),this.candlesPrependSubject.next({prependedCandlesWidth:o,preparedCandles:s}),this.chartBaseModel.recalculatePeriod(),this.candlesUpdatedSubject.next(),this.bus.fireDraw()}removeDataFrom(e){Object.values(this.paneManager.paneComponents).forEach(t=>{t.dataSeries.forEach(r=>{const s=lt(r.dataPoints,e,a=>a.timestamp),i=s.exact?s.index:s.index+1;r.dataPoints=r.dataPoints.slice(0,i)})}),this.candlesRemovedSubject.next(),this.candlesUpdatedSubject.next(),this.canvasModel.fireDraw()}createSecondaryCandleSeriesModel(e){const t=gn(gn({},this.config.colors),this.secondaryChartColors.takeColorFromPool(e.symbol));return this.createCandleSeriesModel(e,t)}createCandleSeriesModel(e,t){const r=new ct(this.paneManager.paneComponents[ae].mainYExtentComponent,this.paneManager.hitTestController.getNewDataSeriesHitTestId(),this.bus,this.scaleModel,e,this.candlesTransformersByChartType,this.candleWidthByChartType,t);return r.config.type="line",this.candleSeries.push(r),r}removeSecondaryCandleSeries(e){return this.secondaryChartColors.addColorToPool(e.instrument.symbol),this.candleSeries=this.candleSeries.filter(t=>t!==e),e.deactivate(),this.paneManager.paneComponents[ae].removeDataSeries(e),this.scaleModel.doAutoScale(),e.colors}secondarySeriesAdjustments(e,t){const r=[];return e.forEach(s=>{var i;const a=(i=s.idx)!=null?i:0,o=t[a];if(o)r.push(o);else{let l=xi(t,a,-1);if(l||(l=xi(t,a,1)),l){const c=gl(l,a,!0);r.push(c)}}}),r}updateSecondaryCandleSeriesConfig(e,t,r){const s=Ge(e,tn().colors);this.secondaryChartColors.updateColorConfig(t,s);const i=this.findSecondarySeriesBySymbol(t);i&&(i.config.type=r,i.updateCandleSeriesColors(s),this.bus.fireDraw([this.canvasModel.canvasId])),this.bus.fireDraw([this.canvasModel.canvasId])}setAutoScale(e){this.scaleModel.autoScale(e)}getEffectiveYAxisWidth(){return this.canvasBoundsContainer.getBounds(Y.PANE_UUID_Y_AXIS(ae)).width}getEffectiveChartWidth(){return this.canvasBoundsContainer.getBounds(Y.PANE_UUID(ae)).width}getEffectiveChartHeight(){return this.canvasBoundsContainer.getBounds(Y.PANE_UUID(ae)).height}setOffsets(e){this.scaleModel.updateOffsets(e);const t=this.getCandlesCountWithRightOffset(),r=this.mainCandleSeries.visualPoints;this.hasCandles()&&t>=r.length&&this.scaleModel.setXScale(this.scaleModel.xStart,this.candleFromIdx(t).startUnit),this.offsetsChanged.next(),this.bus.fireDraw()}getOffsets(){return this.scaleModel.getOffsets()}fromY(e){return this.scaleModel.fromY(e)}priceFromY(e,t){return(t!=null?t:this.mainCandleSeries).view.priceFromY(e)}fromX(e){return this.scaleModel.fromX(e)}toX(e){const t=this.candleFromIdx(e);return this.scaleModel.toX(t.centerUnit)}getBaseLine(){return this.mainCandleSeries.getBaseLine()}candleFromX(e,t=!1,r=this.mainCandleSeries){const s=this.scaleModel.fromX(e);return this.candleFromUnit(s,t,r)}candleFromUnit(e,t=!1,r=this.mainCandleSeries){var s,i;const a=lt(r.visualPoints,e,v=>v.startUnit),o=r.visualPoints,l=this.getLastVisualCandle();o[a.index]!==void 0&&(e<0||l&&e>l.startUnit+l.width)&&(a.index+=gt((e-o[a.index].centerUnit)/this.mainCandleSeries.meanCandleWidth));const c=a.index,h=Math.max(Math.min(o.length-1,c),0);return(c<0||c>=o.length)&&t?zt(this.mainCandleSeries.dataPoints,c,this.chartBaseModel.period):(i=(s=o[h])==null?void 0:s.candle)!=null?i:zt(this.mainCandleSeries.dataPoints,h,this.chartBaseModel.period)}candleFromTimestamp(e,t=!0){return this.chartBaseModel.dataFromTimestamp(e,t)}candleFromIdx(e){return this.chartBaseModel.dataFromIdx(e)}isReady(){return this.canvasModel.isReady()&&this.hasCandles()}registerCandlesTransformer(e,t){this.candlesTransformersByChartType[e]=t}registerCandlesWidthCalculator(e,t){this.candleWidthByChartType[e]=t}registerLastCandleLabelHandler(e,t){this.lastCandleLabelsByChartType[e]=t}hasCandles(){return this.mainCandleSeries.visualPoints.length!==0}getVisualCandle(e){var t,r,s;const i=e-((s=(r=(t=this.mainCandleSeries.visualPoints[0])==null?void 0:t.candle)==null?void 0:r.idx)!=null?s:0);return this.mainCandleSeries.visualPoints[i]}getFirstIdx(){return this.mainCandleSeries.dataIdxStart}getLastIdx(){return this.mainCandleSeries.dataIdxEnd}getFirstTimestamp(e=!0){return e?this.candleFromIdx(this.getFirstIdx()).candle.timestamp:this.candleFromUnit(this.scaleModel.xStart,!0).timestamp}getLastTimestamp(e=!0){return e?this.candleFromIdx(this.getLastIdx()).candle.timestamp:this.candleFromUnit(this.scaleModel.xEnd,!0).timestamp}setTimestampRange(e,t){const r=this.candleFromTimestamp(e).startUnit,s=this.candleFromTimestamp(t),i=s.startUnit+s.width;return this.scaleModel.setXScale(r,i)}getLastCandle(){const e=this.mainCandleSeries.dataPoints;return Ue(e)}getLastVisualCandle(){const e=this.mainCandleSeries.visualPoints;return Ue(e)}getMaxCandlesFitLength(){return ve(this.getEffectiveChartWidth()/this.config.components.chart.minWidth)}getSecondarySeries(){return this.secondaryCandleSeries}isSeriesInstrument(e,t){return e.instrument.symbol===t}findSeriesBySymbol(e){return this.candleSeries.filter(t=>this.isSeriesInstrument(t,e))}findSecondarySeriesBySymbol(e){return this.secondaryCandleSeries.find(t=>this.isSeriesInstrument(t,e))}reindexCandlesBasedOnSeries(e,t){return t.reduce((r,s)=>{const i=s.timestamp,a=kt(i,!1,e,this.chartBaseModel.period);return a.index>=0&&a.index<e.length&&(s.idx=a.index,r[a.index]=s),r},[])}getPeriod(){return this.chartBaseModel.period}isCandleInViewport(e){return this.getFirstIdx()<=e&&e<=this.getLastIdx()}updateCandles(e,t=this.mainCandleSeries.instrument.symbol){const r=this.mainCandleSeries.instrument.symbol===t,s=this.findSeriesBySymbol(t);if(s.length===0){console.warn("updateCandles failed. Can't find series",t);return}s.forEach(i=>{const a=i.dataPoints;let o=!1,l=!1,c;e.forEach(h=>{var v;if(!h)return;const p=kt(h.timestamp,!0,a,this.getPeriod()),y=Math.min(p.index,a.length);o=o||y===a.length,a[y]=h,h.idx=y,i.dataPoints=a,i.recalculateDataViewportIndexes(),l=l||this.isCandleInViewport(y);const E=y>=a.length-1,R=c&&h.timestamp<c.timestamp;if(E&&!R&&(c=h),o&&c&&r&&l){const N=(v=this.candleWidthByChartType[this.config.components.chart.type])!=null?v:Us;this.scaleModel.moveXStart(this.scaleModel.xStart+N(c))}}),c&&i.updateCurrentPrice(c.close),l&&c&&e.length===1?this.bus.fireDraw([this.canvasModel.canvasId]):i.recalculateVisualPoints()}),this.scaleModel.doAutoScale(),this.candlesUpdatedSubject.next()}observeCandlesChanged(){return Me(this.candlesSetSubject,this.candlesUpdatedSubject)}getCandles(){return this.mainCandleSeries.dataPoints}getCandlesWithFake(e=0,t){let r=this.getCandles().slice();const s=this.getCandlesCount(),i=t!=null?t:s+this.FAKE_CANDLES_DEFAULT;r=r.slice(Math.max(0,e),Math.min(s,i));const a=[],o=[];for(let c=s;c<i;c++)a.push(zt(this.mainCandleSeries.dataPoints,c,this.getPeriod()));const l=Math.min(0,i);for(let c=e;c<l;c++)o.push(zt(this.mainCandleSeries.dataPoints,c,this.getPeriod()));return[...o,...r,...a]}getCandlesCount(){return this.mainCandleSeries.dataPoints.length}getCandlesCountWithRightOffset(){return this.getCandlesCount()+this.getOffsets().right}clearData(){this.candleSeries.forEach(e=>e.clearData())}prependCandles(e,t){const r=e.slice(),s=[];return t.forEach(i=>{const o=kt(i.timestamp,!1,e).index;o<0?s.push(i):e[o].timestamp===i.timestamp?r[o]=i:console.warn(`Couldn't update candle with timestamp ${i.timestamp}`)}),{prepended:s.length,candles:[...s,...r]}}addLastCandle(e,t=this.mainCandleSeries.instrument.symbol){this.updateCandles([e],t)}updateLastCandle(e,t=this.mainCandleSeries.instrument.symbol){this.updateCandles([e],t)}}const pn=n=>n.slice().sort((e,t)=>e.timestamp===t.timestamp?0:e.timestamp>t.timestamp?1:-1),xi=(n,e,t)=>{if(e>=n.length)return n[n.length-1];for(let r=e;r<n.length&&r>=0;r+=t){const s=n[r];if(s)return s}},Mi=(n,e)=>{const t=n.slice(),r=[],s=[];return e.forEach(i=>{const o=kt(i.timestamp,!0,n).index;o<0?r.push(i):o>=n.length?s.push(i):n[o].timestamp===i.timestamp?t[o]=i:console.warn(`Couldn't update candle with timestamp ${i.timestamp}`)}),{prepended:r.length,appended:s.length,candles:[...r,...t,...s]}};class Et{constructor(e){this.canvasModel=e}draw(){this.canvasModel.clear()}getCanvasIds(){return[this.canvasModel.canvasId]}}class ar{constructor(e){this.drawers=e!=null?e:new Map}draw(){this.drawers.forEach(e=>e.draw())}addDrawer(e,t){const r=t!=null?t:"drawer"+this.drawers.size;this.drawers.set(r,e)}drawLastBar(){this.drawers.forEach(e=>e.drawLastBar&&e.drawLastBar())}removeDrawer(e){const t=Ps(this.drawers,e);t?this.drawers.delete(t):console.warn("Couldn't find drawer type")}removeDrawerByName(e){this.drawers.delete(e)}getDrawer(e){return this.drawers.get(e)}moveTop(e){const t=Ps(this.drawers,e);t?this.moveTopByName(t):console.warn("Couldn't find drawer type")}moveTopByName(e){if(this.drawers.size===1)return;const t=this.drawers.get(e);this.drawers.delete(e),t&&this.drawers.set(e,t)}getSize(){return this.drawers.size}getAll(){return this.drawers}getCanvasIds(){const e=Ie(Array.from(this.drawers).map(([,r])=>r.getCanvasIds())),t=new Set([...e]);return Array.from(t)}}class mh{constructor(e,t,r){this.model=e,this.crossToolCanvasModel=t,this.crossToolTypeDrawers=r}draw(){const e=this.crossToolTypeDrawers[this.model.type];e?this.model.currentHover&&e.draw(this.crossToolCanvasModel.ctx,this.model.currentHover):console.error(`No cross tool drawer type registered for drawer type ${this.model.type}`)}getCanvasIds(){return[this.crossToolCanvasModel.canvasId]}}class bh extends te{constructor(e,t,r,s){super(),this.config=e,this.crossToolCanvasModel=t,this.crossEventProducer=r,this.hoverProducer=s,this.currentHoverSubject=new pt(null),this.type="cross-and-labels",this.type=e.type}get currentHover(){return this.currentHoverSubject.getValue()}set currentHover(e){this.currentHoverSubject.next(e)}setType(e){this.type=e}doActivate(){super.doActivate(),this.addRxSubscription(this.hoverProducer.hoverSubject.subscribe(e=>{this.crossEventProducer.crossSubject.getValue()!==null&&e!==null?this.updateHover(e):this.currentHover=null,this.fireDraw()}))}fireDraw(){this.type!=="none"&&this.crossToolCanvasModel.fireDraw()}updateHover(e,t=this.config.magnetTarget){if(this.currentHover===null?this.currentHover={x:e.x,y:0,time:e.timeFormatted,paneId:e.paneId}:(this.currentHover.x=e.x,this.currentHover.time=e.timeFormatted),e.candleHover&&e.paneId===ae)switch(t){case"O":this.currentHover.y=e.candleHover.openY;break;case"C":this.currentHover.y=e.candleHover.closeY;break;case"H":this.currentHover.y=e.candleHover.highY;break;case"L":this.currentHover.y=e.candleHover.lowY;break;case"OHLC":this.currentHover.y=e.candleHover.closestOHLCY;break;case"none":this.currentHover.y=e.y;break}else this.currentHover.y=e.y;this.currentHoverSubject.next(this.currentHover)}}const Xe=4;function Ch(n,e,t,r,s,i,a,o=!1){var l,c,h,v,p,y,E;const R=i.align,N=(l=s.textFont)!=null?l:mt(i),k=s.bgColor,U=(c=s.textColor)!=null?c:Ht(k,a.labelTextColor,a.labelInvertedTextColor),Z=(h=s.paddingTop)!=null?h:Xe,K=(v=s.paddingBottom)!=null?v:Xe,q=(p=s.paddingEnd)!=null?p:Xe,$=gt(Qe(N,n)/2),J=r-$-Z,oe=r+$+K-J;if((r<e.y+oe/2||r>e.y+e.height-oe/2)&&!o)return;n.save(),n.fillStyle=k,n.strokeStyle=k;const le=gt(e.width/6),re=R==="right"?e.x:e.x+e.width,ce=R==="right"?re+le:re-le,fe=i.labelBoxMargin.end,de=fe-q,ue=e.width-le-de;wc(n,ce,J,re,J+gt(oe/2),ce,J+oe,ue,(E=(y=i.typeConfig.badge)==null?void 0:y.rounded)!=null?E:!1,R),n.fillStyle=U,n.font=N;const pe=R==="right"?e.x+e.width-Re(t,n,N)-fe:e.x+fe;n.fillText(t,pe,r+$-1),n.restore()}function yh(n,e,t,r,s,i,a,o=!1){var l,c,h,v,p,y,E,R,N,k,U;const Z=i.align,K=(l=s.textFont)!=null?l:mt(i),q=s.bgColor,$=(c=s.textColor)!=null?c:Ht(q,a.labelTextColor,a.labelInvertedTextColor),J=(h=i.typeConfig.rectangle)==null?void 0:h.paddings,ne=(p=(v=s.paddingTop)!=null?v:J==null?void 0:J.top)!=null?p:Xe,oe=(E=(y=s.paddingBottom)!=null?y:J==null?void 0:J.bottom)!=null?E:Xe,le=(N=(R=s.paddingEnd)!=null?R:J==null?void 0:J.end)!=null?N:Xe,re=s.paddingStart,ce=Qe(K,n),fe=r-ce/2-ne,ue=r+ce/2+oe-fe,pe=(U=s.rounded)!=null?U:(k=i.typeConfig.rectangle)==null?void 0:k.rounded;if((r<e.y+ue/2||r>e.y+e.height-ue/2)&&!o)return;n.save(),n.fillStyle=q,n.strokeStyle=q;const me=i.labelBoxMargin.end;n.font=K;const Fe=Re(t,n,K),Ye=me-le,He=re!==void 0?Fe+re+le:e.width-Ye,ut=Z==="right"?e.x+e.width-Ye-He:e.x+Ye,Mn=Z==="right"?e.x+e.width-Fe-me:me;pe?ti(n,ut,fe,He,ue,4,!0):n.fillRect(ut,fe,He,ue),n.fillStyle=$,n.fillText(t,Mn,r+ce/2-1),n.restore()}function wh(n,e,t,r,s,i,a,o=!1,l){var c,h,v,p,y,E,R,N,k;const U=i.align,Z=(c=s.textFont)!=null?c:mt(i),K=s.bgColor,q=(h=s.textColor)!=null?h:Ht(K,a.labelTextColor,a.labelInvertedTextColor),$=(v=i.typeConfig.rectangle)==null?void 0:v.paddings,J=(y=(p=s.paddingTop)!=null?p:$==null?void 0:$.top)!=null?y:Xe,ne=(R=(E=s.paddingBottom)!=null?E:$==null?void 0:$.bottom)!=null?R:Xe,oe=(k=(N=s.paddingEnd)!=null?N:$==null?void 0:$.end)!=null?k:Xe,le=s.paddingStart,re=Qe(Z,n),ce=r-re/2-J,de=r+re/2+ne-ce;if((r<e.y+de/2||r>e.y+e.height-de/2)&&!o)return;n.save(),n.fillStyle=K,n.strokeStyle=K;const ue=i.labelBoxMargin.end;n.font=Z;const pe=Re(t,n,Z),me=ue-oe,Fe=le!==void 0?pe+le+oe:e.width-me,Ye=U==="right"?e.x+e.width-me-Fe:e.x+me,He=U==="right"?e.x+e.width-pe-ue:ue;l&&cn(l,n,Ye,ce,Fe,de),n.fillStyle=q,n.fillText(t,He,r+re/2-1),n.restore()}function Sh(n,e,t=Xe){return Qe(n,e)/2+t}const xh="badge",Pi=4,Ti={badge:Ch,rectangle:yh,plain:wh};function _i(n,e,t,r,s,i,a,o){var l,c,h,v,p;const y=s.y,E=s.labelText,R=(l=s.mode)!=null?l:"label",N=(c=s.labelType)!=null?c:xh,k=s.description,U=(h=s.textFont)!=null?h:mt(a),Z=s.bgColor,K=(v=s.lineColor)!=null?v:Z,q=Re(k!=null?k:"",n,U)+8,$=ve(s.y),J=Qe(U,n),ne=y-J/2,le=y+J/2-ne;n.save(),n.fillStyle=Z,n.strokeStyle=K;const re=i.getBounds(Y.PANE_UUID(ae)),ce=Ti[N],fe=a.labels.descriptions,de=Mh(t,$,le),ue=()=>fe&&Ph(e,n,t,r,s,a.align,a);let pe,me;const Fe=2;a.align==="right"?(pe=re.x,me=fe?re.x+re.width-q:re.x+re.width+Fe):(pe=fe?re.x+q:re.x-Fe,me=re.x+re.width);const Ye=(p=s.lineY)!=null?p:s.y,He=()=>de&&Ct(n,()=>Sc(n,pe,Ye,me,Ye,1)),ut=()=>ce(n,t,E,y,s,a,o,!1,e);switch(R){case"line":He(),ue();break;case"line-label":He(),ue(),ut();break;case"label":ue(),ut();break;case"none":break}n.restore()}const Mh=(n,e,t)=>e>n.y+t/2&&e<n.y+n.height-t/2;function Ph(n,e,t,r,s,i="right",a){var o,l,c;const h=s.description;if(!h||h.length===0)return;const v=s.y,p=mt(a),y=Re(h,e,p),E=Qe(p,e),R=(o=s.paddingTop)!=null?o:Pi,N=(l=s.paddingBottom)!=null?l:Pi,k=v-E/2-R,Z=v+E/2+N-k;if(v<t.y+Z/2||v>t.y+t.height-Z/2)return;e.save();const K=y+5,q=4,$=y+q*2,J=r.x+r.width,ne=i==="right"?J-$:r.x+q;cn(n,e,ne,k,K,Z,.8),e.fillStyle=(c=s.descColor)!=null?c:s.bgColor,e.font=p;const oe=i==="right"?J-y-q*2:r.x+q*2;e.fillText(h,oe,v+E/2-1),e.restore()}class Ai{constructor(e,t,r,s=()=>!0,i){this.config=e,this.canvasBoundsContainer=t,this.paneManager=r,this.crossDrawPredicate=s,this.noLines=i}draw(e,t){this.crossDrawPredicate()&&Ct(e,()=>this.drawCrossTool(e,t))}drawCrossTool(e,t){var r,s,i,a,o;const l=this.canvasBoundsContainer.getBounds(Y.ALL_PANES),c=this.canvasBoundsContainer.getBoundsHitTest(Y.ALL_PANES,{extensionY:1e-4}),h=(r=this.config.components.xAxis.padding.top)!=null?r:0,v=(i=this.config.components.yAxis.typeConfig[(s=this.config.components.crossTool.yLabel.type)!=null?s:"badge"])==null?void 0:i.paddings,p=(a=v==null?void 0:v.start)!=null?a:0,y=(o=this.paneManager.paneComponents[t.paneId])==null?void 0:o.ht;if(c(t.x,l.y)){const E={start:[l.x,t.y],end:[l.x+l.width+p,t.y]},R={start:[t.x,l.y],end:[t.x,l.y+l.height+h]},N=y==null?void 0:y(t.x,t.y);this.noLines||(e.strokeStyle=this.config.colors.crossTool.lineColor,e.setLineDash(this.config.components.crossTool.lineDash),e.beginPath(),N&&(e.moveTo(...E.start),e.lineTo(...E.end)),e.moveTo(...R.start),e.lineTo(...R.end),e.stroke()),N&&this.drawYLabel(e,t),this.drawXLabel(e,t)}}drawXLabel(e,t){var r,s,i,a,o;const l=this.config.components.crossTool.xLabel.padding,c=this.config.components.crossTool.xLabel.margin,h=this.config.colors.crossTool;if(this.config.components.xAxis.visible){e.font=this.config.components.xAxis.fontSize+"px "+this.config.components.xAxis.fontFamily;const v=t.x,p=t.time,y=e.measureText(p).width,E=this.config.components.xAxis.fontSize,R=this.canvasBoundsContainer.getBounds(Y.X_AXIS);e.save(),e.fillStyle=h.labelBoxColor;const N=(r=l==null?void 0:l.left)!=null?r:0,k=(s=l==null?void 0:l.right)!=null?s:0,U=(i=l==null?void 0:l.top)!=null?i:0,Z=(a=l==null?void 0:l.bottom)!=null?a:0,K=(o=c==null?void 0:c.top)!=null?o:0,q=y+N+k,$=E+U+Z,J=Math.max(v-q/2,0),ne=R.y+K;ti(e,J,ne,q,$),e.fillStyle=h.labelTextColor;const oe=Math.max(v-y/2,N),le=R.y+K+E+U-1;e.fillText(p,oe,le),e.restore()}}drawYLabel(e,t){var r,s;const i=this.config.components.crossTool.yLabel.padding,a=this.config.colors.crossTool;if(this.config.components.yAxis.visible){const o=this.paneManager.paneComponents[t.paneId],l=t.y;if(!o)return;for(const c of o.yExtentComponents){const h=c.regularValueFromY(l),v=c.valueFormatter(h),p=this.canvasBoundsContainer.getBounds(Y.PANE_UUID_Y_AXIS(o.uuid,c.idx)),y=Ti[this.config.components.crossTool.yLabel.type];y(e,p,v,l,{textColor:a.labelTextColor,bgColor:a.labelBoxColor,paddingBottom:i==null?void 0:i.bottom,paddingEnd:i==null?void 0:i.end,paddingTop:i==null?void 0:i.top},(s=(r=c.yAxisComponent)==null?void 0:r.state)!=null?s:this.config.components.yAxis,this.config.colors.yAxis,!0)}}}}class Th{draw(){}}class _h extends te{constructor(e,t,r,s,i,a,o){super(),this.config=e,this.crossToolCanvasModel=t,this.canvasBoundsContainer=r,this.drawingManager=s,this.paneManager=i,this.crossToolTypeDrawers={},this.model=new bh(e.components.crossTool,this.crossToolCanvasModel,a,o),this.addChildEntity(this.model);const l=new Et(this.crossToolCanvasModel);this.registerDefaultDrawerTypes();const c=new mh(this.model,this.crossToolCanvasModel,this.crossToolTypeDrawers),h=new ar;h.addDrawer(l,"CLEAR_CANVAS"),h.addDrawer(c,"CROSS_TOOL_DRAWER"),this.drawingManager.addDrawer(h,"CROSS_TOOL")}registerDefaultDrawerTypes(){this.registerCrossToolTypeDrawer("cross-and-labels",new Ai(this.config,this.canvasBoundsContainer,this.paneManager,()=>!0)),this.registerCrossToolTypeDrawer("just-labels",new Ai(this.config,this.canvasBoundsContainer,this.paneManager,()=>!0,!0)),this.registerCrossToolTypeDrawer("none",new Th)}setVisible(e){this.model.setType(e?"cross-and-labels":"none")}setType(e){this.model.setType(e)}observeCrossToolChanged(){return this.model.currentHoverSubject}setMagnetTarget(e){this.config.components.crossTool.magnetTarget=e}registerCrossToolTypeDrawer(e,t){this.crossToolTypeDrawers[e]=t}}const Ah=()=>n=>n.toString(),Dh=(n,e)=>{var t;const r="date.get"+(e((t=n.timezone)!=null?t:"")?"":"UTC"),s={YYYY:a("FullYear"),YY:a("FullYear")+" % 100",MMM:o("shortMonths","Month"),MMMM:l(o("shortMonths","Month")),M:"1+"+a("Month"),d:a("Date"),H:a("Hours"),m:a("Minutes"),s:a("Seconds"),sss:a("Milliseconds"),EEE:o("shortDays","Day"),SSS:"this.addTwoZeros("+a("Milliseconds")+")",T:"date.getTime()"};["s","m","H","d","M"].forEach(function(h){s[h+h]="this.addZero("+s[h]+")"});const i=new RegExp(Object.keys(s).sort().reverse().join("|"),"g");function a(h){return r+h+"()"}function o(h,v){return"this."+h+"["+a(v)+"]"}function l(h){return h+".toUpperCase()"}function c(h){return"' + ("+s[h]+") + '"}return function(h){var v;const p={shortDays:Eh(n),shortMonths:Lh(n),addZero(y){return y<10?"0"+y:y},addTwoZeros(y){return(y<100?"0":"")+(y<10?"0":"")+y},tzDate:e((v=n.timezone)!=null?v:"")||function(y){return y instanceof Date?y:new Date(+y)}};return new Function("date","date=this.tzDate(date); return '"+h.replace(i,c)+"'").bind(p)}};function Eh(n){var e;return(e=n.shortDays)!=null?e:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]}function Lh(n){var e;return(e=n.shortMonths)!=null?e:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]}const Di=(n,e,t)=>{if(n){if(typeof n=="string")return t(n);if(Array.isArray(n)){const r=n.filter(s=>{if(s.showWhen){const i=[];return s.showWhen.periodLessThen&&i.push(()=>{var a,o;return e<((o=(a=s.showWhen)==null?void 0:a.periodLessThen)!=null?o:0)}),s.showWhen.periodMoreThen&&i.push(()=>{var a,o;return e>=((o=(a=s.showWhen)==null?void 0:a.periodMoreThen)!=null?o:0)}),i.every(a=>a())}else return!0});if(r.length>0){const s=r[0];if(s.format)return t(s.format);if(s.customFormatter)return s.customFormatter}}}return Ah()},Ih={"rhombus-small":4,rhombus:6,"rhombus-large":8},Vt=(n,e)=>`${n}_${e}`;class Oh{constructor(e,t,r,s,i,a,o){this.backgroundCanvas=e,this.canvasModel=t,this.chartModel=r,this.config=s,this.canvasBoundsContainer=i,this.model=a,this.formatterProvider=o,this.customIcons={};const l=this.config.components.events.icons;l&&(this.createCustomIcon("earnings",l.earnings),this.createCustomIcon("dividends",l.dividends),this.createCustomIcon("splits",l.splits),this.createCustomIcon("conference-calls",l.conferenceCalls))}createCustomIcon(e,t){if(t){const r=this.createIconImage(t.normal),s=this.createIconImage(t.hover);this.customIcons[Vt(e,"normal")]=r,this.customIcons[Vt(e,"hover")]=s}}createIconImage(e){var t;const s=new DOMParser().parseFromString(e,"text/html").querySelector("svg");let i=0;s&&(i=parseInt((t=s.getAttribute("height"))!=null?t:"",10));const l="data:image/svg+xml;base64,"+btoa(e),c=new Image;return c.src=l,{img:c,svgHeight:i}}draw(){if(!this.config.components.events.visible)return;const e=this.canvasBoundsContainer.getBounds(Y.EVENTS),t=this.canvasBoundsContainer.getBounds(Y.ALL_PANES),r=this.canvasModel.ctx;r.save(),this.model.events.filter(s=>this.config.components.events.eventsVisibility[s.type]).forEach(s=>{const i=this.chartModel.candleFromTimestamp(s.timestamp).xCenter(this.chartModel.scaleModel);if(i>t.x&&i<t.x+t.width){const a=this.config.colors.events[s.type].color;r.strokeStyle=a,this.customIcons[Vt(s.type,"hover")]!==void 0?this.drawCustomSvgEvent(r,i,e,s):this.drawDefaultEvent(r,i,e,s,a),this.model.hoveredEvent.getValue()===s&&(r.beginPath(),r.moveTo(i,t.y),r.lineTo(i,e.y+e.height/2),r.stroke(),r.closePath(),this.config.components.xAxis.visible&&this.drawLabel(i,s))}}),r.restore()}drawCustomSvgEvent(e,t,r,s){const i=r.y+r.height/2,a=this.customIcons[Vt(s.type,"normal")],o=this.customIcons[Vt(s.type,"hover")];this.model.hoveredEvent.getValue()===s?e.drawImage(o.img,t-o.svgHeight/2,i-o.svgHeight/2):e.drawImage(a.img,t-a.svgHeight/2,i-a.svgHeight/2)}drawDefaultEvent(e,t,r,s,i){const a=r.y+r.height/2;e.fillStyle=i,e.lineWidth=1.5;const o=or(s);e.beginPath(),e.moveTo(t-o,a),e.lineTo(t,a-o),e.lineTo(t+o,a),e.lineTo(t,a+o),e.closePath(),this.model.hoveredEvent.getValue()===s?e.fill():e.stroke()}drawLabel(e,t){var r;const s=this.canvasModel.ctx,i=this.canvasBoundsContainer.getBounds(Y.X_AXIS),a=this.config.components.xAxis.fontFamily,o=this.config.components.xAxis.fontSize,l=(r=this.config.components.xAxis.padding.top)!=null?r:0,c=i.y+o-1+l;s.font=`${o}px ${a}`;const h=this.formatterProvider()(t.timestamp),v=s.measureText(h).width;cn(this.backgroundCanvas.ctx,s,e-v/2,i.y+1,v,i.height-1),s.fillStyle=this.config.colors.events[t.type].color,s.fillText(h,e-v/2,c)}getCanvasIds(){return[this.canvasModel.canvasId]}}function or(n){return Ih[n.style]}const mn=5;class Bh{constructor(e,t,r,s,i){this.hitTestCanvasModel=e,this.chartModel=t,this.config=r,this.canvasBoundsContainer=s,this.model=i}draw(){const e=this.hitTestCanvasModel.ctx,t=this.canvasBoundsContainer.getBounds(Y.EVENTS);e.save(),this.model.events.forEach((r,s)=>{const i=this.model.events[s-1],a=i&&this.chartModel.candleFromTimestamp(i.timestamp).xCenter(this.chartModel.scaleModel),o=this.chartModel.candleFromTimestamp(r.timestamp).xCenter(this.chartModel.scaleModel);if(o>t.x&&o<t.x+t.width){const l=this.config.colors.events[r.type].color;e.strokeStyle=l,e.fillStyle=l;const c=or(r);e.fillStyle=this.hitTestCanvasModel.idToColor(r.id);const h=(c+mn)*2;if(a!==void 0){const v=or(i);if(a+v>o-h/2){const y=c*2+mn;e.fillRect(a+v,t.y,y,t.height)}else e.fillRect(o-c-mn,t.y,h,t.height)}else e.fillRect(o-c-mn,t.y,h,t.height)}}),e.restore()}getCanvasIds(){return[this.hitTestCanvasModel.canvasId]}}var Rh=Object.defineProperty,Ei=Object.getOwnPropertySymbols,Fh=Object.prototype.hasOwnProperty,Yh=Object.prototype.propertyIsEnumerable,Li=(n,e,t)=>e in n?Rh(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Hh=(n,e)=>{for(var t in e||(e={}))Fh.call(e,t)&&Li(n,t,e[t]);if(Ei)for(var t of Ei(e))Yh.call(e,t)&&Li(n,t,e[t]);return n};const Ii=317,lr={DRAWINGS:[0,199],NEWS:[200,299],DATA_SERIES:[300,2999],EVENTS:[3e3,4e3]};class Nh extends li{constructor(e,t,r,s,i,a,o,l){super(e,t,i,o,l,{willReadFrequently:!0,desynchronized:!0}),this.canvasInputListener=r,this.canvasBoundsContainer=s,this.hitTestSubscribers=[],this.eventsSubscriptions=[],this.hoverSubject=new G,this.touchStartSubject=new G,this.dblClickSubject=new G,this.rightClickSubject=new G,this.curImgData=new Uint8ClampedArray(4),this.prevAnimationFrameId=-1,ci(this,a),t.style.visibility="hidden",this.enableUserControls()}enableUserControls(){if(this.eventsSubscriptions.length===0){const e=this.canvasBoundsContainer.getBoundsHitTest(Y.ALL_PANES),t=this.canvasInputListener.observeMouseMove().pipe(Nt(100,void 0,{trailing:!0})).subscribe(c=>this.eventHandler(c,"hover")),r=this.canvasInputListener.observeTouchStart().pipe(ye(()=>this.canvasInputListener.currentPoint)).subscribe(c=>this.eventHandler(c,"touchstart")),s=Me(this.canvasInputListener.observeMouseDown(e),this.canvasInputListener.observeTouchStart().pipe(ye(()=>this.canvasInputListener.currentPoint))).subscribe(c=>this.eventHandler(c,"mousedown")),i=Me(this.canvasInputListener.observeMouseUp(e),this.canvasInputListener.observeTouchEndDocument().pipe(ye(()=>this.canvasInputListener.currentPoint))).subscribe(c=>this.eventHandler(c,"mouseup")),a=this.canvasInputListener.observeDbClick(e).subscribe(c=>this.eventHandler(c,"dblclick")),o=this.canvasInputListener.observeContextMenu(e).pipe(ye(()=>Hh({},this.canvasInputListener.currentPoint))).subscribe(c=>{this.eventHandler(c,"contextmenu")}),l=this.canvasInputListener.observeWheel(e).subscribe(c=>setTimeout(()=>this.eventHandler(c,"zoom"),0));this.eventsSubscriptions.push(t,s,a,o,l,r,i)}}disableUserControls(){this.eventsSubscriptions.forEach(e=>e.unsubscribe()),this.eventsSubscriptions=[]}addSubscriber(e){this.hitTestSubscribers.push(e)}removeSubscriber(e){this.hitTestSubscribers=this.hitTestSubscribers.filter(t=>t===e)}idToColor(e){const t=(e*Ii).toString(16);return"#000000".substr(0,7-t.length)+t}colorToId(e){return e/Ii}observeHoverOnElement(){return this.hoverSubject.asObservable()}observeTouchStartOnElement(){return this.touchStartSubject.asObservable()}observeDblClickOnElement(){return this.dblClickSubject.asObservable()}observeRightClickOnElement(){return this.rightClickSubject.asObservable()}getPixel(e,t){const r=window.devicePixelRatio;return this.prevAnimationFrameId!==nr&&(this.curImgData=this.ctx.getImageData(e*r,t*r,1,1).data,this.prevAnimationFrameId=nr),this.curImgData}resolveModel(e){const t=this.getPixel(e.x,e.y),r=this.colorToId(t[0]*65536+t[1]*256+t[2]),s=Number(r),[i]=cr(this.hitTestSubscribers,s);return i==null?void 0:i.lookup(r)}resolveCursor(e){var t;if(!this.hitTestSubscribers.some(l=>l.resolveCursor!==void 0))return;const r=this.getPixel(e.x,e.y),s=this.colorToId(r[0]*65536+r[1]*256+r[2]),i=Number(s),[a]=cr(this.hitTestSubscribers,i),o=a==null?void 0:a.lookup(s);return(t=a==null?void 0:a.resolveCursor)==null?void 0:t.call(a,e,o)}eventHandler(e,t){var r,s,i,a,o,l,c;const h=this.getPixel(e.x,e.y),v=this.colorToId(h[0]*65536+h[1]*256+h[2]),p=Number(v),[y,E]=cr(this.hitTestSubscribers,p),R=y==null?void 0:y.lookup(v),N={point:e,model:R};switch(t){case"mousedown":R&&((r=y==null?void 0:y.onMouseDown)==null||r.call(y,R,e)),E.forEach(k=>k.onMouseDown&&k.onMouseDown(null,e));break;case"mouseup":R&&((s=y==null?void 0:y.onMouseUp)==null||s.call(y,R,e)),E.forEach(k=>k.onMouseUp&&k.onMouseUp(null,e));break;case"hover":R&&((i=y==null?void 0:y.onHover)==null||i.call(y,R,e)),E.forEach(k=>k.onHover&&k.onHover(null,e)),this.hoverSubject.next(N);break;case"touchstart":R&&((a=y==null?void 0:y.onTouchStart)==null||a.call(y,R,e)),E.forEach(k=>k.onTouchStart&&k.onTouchStart(null,e)),this.touchStartSubject.next(N);break;case"dblclick":R&&((o=y==null?void 0:y.onDblClick)==null||o.call(y,R,e)),this.dblClickSubject.next(N);break;case"contextmenu":R&&((l=y==null?void 0:y.onRightClick)==null||l.call(y,R,e)),this.rightClickSubject.next(N);break;case"zoom":R&&((c=y==null?void 0:y.onZoom)==null||c.call(y,R,e)),E.forEach(k=>k.onZoom&&k.onZoom(null,e));break;default:break}}}const cr=(n,e)=>{let t;const r=[];return n.forEach(s=>{const[i,a]=s.getIdRange();e>=i&&e<=a?t=s:r.push(s)}),[t,r]};var kh=Object.defineProperty,Wh=Object.defineProperties,Uh=Object.getOwnPropertyDescriptors,Oi=Object.getOwnPropertySymbols,zh=Object.prototype.hasOwnProperty,Xh=Object.prototype.propertyIsEnumerable,Bi=(n,e,t)=>e in n?kh(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,jh=(n,e)=>{for(var t in e||(e={}))zh.call(e,t)&&Bi(n,t,e[t]);if(Oi)for(var t of Oi(e))Xh.call(e,t)&&Bi(n,t,e[t]);return n},Vh=(n,e)=>Wh(n,Uh(e));class Gh extends te{constructor(e){super(),this.canvasModel=e,this.events=[],this.hoveredEvent=new pt(null)}setEvents(e){this.events=this.indexEvents(e)}indexEvents(e){const t=this.getIdRange()[0];return e.map((r,s)=>Vh(jh({},r),{id:s+t})).sort((r,s)=>r.timestamp-s.timestamp)}getIdRange(){return lr.EVENTS}lookup(e){return this.events.filter(t=>t.id===e)[0]}onHover(e,t){this.hoveredEvent.getValue()!==e&&(e&&(e.point=t),this.hoveredEvent.next(e),this.canvasModel.fireDraw())}onTouchStart(e,t){this.onHover(e,t)}}class $h extends te{constructor(e,t,r,s,i,a,o,l,c){super(),this.config=e,this.canvasModel=t,this.canvasBoundsContainer=i,this.drawingManager=a,this.formatterFactory=o,this.eventsXAxisLabelFormatterProvider=()=>Di(this.config.components.events.xAxisLabelFormat,s.getPeriod(),this.formatterFactory);const h=new Gh(t);this.eventsModel=h,this.addChildEntity(h),r.addSubscriber(h);const v=new Oh(c,t,s,e,i,h,this.eventsXAxisLabelFormatterProvider);this.drawingManager.addDrawer(v,"EVENTS");const p=new Bh(r,s,e,i,h);this.drawingManager.addDrawerBefore(p,"HIT_TEST_EVENTS","HIT_TEST_DRAWINGS"),l.setCursorForCanvasEl(Y.EVENTS,e.components.events.cursor)}setEvents(e){this.eventsModel.setEvents(e),this.canvasModel.fireDraw()}setVisible(e){this.config.components.events.visible=e,this.canvasBoundsContainer.recalculateBounds(),this.canvasModel.fireDraw()}setEventTypeVisible(e){Ge(this.config.components.events.eventsVisibility,e,{overrideExisting:!0,addIfMissing:!1}),this.canvasModel.fireDraw()}observeEventHovered(){return this.eventsModel.hoveredEvent.asObservable()}}class Zh{constructor(e,t,r,s,i,a,o,l=()=>!0,c){this.canvasModel=e,this.viewportModel=t,this.config=r,this.xBoundsProvider=s,this.yBoundsProvider=i,this.xLabelsProvider=a,this.yLabelsProvider=o,this.drawPredicate=l,this.getBaseLine=c}draw(){if(this.drawPredicate()){const e=this.canvasModel.ctx;Ct(e,()=>this.drawVertical(e)),Ct(e,()=>this.drawHorizontal(e)),Ct(e,()=>this.drawZeroLine(e))}}drawZeroLine(e){if(this.getBaseLine&&this.config.components.yAxis.type==="percent"&&this.config.components.yAxis.zeroPercentLine){const t=this.xBoundsProvider(),r=ve(this.getBaseLine());e.beginPath(),e.strokeStyle=this.config.colors.yAxis.zeroPercentLine,e.setLineDash([]),e.moveTo(t.x,r),e.lineTo(t.x+t.width,r),e.stroke(),e.closePath()}}drawVertical(e){const t=this.xLabelsProvider();if(t.length&&this.config.components.grid.vertical){e.lineWidth=this.config.components.grid.width,e.strokeStyle=this.config.colors.chartAreaTheme.gridColor,e.setLineDash(this.config.components.grid.dash||[]);const r=this.xBoundsProvider(),s=r.x+r.width;for(const i of t){const a=ve(this.viewportModel.toX(i.value));a>r.x&&a<s&&(e.beginPath(),e.moveTo(a,r.y),e.lineTo(a,r.y+r.height),e.stroke())}}}drawHorizontal(e){const t=this.yLabelsProvider();if(t.length&&this.config.components.grid.horizontal){e.lineWidth=this.config.components.grid.width,e.strokeStyle=this.config.colors.chartAreaTheme.gridColor,e.setLineDash(this.config.components.grid.dash||[]);const r=this.yBoundsProvider();for(const s of t){const i=ve(this.viewportModel.toY(s.value)),a=Sh(s.text,e,Xe);i>r.y+a&&i<r.y+r.height-a&&(e.beginPath(),e.moveTo(r.x,i),e.lineTo(r.x+r.width,i),e.stroke())}}}getCanvasIds(){return[this.canvasModel.canvasId]}}class Ri extends te{constructor(e,t,r,s,i,a,o,l,c,h,v){super(),this.drawerName=s,this.drawingManager=i,this.drawer=new Zh(e,t,r,a,o,l,c,v,h)}doDeactivate(){super.doDeactivate(),this.drawingManager.removeDrawer(this.drawer)}doActivate(){super.doActivate(),this.drawingManager.addDrawer(this.drawer,this.drawerName)}}class Kh{constructor(e,t,r,s){this.canvasModel=e,this.chartModel=t,this.config=r,this.canvasBoundsContainer=s}draw(){if(this.config.components.highLow.visible&&this.chartModel.isReady()){const{high:e,low:t,highIdx:r,lowIdx:s}=this.chartModel.mainCandleSeries.zippedHighLow,i=this.chartModel.mainCandleSeries.dataIdxStart,a=i+r,o=i+s,l=this.canvasModel.ctx;l.save(),l.font=this.config.components.highLow.font,this.drawMarkerLabel(l,a,e,"high"),this.drawMarkerLabel(l,o,t,"low"),l.restore()}}drawMarkerLabel(e,t,r,s){const i=this.getMarkerY(e,r,s==="low");if(!this.checkMarkerInBounds(i))return;const a=this.getMarkerText(r,s),o=this.getMarkerX(e,t,a);e.fillStyle=s==="high"?this.config.colors.highLowTheme.highColor:this.config.colors.highLowTheme.lowColor,e.fillText(a,o,i)}getMarkerText(e,t){const r=this.chartModel.pane.regularFormatter(e);return`${t==="high"?"H:":"L:"} ${r}`}getMarkerY(e,t,r=!1){const s=this.chartModel.toY(t);if(r){const i=Nn(e);return s+i}return s}checkMarkerInBounds(e){const t=this.canvasBoundsContainer.getBounds(Y.CHART);return e>t.y&&e<t.y+t.height}getMarkerX(e,t,r){let s=this.chartModel.toX(t);const i=this.canvasBoundsContainer.getBounds(Y.CHART),a=4,o=e.measureText(r).width;return s+a+o>i.width&&(s=s-(a+o)),s+a}getCanvasIds(){return[this.canvasModel.canvasId]}}class qh extends te{constructor(e,t,r,s,i){super();const a=new Kh(t,r,e,s);i.addDrawer(a,"HIGH_LOW")}}const Jh=["AFTER_MARKET","PRE_MARKET","NO_TRADING","REGULAR"],Qh=24*60*60*1e3;class ed extends te{constructor(e){super(),this.chartModel=e,this.highlights=[],this.visualHighlights={},this.highlightsUpdatedSubject=new G}activate(){this.addRxSubscription(this.chartModel.scaleModel.xChanged.subscribe(()=>this.highlights.length&&this.recalculateVisualHighlights()))}getHighlights(){return this.highlights}getVisualHighlights(){return this.visualHighlights}recalculateVisualHighlights(){this.visualHighlights={};const e=this.chartModel.getFirstTimestamp(),t=this.chartModel.getLastTimestamp()+Qh;Lo(this.highlights,e,t,td).forEach(s=>{var i;this.visualHighlights[s.type]||(this.visualHighlights[s.type]=[]),(i=this.visualHighlights[s.type])==null||i.push(s)})}setHighlights(e){this.highlights=e,this.highlights.sort((t,r)=>t.to-r.to),this.highlightsUpdatedSubject.next(this.highlights),this.highlights.length?this.recalculateVisualHighlights():this.visualHighlights={}}observeHighlightsUpdated(){return this.highlightsUpdatedSubject.asObservable()}}const td=n=>n.to,ht=[20,10];class nd{constructor(e,t,r,s,i){this.highlightsModel=e,this.chartModel=t,this.canvasModel=r,this.canvasBoundsContainer=s,this.config=i}draw(){var e,t,r,s;if(this.config.components.highlights.visible){const i=this.chartModel.getCandles(),a=this.canvasModel.ctx,o=this.highlightsModel.getVisualHighlights();if(this.highlightsModel.getHighlights().length&&i.length!==0&&this.chartModel.scaleModel.isScaleReady()){const c=this.canvasBoundsContainer.getBounds(Y.ALL_PANES);a.save(),yt(a,c);const h=(e=this.config.components.highlights.border.width)!=null?e:1,v=(t=this.config.components.highlights.border.dash)!=null?t:[0,0],p=(r=this.config.components.highlights.fontSize)!=null?r:11,y=(s=this.config.components.highlights.fontFamily)!=null?s:"monospace",E=`${p}px ${y}, monospace`;a.font=E,a.lineWidth=h,a.setLineDash(v),Jh.forEach(R=>{var N,k;const U=o[R];if(U){const Z=this.config.colors.highlights[R],K=(N=Z==null?void 0:Z.border)!=null?N:"#ffffff",q=(k=Z==null?void 0:Z.background)!=null?k:"#ffffff";a.save(),a.beginPath(),a.fillStyle=q,a.strokeStyle=K,U.forEach($=>{var J,ne,oe;const le=this.chartModel.candleFromTimestamp($.from),re=Pe(le.width,this.chartModel.scaleModel.zoomX),ce=le.xStart(this.chartModel.scaleModel),fe=this.chartModel.candleFromTimestamp($.to),de=Pe(fe.width,this.chartModel.scaleModel.zoomX),ue=fe.xStart(this.chartModel.scaleModel)+de;if($.border&&this.drawBorders($.border,a,ce+re,ue-de,c),a.fillRect(ce,c.y,ue-ce,c.y+c.height),$.label){const pe=(J=$.label.text)!=null?J:"",me=this.config.colors.highlights[$.type];a.save(),a.fillStyle=(ne=me==null?void 0:me.label)!=null?ne:"#ffffff";const Fe=Re(pe,a,E),[Ye,He]=this.resolveHighlightLabelPosition((oe=$.label.placement)!=null?oe:"left-left",c,[ce,ue],Fe);a.fillText(pe,Ye,He),a.restore()}}),a.closePath(),a.restore()}}),a.restore()}}}resolveHighlightLabelPosition(e,t,r,s){const[i,a]=r;switch(e){case"right-left":return[a-ht[1]-s,t.y+ht[0]];case"left-left":return[i-ht[1]-s,t.y+ht[0]];case"right-right":return[a+ht[1],t.y+ht[0]];case"left-right":default:return[i+ht[1],t.y+ht[0]]}}drawBorders(e,t,r,s,i){const a=e.left,o=e.right;a&&(t.beginPath(),t.moveTo(r,i.y),t.lineTo(r,i.y+i.height),t.stroke(),t.closePath()),o&&(t.beginPath(),t.moveTo(s,i.y),t.lineTo(s,i.y+i.height),t.stroke(),t.closePath())}getCanvasIds(){return[this.canvasModel.canvasId]}}const rd="HIGHLIGHTS_PLUGIN";class sd extends te{constructor(e,t,r,s,i,a){super(),this.eventBus=e,this.config=t,this.highlightsModel=new ed(r),this.addChildEntity(this.highlightsModel),this.highLightsDrawer=new nd(this.highlightsModel,r,s,i,t),a.addDrawer(this.highLightsDrawer,rd)}getHighlights(){return this.highlightsModel.getHighlights()}setHighlights(e){this.highlightsModel.setHighlights(e)}setHighlightsVisible(e=!0){this.config.components.highlights.visible=e,this.eventBus.fireDraw(this.highLightsDrawer.getCanvasIds())}observeHighlightsUpdated(){return this.highlightsModel.observeHighlightsUpdated()}}function id(){return w(function(n,e){var t,r=!1;n.subscribe(We(e,function(s){var i=t;t=s,r&&e.next([i,s]),r=!0}))})}function he(n,e){return w(function(t,r){var s=0;t.subscribe(We(r,function(i){return n.call(e,i,s++)&&r.next(i)}))})}var ad=Object.defineProperty,od=Object.defineProperties,ld=Object.getOwnPropertyDescriptors,Fi=Object.getOwnPropertySymbols,cd=Object.prototype.hasOwnProperty,hd=Object.prototype.propertyIsEnumerable,Yi=(n,e,t)=>e in n?ad(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Hi=(n,e)=>{for(var t in e||(e={}))cd.call(e,t)&&Yi(n,t,e[t]);if(Fi)for(var t of Fi(e))hd.call(e,t)&&Yi(n,t,e[t]);return n},Ni=(n,e)=>od(n,ld(e));const nt=4;class dd{constructor(e,t,r,s,i,a){this.config=e,this.chartModel=t,this.canvasModel=r,this.canvasBoundsContainer=s,this.formatterFactory=i,this.visualCandlesProvider=a}draw(){if(this.config.components.navigationMap.visible){const e=this.visualCandlesProvider();if(e.length){const t=this.canvasBoundsContainer.getBounds(Y.N_MAP),r=this.canvasBoundsContainer.getBounds(Y.N_MAP_BTN_L),s=this.canvasBoundsContainer.getBounds(Y.N_MAP_BTN_R),i=this.canvasBoundsContainer.getBounds(Y.N_MAP_KNOT_L),a=this.canvasBoundsContainer.getBounds(Y.N_MAP_KNOT_R),o=this.canvasBoundsContainer.getBounds(Y.N_MAP_SLIDER_WINDOW),l=this.canvasBoundsContainer.getBounds(Y.N_MAP_CHART),c=this.canvasModel.ctx;c.fillStyle=this.config.colors.navigationMap.backgroundColor,c.fillRect(t.x,t.y,t.width,t.height),c.strokeStyle=this.config.colors.paneResizer.lineColor,c.lineWidth=1,c.beginPath(),c.moveTo(t.x,t.y),c.lineTo(t.x+t.width,t.y),c.closePath(),c.stroke(),r.width!==0&&this.drawLeftArrowButton(c,r,this.config),s.width!==0&&this.drawRightArrowButton(c,s,this.config),c.fillStyle=this.config.colors.navigationMap.mapFillColor,c.beginPath(),c.moveTo(l.x,l.y+l.height);for(const h of e)c.lineTo(h[0],h[1]);if(c.lineTo(l.x+l.width,l.y+l.height),c.lineTo(l.x,l.y+l.height),c.closePath(),this.config.colors.navigationMap.mapGradientTopColor&&this.config.colors.navigationMap.mapGradientBottomColor){const h=c.createLinearGradient(l.x,l.y,l.x,l.y+l.height);h.addColorStop(0,this.config.colors.navigationMap.mapGradientTopColor),h.addColorStop(1,this.config.colors.navigationMap.mapGradientBottomColor),c.fillStyle=h}c.fill(),this.config.colors.navigationMap.mapColor&&(c.strokeStyle=this.config.colors.navigationMap.mapColor,c.stroke()),this.drawSlider(c,i,a,r,o),this.drawTimeLabels(c)}}}blockDrawSliderOnLeftArrow(e,t,r,s){e.x<=r.x+r.width&&(e.x=r.x+r.width,s.x=e.x+e.width,t.x=s.x+s.width)}drawSlider(e,t,r,s,i){this.blockDrawSliderOnLeftArrow(t,r,s,i),this.drawKnotButton(e,t,this.config,!0),this.drawKnotButton(e,r,this.config,!1),e.fillStyle=this.config.colors.navigationMap.sliderColor,e.fillRect(i.x,i.y,i.width,i.height)}drawLeftArrowButton(e,t,r){e.fillStyle=r.colors.navigationMap.buttonColor,e.fillRect(t.x,t.y,t.width,t.height),e.beginPath();const s=Math.round(t.x+t.width/2-nt/2),i=Math.round(t.y+t.height/2);e.moveTo(s,i),e.lineTo(s+nt,i+nt),e.lineTo(s+nt,i-nt),e.fillStyle=r.colors.navigationMap.buttonArrowColor,e.fill()}drawRightArrowButton(e,t,r){e.fillStyle=r.colors.navigationMap.buttonColor,e.fillRect(t.x,t.y,t.width,t.height),e.beginPath();const s=Math.round(t.x+t.width/2-nt/2),i=Math.round(t.y+t.height/2);e.moveTo(s,i-nt),e.lineTo(s,i+nt),e.lineTo(s+nt,i),e.fillStyle=r.colors.navigationMap.buttonArrowColor,e.fill()}drawKnotButton(e,t,r,s){const i=r.components.navigationMap.knots.border;e.fillStyle=r.colors.navigationMap.knotColor;const a=s?t.x-i:t.x+i;e.fillRect(a,t.y,t.width,t.height),e.lineWidth=r.components.navigationMap.knots.lineWidth,i>0&&(e.beginPath(),e.moveTo(a,t.y),e.lineTo(a,t.y+t.height),e.lineTo(a+t.width,t.y+t.height),e.lineTo(a+t.width,t.y),e.lineTo(a,t.y),e.lineWidth=i,e.strokeStyle=r.colors.navigationMap.knotBorderColor,e.stroke()),e.beginPath(),e.moveTo(a+t.width/2,t.y+t.height/4),e.lineTo(a+t.width/2,t.y+3*t.height/4),e.strokeStyle=r.colors.navigationMap.knotLineColor,e.stroke()}drawTimeLabels(e){const t=Ie(this.chartModel.mainCandleSeries.getSeriesInViewport()),r=this.config.components.navigationMap.timeLabels,s=r.visible;if(t.length&&s){const i=t[0].candle.timestamp,a=t[t.length-1].candle.timestamp,o=this.canvasBoundsContainer.getBounds(Y.N_MAP_LABEL_L),l=this.canvasBoundsContainer.getBounds(Y.N_MAP_LABEL_R),h={textFill:this.config.colors.navigationMap.timeLabelsTextColor,textFontFamily:r.fontFamily,textSize:`${r.fontSize}px`},v={dateFormat:r.dateFormat,padding:r.padding,textProperties:Ni(Hi({},h),{textAlign:"left"})},p={dateFormat:r.dateFormat,padding:r.padding,textProperties:Ni(Hi({},h),{textAlign:"right"})};this.drawTimeLabel(e,o,i,v),this.drawTimeLabel(e,l,a,p)}}drawTimeLabel(e,t,r,s){const i=s.padding,a=es(r,s.dateFormat,this.formatterFactory);qr(e,s.textProperties);const o=Nn(e),l=Qr(a);Io(e,l,t.x+i.x,t.y+o+i.y,s.textProperties)}getCanvasIds(){return[this.canvasModel.canvasId]}}class Gt extends vi{constructor(e,t,r,s,i=fi){super(e,t,r,s,i)}doActivate(){super.doActivate(),this.addRxSubscription(this.canvasInputListener.observeXDragStart(this.hitTest).subscribe(this.onDragStart)),this.addRxSubscription(this.canvasInputListener.observeXDrag().subscribe(this.onDragTick)),this.addRxSubscription(this.canvasInputListener.observeXDragEnd().subscribe(this.onDragEnd))}doDeactivate(){super.doDeactivate()}}const ki=4;class ud extends te{constructor(e,t,r,s,i,a){super(),this.bus=e,this.chartModel=t,this.scaleModel=r,this.canvasInputListeners=s,this.canvasBoundsContainer=i,this.chartPanComponent=a,this.leftKnotDragStartXRelative=0,this.rightKnotDragStartXRelative=0,this.lastMousePosition=0,this.leftKnotDragStart=y=>{const E=this.canvasBoundsContainer.getBounds(Y.N_MAP_CHART);this.leftKnotDragStartXRelative=y.x-E.x-ki},this.leftKnotDragTick=y=>{const{delta:E}=y,N=this.canvasBoundsContainer.getBounds(Y.N_MAP_CHART).width,k=(this.leftKnotDragStartXRelative+E)/N;this.canvasBoundsContainer.leftRatio=k,this.scaleModel.setXScale(Math.round(this.chartModel.mainCandleSeries.dataPoints.length*this.canvasBoundsContainer.leftRatio),this.scaleModel.xEnd)},this.rightKnotDragStart=y=>{const E=this.canvasBoundsContainer.getBounds(Y.N_MAP_CHART);this.rightKnotDragStartXRelative=y.x-E.x+ki},this.rightKnotDragTick=y=>{const{delta:E}=y,N=this.canvasBoundsContainer.getBounds(Y.N_MAP_CHART).width,k=(this.rightKnotDragStartXRelative+E)/N;this.canvasBoundsContainer.rightRatio=k,this.scaleModel.setXScale(this.scaleModel.xStart,Math.round(this.chartModel.mainCandleSeries.dataPoints.length*this.canvasBoundsContainer.rightRatio))},this.sliderDragStart=()=>{this.lastMousePosition=0},this.sliderDragTick=y=>{const{delta:E}=y,R=this.canvasBoundsContainer.getBounds(Y.N_MAP_CHART),N=this.chartModel.mainCandleSeries.meanCandleWidth/(R.width/this.chartModel.mainCandleSeries.dataPoints.length),k=(this.lastMousePosition-E)*N;this.scaleModel.moveXStart(this.scaleModel.xStart-k),this.lastMousePosition=E};const o=this.canvasBoundsContainer.getBoundsHitTest(Y.N_MAP_KNOT_L),l=this.canvasBoundsContainer.getBoundsHitTest(Y.N_MAP_KNOT_R),c=new Gt(o,{onDragStart:this.leftKnotDragStart,onDragTick:this.leftKnotDragTick},this.canvasInputListeners,this.chartPanComponent),h=new Gt(l,{onDragStart:this.rightKnotDragStart,onDragTick:this.rightKnotDragTick},this.canvasInputListeners,this.chartPanComponent);this.addChildEntity(c),this.addChildEntity(h);const v=this.canvasBoundsContainer.getBoundsHitTest(Y.N_MAP_SLIDER_WINDOW),p=new Gt(v,{onDragStart:this.sliderDragStart,onDragTick:this.sliderDragTick},this.canvasInputListeners,this.chartPanComponent);this.addChildEntity(p)}doActivate(){super.doActivate();const e=this.canvasBoundsContainer.getBoundsHitTest(Y.N_MAP_BTN_L);this.addRxSubscription(this.canvasInputListeners.observeClick(e).subscribe(()=>{this.scaleModel.moveXStart(this.scaleModel.xStart-1)})),this.addRxSubscription(this.canvasInputListeners.observeTouchStart(e).subscribe(()=>{this.scaleModel.moveXStart(this.scaleModel.xStart-1)}));const t=this.canvasBoundsContainer.getBoundsHitTest(Y.N_MAP_BTN_R);this.addRxSubscription(this.canvasInputListeners.observeClick(t).subscribe(()=>{this.scaleModel.moveXStart(this.scaleModel.xStart+1)})),this.addRxSubscription(this.canvasInputListeners.observeTouchStart(t).subscribe(()=>{this.scaleModel.moveXStart(this.scaleModel.xStart+1)})),this.addRxSubscription(this.scaleModel.xChanged.subscribe(()=>{const r=this.chartModel.mainCandleSeries;this.canvasBoundsContainer.leftRatio=r.dataIdxStart/(r.dataPoints.length-1),this.canvasBoundsContainer.rightRatio=r.dataIdxEnd/(r.dataPoints.length-1),this.canvasBoundsContainer.recalculateNavigationMapElementBounds(),this.bus.fireDraw()}))}}class fd extends te{constructor(e,t,r,s,i,a,o,l,c,h){super(),this.eventBus=e,this.chartModel=t,this.canvasModel=r,this.config=s,this.canvasInputListeners=i,this.canvasBoundsContainer=a,this.chartPanComponent=c,this.visualCandles=[];const v=new dd(s,t,r,a,l,()=>this.visualCandles);o.addDrawer(v,Y.N_MAP_CHART),this.navigationMapMoveHandler=new ud(this.eventBus,this.chartModel,this.chartModel.scaleModel,this.canvasInputListeners,this.canvasBoundsContainer,this.chartPanComponent),h.setCursorForCanvasEl(Y.N_MAP_CHART,s.components.navigationMap.cursors.chart),h.setCursorForCanvasEl(Y.N_MAP_BTN_L,s.components.navigationMap.cursors.buttonLeft),h.setCursorForCanvasEl(Y.N_MAP_BTN_R,s.components.navigationMap.cursors.buttonRight),h.setCursorForCanvasEl(Y.N_MAP_KNOT_L,s.components.navigationMap.cursors.leftResizer),h.setCursorForCanvasEl(Y.N_MAP_KNOT_R,s.components.navigationMap.cursors.rightResizer),h.setCursorForCanvasEl(Y.N_MAP_SLIDER_WINDOW,s.components.navigationMap.cursors.slider)}doActivate(){super.doActivate(),this.addRxSubscription(Me(this.chartModel.observeCandlesChanged(),this.canvasBoundsContainer.observeBoundsChanged(Y.N_MAP),this.chartModel.scaleModel.xChanged.pipe(id(),he(([e,t])=>{const s=e.start<0||e.end>0,i=t.start<0||t.end>0;return s&&!i||i}))).subscribe(()=>{this.config.components.navigationMap.visible&&(this.visualCandles=this.makeVisualCandles(),this.canvasModel.fireDraw())}))}makeVisualCandles(){var e;const t=this.chartModel.getCandles();if(!t.length)return[];const r=this.chartModel.mainCandleSeries.dataIdxStart,s=this.chartModel.mainCandleSeries.dataIdxEnd,i=Math.round(Math.max(-r,0)),a=Math.max(this.chartModel.getCandlesCountWithRightOffset(),s)+i;let o=Number.NEGATIVE_INFINITY,l=Number.POSITIVE_INFINITY;const c=this.canvasBoundsContainer.getBounds(Y.N_MAP_CHART),h=c.width,v=[];let p=0,y,E;for(y=0;y<h;y++)E=ve(y*a/h)-i,E in t?(v[y]=t[E].close,p=(e=v[y])!=null?e:0,o=Math.max(o,p),l=Math.min(l,p)):v[y]=0;return o-=l,v.map((R,N)=>[N+c.x,(o+l-R)*c.height/o+c.y])}setVisible(e=!0){var t;(t=this.config.components)!=null&&t.navigationMap&&(this.config.components.navigationMap.visible=e,this.eventBus.fire(Qn),this.canvasModel.fireDraw())}}class vd extends te{constructor(e,t,r){super(),this.scaleModel=e,this.canvasInputListeners=t,this.mainCanvasParent=r,this.touchedCandleIndexes=[0,0]}doActivate(){this.addRxSubscription(this.canvasInputListeners.observeTouchStart().subscribe(e=>this.handleTouchStartEvent(e))),this.addRxSubscription(this.canvasInputListeners.observeTouchMove().subscribe(e=>this.handleTouchMoveEvent(e)))}handleTouchStartEvent(e){e.touches.length===2&&(this.touchedCandleIndexes=this.getXPositions(e).map(t=>this.scaleModel.fromX(t)))}handleTouchMoveEvent(e){e.touches.length===2&&this.pinchHandler(this.touchedCandleIndexes,this.getXPositions(e))}getXPositions(e){const t=this.mainCanvasParent.getBoundingClientRect(),r=[0,0],s=document.body.scrollLeft||document.documentElement.scrollLeft;for(let i=0,a=e.touches.length;i<a;i++){const o=e.touches[i];r[i]=o.pageX-t.left-s}return r}pinchHandler(e,t){const r=(t[0]*e[1]-t[1]*e[0])/(t[0]-t[1]),s=r+(e[0]-e[1])/(t[0]-t[1])*this.scaleModel.getBounds().width;this.scaleModel.setXScale(r,s)}}const Wi=()=>{const n=/Mac|iPod|iPhone|iPad/i.test(navigator.userAgent),t=[/Android/i,/webOS/i,/BlackBerry/i,/Windows Phone/i].some(r=>navigator.userAgent.match(r));return n?"apple":t?"mobile":"other"},Ev=(n,e)=>n==="apple"||n==="mobile"?3:e,gd=/^((?!chrome|android).)*safari/i.test(navigator.userAgent),pd=!!window.chrome,Ui=typeof InstallTrigger!="undefined",md=navigator.platform.indexOf("Win")>-1,zi=n=>{let e=!1;const{wheelDeltaY:t,wheelDeltaX:r}=n;if(t||r){let s;if(gd)s=t===n.deltaY*-3||Math.abs(t+Math.sign(t))===Math.abs(Math.round(n.deltaY)*3)||Math.abs(t-Math.sign(t))===Math.abs(Math.round(n.deltaY)*3);else if(pd){if(s=t+Math.sign(t)===n.deltaY*-3?t+Math.sign(t)===n.deltaY*-3:t===n.deltaY*-3,md){const i=Math.round(n.deltaY)===t||Math.abs(Math.round(n.deltaY)+Math.sign(n.deltaY))===Math.abs(t)||Math.abs(Math.round(n.deltaY)-Math.sign(n.deltaY))===Math.abs(t);s=Math.abs(t)===Math.abs(n.deltaY)||i}}else Ui?Math.abs(n.deltaY)>Math.abs(n.deltaX)?s=!1:s=r===n.deltaX*-3:s=t===n.deltaY*-3;s&&(e=!0)}else n.deltaMode===0&&(e=!0);return Ui&&n.deltaY>=16&&Math.abs(n.deltaY)%16===0&&(e=!1),n.ctrlKey&&(e=!0),e},bd=n=>n.components.yAxis.type==="percent"?n.scale.zoomSensitivity/4:n.scale.zoomSensitivity;var hr=Math.pow;class Cd extends te{constructor(e,t,r,s,i,a,o,l){super(),this.bus=e,this.config=t,this.scaleModel=r,this.mainCanvasParent=s,this.canvasInputListener=i,this.canvasBoundsContainer=a,this.canvasAnimation=o,this.chartPanComponent=l,this.currentPoint={x:0,y:0},this.xDraggedCandlesDelta=0,this.lastXStart=0,this.wheelTrottleTime=15,this.zoomXHandler=v=>{const p=zi(v),y=v.deltaY<0,E=p?bd(this.config):this.config.scale.zoomSensitivity;if(this.config.scale.zoomToCursor){const N=this.canvasBoundsContainer.getBounds(Y.CANVAS).width,U=v.offsetX/N;this.scaleModel.zoomXToPercent(U,y,!1,E)}else this.scaleModel.zoomXToEnd(y,E);this.bus.fireDraw()},this.onXDragStart=()=>{this.canvasAnimation.forceStopAnimation(On),this.xDraggedCandlesDelta=0,this.lastXStart=this.scaleModel.xStart},this.onXDragTick=v=>{const{delta:p}=v;this.currentPoint.x=p;const y=tt(p,this.scaleModel.zoomX);this.scaleModel.moveXStart(this.lastXStart-y),this.bus.fireDraw()},this.touchHandler=new vd(this.scaleModel,this.canvasInputListener,this.mainCanvasParent);const c=this.canvasBoundsContainer.getBoundsHitTest(Y.ALL_PANES),h=new Gt(c,{onDragStart:this.onXDragStart,onDragTick:this.onXDragTick},this.canvasInputListener,this.chartPanComponent,{disableChartPanning:!1});this.addChildEntity(h)}doActivate(){super.doActivate();const e=this.canvasBoundsContainer.getBoundsHitTest(Y.ALL_PANES);this.addRxSubscription(Me(this.canvasInputListener.observeWheel(e),this.canvasInputListener.observePinch(e)).pipe(Nt(this.wheelTrottleTime,void 0,{trailing:!0,leading:!0})).subscribe(this.zoomXHandler)),this.addRxSubscription(this.canvasInputListener.observeScrollGesture().pipe(Nt(this.wheelTrottleTime,void 0,{trailing:!0,leading:!0})).subscribe(t=>{let r=-1;const s=Wi();(s==="apple"||s==="mobile")&&(r=1);let i=0,a=0;if(i+=t.deltaX*r,a+=t.deltaY*-r,i!==0&&Math.abs(i)>Math.abs(a)){const o=tt(i,this.scaleModel.zoomX);this.scaleModel.moveXStart(this.scaleModel.xStart-o)}else a!==0&&Math.abs(a)>Math.abs(i)&&this.zoomXHandler(t);this.bus.fireDraw()})),this.addRxSubscription(this.chartPanComponent.chartBaseModel.dataPrependSubject.asObservable().subscribe(({prependedCandlesWidth:t})=>{this.lastXStart+=t})),this.touchHandler.activate(),this.addSubscription(this.touchHandler.deactivate.bind(this.touchHandler))}registerChartYPanHandler(e,t){let r=e.yStart;const s=()=>{this.canvasAnimation.forceStopAnimation(On),this.currentPoint={x:0,y:0},r=e.yStart},i=o=>{const{delta:l}=o;if(this.currentPoint.y=l,e.state.auto)yd(this.currentPoint,e.state.autoScaleDisableOnDrag)&&e.autoScale(!1);else{const c=tt(e.state.inverse?-l:l,e.zoomY);e.moveYStart(r+c)}},a=new fn(t,{onDragTick:i,onDragStart:s},this.canvasInputListener,this.chartPanComponent,{disableChartPanning:!1});return this.addChildEntity(a),a}}const yd=(n,e)=>{if(!e.enabled)return!1;const t=Math.abs(n.y),r=hr(hr(Math.abs(n.x),2)+hr(t,2),.5),s=Math.abs(Math.acos(t/r));return t>e.yDiff&&s<e.edgeAngle};class wd extends te{constructor(e,t,r,s,i,a,o,l){super(),this.eventBus=e,this.mainScaleModel=t,this.canvasBoundsContainer=r,this.config=s,this.canvasAnimation=i,this.canvasInputListener=a,this.mainCanvasParent=o,this.chartBaseModel=l,this.chartPanComponents=[],this.chartAreaPanHandler=new Cd(this.eventBus,this.config,this.mainScaleModel,this.mainCanvasParent,this.canvasInputListener,this.canvasBoundsContainer,this.canvasAnimation,this),this.chartPanComponents.push(this.chartAreaPanHandler)}doActivate(){this.activateChartPanHandlers()}doDeactivate(){this.deactivatePanHandlers()}activateChartPanHandlers(){this.chartPanComponents.forEach(e=>e.activate())}deactivatePanHandlers(){this.chartPanComponents.forEach(e=>e.deactivate())}}const Xi=n=>e=>{const{top:t,bottom:r}=n(),s=e.high-e.low,i=s===0?1:s,a=i*t/100,o=i*r/100,l=e.low-o,c=e.high+a;return{low:l,high:c}},ji=(n,e)=>{const t=Xi(n);return{isHighLowActive:()=>!0,calculateHighLow:r=>{const s=e.calculateHighLow(r);return t(s)}}};function Sd(){return Fr(1)}function Vi(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];return Sd()(qt(n,Kt(n)))}function xd(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];var t=Kt(n);return w(function(r,s){(t?Vi(n,r,t):Vi(n,r)).subscribe(s)})}function Md(n){return he(function(e,t){return n<=t})}class Pd{constructor(e,t,r,s,i){this.config=e,this.boundsProvider=t,this.canvasModel=r,this.canvasAnimation=s,this.animationId=i}draw(){if(this.config.components.paneResizer.visible){const e=this.config.components.paneResizer.fixedMode,t=this.boundsProvider(),r=this.canvasModel.ctx,s=this.canvasAnimation.getColorAlphaAnimation(this.animationId),i=this.config.components.paneResizer.dragZone;!e&&s&&(r.fillStyle=s.getColor(0),r.fillRect(t.x,t.y-i,t.width,t.height+2*i)),r.fillStyle=this.config.colors.paneResizer.lineColor,this.config.animation.paneResizer.bgMode?r.fillRect(t.x,t.y,t.width,t.height):r.fillRect(t.x,t.y-i,t.width,t.height+2*i)}}getCanvasIds(){return[this.canvasModel.canvasId]}}class Td extends te{constructor(e,t,r,s,i,a,o,l,c,h,v){super(),this.id=e,this.boundsProvider=t,this.hitTest=r,this.dragTickCb=s,this.chartPanComponent=i,this.canvasModel=a,this.drawingManager=o,this.canvasInputListener=l,this.canvasAnimation=c,this.config=h,this.canvasBoundsContainer=v,this.initialY=0,this.resizeEvent$=new G,this.onYDragStart=()=>{this.config.components.crossTool.type="none",this.initialY=this.boundsProvider().y},this.onYDragEnd=()=>{this.config.components.crossTool.type="cross-and-labels",this.initialY=this.boundsProvider().y,this.canvasBoundsContainer.graphsHeightRatioChangedSubject.next(this.canvasBoundsContainer.graphsHeightRatio)},this.onYDragTick=p=>{const{delta:y,draggedPixels:E}=p;Math.abs(this.initialY-this.boundsProvider().y+E)>=0&&(this.dragTickCb(y),this.resizeEvent$.next())},this.animationId=`${this.id}_RESIZER`}doActivate(){if(super.doActivate(),!this.config.components.paneResizer.fixedMode){const r=new fn(this.hitTest,{onDragTick:this.onYDragTick,onDragStart:this.onYDragStart,onDragEnd:this.onYDragEnd},this.canvasInputListener,this.chartPanComponent);this.addChildEntity(r),this.config.animation.paneResizer.enabled&&this.addRxSubscription(this.canvasInputListener.observeMouseEnter(this.hitTest,!0).pipe(xd(!1),Ve(),Md(1)).subscribe(s=>{s?this.handleHoverAnimation("appearing"):this.handleHoverAnimation("fading")}))}const t=new Pd(this.config,this.boundsProvider,this.canvasModel,this.canvasAnimation,this.animationId);this.drawingManager.addDrawer(t,ui.paneResizer(this.id)),this.addSubscription(()=>this.drawingManager.removeDrawerByName(ui.paneResizer(this.id)))}doDeactivate(){super.doDeactivate(),this.resizeEvent$.complete()}handleHoverAnimation(e){let t;this.config.animation.paneResizer.bgMode?(t=this.canvasAnimation.getColorAlphaAnimation(this.animationId),(!t||!t.animationInProgress)&&this.canvasAnimation.startColorAlphaAnimation(this.animationId,[{color:this.config.colors.paneResizer.bgHoverColor,type:e}])):(t=this.canvasAnimation.getColorTransitionAnimation(this.animationId),(!t||!t.animationInProgress)&&this.canvasAnimation.startColorTransitionAnimation(this.animationId,[{startColor:this.config.colors.paneResizer.bgColor,endColor:this.config.colors.paneResizer.bgHoverColor,type:e}],this.config.animation.paneResizer.duration)),t&&t.animationInProgress&&t.revert()}}const _d=n=>e=>{let t;if(typeof e=="number")t=e;else if(typeof e=="string")t=Number(e);else return"\u2014";const[r]=n.dataSeries;if(r!==void 0){const s=ze.getPricePrecision(t,r.pricePrecisions);return t.toFixed(s)}return`${t}`},Ad=n=>(e,t)=>{const[r]=n.dataSeries;let s=e;const i=t!=null?t:r;i!==void 0&&(s=Ds(e,i.getBaseLine()));const a=s.toFixed(ze.DEFAULT_PRECISION).replace("-","\u2212")+" %";return a==="\u22120.00 %"?"0.00 %":a},Dd=n=>({percent:Ad(n),regular:_d(n)});class Ed extends te{constructor(e,t,r,s,i,a,o,l,c,h,v=new Set,p={regular:qn}){if(super(),this.paneUuid=e,this.idx=t,this.paneComponent=r,this.chartBaseModel=s,this.canvasBoundsContainer=i,this.hitTestController=a,this.dataSeriesCanvasModel=o,this.scaleModel=l,this.yAxisComponent=c,this.dragNDrop=h,this.dataSeries=v,this.formatters=p,this.getYAxisBounds=()=>this.canvasBoundsContainer.getBounds(Y.PANE_UUID_Y_AXIS(this.paneUuid,this.idx)),this.yAxisHT=this.canvasBoundsContainer.getBoundsHitTest(Y.PANE_UUID_Y_AXIS(this.paneUuid,this.idx)),this.toVisualPoints=y=>y.map(E=>new Ut(this.chartBaseModel.dataFromTimestamp(E.timestamp).centerUnit,E.close)),this.valueFormatter=(y,E)=>{var R;return((R=this.formatters[this.getAxisType()])!=null?R:this.formatters.regular)(y,E)},this.addChildEntity(l),c!==void 0){this.addChildEntity(c.yAxisScaleHandler),this.addSubscription(c.unsub);const y={getLargestLabel:()=>{var E;return(E=c.labelsGenerator.getLargestLabel())!=null?E:""},getYAxisIndex:()=>t,getYAxisAlign:()=>c.state.align,getPaneUUID:()=>r.uuid};this.canvasBoundsContainer.yAxisBoundsContainer.registerYAxisWidthContributor(y),this.addSubscription(()=>this.canvasBoundsContainer.yAxisBoundsContainer.removeYAxisWidthContributor(y))}this.setValueFormatters(Dd(this))}doDeactivate(){super.doDeactivate(),this.dataSeries.forEach(e=>e.deactivate())}getBounds(){return this.scaleModel.getBounds()}createDataSeries(){const e=new Rs(this,this.hitTestController.getNewDataSeriesHitTestId());return e.toVisualPoints=this.toVisualPoints,e}addDataSeries(e){this.dataSeries.add(e),this.dataSeries.size===1&&(this.mainDataSeries=e),this.paneComponent.updateView()}removeDataSeries(e){this.dataSeries.delete(e),this.paneComponent.updateView()}getAxisType(){return"regular"}get regularFormatter(){return this.formatters.regular}setValueFormatters(e){this.formatters=e}regularValueFromY(e){var t,r;return(r=(t=this.mainDataSeries)==null?void 0:t.view.priceFromY(e))!=null?r:this.scaleModel.fromY(e)}}const Gi=n=>({isHighLowActive:()=>!0,calculateHighLow:e=>{const t=Array.from(n.dataSeries).filter(r=>r.highLowProvider.isHighLowActive()).map(r=>r.highLowProvider.calculateHighLow(e));return Vs(t)}});class Ld{constructor(e,t){this.paneComponents=e,this.canvasModel=t,this.dataSeriesIdCounter=lr.DATA_SERIES[0],this.getNewDataSeriesHitTestId=()=>this.dataSeriesIdCounter++}getIdRange(){return lr.DATA_SERIES}get allDataSeries(){return Ft(Ft(Object.values(this.paneComponents),e=>e.yExtentComponents),e=>Array.from(e.dataSeries))}lookup(e){return this.allDataSeries.find(r=>r.id===e)}onHover(e){this.allDataSeries.forEach(t=>t.hovered=t.id===(e==null?void 0:e.id)),this.canvasModel.fireDraw()}onMouseDown(e){e&&this.handleYExtentDragStart(e)}onMouseUp(){this.handleYExtentDragEnd()}handleYExtentDragStart(e){Object.values(this.paneComponents).forEach(t=>t.yExtentComponents.forEach(r=>r.dragNDrop.deactivate())),e.extentComponent.dragNDrop.activate()}handleYExtentDragEnd(){Object.values(this.paneComponents).forEach(e=>e.yExtentComponents.forEach(t=>t.dragNDrop.activate()))}}class Id{constructor(e,t=()=>!0){this.dataProvider=e,this.dataUpdatedPredicate=t,this.calculatedInThisFrame=!1,this.animFrameId=`anim_cache_${Je()}`}calculateOrGet(){var e;return this.calculatedInThisFrame||(this.cache=this.dataProvider(),this.dataUpdatedPredicate()&&(this.calculatedInThisFrame=!0),di(this.animFrameId,()=>{this.calculatedInThisFrame=!1})),(e=this.cache)!=null?e:this.dataProvider()}forceCalculateOrGet(){return this.invalidate(),this.calculateOrGet()}getLastCachedValue(){return this.cache}updateCacheValue(e){this.cache=e}invalidate(){this.cache=void 0,this.calculatedInThisFrame=!1}}const Od=0,Bd=.01;class dr{constructor(e,t,r,s,i=!1,a,o,l=Bn,c=23){this.increment=e,this.startEndProvider=t,this.lengthProvider=r,this.valueFormatter=s,this.withZero=i,this.axisTypeProvider=a,this.baseLineProvider=o,this.labelFilter=l,this.singleLabelHeightPixels=c,this.gridDistanceMultipliers=[2,4,5,10],this.lastSingleLabelHeightValue=0,this.distanceBetweenLabelsChangeSubject=new G,this.newGeneratedLabelsSubject=new G,this.lastStart=0,this.lastEnd=0,this.labelsCache=new Id(()=>this.labelFilter(this.doGenerateLabels()))}generateRegularLabels(e,t,r){const s=[];this.withZero&&s.push({value:0,text:"0"});let i=we.roundToNearest(e,r);for(;i<t;){const a=we.roundToNearest(i,r),o=this.valueFormatter(a);s.push({value:a,text:o}),i=we.roundDecimal(i+r)}return s}generatePercentLabels(e,t,r){const s=[],i=this.baseLineProvider();let a=we.roundToNearest(e,r);for(;a<t;){const o=we.roundToNearest(a,r),l=Es(o,i),c=this.valueFormatter(l);s.push({value:o,text:c}),a=we.roundDecimal(a+r)}return s}generateLogarithmLabels(e,t,r){const s=[];let i=we.roundToNearest(e,r);for(;i<t;){const a=Kn(i),o=this.valueFormatter(a);s.push({value:i,text:o}),i=we.roundDecimal(i+r)}return s}doGenerateLabels(){var e;const t=this.lengthProvider();if(t<=0)return[];const[r,s]=this.calculateMinMax(),i=this.getAxisStep(r,s,t);this.lastSingleLabelHeightValue||(this.lastSingleLabelHeightValue=i);let a;const o=this.axisTypeProvider();if(o==="logarithmic"?a=this.generateLogarithmLabels(r,s,i):o==="percent"?a=this.generatePercentLabels(r,s,i):a=this.generateRegularLabels(r,s,i),this.lastSingleLabelHeightValue!==i&&this.labelsCache.cache){const l=(e=this.labelsCache.getLastCachedValue())!=null?e:[];this.distanceBetweenLabelsChangeSubject.next([l,a]),this.lastSingleLabelHeightValue=i}return this.newGeneratedLabelsSubject.next(a),a}calculateMinMax(){const[e,t]=this.startEndProvider(),r=this.lengthProvider(),s=dr.getLabelBounds(e,t,r);return[s[0],s[1]]}getAxisStep(e,t,r){const s=t-e,i=r/this.singleLabelHeightPixels,a=this.calculateIncrement(s),o=s/i;return this.calculateAxisStep(o,a)}observeDistanceBetweenLabelsChanged(){return this.distanceBetweenLabelsChangeSubject.asObservable()}observeLabelsChanged(){return this.newGeneratedLabelsSubject.asObservable()}calculateIncrement(e){if(this.increment)return this.increment;if(!isNaN(e)){const t=ze.autoDetectIncrementOfValueRange(e);return this.adjustIncrementOnAxisType(t)}return this.adjustIncrementOnAxisType(Bd)}adjustIncrementOnAxisType(e){switch(this.axisTypeProvider()){case"percent":return e;case"logarithmic":const[t]=this.calculateMinMax(),s=Kn(t)+e;return Ls(s)-t;case"regular":return e}}generateNumericLabels(){const[e,t]=this.startEndProvider();return(e!==this.lastStart||t!==this.lastEnd)&&this.labelsCache.invalidate(),this.lastStart=e,this.lastEnd=t,this.labelsCache.calculateOrGet()}static getLabelBounds(e,t,r){const s=Math.abs((t-e)*(Od/r));return[e-s,t+s]}calculateAxisStep(e,t){if(t===0)return console.error("NumericAxisLabelsGenerator failed at calculateAxisStep: increment = 0"),0;let r=t,s=t,i=0;for(;r<e&&r>0;)i>=this.gridDistanceMultipliers.length&&(i=0,s*=10),r=s*this.gridDistanceMultipliers[i++];return r}}class $i extends dr{constructor(e,t,r,s,i=()=>"regular",a=()=>1,o=23){super(e,()=>[r.yStart,r.yEnd],()=>r.getBounds().height,s,!1,i,a,void 0,o),this.chartModel=t}getLargestLabel(){var e;return((e=this.labelsCache.getLastCachedValue())!=null?e:[]).reduce((t,r)=>r.text.length>t.length?r.text:t,"")}calculateIncrement(e){var t;const r=(t=this.chartModel)==null?void 0:t.mainCandleSeries.instrument;if(this.chartModel&&r&&Array.isArray(r.priceIncrements)){const s=Ue(this.chartModel.getCandles()),i=s&&s.close?s.close:0,a=ze.getPriceIncrement(i,r.priceIncrements);return this.adjustIncrementOnAxisType(a)}return super.calculateIncrement(e)}}const Zi=10;class Ki extends te{constructor(e,t,r,s,i,a,o,l){if(super(),this.bus=e,this.viewportModel=s,this.canvasBoundsContainer=a,this.autoScaleCallback=l,this.yAxisDragEndSubject=new G,this.lastYStart=0,this.lastYEnd=0,this.lastYHeight=0,this.lastYPxHeight=0,this.onYDragStart=()=>{this.lastYStart=this.viewportModel.yStart,this.lastYEnd=this.viewportModel.yEnd,this.lastYHeight=this.viewportModel.yEnd-this.viewportModel.yStart,this.lastYPxHeight=this.canvasBoundsContainer.getBounds(Y.Y_AXIS).height},this.onYDragTick=c=>{const{delta:h}=c;let v;h<0?v=1/(1+-h/this.lastYPxHeight*(Zi-1)):v=1+h/this.lastYPxHeight*(Zi-1);const y=(this.lastYHeight*v-this.lastYHeight)/2,E=this.lastYStart-y,R=this.lastYEnd+y;this.autoScaleCallback(!1),this.viewportModel.setYScale(E,R),this.bus.fireDraw()},this.onYDragEnd=()=>{this.yAxisDragEndSubject.next()},t.customScale){const c=()=>t.type!=="percent",h=new fn(o,{onDragTick:ur(this.onYDragTick,c),onDragStart:ur(this.onYDragStart,c),onDragEnd:ur(this.onYDragEnd,c)},i,r,{disableChartPanning:!1});this.addChildEntity(h),t.customScaleDblClick&&i.observeDbClick(o).subscribe(()=>{l(!0),this.bus.fireDraw()})}}}const ur=(n,e)=>(...t)=>e()&&n(...t);class qi{constructor(e,t,r,s,i,a=()=>!0,o){this.fullConfig=e,this.yAxisState=t,this.canvasModel=r,this.labelsProvider=s,this.axisBounds=i,this.drawPredicate=a,this.toY=o}draw(){if(this.drawPredicate()){const e=this.labelsProvider(),t=this.axisBounds(),r=this.canvasModel.ctx;r.fillStyle=this.getBackgroundColor(),r.fillRect(t.x,t.y,t.width,t.height);const s=mt(this.yAxisState),i=Qe(s,r),a=this.getLabelTextColor();r.save(),yt(r,t),this.drawLabels(r,e,t,i,s,a),r.restore()}}drawLabels(e,t,r,s,i,a){e.fillStyle=a,e.font=i;const o=e.measureText("00.0"),l=o.actualBoundingBoxAscent+o.actualBoundingBoxDescent,c=r.y+l,h=r.y+r.height-l;t.forEach(v=>{const p=this.toY(v.value);p>c&&p<h&&Rd(e,r,v.text,p,s,i,this.yAxisState.labelBoxMargin.end,this.yAxisState.align)})}getCanvasIds(){return[this.canvasModel.canvasId]}getBackgroundColor(){return this.fullConfig.colors.yAxis.backgroundColor}getLabelTextColor(){return this.fullConfig.colors.yAxis.labelTextColor}}const Rd=(n,e,t,r,s,i,a,o)=>{const l=o==="right"?e.x+e.width-Re(t,n,i)-a:e.x+a;n.fillText(t,l,r+s/2-1)};function fr(n,e,t){var r=L(n)||e||t?{next:n,error:e,complete:t}:n;return r?w(function(s,i){var a;(a=r.subscribe)===null||a===void 0||a.call(r);var o=!0;s.subscribe(We(i,function(l){var c;(c=r.next)===null||c===void 0||c.call(r,l),i.next(l)},function(){var l;o=!1,(l=r.complete)===null||l===void 0||l.call(r),i.complete()},function(l){var c;o=!1,(c=r.error)===null||c===void 0||c.call(r,l),i.error(l)},function(){var l,c;o&&((l=r.unsubscribe)===null||l===void 0||l.call(r)),(c=r.finalize)===null||c===void 0||c.call(r)}))}):Pt}class Ji extends te{constructor(e,t,r){super(),this.scaleModel=e,this.yAxisLabelsGenerator=t,this.canvasBoundsContainer=r,this.labels=[],this.prevYAxisHeight=0,this.animFrameId=`anim_cache_${Je()}`}doActivate(){super.doActivate(),this.addRxSubscription(Me(this.scaleModel.yChanged,this.canvasBoundsContainer.observeBoundsChanged(Y.Y_AXIS).pipe(ye(e=>e.height),he(e=>ao(e,this.prevYAxisHeight,1.5)),fr(e=>{this.yAxisLabelsGenerator.labelsCache.invalidate(),this.prevYAxisHeight=e}))).subscribe(()=>this.updateLabels()))}updateLabels(){this.labels=this.yAxisLabelsGenerator.generateNumericLabels(),sr(this.animFrameId,()=>this.canvasBoundsContainer.updateYAxisWidths())}}class Fd extends te{constructor(e,t,r,s,i,a,o,l,c,h,v,p,y,E,R,N){super(),this.chartBaseModel=e,this.hitTestController=t,this.config=r,this.mainScaleModel=s,this.drawingManager=i,this.chartPanComponent=a,this.mainCanvasModel=o,this.canvasInputListener=l,this.userInputListenerComponents=c,this.canvasAnimation=h,this.cursorHandler=v,this.eventBus=p,this.canvasBoundsContainer=y,this.uuid=E,this.dataSeriesCanvasModel=R,this._paneOrder=0,this.yExtentComponents=[],this.getYAxisBounds=()=>this.canvasBoundsContainer.getBounds(Y.PANE_UUID_Y_AXIS(this.uuid)),this.valueFormatter=(U,Z)=>this.mainYExtentComponent.valueFormatter(U,Z);const k=this.createExtentComponent(N);this.mainYExtentComponent=k,this.ht=this.canvasBoundsContainer.getBoundsHitTest(Y.PANE_UUID(E),{extensionY:-this.config.components.paneResizer.dragZone})}get scaleModel(){return this.mainYExtentComponent.scaleModel}get dataSeries(){return this.yExtentComponents.flatMap(e=>Array.from(e.dataSeries))}doActivate(){super.doActivate(),this.addRxSubscription(this.canvasBoundsContainer.observeBoundsChanged(Y.PANE_UUID(this.uuid)).pipe(Ve(ms)).subscribe(()=>{this.yExtentComponents.forEach(e=>e.scaleModel.recalculateZoomY()),this.dataSeriesCanvasModel.fireDraw()}))}createYAxisComponent(e,t,r,s,i){const a=Wt(this.config.components.yAxis),o=new $i(i,void 0,r,s,()=>"regular",()=>1,a.labelHeight),l=Y.PANE_UUID_Y_AXIS(e,t),c=new qi(this.config,a,this.mainCanvasModel,()=>o.generateNumericLabels(),()=>this.canvasBoundsContainer.getBounds(l),()=>this.config.components.yAxis.visible,r.toY.bind(r));this.drawingManager.addDrawerAfter(c,l,"Y_AXIS"),a.type="regular";const h=new Ki(this.eventBus,a,this.chartPanComponent,r,this.canvasInputListener,this.canvasBoundsContainer,this.canvasBoundsContainer.getBoundsHitTest(l),p=>r.autoScale(p)),v=new Ji(r,o,this.canvasBoundsContainer);return v.activate(),this.userInputListenerComponents.push(h),{labelsGenerator:o,drawer:c,yAxisScaleHandler:h,state:this.config.components.yAxis,unsub:()=>{this.drawingManager.removeDrawerByName(l),v.disable()}}}createGridComponent(e,t,r){return new Ri(this.mainCanvasModel,t,this.config,`PANE_${e}_grid_drawer`,this.drawingManager,()=>this.canvasBoundsContainer.getBounds(Y.PANE_UUID(e)),()=>this.canvasBoundsContainer.getBounds(Y.PANE_UUID(e)),()=>[],()=>r.generateNumericLabels())}createYPanHandler(e,t){const r=this.chartPanComponent.chartAreaPanHandler.registerChartYPanHandler(t,this.canvasBoundsContainer.getBoundsHitTest(Y.PANE_UUID(e)));return[()=>{this.chartPanComponent.chartAreaPanHandler.removeChildEntity(r),r.disable()},r]}addCursors(e){const t=Y.PANE_UUID_Y_AXIS(this.uuid,e);return this.cursorHandler.setCursorForCanvasEl(t,this.config.components.yAxis.cursor),()=>this.cursorHandler.removeCursorForCanvasEl(t)}createExtentComponent(e){var t,r,s,i,a,o;const l=this.yExtentComponents.length,c=()=>this.canvasBoundsContainer.getBounds(Y.PANE_UUID(this.uuid)),h=(t=e==null?void 0:e.scaleModel)!=null?t:new bc(this.mainScaleModel,this.config,c,this.canvasAnimation),v=(r=e==null?void 0:e.useDefaultYAxis)==null||r?this.createYAxisComponent(this.uuid,l,h,(i=(s=e==null?void 0:e.paneFormatters)==null?void 0:s.regular)!=null?i:qn,(a=e==null?void 0:e.increment)!=null?a:null):void 0,[p,y]=this.createYPanHandler(this.uuid,h),E=new Ed(this.uuid,l,this,this.chartBaseModel,this.canvasBoundsContainer,this.hitTestController,this.dataSeriesCanvasModel,h,v,y);if(E.addSubscription(p),E.addSubscription(this.addCursors(l)),e!=null&&e.paneFormatters&&E.setValueFormatters(e.paneFormatters),((o=e==null?void 0:e.useDefaultHighLow)!=null?o:!0)&&h.autoScaleModel.setHighLowProvider("default",ji(()=>({top:10,bottom:10,left:0,right:0,visible:!0}),Gi(E))),v){const N=this.createGridComponent(this.uuid,h,v.labelsGenerator);E.addChildEntity(N)}return E.activate(),this.yExtentComponents.push(E),this.canvasBoundsContainer.updateYAxisWidths(),E}removeExtentComponent(e){e.disable(),this.yExtentComponents.splice(e.idx,1),this.yExtentComponents.forEach((t,r)=>t.idx=r),this.canvasBoundsContainer.updateYAxisWidths()}updateView(){this.yExtentComponents.forEach(e=>{var t;e.scaleModel.doAutoScale(),(t=e.yAxisComponent)==null||t.labelsGenerator.generateNumericLabels()}),this.canvasBoundsContainer.updateYAxisWidths(),this.eventBus.fireDraw()}mergeYExtents(){for(let e=1;e<this.yExtentComponents.length;e++){const t=this.yExtentComponents[e];t.dataSeries.forEach(r=>r.moveToExtent(this.mainYExtentComponent)),t.disable()}this.canvasBoundsContainer.updateYAxisWidths(),this.yExtentComponents=[this.mainYExtentComponent]}getBounds(){return this.mainYExtentComponent.getBounds()}hide(){this._paneOrder=this.canvasBoundsContainer.panesOrder.indexOf(this.uuid),this.canvasBoundsContainer.removedPaneBounds(this.uuid),this.eventBus.fireDraw()}show(){this.canvasBoundsContainer.addPaneBounds(this.uuid,this._paneOrder),this.eventBus.fireDraw()}createDataSeries(){var e;return(e=this.mainYExtentComponent)==null?void 0:e.createDataSeries()}addDataSeries(e){this.mainYExtentComponent.addDataSeries(e),this.updateView()}removeDataSeries(e){this.mainYExtentComponent.removeDataSeries(e),this.updateView()}getAxisType(){return"regular"}moveUp(){this.canvasBoundsContainer.movePaneUp(this.uuid)}moveDown(){this.canvasBoundsContainer.movePaneDown(this.uuid)}canMoveUp(){const e=Yt(this.canvasBoundsContainer.panesOrder);return this.uuid!==e}canMoveDown(){const e=Ue(this.canvasBoundsContainer.panesOrder);return this.uuid!==e}get regularFormatter(){return this.mainYExtentComponent.formatters.regular}setPaneValueFormatters(e){this.mainYExtentComponent.setValueFormatters(e)}regularValueFromY(e){return this.mainYExtentComponent.regularValueFromY(e)}}class Yd extends te{constructor(e,t,r,s,i,a,o,l,c,h,v,p,y,E){super(),this.chartBaseModel=e,this.userInputListenerComponents=t,this.eventBus=r,this.mainScaleModel=s,this.canvasBoundsContainer=i,this.config=a,this.canvasAnimation=o,this.canvasInputListener=l,this.drawingManager=c,this.dataSeriesCanvasModel=h,this.cursorHandler=v,this.crossEventProducer=p,this.chartPanComponent=y,this.mainCanvasModel=E,this.paneComponents={},this.panesChangedSubject=new G,this.hitTestController=new Ld(this.paneComponents,this.dataSeriesCanvasModel);const R=this.createPane(ae,{useDefaultHighLow:!1,scaleModel:this.mainScaleModel,useDefaultYAxis:!1});R.mainYExtentComponent.scaleModel.autoScaleModel.setHighLowProvider("series",Gi(R.mainYExtentComponent)),s.autoScaleModel.setHighLowPostProcessor("offsets",Xi(()=>this.mainScaleModel.getOffsets()))}get panesOrder(){return this.canvasBoundsContainer.panesOrder}addBounds(e,t){return this.canvasBoundsContainer.addPaneBounds(e,t),()=>this.canvasBoundsContainer.removedPaneBounds(e)}addResizer(e){const t=this.canvasBoundsContainer.getBoundsHitTest(Y.PANE_UUID_RESIZER(e),{extensionY:this.config.components.paneResizer.dragZone}),r=()=>{this.canvasBoundsContainer.resizePaneVertically(e,this.canvasInputListener.getCurrentPoint().y),this.eventBus.fireDraw([this.mainCanvasModel.canvasId,"overDataSeriesCanvas"])},s=Y.PANE_UUID_RESIZER(e),i=new Td(s,()=>this.canvasBoundsContainer.getBounds(s),t,r,this.chartPanComponent,this.mainCanvasModel,this.drawingManager,this.canvasInputListener,this.canvasAnimation,this.config,this.canvasBoundsContainer);return this.userInputListenerComponents.push(i),i}getPaneIfHit(e){return Object.values(this.paneComponents).find(r=>this.canvasBoundsContainer.getBoundsHitTest(Y.PANE_UUID(r.uuid))(e.x,e.y))}createPane(e=Je(),t){if(this.paneComponents[e]!==void 0)return this.paneComponents[e];const r=new Fd(this.chartBaseModel,this.hitTestController,this.config,this.mainScaleModel,this.drawingManager,this.chartPanComponent,this.mainCanvasModel,this.canvasInputListener,this.userInputListenerComponents,this.canvasAnimation,this.cursorHandler,this.eventBus,this.canvasBoundsContainer,e,this.dataSeriesCanvasModel,t);return this.config.components.paneResizer.visible&&r.addChildEntity(this.addResizer(e)),r.addSubscription(this.addBounds(e,t==null?void 0:t.order)),r.addSubscription(this.addCursors(e)),r.addSubscription(this.crossEventProducer.subscribeMouseOverHT(e,r.ht)),this.paneComponents[e]=r,r.activate(),this.recalculateState(),r.mainYExtentComponent.scaleModel.autoScale(!0),this.panesChangedSubject.next(this.paneComponents),r}removePane(e){const t=this.paneComponents[e];t!==void 0&&(t.disable(),t.yExtentComponents.forEach(r=>r.disable()),delete this.paneComponents[e],this.recalculateState(),this.panesChangedSubject.next(this.paneComponents))}addCursors(e,t=this.config.components.chart.cursor){const r=Y.PANE_UUID(e),s=Y.PANE_UUID_RESIZER(e);return this.cursorHandler.setCursorForCanvasEl(r,t),this.config.components.paneResizer.visible&&this.cursorHandler.setCursorForCanvasEl(s,this.config.components.paneResizer.cursor,this.config.components.paneResizer.dragZone),()=>{this.cursorHandler.removeCursorForCanvasEl(r),this.config.components.paneResizer.visible&&this.cursorHandler.removeCursorForCanvasEl(s)}}recalculateState(){Object.values(this.paneComponents).forEach(e=>e.scaleModel.recalculateZoomY()),this.eventBus.fireDraw([this.mainCanvasModel.canvasId,"overDataSeriesCanvas"])}}class Hd extends te{constructor(e,t){super(),this.elements=e,this.canvasModel=t}doActivate(){super.doActivate()}createSnapshot(e){const t=this.canvasModel.canvas,r=this.canvasModel.ctx;if(r){r.clearRect(0,0,t.width,t.height);const s=t.width/window.devicePixelRatio,i=t.height/window.devicePixelRatio;return r.drawImage(this.elements.backgroundCanvas,0,0,s,i),r.drawImage(this.elements.mainCanvas,0,0,s,i),r.drawImage(this.elements.staticDrawingCanvas,0,0,s,i),r.drawImage(this.elements.dataSeriesCanvas,0,0,s,i),r.drawImage(this.elements.overDataSeriesCanvas,0,0,s,i),r.drawImage(this.elements.dynamicDrawingCanvas,0,0,s,i),r.drawImage(this.elements.crossToolCanvas,0,0,s,i),e&&e(r),new Promise((a,o)=>this.elements.snapshotCanvas.toBlob(l=>l?a(l):o("Blob is null")))}else return console.error("Snapshot isn't supported"),Promise.reject()}}const bn=.3,Nd=(n,e)=>{const t=e.barTheme[`${n}Color`];return Jt()(t).alpha(bn).toString()},kd=(n,e)=>{const t=e.volume[`${n}BarColor`];return Jt()(t).alpha(bn).toString()},Wd=(n,e)=>{const t=e.lineTheme[`${n}Color`];return Jt()(t).alpha(bn).toString()},vr=(n,e)=>{const t=e.candleTheme[`${n}Color`];return Jt()(t).alpha(bn).toString()},Ud=3;class Qi{constructor(e,t,r,s,i,a,o){this.canvasModel=e,this.config=t,this.volumesModel=r,this.chartModel=s,this.viewportModel=i,this.volumesColorByChartTypeMap=a,this.drawPredicate=o,this.volumeBarColors={down:"#FF00FF",up:"#FF00FF",none:"#FF00FF"}}calculateColors(e){var t;const r=(t=this.volumesColorByChartTypeMap[e])!=null?t:kd;this.volumeBarColors.down=r("down",this.config.colors),this.volumeBarColors.up=r("up",this.config.colors),this.volumeBarColors.none=r("none",this.config.colors)}draw(){if(this.config.components.volumes.visible&&this.drawPredicate()){this.calculateColors(this.config.components.chart.type);const e=this.canvasModel.ctx;e.save();const t=this.viewportModel.getBounds();yt(e,t),this.drawVolumes(),e.restore()}}drawLastBar(){this.config.components.volumes.visible}drawVolumes(){const e=this.volumesModel.volumeMax.getValue();if(e===0)return;const t=Ie(this.chartModel.mainCandleSeries.getSeriesInViewport(this.chartModel.scaleModel.xStart-1,this.chartModel.scaleModel.xEnd+1));t.forEach((r,s)=>{if(r.candle.volume){const i=this.viewportModel.getBounds(),a=i.height,o=t[s+1]!==void 0?se(this.viewportModel.toX(t[s+1].startUnit)):void 0,l=se(this.viewportModel.toX(r.startUnit)),c=o!==void 0?o-l:se(Pe(r.width,this.viewportModel.zoomX));if(this.config.components.volumes.showSeparately){const h=se(this.viewportModel.toY(r.candle.volume)),v=se(this.viewportModel.toY(0))-h;this.drawVolume(r,l,h,c,v)}else{const h=e/(a/Ud),v=Math.max(Pe(r.candle.volume,h),2),p=se(i.y+a-v);this.drawVolume(r,l,p,c,v)}}})}drawVolume(e,t,r,s,i){const a=this.canvasModel.ctx,o=r,l=r+i,c=e.name;a.fillStyle=this.volumeBarColors[c],a.strokeStyle=this.volumeBarColors[c],s===0?(a.beginPath(),a.moveTo(t,o),a.lineTo(t,Ms(l)),a.stroke()):a.fillRect(t,r,s,Ms(i))}getCanvasIds(){return[this.canvasModel.canvasId]}}const ea=5,zd=1e-10,Xd=/\.?0+$/,ta=/(\.[1-9]*)0+$/,jd=n=>{const e=(t,r)=>{const s=Math.pow(10,ea),i=Math.round(t*s)/s;return i<1&&i>=zd?i.toFixed(ea).replace(Xd,"").replace(ta,""):(i+"").replace(ta,"")+(r||"")};return Math.abs(n)>999999999?(n=Math.round(n/1e6)*1e6,e(n/1e9,"B")):Math.abs(n)>999999?(n=1e3*Math.round(n/1e3),e(n/1e6,"M")):Math.abs(n)>9999?e(n/1e3,"K"):e(n)},Cn=class extends te{constructor(n,e,t,r,s,i,a){super(),this.canvasModel=n,this.chartComponent=e,this.drawingManager=t,this.config=r,this.volumesModel=s,this.volumesColorByChartTypeMap=i,this.paneManager=a,r.components.volumes.showSeparately&&this.activateSeparateVolumes()}doActivate(){super.doActivate(),this.addRxSubscription(this.chartComponent.chartModel.candlesUpdatedSubject.subscribe(()=>{var n,e;return!((n=this.scaleModel)!=null&&n.isViewportValid())&&((e=this.scaleModel)==null?void 0:e.doAutoScale(!0))})),this.addRxSubscription(this.volumesModel.volumeMax.subscribe(()=>{var n;return(n=this.scaleModel)==null?void 0:n.doAutoScale()}))}activateSeparateVolumes(){if(this.paneManager.paneComponents[Cn.UUID]===void 0){const n=this.paneManager.createPane(Cn.UUID,{paneFormatters:{regular:jd},useDefaultHighLow:!1,increment:1}),{scaleModel:e}=n,t=ji(()=>({top:10,bottom:0,left:0,right:0,visible:!0}),this.volumesModel.highLowProvider);e.autoScaleModel.setHighLowProvider("volumes",t),e.doAutoScale(!0),this.scaleModel=e;const r=new Qi(this.canvasModel,this.config,this.volumesModel,this.chartComponent.chartModel,e,this.volumesColorByChartTypeMap,()=>this.config.components.volumes.showSeparately);this.drawingManager.addDrawer(r,"UNDERLAY_VOLUMES_AREA")}}deactiveSeparateVolumes(){this.paneManager.removePane(Cn.UUID),delete this.scaleModel,this.drawingManager.removeDrawerByName("UNDERLAY_VOLUMES_AREA")}fromY(n){var e,t;return(t=(e=this.scaleModel)==null?void 0:e.fromY(n))!=null?t:0}};let na=Cn;na.UUID="volumes";const Vd=Eo(n=>n.candle.volume);class Gd extends te{constructor(e,t){super(),this.chartComponent=e,this.scaleModel=t,this.volumeMax=new pt(0),this.highLowProvider={calculateHighLow:()=>({high:this.volumeMax.getValue(),low:0}),isHighLowActive:()=>!0}}doActivate(){super.doActivate(),this.addRxSubscription(Me(this.chartComponent.chartModel.observeCandlesChanged(),this.scaleModel.xChanged).subscribe(()=>this.updateVolumeMax())),this.addRxSubscription(this.chartComponent.chartModel.mainCandleSeries.observeLastVisualCandleChanged().subscribe(()=>this.recalculateLastVisualVolume()))}recalculateLastVisualVolume(){}updateVolumeMax(){var e;this.volumeMax.next((e=Yt(Vd(this.chartComponent.chartModel.mainCandleSeries.getSeriesInViewport().flat())))!=null?e:0)}}class $d extends te{constructor(e,t,r,s,i,a,o,l){super(),this.canvasModel=e,this.canvasBoundsContainer=s,this.config=a,this.volumesColorByChartTypeMap={},this.volumeSettingChangedSubject=new pt(!1);const c=new Gd(t,r);this.volumesModel=c,this.yAxisComponent=l,this.addChildEntity(c),this.separateVolumes=new na(e,t,i,a,c,this.volumesColorByChartTypeMap,o),this.addChildEntity(this.separateVolumes);const h=new Qi(e,a,c,t.chartModel,r,this.volumesColorByChartTypeMap,()=>!a.components.volumes.showSeparately);i.addDrawer(h,"VOLUMES"),this.registerDefaultVolumeColorResolvers(),this.volumeSettingChangedSubject.next(a.components.volumes.visible)}registerDefaultVolumeColorResolvers(){this.registerVolumeColorResolver("candle",vr),this.registerVolumeColorResolver("trend",vr),this.registerVolumeColorResolver("hollow",vr),this.registerVolumeColorResolver("line",Wd),this.registerVolumeColorResolver("bar",Nd)}setShowVolumesSeparatly(e){this.config.components.volumes.showSeparately!==e&&(this.config.components.volumes.showSeparately=e,e?this.separateVolumes.activateSeparateVolumes():this.separateVolumes.deactiveSeparateVolumes())}doDeactivate(){super.doDeactivate(),this.setVisible(!1)}registerVolumeColorResolver(e,t){this.volumesColorByChartTypeMap[e]=t}setVisible(e=!0){this.config.components.volumes.visible=e,this.volumeSettingChangedSubject.next(e),this.config.components.volumes.showSeparately===!0&&(e?this.separateVolumes.activateSeparateVolumes():this.separateVolumes.deactiveSeparateVolumes()),this.canvasBoundsContainer.recalculatePanesHeightRatios(),this.canvasModel.fireDraw()}}class Zd{constructor(e,t,r,s,i){this.config=e,this.canvasBoundsContainer=t,this.canvasModel=r,this.waterMarkConfigProvider=s,this.watermarkDataProvider=i,this.getConfig=(a=0,o,l,c,h,v)=>{const p=this.canvasModel.ctx,y=this.canvasBoundsContainer.getBounds(Y.PANE_UUID(ae)),{position:E,offsetY:R,offsetX:N}=this.config.components.waterMark;let k;switch(v?k=v:(p.font=yn(this.config,l),k=p.measureText(o).width,y.width-10<k&&(p.font=Kd(this.config,this.canvasBoundsContainer,l,k),k=p.measureText(o).width)),E){case"left-top":return{x:N+y.x,y:R+a+y.y,font:p.font,text:o,color:c};case"left-bottom":return{x:N+y.x,y:y.height-h-R+a+y.y,font:p.font,text:o,color:c};case"center":return{x:y.width/2-k/2+y.x,y:(y.height-h)/2+a+y.y,font:p.font,text:o,color:c}}}}draw(){var e,t,r,s,i,a,o;if((e=this.config.components.waterMark)!=null&&e.visible&&this.config.colors){const{firstRow:l,secondRow:c,thirdRow:h}=this.watermarkDataProvider(),v=this.waterMarkConfigProvider(),p=this.config.colors.waterMarkTheme,y=this.canvasModel.ctx;let E=0,R=0,N=0,k=0,U=0;if(y.save(),v.firstRowFontSize&&l){y.font=yn(this.config,v.firstRowFontSize);const $=y.measureText(l);E=$.actualBoundingBoxAscent+$.actualBoundingBoxDescent}if(v.secondRowFontSize&&c){y.font=yn(this.config,v.secondRowFontSize);const $=y.measureText(c);R=$.actualBoundingBoxAscent+$.actualBoundingBoxDescent,N=(t=v.firstRowBottomPadding)!=null?t:0}if(v.thirdRowFontSize&&h){y.font=yn(this.config,v.thirdRowFontSize);const $=y.measureText(h);k=$.actualBoundingBoxAscent+$.actualBoundingBoxDescent,U=(r=v.secondRowBottomPadding)!=null?r:0}const Z=(s=v.thirdRowBottomPadding)!=null?s:0,K=(i=v.logoHeight)!=null?i:0,q=E+R+N+k+U+Z+K;if(l&&this.drawWaterMark(this.getConfig(E,l,v.firstRowFontSize,p.firstRowColor,q)),c&&this.drawWaterMark(this.getConfig(E+N+R,c,v.secondRowFontSize,p.secondRowColor,q)),h&&this.drawWaterMark(this.getConfig(E+N+R+U+k,h,v.thirdRowFontSize,p.thirdRowColor,q)),this.logoImage){const $=this.getConfig(E+N+R+U+k+Z,"",v.thirdRowFontSize,p.thirdRowColor,q,v.logoWidth);this.canvasModel.ctx.drawImage(this.logoImage,$.x,$.y,(a=v.logoWidth)!=null?a:0,(o=v.logoHeight)!=null?o:0)}y.restore()}}getCanvasIds(){return[this.canvasModel.canvasId]}setLogoImage(e){this.logoImage=e}drawWaterMark(e){const t=e.text;if(!t||!t.length)return;const r=this.canvasModel.ctx;r.font=e.font,r.fillStyle=e.color;const s=e.x,i=e.y;r.fillText(t,s,i)}reset(){}}const Kd=(n,e,t,r)=>{const i=((o,l)=>e.getBounds(Y.CHART).width/l*o)(t,r);let a;return n.components&&n.components.waterMark&&(a=n.components.waterMark.fontFamily),i+"px "+a},yn=(n,e)=>{let t;return n.components&&n.components.waterMark&&(t=n.components.waterMark.fontFamily),e+"px "+t};var qd=Object.defineProperty,ra=Object.getOwnPropertySymbols,Jd=Object.prototype.hasOwnProperty,Qd=Object.prototype.propertyIsEnumerable,sa=(n,e,t)=>e in n?qd(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,ia=(n,e)=>{for(var t in e||(e={}))Jd.call(e,t)&&sa(n,t,e[t]);if(ra)for(var t of ra(e))Qd.call(e,t)&&sa(n,t,e[t]);return n};class eu extends te{constructor(e,t,r,s,i,a,o){super(),this.paneManager=e,this.chartModel=t,this.eventBus=r,this.config=s,this.canvasModel=a,this.waterMarkConfig=this.config.components.waterMark,this.waterMarkData=this.getWaterMarkData(),this.waterMarkDrawer=new Zd(this.config,i,a,()=>this.waterMarkConfig,()=>this.waterMarkData),this.addRxSubscription(Ge(i.observeBoundsChanged(Y.PANE_UUID(ae)),this.paneManager.panesChangedSubject).subscribe(l=>{this.waterMarkConfig=this.recalculateTextSize(l.width,l.height)})),this.addRxSubscription(this.chartModel.candlesSetSubject.subscribe(()=>{this.waterMarkData=this.getWaterMarkData()})),o.addDrawerAfter(this.waterMarkDrawer,"WATERMARK","DRAWINGS")}setWaterMarkVisible(e){this.config.components&&this.config.components.waterMark&&(this.config.components.waterMark.visible=e,this.canvasModel.fireDraw())}setWaterMarkData(e){this.waterMarkData=e,this.canvasModel.fireDraw()}getWaterMarkData(){return this.waterMarkData||{}}setWaterMarkConfig(e){if(!(!e||!this.config.components)){if(!this.config.components.waterMark)this.config.components.waterMark=JSON.parse(JSON.stringify(e));else{const t={};Ge(t,e),Ge(t,this.config.components.waterMark),this.config.components.waterMark=t}this.canvasModel.fireDraw()}}setLogoImage(e){this.waterMarkDrawer.setLogoImage(e)}recalculateTextSize(e,t){const i=v=>.15*Math.log(v)/Math.log(1.5)+1,a=i(e/1920),o=i(t/1080),l=Math.min(a,o),c=l>=0?l:0,h={firstRowFontSize:Math.round(this.config.components.waterMark.firstRowFontSize*c),secondRowFontSize:Math.round(this.config.components.waterMark.secondRowFontSize*c),thirdRowFontSize:Math.round(this.config.components.waterMark.thirdRowFontSize*c)};return ia(ia({},this.config.components.waterMark),h)}}const aa={x:4,y:4};function tu(n,e,t,r,s){var i,a;const o=(i=s.alignType)!=null?i:"middle",{fontSize:l,fontFamily:c,padding:h}=r.components.xAxis,v=(a=h.top)!=null?a:0,p=t.getBounds(Y.X_AXIS);e.save(),e.font=`bold ${l}px ${c}`;const E=e.measureText(s.text).width+aa.x*2;let R=0;const N=s.x;switch(o){case"start":R=N-E;break;case"end":R=N;break;case"middle":default:R=N-E/2;break}cn(n,e,R,p.y,E,p.height-1),o!=="middle"&&(e.strokeStyle=s.color,e.beginPath(),e.moveTo(N,p.y),e.lineTo(N,p.y+p.height),e.stroke()),e.fillStyle=s.color;const k=R+aa.x,U=p.y+v+l;e.fillText(s.text,k,U),e.restore()}class nu{constructor(e,t,r,s,i){this.backgroundCanvasModel=e,this.config=t,this.canvasModel=r,this.canvasBoundsContainer=s,this.xAxisLabelsModel=i}draw(){const e=this.canvasModel.ctx;this.drawHighlightedBackgroundBetweenLabels(),this.xAxisLabelsModel.labels.forEach(t=>{tu(this.backgroundCanvasModel.ctx,e,this.canvasBoundsContainer,this.config,t)})}drawHighlightedBackgroundBetweenLabels(){const e=this.canvasModel.ctx,t={},r=this.xAxisLabelsModel.labels.reduce((s,i)=>{if(i.subGroupId!==void 0){let a=s[i.subGroupId];a||(a=[],s[i.subGroupId]=a),a.push(i)}return s},t);Object.keys(r).forEach(s=>{const i=r[s];if(i.length===2){const a=this.canvasBoundsContainer.getBounds(Y.X_AXIS);e.fillStyle=vt.rgb(i[0].color).alpha(.1).toString(),ni(e,{x:i[0].x,y:a.y},{x:i[1].x,y:a.y+a.height})}})}getCanvasIds(){return[this.canvasModel.canvasId]}}const Lv="week-weekday",ru=["second","minute","hour","day","month","year"],su=["lessThanSecond"],iu=n=>ru.some(e=>e===n),au=n=>n==="week-weekday",ou=n=>su.some(e=>e===n),oa=n=>{const e={"!":!1,$:!1};return n.includes("!")&&(e["!"]=!0),n.includes("$")&&(e.$=!0),e},gr=n=>parseInt(n,10),la=n=>{const[e,...t]=n.split("_");if(iu(e)){const[r]=t,s=oa(r),i=gr(r);return{key:e,value:i,exact:s["!"]}}else if(au(e)){const[r,s]=t,i=oa(r),a=gr(r),o=gr(s);return{key:e,week:i.$?"$":a,weekday:o}}else return ou(e)?{key:e}:(console.warn(`${n} is not fit, check the documentation to see available formats https://webdev.prosp.devexperts.com:8095/docs/chart/x-axis`),null)};class wn{constructor(e,t,r,s,i,a=()=>!0){this.config=e,this.canvasModel=t,this.viewportModel=r,this.canvasBoundsContainer=s,this.labelsProvider=i,this.drawPredicate=a}draw(){var e;if(this.drawPredicate()){const t=this.canvasModel.ctx,r=this.config.colors.xAxis,s=this.config.components.xAxis.fontFamily,i=wn.getFontFromConfig(this.config),a=this.config.components.xAxis.fontSize,o=(e=this.config.components.xAxis.padding.top)!=null?e:0;t.save(),t.font=i,t.fillStyle=r.backgroundColor;const l=this.canvasBoundsContainer.getBounds(Y.X_AXIS);t.fillRect(l.x,l.y,l.width,l.height);const c=this.config.colors.xAxis.labelTextColor,h=this.labelsProvider();this.drawLabels(t,h,l,c,a,s,o),t.restore()}}drawLabels(e,t,r,s,i,a,o){const l=`${i}px ${a}`;e.fillStyle=s;for(const c of t){const h=this.viewportModel.toX(c.value)-Re(c.text,e,l)/2;if(h<0||h>r.width)continue;const v=r.y+i-1+o,p=c.text;e.font=l,e.fillText(p,h,v)}}static getFontFromConfig(e){return`${e.components.xAxis.fontStyle} ${e.components.xAxis.fontSize}px ${e.components.xAxis.fontFamily}`}getCanvasIds(){return[this.canvasModel.canvasId]}}const pr={lessThanSecond:0,second:100,minute:200,hour:300,day:400,"week-weekday":500,month:600,year:1e4},ca=n=>{switch(n.key){case"second":case"minute":case"hour":case"day":case"month":case"year":return pr[n.key]+n.value;case"lessThanSecond":return pr[n.key];case"week-weekday":return pr[n.key]+(n.week==="$"?9:n.week)+n.weekday*10}},ha=n=>{const e={};return n.forEach(t=>{const r=e[t.weight];r===void 0?e[t.weight]=[t]:r.push(t)}),e},lu=(n,e)=>{const t=Object.keys(n).map(s=>parseInt(s,10)).sort((s,i)=>i-s);let r=[];for(const s of t){const i=n[s];if(!i)continue;const a=[...r];r=[];const o=a.length,l=i.length;let c=0,h=1/0,v=-1/0;for(let p=0;p<l;p++){const y=i[p],E=y.idx;for(;c<o;){const R=a[c],N=R.idx;if(E>N)c++,r.push(R),v=N,h=1/0;else{h=N;break}}h-E>=e&&E-v>=e&&(r.push(y),v=E)}for(;c<o;)r.push(a[c]),c++}return r},cu=(n,e,t,r,s,i)=>{const a=wn.getFontFromConfig(e),o=Re(t.text,n,a),l=Re(r.text,n,a),c=s.toX(t.value)+o/2;return s.toX(r.value)-l/2-c<i};function mr(n){"@babel/helpers - typeof";return mr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},mr(n)}function Oe(n,e){if(e.length<n)throw new TypeError(n+" argument"+(n>1?"s":"")+" required, but only "+e.length+" present")}function Be(n){Oe(1,arguments);var e=Object.prototype.toString.call(n);return n instanceof Date||mr(n)==="object"&&e==="[object Date]"?new Date(n.getTime()):typeof n=="number"||e==="[object Number]"?new Date(n):((typeof n=="string"||e==="[object String]")&&typeof console!="undefined"&&(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"),console.warn(new Error().stack)),new Date(NaN))}function hu(n){return Oe(1,arguments),Be(n).getDay()===1}function du(n){return Oe(1,arguments),Be(n).getDay()===2}function uu(n){return Oe(1,arguments),Be(n).getDay()===3}function fu(n){return Oe(1,arguments),Be(n).getDay()===4}function vu(n){return Oe(1,arguments),Be(n).getDay()===5}function gu(n){return Oe(1,arguments),Be(n).getDay()===6}function pu(n){return Oe(1,arguments),Be(n).getDay()===0}function mu(n,e){var t;Oe(1,arguments);var r=n||{},s=Be(r.start),i=Be(r.end),a=i.getTime();if(!(s.getTime()<=a))throw new RangeError("Invalid interval");var o=[],l=s;l.setHours(0,0,0,0);var c=Number((t=e==null?void 0:e.step)!==null&&t!==void 0?t:1);if(c<1||isNaN(c))throw new RangeError("`options.step` must be a number greater than 1");for(;l.getTime()<=a;)o.push(Be(l)),l.setDate(l.getDate()+c),l.setHours(0,0,0,0);return o}function bu(n){Oe(1,arguments);var e=Be(n);return e.setDate(1),e.setHours(0,0,0,0),e}function Cu(n){Oe(1,arguments);var e=Be(n),t=e.getMonth();return e.setFullYear(e.getFullYear(),t+1,0),e.setHours(23,59,59,999),e}function da(n){Oe(1,arguments);var e=Be(n);return e.setHours(0,0,0,0),e}function ua(n,e){Oe(2,arguments);var t=da(n),r=da(e);return t.getTime()===r.getTime()}const yu=n=>{switch(n.key){case"lessThanSecond":return Mu(n);case"month":return Pu(n);case"second":case"minute":case"hour":case"day":case"year":return Tu(n);case"week-weekday":return _u(n);default:return()=>!1}},dt=(n,e)=>{switch(e){case"lessThanSecond":return n.getMilliseconds();case"month":return n.getMonth();case"second":return n.getSeconds();case"minute":return n.getMinutes();case"hour":return n.getHours();case"day":return n.getDate();case"year":return n.getFullYear();case"week-weekday":return n.getDate()}},br=n=>(e,t)=>{const r=dt(e,n),s=dt(t,n);return r!==s},wu=n=>(e,t)=>{const r=dt(e,n),s=dt(t,n);return r>=s},Su={1:hu,2:du,3:uu,4:fu,5:vu,6:gu,7:pu},xu=(n,e,t)=>{var r;const s=mu({start:bu(n),end:Cu(n)}),i=(r=Su[t])!=null?r:()=>!1;if(e==="$"){for(const a of s.reverse())if(i(a))return ua(n,a)}else{let a=1;for(const o of s)if(i(o)){if(a===e)return ua(n,o);a++}}return!1},fa=(n,e)=>e===1?n===1:n/e===1,va=(n,e)=>e===1?!0:n%e===0,Mu=n=>(e,t)=>wu(n.key)(e,t),Pu=n=>(e,t)=>{const r=br(n.key)(e,t),s=n.exact?fa(dt(e,n.key)+1,n.value):va(dt(e,n.key)+1,n.value);return r&&s},Tu=n=>(e,t)=>{const r=br(n.key)(e,t),s=n.exact?fa(dt(e,n.key),n.value):va(dt(e,n.key),n.value);return r&&s},_u=n=>(e,t)=>{const r=br(n.key)(e,t),s=xu(e,n.week,n.weekday);return r&&s},Au=n=>{switch(n.key){case"second":case"minute":return Du(n.value);case"hour":return Eu(n.value);case"day":return Lu(n.value);case"month":return Bu(n.value);case"year":return Ru(n.value);case"week-weekday":const e=Ou(n.week),t=Iu(n.weekday);return e&&t;case"lessThanSecond":return!0;default:return!1}},Du=n=>n>0&&n<=60,Eu=n=>n>0&&n<=24,Lu=n=>n>0&&n<=31,Iu=n=>ga(n)?n>=1&&n<=7:!1,Ou=n=>n==="$"?!0:ga(n)?n>=1&&n<=6:!1,Bu=n=>n>0&&n<=12,Ru=n=>n>0,ga=n=>!isNaN(n)&&isFinite(n),Fu=(n,e,t,r)=>{var s,i;const a=r(n.getTime()),o=r(e.getTime());for(const[l,c]of t)if(c(a,o))return l;return(i=(s=t[t.length-1])==null?void 0:s[0])!=null?i:0};function Cr(n,e,t){const r=new Array(n.length);let s=new Date(0);for(let i=0;i<n.length;i++){const a=n[i],o=new Date(a.candle.timestamp),l={weight:Fu(o,s,e,t)};r[i]=l,s=o}return r}const pa=n=>{const e={},t={};return $n(n).forEach(([r,s])=>{const i=la(r),a=i===null?!1:Au(i);if(i&&a){const o=ca(i);e[o]=s,t[o]=yu(i)}}),{weightToTimeFormatsDict:e,weightToTimeFormatMatcherDict:t}};class ma{constructor(e,t,r,s,i,a){this.eventBus=e,this.config=t,this.chartModel=r,this.scaleModel=s,this.timeZoneModel=i,this.canvasModel=a,this.labelsGroupedByWeight={},this.levelsCache={},this.weightToTimeFormatMatcherArray=[],this.weightToTimeFormatsDict={},this.extendedLabelsFilterConfig={minute_1:c=>c>=2},this.formatsByWeightMap=t.components.xAxis.formatsForLabelsConfig;const{weightToTimeFormatsDict:o,weightToTimeFormatMatcherDict:l}=pa(this.formatsByWeightMap);this.weightToTimeFormatMatcherArray=Object.entries(l).map(([c,h])=>[parseInt(c,10),h]).sort(([c],[h])=>h-c),this.weightToTimeFormatsDict=o}get labels(){return this.getLabelsFromChartType()}getLabelsFromChartType(){var e,t;const r=(t=(e=this.weightedCache)==null?void 0:e.labels)!=null?t:[];return this.config.components.chart.type==="equivolume"?this.postProcessing(r):r}getAllCandlesWithFake(){const e=this.chartModel.mainCandleSeries.visualPoints;if(e.length===0)return[];const r=Array.from({length:750}).map((s,i)=>Fs(this.chartModel.mainCandleSeries.dataPoints,this.chartModel.mainCandleSeries.visualPoints,this.chartModel.mainCandleSeries.meanCandleWidth,e.length+i,this.chartModel.getPeriod()));return[...e,...r]}mapWeightedPointsToLabels(e,t){const r=new Array(e.length);return e.forEach((s,i)=>{var a;const o=t[i],l=this.weightToTimeFormatsDict[s.weight],c=this.timeZoneModel.getDateTimeFormatter(l)(o.candle.timestamp);r[i]={weight:s.weight,idx:(a=o.candle.idx)!=null?a:0,value:o.centerUnit,time:o.candle.timestamp,text:c}}),r}setFormatsForLabelsConfig(e){const{weightToTimeFormatsDict:t,weightToTimeFormatMatcherDict:r}=pa(e);this.formatsByWeightMap=e,this.weightToTimeFormatMatcherArray=Object.entries(r).map(([s,i])=>[parseInt(s,10),i]).sort(([s],[i])=>i-s),this.weightToTimeFormatsDict=t,this.generateWeightedLabels()}generateWeightedLabels(){const e=this.getAllCandlesWithFake(),t=Cr(e,this.weightToTimeFormatMatcherArray,this.timeZoneModel.tzOffset(this.config.timezone)),r=this.mapWeightedPointsToLabels(t,e);this.labelsGroupedByWeight=ha(r),this.weightedCache=void 0,this.levelsCache={},this.recalculateCachedLabels()}getLabelsFromCache(e){if(this.levelsCache[e])return this.levelsCache[e]}updateLastLabel(e){const t=this.chartModel.mainCandleSeries.visualPoints[this.chartModel.mainCandleSeries.visualPoints.length-2];if(t){const s=Cr([t,e],this.weightToTimeFormatMatcherArray,this.timeZoneModel.tzOffset(this.config.timezone)),i=this.mapWeightedPointsToLabels([s[1]],[e]),[a]=i;this.labelsGroupedByWeight=Object.entries(this.labelsGroupedByWeight).reduce((o,[l,c])=>{const h=c.findIndex(p=>p.idx===a.idx);let v=c;if(h!==-1&&(v=c.filter(p=>p.idx!==a.idx)),parseInt(l,10)===a.weight){const p=v.findIndex(y=>y.idx>a.idx);p!==-1?v=[...v.slice(0,p),a,...v.slice(p)]:v.push(a)}return o[l]=v,o},{}),this.weightedCache=void 0,this.levelsCache={},this.recalculateCachedLabels()}}updateHistoryLabels(e){const t=e.concat(this.chartModel.mainCandleSeries.visualPoints[e.length]),r=Cr(t,this.weightToTimeFormatMatcherArray,this.timeZoneModel.tzOffset(this.config.timezone)),s=this.mapWeightedPointsToLabels(r,t),i=ha(s),a=Wt(i);for(const c in this.labelsGroupedByWeight)a[c]===void 0&&(a[c]=this.labelsGroupedByWeight[c]);const o=this.chartModel.mainCandleSeries.visualPoints[e.length-1],l=Object.entries(a).sort(([c],[h])=>parseInt(h,10)-parseInt(c,10)).reduce((c,[h,v])=>{const p=parseInt(h,10),y=this.labelsGroupedByWeight[p];if(p===this.weightToTimeFormatMatcherArray[0][0]&&y.shift(),y){const E=y.map(R=>(R.idx=R.idx+e.length,R.value=o.startUnit+o.width+R.value,R));i[p]?c[h]=v.concat(E):c[h]=E}else c[h]=v;return c},{});this.labelsGroupedByWeight=l,this.weightedCache=void 0,this.levelsCache={},this.recalculateCachedLabels()}generateLabels(){this.generateWeightedLabels()}recalculateLabels(){this.recalculateCachedLabels()}recalculateCachedLabels(){if(Object.getOwnPropertyNames(this.labelsGroupedByWeight).length===0)return;const e=this.config.components.xAxis.fontSize,t=Object.values(this.formatsByWeightMap).reduce((a,o)=>Math.max(o.length,a),1),r=e*t,s=Pe(this.chartModel.mainCandleSeries.meanCandleWidth,this.scaleModel.zoomX),i=Math.round(r/s);if(!(i<0&&!isFinite(s))&&(this.weightedCache===void 0||i!==this.weightedCache.coverUpLevel)){const a=this.getLabelsFromCache(i);if(a){this.weightedCache={labels:a,coverUpLevel:i};return}const o=lu(this.filterLabelsByExtendedRules(this.labelsGroupedByWeight,i),i);this.levelsCache[i]=o,this.weightedCache={labels:o,coverUpLevel:i},this.eventBus.fireDraw()}}postProcessing(e){var t,r;const s=[];let i=0,a=1;for(;a<=e.length-1;){const o=e[i],l=e[a];cu(this.canvasModel.ctx,this.config,o,l,this.scaleModel,30)?((t=l.weight)!=null?t:0)>((r=o.weight)!=null?r:0)&&(i=a):(s.push(o),i=a,a===e.length-1&&s.push(l)),a++}return s}filterLabelsByExtendedRules(e,t){const r=$n(this.extendedLabelsFilterConfig).reduce((s,i)=>{if(!i)return s;const[a,o]=i;if(o){const l=la(a);if(l){const c=ca(l);s[c]=o}}return s},{});return $n(e).reduce((s,[i,a])=>(r[i]&&r[i](t)||(s[i]=a),s),{})}}class Yu extends te{constructor(e,t){super(),this.eventBus=e,this.labelProviders=t,this.labels=[],this.initModel(),this.addSubscription(this.eventBus.on(Xt,()=>this.recalculateLabels()))}initModel(){this.recalculateLabels()}recalculateLabels(){this.labels=[];for(const e of this.labelProviders)this.labels.push(...e.getUnorderedLabels())}}class Hu extends te{constructor(e,t,r,s,i){super(),this.scaleModel=e,this.canvasInputListener=t,this.canvasBoundsContainer=r,this.chartPanComponent=s,this.chartModel=i,this.lastXStart=0,this.lastXWidth=0,this.lastXPxWidth=0,this.onXDragStart=()=>{this.lastXStart=this.scaleModel.xStart,this.lastXWidth=this.scaleModel.xEnd-this.scaleModel.xStart;const o=this.canvasBoundsContainer.getBounds(Y.X_AXIS);this.lastXPxWidth=o.width-this.canvasInputListener.currentPoint.x},this.onXDragTick=o=>{const{delta:l}=o,c=this.lastXPxWidth-l;if(c<0)return;const h=this.lastXPxWidth/c,v=this.lastXWidth*h,p=this.lastXStart+(this.lastXWidth-v);this.scaleModel.setXScale(p,this.scaleModel.xEnd)};const a=new Gt(this.canvasBoundsContainer.getBoundsHitTest(Y.X_AXIS),{onDragStart:this.onXDragStart,onDragTick:this.onXDragTick},this.canvasInputListener,this.chartPanComponent,{disableChartPanning:!1});this.addChildEntity(a)}doActivate(){super.doActivate(),this.addRxSubscription(this.canvasInputListener.observeDbClick(this.canvasBoundsContainer.getBoundsHitTest(Y.X_AXIS)).subscribe(()=>this.chartModel.doBasicScale())),this.addRxSubscription(this.chartModel.candlesPrependSubject.subscribe(({prependedCandlesWidth:e})=>this.lastXStart+=e))}}class Nu extends te{constructor(e,t,r,s,i,a,o,l,c,h,v,p,y){super(),this.eventBus=e,this.config=t,this.canvasModel=r,this.chartComponent=s,this.scaleModel=i,this.chartResizeHandler=l,this.timeZoneModel=h;const E=new ma(e,t,s.chartModel,i,h,this.canvasModel);this.xAxisLabelsGenerator=E,this.xAxisLabelsModel=new Yu(e,[]);const R=new ar;c.addDrawer(R,"X_AXIS"),this.xAxisDrawer=new wn(t,r,i,a,()=>this.xAxisLabelsGenerator.labels,()=>t.components.xAxis.visible),R.addDrawer(this.xAxisDrawer),this.xAxisLabelsDrawer=new nu(y,t,r,a,this.xAxisLabelsModel),R.addDrawer(this.xAxisLabelsDrawer),this.xAxisScaleHandler=new Hu(i,o,a,v,this.chartComponent.chartModel),this.addChildEntity(this.xAxisScaleHandler),p.setCursorForCanvasEl(Y.X_AXIS,t.components.xAxis.cursor)}doActivate(){super.doActivate(),this.addRxSubscription(Me(this.chartComponent.chartModel.candlesSetSubject,this.timeZoneModel.observeTimeZoneChanged()).subscribe(()=>{this.xAxisLabelsGenerator.generateLabels()})),this.addRxSubscription(this.chartComponent.chartModel.candlesPrependSubject.pipe(he(({preparedCandles:e})=>e.length!==0),ye(({preparedCandles:e})=>this.chartComponent.chartModel.mainCandleSeries.visualPoints.slice(0,e.length))).subscribe(e=>{Wo.includes(this.config.components.chart.type)&&this.xAxisLabelsGenerator.updateHistoryLabels&&this.xAxisLabelsGenerator.updateHistoryLabels(e)})),this.addRxSubscription(Me(this.scaleModel.xChanged,this.chartResizeHandler.canvasResized).pipe(Nt(50,void 0,{trailing:!0,leading:!0})).subscribe(()=>{this.xAxisLabelsGenerator.recalculateLabels()})),this.addRxSubscription(this.chartComponent.chartModel.candlesUpdatedSubject.pipe(ye(()=>Ue(this.chartComponent.chartModel.mainCandleSeries.visualPoints)),Ve((e,t)=>{var r,s;return((r=e==null?void 0:e.candle)==null?void 0:r.timestamp)===((s=t==null?void 0:t.candle)==null?void 0:s.timestamp)}),he(Gr)).subscribe(e=>{this.xAxisLabelsGenerator.updateLastLabel&&this.xAxisLabelsGenerator.updateLastLabel(e)}))}getDrawer(){return this.xAxisDrawer}registerXAxisLabelsProvider(e){this.xAxisLabelsModel.labelProviders.push(e)}setVisible(e){var t;(t=this.config.components)!=null&&t.xAxis&&(this.config.components.xAxis.visible=e,this.eventBus.fireDraw())}setFormatsForLabelsConfig(e){this.xAxisLabelsGenerator instanceof ma?this.xAxisLabelsGenerator.setFormatsForLabelsConfig(e):console.error("Format config for x-axis is not available")}isVisible(){var e,t;return(t=(e=this.config.components)==null?void 0:e.xAxis.visible)!=null?t:!1}}const rt="#FF00FF",ku=(n,e)=>n==="down"?e.lastPrice.textNegative:n==="up"?e.lastPrice.textPositive:e.lastPrice.textSelected,Wu=(n,e)=>{const t=e.barTheme[`${n}Color`];return t!=null?t:rt},Uu=(n,e)=>{const t=e.lineTheme[`${n}Color`];return t!=null?t:rt},zu=(n,e)=>{const t=e.candleTheme[`${n}Color`];return t!=null?t:rt},Xu=(n,e)=>{const t=e.areaTheme.lineColor;return t!=null?t:rt},ju=(n,e)=>{const t=e.scatterPlot.mainColor;return t!=null?t:rt},Vu=(n,e)=>{const t=e.histogram[`${n}Cap`];return t!=null?t:rt},Gu=(n,e)=>{const t=n==="up"?e.baseLineTheme.upperSectionStrokeColor:e.baseLineTheme.lowerSectionStrokeColor;return t!=null?t:rt},ba=(n,e)=>{const t=e.candleTheme[`${n}WickColor`];return t!=null?t:rt},$u=()=>(console.warn("Fallback for label default color"),rt);var Zu=Object.defineProperty,Ca=Object.getOwnPropertySymbols,Ku=Object.prototype.hasOwnProperty,qu=Object.prototype.propertyIsEnumerable,ya=(n,e,t)=>e in n?Zu(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Sn=(n,e)=>{for(var t in e||(e={}))Ku.call(e,t)&&ya(n,t,e[t]);if(Ca)for(var t of Ca(e))qu.call(e,t)&&ya(n,t,e[t]);return n};class Ju{constructor(e,t,r,s){this.chartModel=e,this.config=t,this.lastCandleLabelsByChartType=r,this.resolveLabelColorFn=s}getUnorderedLabels(){const e=[];if(this.config.components.yAxis.labels.settings.lastPrice.mode!=="none"){const r=this.getYAxisVisualLabel(this.chartModel.mainCandleSeries),s=r&&Sn(Sn({},r),this.getLabelDrawConfig(this.chartModel.mainCandleSeries,!0));if(s){const i={labels:[s]},a=this.lastCandleLabelsByChartType[this.config.components.chart.type];a==null||a(i,this.chartModel.mainCandleSeries),e.push(i)}this.chartModel.candleSeries.forEach((i,a)=>{if(a===0)return;const o=this.getYAxisVisualLabel(i),l=o&&Sn(Sn({},o),this.getLabelDrawConfig(i,!1));if(l){const c={labels:[l]},h=this.lastCandleLabelsByChartType[i.config.type];h==null||h(c,this.chartModel.mainCandleSeries),e.push(c)}})}return e}getYAxisVisualLabel(e){const t=Ue(e.dataPoints);if(t){const r=e.view.toY(t.close);if(isFinite(r)){const s=this.config.components.yAxis.labels.settings.lastPrice.mode,i=this.config.components.yAxis.labels.settings.lastPrice.type;return{y:r,labelWeight:0,labelText:this.chartModel.pane.valueFormatter(t.close,e),mode:s,labelType:i,description:e.instrument.symbol}}}return null}getLabelDrawConfig(e,t){const r=e.colors.labels,s=this.resolveLabelColorFn(e.config.type),{rectLabelTextColor:i,rectLabelInvertedTextColor:a}=this.chartModel.config.colors.yAxis;let o="#FFFFFF",l="#FFFFFF";return r&&(o=s(e.lastPriceMovement,e.colors),l=t?ku(e.lastPriceMovement,r):i),{bgColor:o,textColor:Ht(o,l,a),rounded:!0}}}function Qu(n,e){if(n.filter(i=>i!==null).length<=1)return n.map(i=>i.y);const t=e-2,r=n.map((i,a)=>ef(i,a,t)).filter(Gr).sort(tf),s=new Array(r.length);return r.forEach((i,a)=>{if(i===null)return;const o=r[a+1];if(o&&o.top<i.bottom){const l=o.labelWeight-i.labelWeight===1?2:0,c=i.bottom-o.top+l;o.top+=c,o.bottom+=c}s[i.actualIndex]=(i.top+i.bottom)/2}),s}const ef=(n,e,t)=>n?{top:n.y-t/2,bottom:n.y+t/2,labelWeight:n.weight,actualIndex:e}:null,tf=(n,e)=>{const t=n.top,r=e.top;return t>r?1:t<r||t===r&&n.labelWeight<e.labelWeight?-1:0};var nf=Object.defineProperty,rf=Object.defineProperties,sf=Object.getOwnPropertyDescriptors,wa=Object.getOwnPropertySymbols,af=Object.prototype.hasOwnProperty,of=Object.prototype.propertyIsEnumerable,Sa=(n,e,t)=>e in n?nf(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,xa=(n,e)=>{for(var t in e||(e={}))af.call(e,t)&&Sa(n,t,e[t]);if(wa)for(var t of wa(e))of.call(e,t)&&Sa(n,t,e[t]);return n},Ma=(n,e)=>rf(n,sf(e));const yr={MAIN:"MAIN"};class lf extends te{constructor(e,t,r,s,i,a){super(),this.eventBus=e,this.chartModel=t,this.canvasBoundsContainer=r,this.config=s,this.canvasModel=i,this.updateYAxisWidth=a,this.orderedLabels=[],this.customLabels={},this.labelsProviders={},this.labelsPositionRecalculatedSubject=new G,this.animFrameId=`anim_cache_${Je()}`,this.initModel()}doActivate(){super.doActivate(),this.addRxSubscription(Me(this.chartModel.observeCandlesChanged(),this.canvasBoundsContainer.observeBoundsChanged(Y.PANE_UUID(ae)),this.chartModel.nextCandleTimeStampSubject,this.canvasBoundsContainer.barResizerChangedSubject,this.chartModel.scaleModel.changed).subscribe(()=>{this.updateLabels()}))}initModel(){this.initLabelsGroups(),this.recalculateLabels(),this.canvasModel.fireDraw()}initLabelsGroups(){if(Object.keys(this.labelsProviders).length!==0)for(const e of Object.keys(this.labelsProviders))this.createGroup(e),Object.entries(this.labelsProviders[e]).forEach(([t,r])=>{this.addToGroup(r,e,t)})}updateLabels(e=!1){this.recalculateLabels(),sr(this.animFrameId,()=>{e&&this.updateYAxisWidth(),this.canvasModel.fireDraw()})}recalculateLabels(){var e,t;this.orderedLabels=[];const r=this.config.components.yAxis.fontSize+((e=this.config.components.yAxis.labelBoxMargin.top)!=null?e:0)+((t=this.config.components.yAxis.labelBoxMargin.bottom)!=null?t:0);for(const s of Object.values(this.labelsProviders)){const i=Ie(Object.values(s).map(l=>l.getUnorderedLabels())),a=Ie(i.map(l=>l.labels)).map(l=>{var c;return{y:l.y,weight:(c=l.labelWeight)!=null?c:Number.POSITIVE_INFINITY}}),o=Qu(a,r);i.forEach(l=>{const c=o.splice(0,l.labels.length);this.orderedLabels.push(this.updateLabelsCoordinates(l,c))})}this.orderedLabels=this.orderedLabels.reverse()}createGroup(e){!this.labelsProviders[e]&&(this.labelsProviders[e]={})}addToGroup(e,t,r){this.labelsProviders[t]&&(Object.values(this.labelsProviders[t]).includes(e)||(this.labelsProviders[t][r]=e))}updateLabelsCoordinates(e,t){return Ma(xa({},e),{labels:e.labels.map((r,s)=>Ma(xa({},r),{lineY:r.y,y:t[s]}))})}observeLabelsPositionsRecalculated(){return this.labelsPositionRecalculatedSubject.asObservable()}registerYAxisLabelsProvider(e,t,r){var s;const i=(s=this.labelsProviders[e])!=null?s:{};i[r]=t,this.labelsProviders[e]=i,this.initModel()}unregisterYAxisLabelsProvider(e,t){var r;const s=(r=this.labelsProviders[e])!=null?r:{};delete s[t],this.labelsProviders[e]&&Object.keys(this.labelsProviders[e]).length===0&&delete this.labelsProviders[e],this.initModel()}}class cf{constructor(e,t,r,s,i,a,o){this.labelsProvider=e,this.yAxisLabelsCanvasModel=t,this.backgroundCanvasModel=r,this.yAxisState=s,this.canvasBoundsContainer=i,this.yAxisColors=a,this.customLabels=o}draw(){const e=this.yAxisLabelsCanvasModel.ctx,t=this.backgroundCanvasModel.ctx,r=this.canvasBoundsContainer.getBounds(Y.PANE_UUID_Y_AXIS(ae)),s=this.canvasBoundsContainer.getBounds(Y.ALL_PANES);this.drawHighlightedBackgroundBetweenLabels(),this.labelsProvider().forEach(a=>{var o;const l=(o=a.bounds)!=null?o:r;a.labels.forEach(c=>{var h;return _i(e,t,l,s,c,this.canvasBoundsContainer,(h=a.axisState)!=null?h:this.yAxisState,this.yAxisColors)})}),Object.values(this.customLabels).forEach(a=>_i(e,t,r,s,a,this.canvasBoundsContainer,this.yAxisState,this.yAxisColors))}drawHighlightedBackgroundBetweenLabels(){const e=this.yAxisLabelsCanvasModel.ctx,t=this.labelsProvider(),r={};t.forEach(s=>{s.labels.forEach(i=>{var a,o,l;if(i.subGroupId){const c=(a=r[i.subGroupId])!=null?a:[];if(r[i.subGroupId]=c,c.push(i),c.length===2){const h=(o=s.bounds)!=null?o:this.canvasBoundsContainer.getBounds(Y.PANE_UUID_Y_AXIS(ae));e.save(),e.fillStyle=(l=c[0].highlightColor)!=null?l:c[0].bgColor;const[v,p]=c[0].y>c[1].y?[c[1].y,c[0].y]:[c[0].y,c[1].y];ni(e,{x:h.x,y:ps(v,h)},{x:h.x+h.width-6,y:ps(p,h)}),e.restore()}}})})}getCanvasIds(){return[this.yAxisLabelsCanvasModel.canvasId]}}class hf extends te{constructor(e,t,r,s,i,a,o){super(),this.config=r,this.canvasBoundsContainer=s,this.canvasModel=i,this.chartModel=a;const l=e.valueFormatter;this.yAxisLabelsGenerator=new $i(null,a,o,l,()=>this.config.components.yAxis.type,()=>this.chartModel.getBaseLine(),r.components.yAxis.labelHeight),this.yAxisBaseLabelsModel=new Ji(o,this.yAxisLabelsGenerator,this.canvasBoundsContainer),this.addChildEntity(this.yAxisBaseLabelsModel),this.yAxisLabelsModel=new lf(t,this.chartModel,this.canvasBoundsContainer,this.config,i,()=>this.canvasBoundsContainer.updateYAxisWidths()),this.addChildEntity(this.yAxisLabelsModel),this.canvasBoundsContainer.yAxisBoundsContainer.registerYAxisWidthContributor({getLargestLabel:()=>{var c;return((c=this.yAxisLabelsGenerator.labelsCache.getLastCachedValue())!=null?c:[]).map(h=>h.text).concat(this.yAxisLabelsModel.orderedLabels.flatMap(h=>h.labels).map(h=>h.labelText)).reduce((h,v)=>v.length>h.length?v:h,"")},getYAxisIndex:()=>0,getYAxisAlign:()=>this.config.components.yAxis.align,getPaneUUID:()=>e.uuid})}doActivate(){super.doActivate(),this.addRxSubscription(Me(this.chartModel.candlesSetSubject).subscribe(()=>{this.yAxisLabelsGenerator.labelsCache.invalidate(),this.yAxisLabelsModel.updateLabels(),this.yAxisBaseLabelsModel.updateLabels(),this.canvasModel.fireDraw()}))}}class df extends te{constructor(e,t,r,s,i,a,o,l,c,h,v,p,y){super(),this.eventBus=e,this.config=t,this.canvasModel=r,this.yAxisLabelsCanvasModel=s,this.backgroundCanvasModel=i,this.chartModel=a,this.scaleModel=o,this.canvasBoundsContainer=c,this.cursorHandler=y,this.axisTypeSetSubject=new G,this.labelsColorByChartTypeMap={},this.state=t.components.yAxis;const E=new ar;this.drawer=E;const R=new Et(this.yAxisLabelsCanvasModel);E.addDrawer(R,"YAXIS_CLEAR"),this.registerDefaultLabelColorResolver(),h.addDrawer(E,"Y_AXIS"),this.yAxisScaleHandler=new Ki(e,this.state,v,o,l,c,c.getBoundsHitTest(Y.PANE_UUID_Y_AXIS(ae)),Z=>o.autoScale(Z)),this.addChildEntity(this.yAxisScaleHandler),this.yAxisModel=new hf(p.paneComponents[ae],e,this.config,c,r,a,o),this.addChildEntity(this.yAxisModel),p.paneComponents[ae].yAxisLabelsGenerator=this.yAxisModel.yAxisLabelsGenerator;const N=new qi(t,this.state,r,()=>this.yAxisModel.yAxisBaseLabelsModel.labels,()=>c.getBounds(Y.Y_AXIS),()=>this.state.visible,a.pane.scaleModel.toY.bind(a.pane.scaleModel));E.addDrawer(N);const k=new cf(()=>this.yAxisModel.yAxisLabelsModel.orderedLabels,this.yAxisLabelsCanvasModel,this.backgroundCanvasModel,this.state,this.canvasBoundsContainer,this.config.colors.yAxis,this.yAxisModel.yAxisLabelsModel.customLabels);E.addDrawer(k);const U=new Ju(this.chartModel,this.config,this.chartModel.lastCandleLabelsByChartType,this.getLabelsColorResolver.bind(this));this.registerYAxisLabelsProvider(U,yr.MAIN),p.paneComponents[ae].mainYExtentComponent.getAxisType=()=>this.state.type,this.updateCursor()}updateCursor(){this.state.type==="percent"?this.cursorHandler.setCursorForCanvasEl(Y.PANE_UUID_Y_AXIS(ae),this.config.components.yAxis.resizeDisabledCursor):this.cursorHandler.setCursorForCanvasEl(Y.PANE_UUID_Y_AXIS(ae),this.config.components.yAxis.cursor)}updateOrderedLabels(e=!1){this.yAxisModel.yAxisLabelsModel.updateLabels(e)}doActivate(){super.doActivate()}registerDefaultLabelColorResolver(){this.registerLabelColorResolver("candle",zu),this.registerLabelColorResolver("bar",Wu),this.registerLabelColorResolver("line",Uu),this.registerLabelColorResolver("area",Xu),this.registerLabelColorResolver("scatterPlot",ju),this.registerLabelColorResolver("histogram",Vu),this.registerLabelColorResolver("baseline",Gu),this.registerLabelColorResolver("trend",ba),this.registerLabelColorResolver("hollow",ba)}registerYAxisLabelsProvider(e,t=yr.MAIN,r=Je()){return this.yAxisModel.yAxisLabelsModel.registerYAxisLabelsProvider(t,e,r),r}addSimpleYAxisLabel(e,t){this.yAxisModel.yAxisLabelsModel.customLabels[e]=t,this.canvasModel.fireDraw()}deleteSimpleYAxisLabel(e){delete this.yAxisModel.yAxisLabelsModel.customLabels[e],this.canvasModel.fireDraw()}unregisterYAxisLabelsProvider(e=yr.MAIN,t){return this.yAxisModel.yAxisLabelsModel.unregisterYAxisLabelsProvider(e,t),t}registerYAxisWidthContributor(e){this.canvasBoundsContainer.yAxisBoundsContainer.registerYAxisWidthContributor(e)}setAxisType(e){e!==this.state.type&&(this.state.type=e,this.axisTypeSetSubject.next(e),this.scaleModel.autoScale(!0),this.yAxisModel.yAxisLabelsModel.updateLabels(!0),this.updateCursor())}setYAxisAlign(e){this.state.align=e,this.canvasBoundsContainer.updateYAxisWidths(),this.eventBus.fireDraw()}setVisible(e){this.state.visible=e,this.eventBus.fireDraw()}isVisible(){return this.state.visible}setLockPriceToBarRatio(e=!1){this.scaleModel.setLockPriceToBarRatio(e)}changeLabelMode(e,t){this.state.labels.settings[e].mode=t,this.yAxisModel.yAxisLabelsModel.updateLabels()}changeLabelAppearance(e,t){this.state.labels.settings[e].type=t,this.yAxisModel.yAxisLabelsModel.updateLabels()}togglePriceScaleInverse(e){this.scaleModel.state.inverse=e,this.scaleModel.inverseY=e,this.scaleModel.scaleInversedSubject.next(e)}changeLabelsDescriptionVisibility(e){this.state.labels.descriptions=e,this.canvasModel.fireDraw()}registerLabelColorResolver(e,t){this.labelsColorByChartTypeMap[e]=t}getLabelsColorResolver(e){var t;return(t=this.labelsColorByChartTypeMap[e])!=null?t:$u}}class uf{constructor(){this.UNKNOWN_ARR=[],this.handlers={},this.muted=!1,this.unsub=(e,t)=>{const r=this.handlers[e];r!==void 0&&Ao.call(r,t)},this.add=(e,t,r)=>(t in this.handlers?e.call(this.handlers[t],r):this.handlers[t]=[r],this.unsub.bind(this,t,r)),this.on=(e,t)=>this.add(this.UNKNOWN_ARR.push,e,t),this.observe=e=>{const t=new G,r=t.next.bind(t),s=t.unsubscribe.bind(t);return this.on(e,r),t.unsubscribe=()=>{this.unsub(e,r),s()},t.asObservable()},this.onPrior=(e,t)=>this.add(this.UNKNOWN_ARR.unshift,e,t),this.off=this.unsub,this.fire=(e,...t)=>{var r;if(!this.muted){const s=(r=this.handlers[e])!=null?r:[];let i;for(i=0,s.length;i<s.length;i++)s[i].apply(null,t)}},this.fireAsync=(e,t)=>{if(!this.muted)return window.setTimeout(this.fire.bind(this,e,t),0)},this.setMuted=e=>{this.muted=e},this.clear=()=>{this.handlers={}}}fireDraw(e){this.fire(Xt,e)}}class ff extends te{constructor(e,t,r,s){super(),r.observeTouchStart().pipe(ye(i=>s.components.chart.highlightActiveCandle?i:void 0),Ve()).subscribe(i=>{i&&this.setCandleAsActive(i,e,t)})}setCandleAsActive(e,t,r){if(e.touches.length===1){const s=e.touches.item(0);if(s!==null){const i=this.getTouchXPosition(s,t),a=r.candleFromX(i);a&&r.mainCandleSeries.setActiveCandle(a)}}}getTouchXPosition(e,t){const r=t.getBoundingClientRect(),s=document.body.scrollLeft||document.documentElement.scrollLeft;return e.pageX-r.left-s}}class vf{constructor(e,t,r,s,i){this.frameElement=e,this.resizerElement=t,this.bus=r,this.canvasModels=s,this.config=i,this.previousBCR=void 0,this.animFrameId=`resize_${Je()}`,this.canvasResized=new G,this.elementResizeDetector=new ResizeObserver(()=>this.handleResize())}subscribeResize(){this.elementResizeDetector.observe(this.resizerElement)}handleResize(){sr(this.animFrameId,()=>this.fireUpdates())}fireUpdates(){const e=this.resizerElement.getBoundingClientRect(),t={x:e.x,y:e.y,width:e.width,height:e.height};this.config||(this.frameElement.style.height=this.resizerElement.clientHeight+"px"),(this.previousBCR===void 0||this.isBCRDimensionsDiffer(this.previousBCR,t))&&(this.previousBCR=t,this.canvasModels.forEach(r=>this.previousBCR&&r.updateDPR(this.previousBCR)),this.canvasResized.next(t),this.bus.fire(Qn,t),this.bus.fire(Xt))}isBCRDimensionsDiffer(e,t){return e.height!==t.height||e.width!==t.width}unsubscribeAnimationUpdate(){if(this.resizerElement)try{this.elementResizeDetector.unobserve(this.resizerElement)}catch(e){console.warn("ChartResizeHandler.ts, unsubscribeAnimationUpdate failed")}}wasResized(){return this.previousBCR!==void 0}}var gf=Array.isArray,pf=Object.getPrototypeOf,mf=Object.prototype,bf=Object.keys;function Cf(n){if(n.length===1){var e=n[0];if(gf(e))return{args:e,keys:null};if(yf(e)){var t=bf(e);return{args:t.map(function(r){return e[r]}),keys:t}}}return{args:n,keys:null}}function yf(n){return n&&typeof n=="object"&&pf(n)===mf}var wf=Array.isArray;function Sf(n,e){return wf(e)?n.apply(void 0,g([],P(e))):n(e)}function xf(n){return ye(function(e){return Sf(n,e)})}function Mf(n,e){return n.reduce(function(t,r,s){return t[r]=e[s],t},{})}function Pf(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];var t=Kt(n),r=Za(n),s=Cf(n),i=s.args,a=s.keys;if(i.length===0)return qt([],t);var o=new xe(Tf(i,t,a?function(l){return Mf(a,l)}:Pt));return r?o.pipe(xf(r)):o}function Tf(n,e,t){return t===void 0&&(t=Pt),function(r){Pa(e,function(){for(var s=n.length,i=new Array(s),a=s,o=s,l=function(h){Pa(e,function(){var v=qt(n[h],e),p=!1;v.subscribe(We(r,function(y){i[h]=y,p||(p=!0,o--),o||r.next(t(i.slice()))},function(){--a||r.complete()}))},r)},c=0;c<s;c++)l(c)},r)}}function Pa(n,e,t){n?qe(t,n,e):e()}class _f extends te{constructor(e,t){super(),this.canvasInputListener=e,this.canvasBoundsContainer=t,this.panesSubscriptions={},this.crossSubject=new pt(null)}doActivate(){super.doActivate()}fireCrossClose(){this.crossSubject.next(null)}unsubscribeMouseOver(e){var t;(t=this.panesSubscriptions[e])==null||t.unsubscribe()}subscribeMouseOver(e,t,r){const s=t.map(a=>this.canvasBoundsContainer.getBoundsHitTest(a,r)),i=(a,o)=>s.some(l=>l(a,o));return this.subscribeMouseOverHT(e,i)}subscribeMouseOverHT(e,t){const r=this.canvasInputListener.observeMouseMoveDocument(),s=this.canvasInputListener.observeMouseEnter(t);let i=!1;const a=Pf([r,s]).pipe(he(([,o])=>!i||i&&o)).subscribe(([o,l])=>{if(l){const c=[o.x,o.y,e];this.crossSubject.next(c),i=!1}else this.crossSubject.next(null),i=!0});return this.panesSubscriptions[e]=a,()=>a.unsubscribe()}}class Af{constructor(e,t,r,s){this.visualCandle=e,this.price=t,this.priceFormatter=r,this.toY=s}get high(){return this.visualCandle.high}get low(){return this.visualCandle.low}get open(){return this.visualCandle.open}get close(){return this.visualCandle.close}get volume(){return this.visualCandle.candle.volume}get openY(){return this.toY(this.open)}get closeY(){return this.toY(this.close)}get highY(){return this.toY(this.high)}get lowY(){return this.toY(this.low)}get openFormatted(){return this.priceFormatter(this.open)}get closeFormatted(){return this.priceFormatter(this.close)}get highFormatted(){return this.priceFormatter(this.high)}get lowFormatted(){return this.priceFormatter(this.low)}get closestOHLCY(){return this.toY([this.close,this.open,this.high,this.low].sort((e,t)=>Math.abs(e-this.price)-Math.abs(t-this.price))[0])}}class Df{constructor(e){this.chartModel=e}getData(e){const{x:t,y:r}=e,i=this.chartModel.candleFromX(t).idx||0,a=this.chartModel.getVisualCandle(i),o=this.chartModel.priceFromY(r);return a&&new Af(a,o,this.chartModel.pane.regularFormatter,this.chartModel.toY)}}class Ef{constructor(e){this.chartModel=e}getData(e){const{x:t}=e,s=this.chartModel.candleFromX(t).idx||0;return this.chartModel.candleSeries.map(a=>{const o=a.dataPoints[s],l=this.chartModel.pane.regularFormatter(o==null?void 0:o.close);return{instrument:a.instrument.symbol,price:l,id:a.id}})}}var Lf=Object.defineProperty,If=Object.defineProperties,Of=Object.getOwnPropertyDescriptors,Ta=Object.getOwnPropertySymbols,Bf=Object.prototype.hasOwnProperty,Rf=Object.prototype.propertyIsEnumerable,_a=(n,e,t)=>e in n?Lf(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,$t=(n,e)=>{for(var t in e||(e={}))Bf.call(e,t)&&_a(n,t,e[t]);if(Ta)for(var t of Ta(e))Rf.call(e,t)&&_a(n,t,e[t]);return n},wr=(n,e)=>If(n,Of(e));class Ff extends te{constructor(e,t,r,s,i,a,o,l,c){super(),this.crossEventProducer=e,this.scaleModel=t,this.config=r,this.chartModel=s,this.canvasInputListener=i,this.canvasBoundsContainer=a,this.paneManager=o,this.timeZoneModel=l,this.formatterFactory=c,this.hoverSubject=new pt(null),this.longTouchActivated=!1,this.xFormatter=()=>"";const h=new Df(this.chartModel),v=new Ef(this.chartModel);this.hoverProducerParts={candleHover:h,compareSeriesHover:v}}get hover(){return this.hoverSubject.getValue()}doActivate(){super.doActivate(),this.addRxSubscription(this.chartModel.candlesSetSubject.subscribe(()=>{const t=this.chartModel.getLastVisualCandle();t&&this.createAndFireHoverFromCandle(t)})),this.addRxSubscription(this.chartModel.candlesUpdatedSubject.subscribe(()=>{const t=this.chartModel.getLastVisualCandle();this.hover!==null&&t!==void 0&&t.candle.timestamp===this.hover.timestamp&&this.updateHover(t)})),this.addRxSubscription(this.crossEventProducer.crossSubject.subscribe(t=>{t===null?this.hoverSubject.next(null):this.createAndFireHover(t)})),this.addRxSubscription(this.scaleModel.xChanged.subscribe(()=>this.fireLastCross())),this.addRxSubscription(this.canvasInputListener.observeTouchStart().subscribe(t=>{const r=t.touches[0].clientX,s=t.touches[0].clientY-this.canvasBoundsContainer.canvasOnPageLocation.y;this.chartModel.candleFromX(r,!0)&&this.createAndFireHover([r,s,""])}));const e=this.canvasBoundsContainer.getBoundsHitTest(Y.ALL_PANES);this.addRxSubscription(this.canvasInputListener.observeLongTouch(e).subscribe(t=>{this.paneManager.chartPanComponent.deactivatePanHandlers(),this.longTouchActivated=!0;const r=t.touches[0].clientX,s=t.touches[0].clientY-this.canvasBoundsContainer.canvasOnPageLocation.y;this.createAndFireHover([r,s,""])})),this.addRxSubscription(this.canvasInputListener.observeTouchEndDocument().subscribe(()=>{this.paneManager.chartPanComponent.activateChartPanHandlers(),this.longTouchActivated&&(this.longTouchActivated=!1,this.crossEventProducer.fireCrossClose())})),this.addRxSubscription(Me(this.chartModel.candlesSetSubject,this.timeZoneModel.observeTimeZoneChanged()).subscribe(()=>this.recalculateCrossToolXFormatter()))}recalculateCrossToolXFormatter(){const e=this.config.components.crossTool.xAxisLabelFormat;this.xFormatter=Di(e,this.chartModel.getPeriod(),this.formatterFactory)}createHoverFromCandle(e){const t=e.xCenter(this.chartModel.scaleModel),r=this.chartModel.scaleModel.toY(e.close);return this.createHover(t,r,ae)}createHover(e,t,r){if(this.chartModel.getCandles().length===0)return;const i=this.chartModel.candleFromX(e,!0).timestamp,a={x:e,y:t,timestamp:i,timeFormatted:this.xFormatter(i),paneId:r},o=Object.entries(this.hoverProducerParts).reduce((l,c)=>wr($t({},l),{[c[0]]:c[1].getData(a)}),{});return $t($t({},a),o)}createAndFireHoverFromCandle(e){const t=this.createHoverFromCandle(e);this.fireHover(t)}updateHover(e){const t=this.createHoverFromCandle(e);if(this.hover&&t){const r=wr($t({},t),{x:this.hover.x,y:this.hover.y});this.fireHover(r)}}createAndFireHover([e,t,r]){const s=this.createHover(e,t,r);this.fireHover(s)}fireHover(e){var t;if(e){if(Hn()&&this.config.components.crossTool.type!=="none"){const r=(t=e.candleHover)==null?void 0:t.visualCandle.candle;r&&this.chartModel.mainCandleSeries.setActiveCandle(r)}this.hoverSubject.next(e)}else this.crossEventProducer.fireCrossClose()}fireLastCross(){const e=this.crossEventProducer.crossSubject.getValue();e&&this.createAndFireHover(e)}registerHoverProducerPart(e,t){this.hoverProducerParts=wr($t({},this.hoverProducerParts),{[e]:t})}unregisterHoverProducerPart(e){delete this.hoverProducerParts[e]}}function Te(n,e,t,r){return n.addEventListener(t,e,r),function(){n.removeEventListener(t,e,r)}}var Yf=Object.defineProperty,Aa=Object.getOwnPropertySymbols,Hf=Object.prototype.hasOwnProperty,Nf=Object.prototype.propertyIsEnumerable,Da=(n,e,t)=>e in n?Yf(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,kf=(n,e)=>{for(var t in e||(e={}))Hf.call(e,t)&&Da(n,t,e[t]);if(Aa)for(var t of Aa(e))Nf.call(e,t)&&Da(n,t,e[t]);return n},Wf=(n=>(n[n.left=0]="left",n[n.middle=1]="middle",n[n.right=2]="right",n))(Wf||{});const St=class extends te{constructor(n,e){super(),this.eventBus=n,this.element=e,this.xDragStartSubject=new G,this.xDragSubject=new G,this.xDragTickSubject=new G,this.xDragEndSubject=new G,this.yDragStartSubject=new G,this.yDragSubject=new G,this.yDragTickSubject=new G,this.yDragEndSubject=new G,this.mouseMoveSubject=new G,this.mouseMoveDocumentSubject=new G,this.clickSubject=new G,this.clickDocumentSubject=new G,this.dbClickSubject=new G,this.mouseDownSubject=new G,this.mouseUpSubject=new G,this.mouseUpDocumentSubject=new G,this.wheelSubject=new G,this.touchStartSubject=new G,this.touchMoveSubject=new G,this.touchEndSubject=new G,this.touchCancelSubject=new G,this.contextMenuSubject=new G,this.longTouchSubject=new G,this.pinchSubject=new G,this.scrollGestureSubject=new G,this.mouseLeavesCanvasSubject=new G,this.dragStartPoint={x:0,y:0},this.prevDragPoint={x:0,y:0},this.currentPoint={x:0,y:0},this.currentPointDocument={x:0,y:0},this.dragging=!1,this.canvasBounds={x:0,y:0,pageX:0,pageY:0,width:0,height:0},this.documentDragListeners=[],this.dragProcessListener=()=>{this.xDragSubject.next(this.currentPoint.x-this.dragStartPoint.x),this.yDragSubject.next(this.currentPoint.y-this.dragStartPoint.y),this.xDragTickSubject.next(this.currentPoint.x-this.prevDragPoint.x),this.yDragTickSubject.next(this.currentPoint.y-this.prevDragPoint.y),this.prevDragPoint.x=this.currentPoint.x,this.prevDragPoint.y=this.currentPoint.y},this.dragStartListener=t=>{this.isDraggable(t)&&(this.updateCurrentPoints(t),this.dragging=!0,this.dragStartEvent=t,this.documentDragListeners.forEach(r=>r()),this.dragStartPoint=St.copyPoint(this.currentPoint),this.xDragStartSubject.next(this.dragStartPoint),this.yDragStartSubject.next(this.dragStartPoint),this.prevDragPoint=kf({},this.dragStartPoint),St.DRAG_EVENTS.forEach(r=>{document.addEventListener(r,this.dragProcessListener,!0);const s=document.removeEventListener.bind(document,r,this.dragProcessListener,!0);this.documentDragListeners.push(s),this.addSubscription(s)}),this.dragProcessListener())},this.dragListener=()=>this.mouseMoveDocumentSubject.next(this.currentPoint),this.updateElementOffsetListener=()=>this.mouseMoveSubject.next(this.currentPoint),this.dragEndListener=()=>{this.dragging=!1,this.documentDragListeners.forEach(t=>t()),this.xDragEndSubject.next(),this.yDragEndSubject.next()},this.clickHandler=()=>this.clickSubject.next(this.currentPoint),this.updateCurrentPoints=t=>{this.updateCurrentDocumentPoint(t),this.updateCurrentMousePoint(t)}}isDraggable(n){return n instanceof MouseEvent?n.button===0:n instanceof TouchEvent}startDragging(n){this.updateCurrentPoints(n),this.dragStartListener(n)}movePointer(n){this.updateCurrentPoints(n),this.dragListener(),this.updateElementOffsetListener(),this.dragging&&this.dragProcessListener()}stopDragging(){this.dragEndListener()}fixTextSelection(){const n=e=>(e.preventDefault(),!1);this.element.addEventListener("selectstart",n,!1),this.addSubscription(this.element.removeEventListener.bind(this.element,"selectstart",n,!1))}doActivate(){this.fixTextSelection(),this.documentDragListeners=[],St.DRAG_START_EVENTS.forEach(s=>{this.element.addEventListener(s,this.dragStartListener),this.addSubscription(()=>this.element.removeEventListener(s,this.dragStartListener))}),this.trackMousePosition(),St.DRAG_EVENTS.forEach(s=>{document.addEventListener(s,this.dragListener),this.addSubscription(document.removeEventListener.bind(document,s,this.dragListener)),this.element.addEventListener(s,this.updateElementOffsetListener),this.addSubscription(this.element.removeEventListener.bind(this.element,s,this.updateElementOffsetListener))}),St.DRAG_END_EVENTS.forEach(s=>{document.addEventListener(s,this.dragEndListener),this.addSubscription(document.removeEventListener.bind(document,s,this.dragEndListener))}),this.addSubscription(Te(this.element,this.clickHandler,"click"));const n=s=>{this.clickDocumentSubject.next(s)};this.addSubscription(Te(document,n,"click"));const e=Wi();if(e==="apple"||e==="mobile"){const i=(()=>{let a=null;return()=>{a?(this.dbClickSubject.next(this.currentPoint),clearTimeout(a),a=null):a=window.setTimeout(()=>{a=null},250)}})();this.addSubscription(Te(this.element,i,"touchend"))}const t=(s,i=500,a=2)=>{s.preventDefault();let o=null;const l={x:s.touches[0].clientX,y:s.touches[0].clientY};let c={x:0,y:0};const h=p=>{c={x:p.touches[0].clientX,y:p.touches[0].clientY},(Math.sqrt(Math.pow(c.x-l.x,2)+Math.pow(c.y-l.y,2))>a||p.touches.length>1)&&v()},v=()=>{o&&(clearTimeout(o),o=null),this.element.removeEventListener("touchend",v),this.element.removeEventListener("touchmove",h)};o=setTimeout(()=>this.longTouchSubject.next(s),i),this.element.addEventListener("touchmove",h,{passive:!0}),this.element.addEventListener("touchend",v)};this.addSubscription(Te(this.element,s=>t(s),"touchstart")),this.addSubscription(Te(this.element,()=>this.dbClickSubject.next(this.currentPoint),"dblclick")),this.addSubscription(Te(this.element,s=>this.touchStartSubject.next(s),"touchstart")),this.addSubscription(Te(this.element,s=>this.touchMoveSubject.next(s),"touchmove",!0)),this.addSubscription(Te(this.element,s=>this.touchEndSubject.next(s),"touchend")),this.addSubscription(Te(this.element,s=>this.touchCancelSubject.next(s),"touchcancel")),this.addSubscription(Te(this.element,s=>{s.ctrlKey?this.pinchSubject.next(s):zi(s)?this.scrollGestureSubject.next(s):this.wheelSubject.next(s),s.preventDefault()},"wheel")),this.addSubscription(Te(this.element,s=>this.contextMenuSubject.next(s),"contextmenu")),this.addSubscription(Te(this.element,()=>this.mouseDownSubject.next(this.currentPoint),"mousedown")),this.addSubscription(Te(this.element,()=>this.mouseUpSubject.next(this.currentPoint),"mouseup")),this.addSubscription(Te(document,()=>this.mouseUpDocumentSubject.next(this.currentPoint),"mouseup")),this.addRxSubscription(this.eventBus.observe(Qn).subscribe(()=>{const s=this.element.getBoundingClientRect();this.canvasBounds.x=s.left,this.canvasBounds.y=s.top,this.canvasBounds.width=s.width,this.canvasBounds.height=s.height}));const r=()=>{this.mouseLeavesCanvasSubject.next(!0)};this.element.addEventListener("mouseleave",r,!1),this.addSubscription(this.element.removeEventListener.bind(this.element,"mouseleave",r,!1))}getCurrentMousePoint(){return this.currentPoint}trackMousePosition(){St.DRAG_EVENTS.forEach(n=>{document.addEventListener(n,this.updateCurrentPoints,!0),this.addSubscription(()=>document.removeEventListener(n,this.updateCurrentPoints,!0))})}updateCurrentDocumentPoint(n){"pageX"in n?this.currentPointDocument.x=n.pageX:n.touches!==void 0&&(this.currentPointDocument.x=n.touches[0].pageX),"pageY"in n?this.currentPointDocument.y=n.pageY:n.touches!==void 0&&(this.currentPointDocument.y=n.touches[0].pageY)}updateCurrentMousePoint(n){const e=this.element.getBoundingClientRect();"clientX"in n?this.currentPoint.x=n.clientX-e.left:n.touches!==void 0&&(this.currentPoint.x=n.touches[0].clientX-e.left),"clientY"in n?this.currentPoint.y=n.clientY-e.top:n.touches!==void 0&&(this.currentPoint.y=n.touches[0].clientY-e.top)}static copyPoint(n){return{x:n.x,y:n.y}}observeMouseMove(n=()=>!0){return this.mouseMoveSubject.asObservable().pipe(he(()=>n(this.currentPoint.x,this.currentPoint.y)))}observeMouseMoveNoDrag(){return this.mouseMoveSubject.asObservable().pipe(he(()=>!this.dragging))}observeMouseMoveDocument(n=()=>!0){return this.mouseMoveDocumentSubject.asObservable().pipe(he(()=>n(this.currentPoint.x,this.currentPoint.y)))}observeMouseMoveDocumentAnyElement(n=()=>!0){return this.mouseMoveDocumentSubject.asObservable().pipe(he(()=>n(this.currentPointDocument.x,this.currentPointDocument.y)),ye(()=>this.currentPointDocument))}observeClickOnDocument(){return this.clickDocumentSubject.asObservable()}observeXDragStart(n=()=>!0){return this.xDragStartSubject.asObservable().pipe(he(()=>n(this.currentPoint.x,this.currentPoint.y)))}observeXDrag(n=()=>!0){return this.xDragSubject.pipe(he(()=>n(this.currentPoint.x,this.currentPoint.y)))}observeXDragEnd(n=()=>!0){return this.xDragEndSubject.asObservable().pipe(he(()=>n(this.currentPoint.x,this.currentPoint.y)))}observeXDragTick(){return this.xDragTickSubject.asObservable()}observeYDragStart(n=()=>!0){return this.yDragStartSubject.asObservable().pipe(he(()=>n(this.currentPoint.x,this.currentPoint.y)))}observeYDrag(n=()=>!0){return this.yDragSubject.asObservable().pipe(he(()=>n(this.currentPoint.x,this.currentPoint.y)))}observeYDragEnd(n=()=>!0){return this.yDragEndSubject.asObservable().pipe(he(()=>n(this.currentPoint.x,this.currentPoint.y)))}observeYDragTick(){return this.yDragTickSubject.asObservable()}observeMouseEnter(n=()=>!0,e=!1){const t=this.mouseMoveSubject.asObservable().pipe(he(()=>!(e&&this.dragging)),ye(()=>n(this.currentPoint.x,this.currentPoint.y))),r=this.observeMouseLeavesCanvas().pipe(ye(()=>!1));return Me(t,r).pipe(Ve())}observeMouseLeavesCanvas(){return this.mouseLeavesCanvasSubject.asObservable()}observeClick(n=()=>!0){return this.clickSubject.asObservable().pipe(he(()=>n(this.currentPoint.x,this.currentPoint.y)))}observeDbClick(n=()=>!0){return this.dbClickSubject.asObservable().pipe(he(()=>n(this.currentPoint.x,this.currentPoint.y)))}observeWheel(n=()=>!0){return this.wheelSubject.asObservable().pipe(he(()=>n(this.currentPoint.x,this.currentPoint.y)))}observePinch(n=()=>!0){return this.pinchSubject.asObservable().pipe(he(()=>n(this.currentPoint.x,this.currentPoint.y)))}observeScrollGesture(){return this.scrollGestureSubject.asObservable()}observeTouchStart(n=()=>!0){return this.touchStartSubject.asObservable().pipe(he(()=>n(this.currentPoint.x,this.currentPoint.y)))}observeTouchMove(n=()=>!0){return this.touchMoveSubject.asObservable().pipe(he(()=>n(this.currentPoint.x,this.currentPoint.y)))}observeTouchEndDocument(){return this.touchEndSubject.asObservable()}observeTouchCancelDocument(){return this.touchCancelSubject.asObservable()}observeMouseDown(n=()=>!0){return this.mouseDownSubject.asObservable().pipe(he(()=>n(this.currentPoint.x,this.currentPoint.y)))}observeMouseUp(n=()=>!0){return this.mouseUpSubject.asObservable().pipe(he(()=>n(this.currentPoint.x,this.currentPoint.y)))}observeMouseUpDocument(n=()=>!0){return this.mouseUpDocumentSubject.asObservable().pipe(he(()=>n(this.currentPoint.x,this.currentPoint.y)))}observeContextMenu(n=()=>!0){return this.contextMenuSubject.asObservable().pipe(he(()=>n(this.currentPoint.x,this.currentPoint.y)),fr(e=>e.preventDefault()))}observeLongTouch(n=()=>!0){return this.longTouchSubject.asObservable().pipe(he(()=>n(this.currentPoint.x,this.currentPoint.y)),fr(e=>e.preventDefault()))}getCurrentPoint(){return this.currentPoint}};let xn=St;xn.DRAG_START_EVENTS=["mousedown","touchstart"],xn.DRAG_EVENTS=["mousemove","touchmove"],xn.DRAG_END_EVENTS=["mouseup","touchend","touchcancel"];var Uf=_e(722),zf=function(n){I(e,n);function e(t,r,s){t===void 0&&(t=1/0),r===void 0&&(r=1/0),s===void 0&&(s=jn);var i=n.call(this)||this;return i._bufferSize=t,i._windowTime=r,i._timestampProvider=s,i._buffer=[],i._infiniteTimeWindow=!0,i._infiniteTimeWindow=r===1/0,i._bufferSize=Math.max(1,t),i._windowTime=Math.max(1,r),i}return e.prototype.next=function(t){var r=this,s=r.isStopped,i=r._buffer,a=r._infiniteTimeWindow,o=r._timestampProvider,l=r._windowTime;s||(i.push(t),!a&&i.push(o.now()+l)),this._trimBuffer(),n.prototype.next.call(this,t)},e.prototype._subscribe=function(t){this._throwIfClosed(),this._trimBuffer();for(var r=this._innerSubscribe(t),s=this,i=s._infiniteTimeWindow,a=s._buffer,o=a.slice(),l=0;l<o.length&&!t.closed;l+=i?1:2)t.next(o[l]);return this._checkFinalizedStatuses(t),r},e.prototype._trimBuffer=function(){var t=this,r=t._bufferSize,s=t._timestampProvider,i=t._buffer,a=t._infiniteTimeWindow,o=(a?1:2)*r;if(r<1/0&&o<i.length&&i.splice(0,i.length-o),!a){for(var l=s.now(),c=0,h=1;h<i.length&&i[h]<=l;h+=2)c=h;c&&i.splice(0,c+1)}},e}(G);const Xf=Symbol("MEMOIZE_CLEAR_FUNCTION");function jf(n){const e={},t=function(){const r=Array.prototype.slice.call(arguments),s=Ea(r);return typeof e[s]=="undefined"&&(e[s]=n.apply(this,r)),e[s]}.bind(this);return t[Xf]=function(){const r=Array.prototype.slice.call(arguments),s=Ea(r);delete e[s]},t}const Iv=n=>e=>{let t=!1,r,s=[];const i=a=>{r=e(...a),t=!0,s=a};return(...a)=>{const o=a.length;if(t&&o===0)return r;if(!t||s.length!==o)return i(a),r;for(let l=0;l<o;l++)if(!n.equals(s[l],a[l]))return i(a),r;return r}};function Ea(n){if(!n.every(t=>typeof t=="number"||typeof t=="string"||typeof t=="boolean"))throw Error("Arguments to memoized function can only be strings or numbers");return JSON.stringify(n)}const La=jf(Uf.getTimezoneOffset),Vf=(n,e)=>new Date(e).getTimezoneOffset()*60*1e3+La(n,e);class Gf{constructor(e){this.config=e,this.timeZoneChangedSubject=new zf,this.currentTzOffset=t=>this.getOffset(this.config.timezone,t),this.formatterCache={},this.getOffset=(t,r)=>Vf(t,r),this.dateTimeFormatterFactory=this.initFormatterFactory(this.config.dateFormatter)}setTimeZone(e){this.config.timezone=e,this.formatterCache={},this.timeZoneChangedSubject.next(e)}observeTimeZoneChanged(){return this.timeZoneChangedSubject.asObservable()}initFormatterFactory(e){let t;if(e&&typeof e=="function")t=e;else if(e&&e.createFormatterFunction&&typeof e.createFormatterFunction=="function"){const r=e.createFormatterFunction;t=s=>r(s).bind(e)}else t=Dh(this.config,this.tzOffset);return t}getFormatterFactory(){return this.dateTimeFormatterFactory}getDateTimeFormatter(e){return this.formatterCache[e]===void 0&&(this.formatterCache[e]=this.dateTimeFormatterFactory(e)),this.formatterCache[e]}tzOffset(e){const t=s=>-new Date(s).getTimezoneOffset()*$f;let r;return e?r=s=>La(e,s):r=t,s=>new Date(+s+r(s)-t(s))}}const $f=60*1e3;class Zt{constructor(e,t={}){this.components=[],this.chartComponents=[],this.userInputListenerComponents=[],this.canvasModels=[];var r,s;this.parentElement=e;const i=t;Uo(i),this.config=i;const a=dl(i);e.innerHTML="",e.appendChild(a.content),this.id=(r=e.getAttribute("data-id"))!=null?r:"",i.fixedSize&&(e.style.width=i.fixedSize.width+"px",e.style.height=i.fixedSize.height+"px");const o=new Gf(i);this.timeZoneModel=o;const l=this.timeZoneModel.getFormatterFactory(),c=ul(e);this.elements=c;const h=new uf;this.bus=h;const v=new vf(e,(s=c.chartResizer)!=null?s:e,h,this.canvasModels,i);this.chartResizeHandler=v,v.subscribeResize(),this.components.push(v.unsubscribeAnimationUpdate.bind(v));const p=new Gc(h,v);this.drawingManager=p;const y=jc(h,c.mainCanvas,c.chartResizer,this.config.components.chart.type,this.config,p,this.canvasModels);this.mainCanvasModel=y;const E=wt(h,c.overDataSeriesCanvas,i,p,this.canvasModels,c.chartResizer);this.overSeriesCanvasModel=E;const R=new Et(E);p.addDrawer(R,"OVER_SERIES_CLEAR"),this.dataSeriesCanvasModel=wt(h,c.dataSeriesCanvas,i,p,this.canvasModels,c.chartResizer);const N=new Et(this.dataSeriesCanvasModel);p.addDrawer(N,"SERIES_CLEAR");const k=wt(h,c.yAxisLabelsCanvas,i,p,this.canvasModels,c.chartResizer),U=new Xn(i,h,y,l,v);this.canvasBoundsContainer=U;const Z=c.mainCanvas.parentElement;if(Z===null)throw new Error("Couldn't get main canvas parent");const K=new xn(h,Z);this.canvasInputListener=K,this.chartComponents.push(this.canvasInputListener);const q=new Nh(h,c.hitTestCanvas,K,U,p,i,this.canvasModels,c.chartResizer);this.hitTestCanvasModel=q;const $=new Et(q);p.addDrawer($,"HIT_TEST_CLEAR");const J=new Co(h);this.canvasAnimation=J;const ne=new ei(i,()=>U.getBounds(Y.CHART),J);this.scaleModel=ne;const oe=wt(h,c.backgroundCanvas,i,p,this.canvasModels,c.chartResizer,{willReadFrequently:!0});this.backgroundCanvasModel=oe,this.cursorHandler=new ll(c.canvasArea,K,U,q),this.chartComponents.push(this.cursorHandler),this.crossEventProducer=new _f(K,U),this.chartComponents.push(this.crossEventProducer);const le=new Yl("candle"),re=new wd(h,ne,U,i,J,K,Z,le);this.chartPanComponent=re,this.chartComponents.push(re),this.userInputListenerComponents.push(re.chartAreaPanHandler);const ce=new Yd(le,this.userInputListenerComponents,h,ne,U,i,J,K,p,this.dataSeriesCanvasModel,this.cursorHandler,this.crossEventProducer,re,y);this.paneManager=ce,this.chartComponents.push(ce),this.chartModel=new ph(le,ce,h,this.dataSeriesCanvasModel,i,ne,l,Z,U,v);const fe=new rh(this.chartModel,this.dataSeriesCanvasModel,i,ne,U,p,q,K,oe,re,ce,this.cursorHandler);this.chartComponents.push(fe),this.chartComponent=fe;const de=this.chartComponent.chartModel;this.chartModel=de,this.canvasBoundsContainer.setMainCandleSeries(this.chartModel.mainCandleSeries),q.addSubscriber(ce.hitTestController),this.xAxisComponent=new Nu(h,i,y,fe,ne,U,K,v,this.drawingManager,o,re,this.cursorHandler,oe),this.chartComponents.push(this.xAxisComponent),this.userInputListenerComponents.push(this.xAxisComponent.xAxisScaleHandler);const ue=new Et(y);p.addDrawer(ue,"MAIN_CLEAR");const pe=new ff(Z,de,K,i);this.chartComponents.push(pe),this.watermarkComponent=new eu(ce,de,h,i,U,E,p),this.chartComponents.push(this.watermarkComponent);const me=wt(h,c.crossToolCanvas,i,p,this.canvasModels,c.chartResizer);this.highlightsComponent=new sd(h,i,de,y,U,p),this.chartComponents.push(this.highlightsComponent),i.useUTCTimeOverride&&i.dateFormatter&&!i.dateFormatter.utcTimeOverride&&(i.dateFormatter.utcTimeOverride=this.createUTCTimeOverrideConfig(de)),this.navigationMapComponent=new fd(h,de,y,i,K,U,p,l,re,this.cursorHandler),this.chartComponents.push(this.navigationMapComponent),this.userInputListenerComponents.push(this.navigationMapComponent.navigationMapMoveHandler);const Fe=new qh(i,this.dataSeriesCanvasModel,de,U,p);this.chartComponents.push(Fe),this.yAxisComponent=new df(h,i,y,k,oe,de,ne,this.canvasInputListener,U,this.drawingManager,re,ce,this.cursorHandler),this.chartComponents.push(this.yAxisComponent),this.userInputListenerComponents.push(this.yAxisComponent.yAxisScaleHandler),this.volumesComponent=new $d(this.dataSeriesCanvasModel,fe,ne,U,p,i,ce,this.yAxisComponent),this.chartComponents.push(this.volumesComponent);const Ye=new Ri(y,ne,i,"GRID",p,()=>this.canvasBoundsContainer.getBounds(Y.ALL_PANES),()=>this.canvasBoundsContainer.getBounds(Y.PANE_UUID(ae)),()=>this.xAxisComponent.xAxisLabelsGenerator.labels,()=>this.yAxisComponent.yAxisModel.yAxisBaseLabelsModel.labels,()=>this.chartModel.toY(this.chartModel.getBaseLine()),()=>i.components.grid.visible);this.chartComponents.push(Ye),this.hoverProducer=new Ff(this.crossEventProducer,ne,i,de,K,this.canvasBoundsContainer,this.paneManager,o,l),this.chartComponents.push(this.hoverProducer),this.crossToolComponent=new _h(i,me,U,p,ce,this.crossEventProducer,this.hoverProducer),this.chartComponents.push(this.crossToolComponent);const He=wt(h,c.snapshotCanvas,i,p,this.canvasModels,c.chartResizer),ut=new Hd(this.elements,He);this.snapshotComponent=ut,this.chartComponents.push(ut);const Mn=new $h(i,E,q,de,U,p,l,this.cursorHandler,oe);this.eventsComponent=Mn,this.chartComponents.push(Mn),this.chartComponents.forEach(nv=>nv.activate()),this.enableUserControls(),p.reorderDrawers(i.drawingOrder),this.clearer=So(this.components)}createUTCTimeOverrideConfig(e){const t=new RegExp("HH|H|mm|m|s|ss|sss|SSS");return{pattern:"MM/dd/YY",test:r=>t.test(r)&&(e.getPeriod()||0)>=86400}}static mergeConfig(e,t){for(const r in t)r in e?typeof e[r]=="object"&&Zt.mergeConfig(e[r],t[r]):e[r]=t[r];return e}getConfig(){return this.config}setRtl(e){this.config.rtl=e,this.bus.fire(Xt)}setChartType(e){this.chartComponent.setChartType(e)}disableUserControls(){this.userInputListenerComponents.forEach(e=>e.deactivate()),this.hitTestCanvasModel.disableUserControls()}enableUserControls(){this.userInputListenerComponents.forEach(e=>e.activate()),this.hitTestCanvasModel.enableUserControls()}setGridConfig(e){var t,r,s,i,a;const o=this.config.components.grid;o.visible=(t=e.visible)!=null?t:!1,o.dash=(r=e.dash)!=null?r:[0,0],o.width=(s=e.width)!=null?s:1,o.color=(i=e.color)!=null?i:"#FFFFFF",this.config.colors.chartAreaTheme.gridColor=(a=e.color)!=null?a:"#FFFFFF",this.redraw()}setGridVisible(e){this.config.components&&this.config.components.grid&&(this.config.components.grid.visible=e,this.redraw())}setGridVertical(e){this.config.components.grid.vertical=e,this.redraw()}setGridHorizontal(e){this.config.components.grid.horizontal=e,this.redraw()}deactivate(){this.clearer(),this.disableUserControls(),this.chartComponents.forEach(e=>e.deactivate())}redraw(){this.bus.fireDraw()}getOffsets(){return this.config.components&&this.config.components.offsets}showSeparateVolumes(e=!1){this.volumesComponent&&(this.volumesComponent.setShowVolumesSeparatly(e),this.canvasBoundsContainer.updateYAxisWidths())}setAutoScale(e=!0){this.scaleModel.autoScale(e)}setShowCandleBorders(e=!0){this.config.components&&this.config.components.chart&&(this.config.components.chart.showCandlesBorder=e,this.redraw())}valueToY(e){return this.chartModel.toY(e)}setHighLowVisible(e=!0){this.config.components&&this.config.components.highLow&&(this.config.components.highLow.visible=e,this.redraw())}setCrossToolVisible(e="cross-and-labels"){this.config.components&&this.config.components.crossTool&&(this.config.components.crossTool.type=e,this.redraw())}setHighlightsVisible(e=!0){var t;(t=this.config.components)!=null&&t.highlights&&(this.config.components.highlights.visible=e,this.redraw())}setHighlightsData(e){this.highlightsComponent.setHighlights(e)}setColors(e){Ge(this.config.colors,e,{addIfMissing:!0,overrideExisting:!0}),this.redraw()}addMouseMoveOnChartElementHandler(e,t){const r=this.canvasBoundsContainer.getBoundsHitTest(e),s=this.canvasInputListener.observeMouseMove(r).subscribe(t);return()=>s.unsubscribe()}addMouseEnterOnChartElementHandler(e,t,r=!1){const s=this.canvasBoundsContainer.getBoundsHitTest(e),i=this.canvasInputListener.observeMouseEnter(s,r).subscribe(t);return()=>i.unsubscribe()}addClickOnChartElementHandler(e,t){const r=this.canvasBoundsContainer.getBoundsHitTest(e),s=this.canvasInputListener.observeClick(r).subscribe(t);return()=>s.unsubscribe()}addDragEventsListener(e,t){const r=this.canvasBoundsContainer.getBoundsHitTest(e),s=Me(this.canvasInputListener.observeYDrag(r),this.canvasInputListener.observeXDrag(r)).subscribe(t);return()=>s.unsubscribe()}destroy(){this.bus.setMuted(!0),this.chartComponents.forEach(e=>e.disable()),this.parentElement.childNodes.forEach(e=>e.remove()),this.parentElement.style.width="",this.parentElement.style.height=""}registerComponent(e,t){const r=e(this);this.components.push(r),t&&t(r),r.activate()}registerPaneFormatters(e,t){var r;(r=this.paneManager.paneComponents[e])==null||r.setPaneValueFormatters(t)}}var Zf=Object.defineProperty,Kf=Object.defineProperties,qf=Object.getOwnPropertyDescriptors,Ia=Object.getOwnPropertySymbols,Jf=Object.prototype.hasOwnProperty,Qf=Object.prototype.propertyIsEnumerable,Oa=(n,e,t)=>e in n?Zf(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,ev=(n,e)=>{for(var t in e||(e={}))Jf.call(e,t)&&Oa(n,t,e[t]);if(Ia)for(var t of Ia(e))Qf.call(e,t)&&Oa(n,t,e[t]);return n},tv=(n,e)=>Kf(n,qf(e));const Ba=(n,e={})=>new Zt(n,e);window.DXChart=tv(ev({},window.DXChart),{ChartBootstrap:Zt,createChart:Ba})})(),rv=Pn})();})();
|
|
26
|
+
`;function dl(n){const e=document.createElement("template");return e.innerHTML=hl(n.devexpertsPromoLink),e}function ul(n){const e={},t=Array.from(n.querySelectorAll("[data-element]"));if(t.length!==0&&t.forEach(r=>{var s;e[(s=r.getAttribute("data-element"))!=null?s:""]=r}),cl(e))return e;throw new Error("Some chart elements are missing")}function fl(n){if(n.length>1){const e=n.reduce((s,i,a)=>{if(a!==n.length-1){const o=n[a+1].timestamp-i.timestamp;s[o]?s[o]++:s[o]=1}return s},{});let t=0,r;for(const s of Object.keys(e)){const i=parseInt(s,10),a=e[i];a>t&&i>0&&(t=a,r=i)}if(r)return r}}const kt=(n,e,t,r=1e3)=>{var s,i,a,o;const l=(i=(s=Yt(t))==null?void 0:s.timestamp)!=null?i:0,c=(o=(a=Ue(t))==null?void 0:a.timestamp)!=null?o:0;return n>c?e?{index:t.length-1+Math.ceil((n-c)/r),exact:!0}:{index:t.length-1,exact:!0}:n<l?e?{index:ve((n-l)/r),exact:!0}:{index:-1,exact:!0}:ct(t,n,h=>h.timestamp)},Vn=1;function sn(n,e){return e===n?"none":e>n?"up":"down"}function vl(n,e){return e>n?"up":"down"}function gl(n,e,t=!1){const{expansion:r,impVolatility:s,vwap:i,volume:a,timestamp:o}=n;let l=n.hi,c=n.lo,h=n.open;const v=n.close;t&&(l=v,c=v,h=v);let p=n.idx;return e!==void 0&&(p=e),{hi:l,lo:c,open:h,close:v,timestamp:o,volume:a,expansion:r,idx:p,impVolatility:s,vwap:i}}const ys={color:"#FF00FF",lineWidth:1,hoveredLineWidth:2},ws={paintConfig:[ys],type:"LINEAR",highLowActive:!0,visible:!0,labelLastValue:"viewport",labelMode:"label",labelAppearanceType:"badge"};var pl=Object.defineProperty,Ss=Object.getOwnPropertySymbols,ml=Object.prototype.hasOwnProperty,bl=Object.prototype.propertyIsEnumerable,xs=(n,e,t)=>e in n?pl(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Cl=(n,e)=>{for(var t in e||(e={}))ml.call(e,t)&&xs(n,t,e[t]);if(Ss)for(var t of Ss(e))bl.call(e,t)&&xs(n,t,e[t]);return n};class yl{constructor(e,t,r,s){this.series=e,this.config=t,this.yAxisBoundsProvider=r,this.axisState=s}getUnorderedLabels(){if(this.config.visible){const t=this.config.labelLastValue==="series"?this.series.getLastDataSeriesPoint:this.series.getLastVisualSeriesPoint,r=this.yAxisBoundsProvider(),s=this.config.labelMode,i=this.config.labelAppearanceType,a=t();if(a!==void 0){const o=this.series.view.toY(a.close);if(isFinite(o)){const l=this.series.valueFormatter(a.close),c=this.getLabelDrawConfig();return[{labels:[Cl({y:o,description:this.series.name,mode:s,labelType:i,labelText:l},c)],axisState:this.axisState,bounds:r}]}}}return[]}getLabelDrawConfig(){var e;const t=this.series.config,s=((e=t.paintConfig[0])!=null?e:ys).color;return{textColor:Ht(s,"white","black"),bgColor:s,paddingBottom:t.labelPaddingBottom,paddingEnd:t.labelPaddingEnd,paddingTop:t.labelPaddingTop}}}let $e=window.devicePixelRatio,an=window.matchMedia(`screen and (resolution: ${window.devicePixelRatio}dppx)`);const Gn=()=>{an.removeEventListener("change",Gn),$e=window.devicePixelRatio,an=window.matchMedia(`screen and (resolution: ${window.devicePixelRatio}dppx)`),an.addEventListener("change",Gn)};an.addEventListener("change",Gn);const wl=()=>$e,Sl=n=>pt($e*n)/$e,se=n=>ve($e*n)/$e,Ms=n=>lo($e*n)/$e,Wt=n=>JSON.parse(JSON.stringify(n));function $n(n){return Object.entries(n)}const Ps=(n,e)=>{for(const[t,r]of Array.from(n.entries()))if(r===e)return t};function Ts(n){return Object.keys(n)}function _s(n,e){if(Object.is(n,e))return!0;if(typeof n!="object"||n===null||typeof e!="object"||e===null)return!1;const t=Object.keys(n),r=Object.keys(e);if(t.length!==r.length)return!1;for(let s=0,i=t.length;s<i;s++)if(!hasOwnProperty.call(e,t[s])||!_s(n[t[s]],e[t[s]]))return!1;return!0}function As(n){n===void 0&&(n={});var e=n.connector,t=e===void 0?function(){return new G}:e,r=n.resetOnError,s=r===void 0?!0:r,i=n.resetOnComplete,a=i===void 0?!0:i,o=n.resetOnRefCountZero,l=o===void 0?!0:o;return function(c){var h,v,p,y=0,E=!1,R=!1,N=function(){v==null||v.unsubscribe(),v=void 0},k=function(){N(),h=p=void 0,E=R=!1},U=function(){var Z=h;k(),Z==null||Z.unsubscribe()};return w(function(Z,K){y++,!R&&!E&&N();var q=p=p!=null?p:t();K.add(function(){y--,y===0&&!R&&!E&&(v=Zn(U,l))}),q.subscribe(K),!h&&y>0&&(h=new vt({next:function($){return q.next($)},error:function($){R=!0,N(),v=Zn(k,s,$),q.error($)},complete:function(){E=!0,N(),v=Zn(k,a),q.complete()}}),Ke(Z).subscribe(h))})(c)}}function Zn(n,e){for(var t=[],r=2;r<arguments.length;r++)t[r-2]=arguments[r];if(e===!0){n();return}if(e!==!1){var s=new vt({next:function(){s.unsubscribe(),n()}});return Ke(e.apply(void 0,g([],P(t)))).subscribe(s)}}const on=(n,e)=>n/e,Pe=(n,e)=>n/e,tt=(n,e)=>n*e,Ds=(n,e)=>(n-e)*100/e,Es=(n,e)=>n*e/100+e,Ls=n=>Math.log2(n),Kn=n=>Math.pow(2,n);class xl extends te{constructor(){super(...arguments),this._xStart=0,this._xEnd=0,this._yStart=0,this._yEnd=0,this._zoomX=1,this._zoomY=1,this._inverseY=!1,this.changed=new G,this.xChanged=this.changed.pipe(ye(()=>({start:this.xStart,end:this.xEnd})),Ve((e,t)=>e.start===t.start&&e.end===t.end),As()),this.yChanged=this.changed.pipe(ye(()=>({start:this.yStart,end:this.yEnd})),Ve((e,t)=>e.start===t.start&&e.end===t.end),As())}toX(e){return this.getBounds().x+Pe(e-this.xStart,this.zoomX)}xPixels(e){return Pe(e,this.zoomX)}toY(e){return this.inverseY?this.getBounds().y+Pe(e-this.yStart,this.zoomY):this.getBounds().y+this.getBounds().height-Pe(e-this.yStart,this.zoomY)}yPixels(e){return Pe(e,this.zoomY)}fromX(e){const t=e-this.getBounds().x;return tt(t+Pe(this.xStart,this.zoomX),this.zoomX)}fromY(e){const t=e-this.getBounds().y;return this.inverseY?tt(t+Pe(this.yStart,this.zoomY),this.zoomY):tt(this.getBounds().height-t+Pe(this.yStart,this.zoomY),this.zoomY)}recalculateZoomX(){this.zoomX=this.calculateZoomX(this.xStart,this.xEnd)}recalculateZoomY(){this.zoomY=this.calculateZoomY(this.yStart,this.yEnd)}calculateZoomX(e,t){return on(t-e,this.getBounds().width)}calculateZoomY(e,t){return on(t-e,this.getBounds().height)}recalculateZoom(e=!0){this.recalculateZoomX(),this.recalculateZoomY(),e&&this.fireChanged()}setXScale(e,t,r=!0){this.xStart=e,this.xEnd=t,this.recalculateZoomX(),r&&this.fireChanged()}setYScale(e,t,r=!0){this.yStart=e,this.yEnd=t,this.recalculateZoomY(),r&&this.fireChanged()}export(){return{xStart:this.xStart,xEnd:this.xEnd,yStart:this.yStart,yEnd:this.yEnd,zoomX:this.zoomX,zoomY:this.zoomY,inverseY:this.inverseY}}apply(e){this.xStart=e.xStart,this.xEnd=e.xEnd,this.yStart=e.yStart,this.yEnd=e.yEnd,this.zoomX=e.zoomX,this.zoomY=e.zoomY,this.inverseY=e.inverseY,this.fireChanged()}fireChanged(){this.changed.next()}get xStart(){return this._xStart}set xStart(e){this._xStart=e}get xEnd(){return this._xEnd}set xEnd(e){this._xEnd=e}get yStart(){return this._yStart}set yStart(e){this._yStart=e}get yEnd(){return this._yEnd}set yEnd(e){this._yEnd=e}get zoomX(){return this._zoomX}set zoomX(e){this._zoomX=e}get zoomY(){return this._zoomY}set zoomY(e){this._zoomY=e}get inverseY(){return this._inverseY}set inverseY(e){this._inverseY=e}isViewportValid(){return this.xStart!==this.xEnd&&this.yStart!==this.yEnd&&isFinite(this.yStart)&&isFinite(this.yEnd)}}const Ml=(n,e)=>!Ts(n).some(t=>n[t]!==e[t]);class Pl{constructor(e,t){this.scaleModel=e,this.dataSeries=t,this.prevAnimationId=""}getBaselineForPercent(e){const t=this.scaleModel.currentAnimation;let r;if(t!=null&&t.animationInProgress){t.id!==this.prevAnimationId&&(this.initialBaseline=void 0,this.targetBaseline=void 0,this.prevAnimationId=t.id);const s=t.easingFn(t.getProgress());this.initialBaseline===void 0&&(this.initialBaseline=e(ct(this.dataSeries.visualPoints,t.xStart,i=>i.centerUnit).index)),this.targetBaseline===void 0&&(this.targetBaseline=e(ct(this.dataSeries.visualPoints,t.animationConfig.targetXStart,i=>i.centerUnit).index)),r=this.initialBaseline+(this.targetBaseline-this.initialBaseline)*s}else r=e();return r}}class Is{constructor(e,t,r,s){this.dataSeries=e,this.scaleModel=t,this.getAxisType=r,this.getBaseLine=s,this.toY=i=>this.scaleModel.toY(this.toAxisUnits(i)),this.toX=i=>this.scaleModel.toX(i),this.xPixels=i=>this.scaleModel.xPixels(i),this.yPixels=i=>this.scaleModel.yPixels(i),this.percentAnimationHandler=new Pl(this.scaleModel,this.dataSeries)}toAxisUnits(e,t=this.getBaseLine){switch(this.getAxisType()){case"percent":const r=this.percentAnimationHandler.getBaselineForPercent(t);return Ds(e,r);case"logarithmic":return Ls(e);case"regular":return e}}priceFromY(e){const t=this.scaleModel.fromY(e);return this.fromAxisUnits(t)}fromAxisUnits(e){switch(this.getAxisType()){case"percent":return Es(e,this.getBaseLine());case"logarithmic":return Kn(e);case"regular":return e}}}var Tl=Object.defineProperty,_l=Object.defineProperties,Al=Object.getOwnPropertyDescriptors,Os=Object.getOwnPropertySymbols,Dl=Object.prototype.hasOwnProperty,El=Object.prototype.propertyIsEnumerable,Bs=(n,e,t)=>e in n?Tl(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Ll=(n,e)=>{for(var t in e||(e={}))Dl.call(e,t)&&Bs(n,t,e[t]);if(Os)for(var t of Os(e))El.call(e,t)&&Bs(n,t,e[t]);return n},Il=(n,e)=>_l(n,Al(e));class Ut{constructor(e,t){this.centerUnit=e,this.close=t}y(e){return se(e.toY(this.close))}x(e){return se(e.toX(this.centerUnit))}clone(){return new Ut(this.centerUnit,this.close)}}class Rs extends te{constructor(e,t,r=Wt(ws)){var s;super(),this.extentComponent=e,this.id=t,this.name="",this.hovered=!1,this._dataPoints=[],this.pricePrecisions=[2],this.linkedDataSeriesModels=[],this._dataPointsFlat=[],this._visualPoints=[],this._visualPointsFlat=[],this.dataIdxStart=0,this.dataIdxEnd=0,this.getPaintConfig=i=>{var a;return(a=this.config.paintConfig[i])!=null?a:this.config.paintConfig[0]},this.getBaseLine=(i=this.dataIdxStart)=>{var a,o;return(o=(a=this.visualPoints[i])==null?void 0:a.close)!=null?o:1},this.getTextForPoint=i=>`${i.close}`,this.getLastVisualSeriesPoint=()=>{const i=this.visualPoints,a=ct(i,this.scaleModel.xEnd,o=>o.centerUnit).index;return i[a]},this.getLastDataSeriesPoint=()=>{const i=this.visualPoints;return Ue(i)},this.config=Ge(r,ws),this.scaleModel=e.scaleModel,this.view=new Is(this,this.scaleModel,()=>this.extentComponent.getAxisType(),this.getBaseLine),this.yAxisLabelProvider=new yl(this,this.config,e.getYAxisBounds,(s=e.yAxisComponent)==null?void 0:s.state),this.highLowProvider=Bl(this),e.addDataSeries(this),this.activate()}get dataPoints2D(){return this._dataPoints}get dataPoints(){return this._dataPointsFlat}set dataPoints(e){this._dataPoints=Kr(e),this._dataPointsFlat=this._dataPoints.flat(),this.visualPoints=this._toVisualPoints(this._dataPoints)}get visualPoints(){return this._visualPointsFlat}get visualPoints2D(){return this._visualPoints}set visualPoints(e){this._visualPoints=Kr(e),this._visualPointsFlat=this._visualPoints.flat()}doActivate(){this.addRxSubscription(this.scaleModel.xChanged.subscribe(()=>this.recalculateDataViewportIndexes())),this.addRxSubscription(this.scaleModel.scaleInversedSubject.subscribe(()=>this.recalculateVisualPoints()))}setDataPoints(e){this.dataPoints=e,this.extentComponent.paneComponent.updateView()}_toVisualPoints(e){return e.map(t=>this.toVisualPoints(t))}moveToExtent(e){var t;this.extentComponent.removeDataSeries(this),this.extentComponent=e,this.scaleModel=e.scaleModel,this.view=new Is(this,this.scaleModel,()=>this.extentComponent.getAxisType(),this.getBaseLine),this.yAxisLabelProvider.yAxisBoundsProvider=e.getYAxisBounds,this.yAxisLabelProvider.axisState=(t=e.yAxisComponent)==null?void 0:t.state,this.deactivate(),this.activate(),e.addDataSeries(this)}toVisualPoints(e){return e.map((t,r)=>({centerUnit:r,close:t.close}))}setType(e){this.config.type=e,this.extentComponent.dataSeriesCanvasModel.fireDraw()}recalculateVisualPoints(){this.visualPoints=this._toVisualPoints(this.dataPoints2D)}recalculateDataViewportIndexes(e=this.scaleModel.xStart,t=this.scaleModel.xEnd){const{dataIdxStart:r,dataIdxEnd:s}=this.calculateDataViewportIndexes(e,t);this.dataIdxStart=r,this.dataIdxEnd=s}calculateDataViewportIndexes(e,t){const r=ct(this.visualPoints,e,i=>i.centerUnit).index,s=ct(this.visualPoints,t,i=>i.centerUnit).index;return{dataIdxStart:r,dataIdxEnd:s}}valueFormatter(e){return qn(e)}getSeriesInViewport(e,t){let r=this.dataIdxStart,s=this.dataIdxEnd;if(t!==void 0&&e!==void 0){const i=this.calculateDataViewportIndexes(e,t);r=i.dataIdxStart,s=i.dataIdxEnd}return To(this.visualPoints2D,r,s)}}const Ol=n=>{const e={high:Number.MIN_SAFE_INTEGER,low:Number.MAX_SAFE_INTEGER,highIdx:0,lowIdx:0};for(let t=0;t<n.length;t++){const r=n[t];r.close>e.high&&(e.high=r.close,e.highIdx=t),r.close<e.low&&(e.low=r.close,e.lowIdx=t)}return e},Bl=n=>({isHighLowActive:()=>n.config.highLowActive,calculateHighLow:e=>{const t=Ol(n.getSeriesInViewport(e==null?void 0:e.xStart,e==null?void 0:e.xEnd).flat());return Il(Ll({},t),{high:n.view.toAxisUnits(t.high),low:n.view.toAxisUnits(t.low)})}}),qn=n=>{const t=i=>Math.ceil(Math.log(Math.abs(i))*Math.LOG10E),s=((i,a=5)=>Math.max(0,a-Math.max(0,t(i))))(n);return we.makeDecimal(n,s)};class ln extends Ut{constructor(e,t,r,s,i,a,o,l,c=!1,h=!1,v=!1){super(e,s),this.startUnit=e-t/2,this.width=t,this.open=r,this.high=i,this.low=a,this.name=o,this.candle=l,this.hasBorder=c,this.isActive=h,this.isHollow=v}bodyHeight(e){return se(Math.abs(e.toY(this.open)-e.toY(this.close)))}candleHeight(e){return se(Math.abs(e.toY(this.high)-e.toY(this.low)))}bodyAsVLine(e){if(this.width<2)return[this.centerUnit,this.yLineStart(e),this.width,this.candleHeight(e)]}bodyRect(e){return[this.startUnit,this.yBodyStart(e),this.width,this.bodyHeight(e)]}getCandle(){return this.candle}yBodyKeyPoints(e){const t=se(e.toY(this.high)),r=se(e.toY(this.low)),s=se(e.toY(this.open)),i=se(e.toY(this.close)),[a,o]=s>i?[i,s]:[s,i],[l,c]=t>r?[r,t]:[t,r];return[l,a,o,c]}yLineEnd(e){return se(Math.max(e.toY(this.high),e.toY(this.low)))}yLineStart(e){return se(Math.min(e.toY(this.high),e.toY(this.low)))}yBodyStart(e){return se(Math.min(e.toY(this.open),e.toY(this.close)))}yBodyEnd(e){return se(Math.max(e.toY(this.open),e.toY(this.close)))}xCenter(e){return this.x(e)}xStart(e){return Sl(e.toX(this.startUnit))}}const At=60,Fs=(n,e,t,r,s=At)=>{const i=zt(n,r,s);i.volume=t;let a;if(e.length===0)a=0;else if(r>=e.length){const o=e[e.length-1],c=(r-(e.length-1))*t;a=o.centerUnit+c}else{const o=e[0],c=-r*t;a=o.centerUnit-c}return new ln(a,t,i.open,i.close,i.lo,i.hi,sn(i.open,i.close),i)},Rl=(n,e,t,r,s=At)=>{const i=Fl(n,r,s);let a;if(e.length===0)a=0;else if(r>=e.length){const o=e[e.length-1],c=(r-(e.length-1))*t;a=o.centerUnit+c}else{const o=e[0],c=-r*t;a=o.centerUnit-c}return new Ut(a,i.close)},zt=(n,e,t=At)=>({hi:NaN,lo:NaN,open:NaN,close:NaN,timestamp:Ys(n,e,t),volume:NaN,expansion:!0,idx:e}),Fl=(n,e,t=At)=>({close:NaN,timestamp:Ys(n,e,t)});function Ys(n,e,t=At){var r,s;const i=pt(e);if(n.length===0)return 0;const a=Ue(n);if(i>=n.length&&a)return Hs(a,n.length-1,i,t);const o=Yt(n);return i<0&&o?Hs(o,0,i,t):(s=(r=n[i])==null?void 0:r.timestamp)!=null?s:0}const Hs=(n,e,t,r=At)=>n.timestamp+(t-(e!=null?e:0))*r;class Yl{constructor(e){this.type=e,this.mainDataPoints=[],this.mainVisualPoints=[],this.dataUpdatedSubject=new G,this.dataSetSubject=new G,this.dataRemovedSubject=new G,this.dataPrependSubject=new G,this.meanDataWidth=1,this.period=1}dataFromTimestamp(e,t=!0){const r=kt(e,t,this.mainDataPoints,this.period);return this.dataFromIdx(r.index)}recalculatePeriod(){const e=fl(this.mainDataPoints);e&&(this.period=e)}dataFromIdx(e){const t=this.mainVisualPoints[e];return t||(this.type==="candle"?Fs(this.mainDataPoints,this.mainVisualPoints,this.meanDataWidth,e,this.period):Rl(this.mainDataPoints,this.mainVisualPoints,this.meanDataWidth,e,this.period))}}var Hl=Object.defineProperty,Ns=Object.getOwnPropertySymbols,Nl=Object.prototype.hasOwnProperty,kl=Object.prototype.propertyIsEnumerable,ks=(n,e,t)=>e in n?Hl(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Wl=(n,e)=>{for(var t in e||(e={}))Nl.call(e,t)&&ks(n,t,e[t]);if(Ns)for(var t of Ns(e))kl.call(e,t)&&ks(n,t,e[t]);return n};class Ul{constructor(e,t){this.canvasModel=e,this.config=t,this.prevState={},this.prevWidth=0,this.prevHeight=0}draw(){if(_s(this.config.colors.chartAreaTheme,this.prevState)&&this.prevHeight===this.canvasModel.height&&this.prevWidth===this.canvasModel.width)return;this.canvasModel.clear();const e=this.canvasModel.ctx;if(this.config.colors.chartAreaTheme.backgroundMode==="gradient"){const t=e.createLinearGradient(0,0,this.canvasModel.width,this.canvasModel.height);t.addColorStop(0,this.config.colors.chartAreaTheme.backgroundGradientTopColor),t.addColorStop(1,this.config.colors.chartAreaTheme.backgroundGradientBottomColor),e.fillStyle=t}else e.fillStyle=this.config.colors.chartAreaTheme.backgroundColor;e.fillRect(0,0,this.canvasModel.width,this.canvasModel.height),this.prevState=Wl({},this.config.colors.chartAreaTheme),this.prevWidth=this.canvasModel.width,this.prevHeight=this.canvasModel.height}getCanvasIds(){return[this.canvasModel.canvasId]}}const cn=(n,e,t,r,s,i,a)=>{const o=wl(),l=[t*o,r*o,s*o,i*o];let c=n.getImageData(...l);if(a!==void 0){const h=c.data[3]/255;if(h===1)for(let v=3;v<c.data.length;v+=4)c.data[v]=ve(c.data[v]*a);else for(let v=0;v<c.data.length;v++){const p=c.data[v];c.data[v]=v%4===3?ve(p*a):ve(h*p)}c=new ImageData(c.data,c.width,c.height,{colorSpace:c.colorSpace})}e.putImageData(c,l[0],l[1])},Ws=(n,{x:e,width:t,activeCandle:r})=>new ln(e,t,n.open,n.close,n.hi,n.lo,sn(n.open,n.close),n,!0,Jn(n,r)),zl=(n,{x:e,width:t,activeCandle:r,prevCandle:s})=>{var i;return new ln(e,t,n.open,n.close,n.hi,n.lo,vl((i=s==null?void 0:s.close)!=null?i:n.close,n.close),n,!0,Jn(n,r),n.close>n.open)},Xl=(n,{x:e,width:t,activeCandle:r,prevCandle:s})=>{var i;return new ln(e,t,n.open,n.close,n.hi,n.lo,sn((i=s==null?void 0:s.close)!=null?i:n.close,n.close),n,!0,Jn(n,r),n.close>n.open)},Jn=(n,e)=>{const t=e&&e.idx===n.idx;return t!=null?t:!1},Us=()=>Vn,bt=class{static autoDetectIncrementOfValueRange(n){const e=this.getDigitsInNumber(n);return n===0?.01:Math.pow(10,e-3)}static getDigitsInNumber(n){const e=r=>ve(Math.log10((r^r>>31)-(r>>31)))+1;let t=e(n);return t===1&&n<1&&(t=e(n*1e9)-9),t}static getPriceIncrement(n,e=[]){if(!this.validatePriceIncrementsOrPrecisions(e))return this.DEFAULT_INCREMENT;if(isNaN(n))return Math.round(e[0]);n=Math.abs(n);let t=1;const r=1e-6;for(;t<e.length&&n>e[t]+Math.min(e[t-1],e[t+1])*r;)t+=2;return t>=e.length||n<e[t]-Math.min(e[t-1],e[t+1])*r?e[t-1]:Math.min(e[t-1],e[t+1])}static getPricePrecision(n,e){if(!this.validatePriceIncrementsOrPrecisions(e))return 0;if(isNaN(n))return Math.round(e[0]);n=Math.abs(n);let t=1;for(;t<e.length&&n>e[t];)t+=2;return Math.round(e[t-1])}static roundPriceToIncrement(n,e,t){const r=bt.getPriceIncrement(t||n,e);return we.roundToNearest(n,r)}static computePrecisions(n){const e=[...n];for(let t=0;t<n.length;t+=2)e[t]=bt.calculatePrecision(n[t]);for(let t=1;t<n.length;t+=2)e[t]=n[t]+Math.min(n[t-1],n[t+1])*bt.RELATIVE_EPS;return e}static calculatePrecision(n){let e=n>1?Math.abs(Math.floor(n)-n):n;for(let t=0;t<bt.MAXIMUM_PRECISION;t++){const r=Math.floor(e+.5),s=Math.abs(e*bt.RELATIVE_EPS);if(r>=e-s&&r<=e+s)return t;e*=10}return bt.MAXIMUM_PRECISION}static validatePriceIncrementsOrPrecisions(n){return!(n.length===0||!Array.isArray(n)||n.findIndex(e=>e!==0)===-1)}};let ze=bt;ze.DEFAULT_INCREMENT=.01,ze.DEFAULT_PRECISION=2,ze.RELATIVE_EPS=1e-8,ze.MAXIMUM_PRECISION=10;var jl=Object.defineProperty,Vl=Object.defineProperties,Gl=Object.getOwnPropertyDescriptors,zs=Object.getOwnPropertySymbols,$l=Object.prototype.hasOwnProperty,Zl=Object.prototype.propertyIsEnumerable,Xs=(n,e,t)=>e in n?jl(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Kl=(n,e)=>{for(var t in e||(e={}))$l.call(e,t)&&Xs(n,t,e[t]);if(zs)for(var t of zs(e))Zl.call(e,t)&&Xs(n,t,e[t]);return n},ql=(n,e)=>Vl(n,Gl(e));const Jl=n=>({isHighLowActive:()=>!0,calculateHighLow:e=>{const t=e?e.xStart:n.scaleModel.xStart,r=e?e.xEnd:n.scaleModel.xEnd,{dataIdxStart:s,dataIdxEnd:i}=n.calculateDataViewportIndexes(t,r),a=n.visualPoints.slice(s,i+1),o=js(a),l=()=>{var c,h;return(h=(c=n.visualPoints[s])==null?void 0:c.close)!=null?h:1};return ql(Kl({},o),{low:n.view.toAxisUnits(o.low,l),high:n.view.toAxisUnits(o.high,l)})}}),js=n=>{const e={high:Number.MIN_SAFE_INTEGER,low:Number.MAX_SAFE_INTEGER,highIdx:0,lowIdx:0};for(let t=0;t<n.length;t++){const r=n[t];r.high>e.high&&(e.high=r.high,e.highIdx=t),r.low<e.low&&(e.low=r.low,e.lowIdx=t)}return e},Ql=30,ec=(n,e,t)=>{const r=n.startViewportMovementAnimation(e,{duration:Ql,targetXStart:t.xStart,targetXEnd:t.xEnd,targetYStart:t.yStart,targetYEnd:t.yEnd,targetZoomX:t.zoomX,targetZoomY:t.zoomY});e.currentAnimation=r};class tc{constructor(e,t){this.delegate=e,this.auto=!0,this.highLowPostPorcessor={},this.highLowProviders=t!=null?t:{}}setHighLowProvider(e,t){this.highLowProviders[e]=t}deleteHighLowProvider(e){delete this.highLowProviders[e]}setHighLowPostProcessor(e,t){this.highLowPostPorcessor[e]=t}setAutoAndRecalculateState(e,t){this.auto=t,t&&nc(this.delegate,e,Object.values(this.highLowProviders),Object.values(this.highLowPostPorcessor))}}const nc=(n,e,t,r)=>{const s=t.filter(o=>o.isHighLowActive()).map(o=>o.calculateHighLow(e)),i=Vs(s),a=r.reduce((o,l)=>l(o),i);e.yStart=a.low,e.yEnd=a.high,e.zoomY=n.calculateZoomY(e.yStart,e.yEnd)};function Vs(n){if(n.length===0)return rc();let e=n[0].high,t=n[0].low;return n.forEach(r=>{isFinite(r.high)&&r.high>=e&&(e=r.high),isFinite(r.low)&&r.low<=t&&(t=r.low)}),{low:t,high:e}}const rc=()=>({high:Number.MIN_SAFE_INTEGER,low:Number.MAX_SAFE_INTEGER});var sc=Object.defineProperty,Gs=Object.getOwnPropertySymbols,ic=Object.prototype.hasOwnProperty,ac=Object.prototype.propertyIsEnumerable,$s=(n,e,t)=>e in n?sc(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Zs=(n,e)=>{for(var t in e||(e={}))ic.call(e,t)&&$s(n,t,e[t]);if(Gs)for(var t of Gs(e))ac.call(e,t)&&$s(n,t,e[t]);return n};const oc=(n,e,t,r)=>{var s,i,a,o;const l=Zs({},n),c=(i=(s=e[t])==null?void 0:s.startUnit)!=null?i:0,h=(o=(a=_o(-t,e))==null?void 0:a.startUnit)!=null?o:0;let v=n.xStart,p=n.xEnd;return l.xStart>=h&&(v=h,p=p-(l.xStart-h)),l.xEnd<c&&(v=c-tt(r.width,l.zoomX),p=c),l.xStart=v,l.xEnd=p,l},lc=(n,e,t,r)=>{const s=Zs({},e),i=r(),a=s.xEnd-s.xStart,o=a<t.minCandles,l=i.width/t.minWidth,c=a>l;if(i.width>0){if(c)return s.xStart=s.xEnd-l,s.zoomX=on(s.xEnd-s.xStart,i.width),s;if(o)return s.xEnd=n.xEnd,s.xStart=s.xEnd-t.minCandles,s.zoomX=on(s.xEnd-s.xStart,i.width),s}return s},cc=(n,e)=>n/e,hc=(n,e)=>n/e,wv=(n,e)=>n*e,Ks=(n,e)=>{const t=n.zoomY;n.zoomY=hc(n.zoomX,e);const r=n.zoomY/t,s=n.yEnd-n.yStart,a=s*r-s;n.yEnd=n.yEnd+a},dc=(n,e)=>{const t=n.xStart;n.xStart=e,n.xEnd=n.xEnd+(e-t)},uc=(n,e)=>{const t=n.yStart;n.yStart=e,n.yEnd=n.yEnd+(e-t)},qs=(n,e,t,r,s)=>{const i=(e.xEnd-e.xStart)*r,a=i*t,o=i*(1-t);return s?(e.xStart=e.xStart+a,e.xEnd=e.xEnd-o):(e.xStart=e.xStart-a,e.xEnd=e.xEnd+o),e.zoomX=n.calculateZoomX(e.xStart,e.xEnd),e},fc=(n,e,t,r)=>qs(n,e,1,t,r);var vc=Object.defineProperty,Js=Object.getOwnPropertySymbols,gc=Object.prototype.hasOwnProperty,pc=Object.prototype.propertyIsEnumerable,Qs=(n,e,t)=>e in n?vc(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,hn=(n,e)=>{for(var t in e||(e={}))gc.call(e,t)&&Qs(n,t,e[t]);if(Js)for(var t of Js(e))pc.call(e,t)&&Qs(n,t,e[t]);return n};const mc=()=>({high:Number.NEGATIVE_INFINITY,low:Number.POSITIVE_INFINITY,highIdx:0,lowIdx:0});class ei extends xl{constructor(e,t,r){super(),this.config=e,this.getBounds=t,this.canvasAnimation=r,this.scaleInversedSubject=new G,this.history=[],this.zoomXYRatio=0,this.xConstraints=[],this.scalePostProcessor=(s,i)=>this.xConstraints.reduce((a,o)=>o(s,a),i),this.state=Wt(e.scale),this.autoScaleModel=new tc(this),this.offsets=this.config.components.offsets,this.addXConstraint((s,i)=>lc(s,i,this.config.components.chart,this.getBounds))}addXConstraint(e){this.xConstraints=[...this.xConstraints,e]}updateOffsets(e){this.offsets=hn(hn({},this.offsets),e),this.doAutoScale(!0)}getOffsets(){return this.offsets}zoomXToPercent(e,t,r=!1,s=this.config.scale.zoomSensitivity){this.config.components.yAxis.type==="percent"&&this.haltAnimation();const i=this.export();qs(this,i,e,s,t),this.zoomXTo(i,r)}zoomXToEnd(e,t=this.config.scale.zoomSensitivity){this.config.components.yAxis.type==="percent"&&this.haltAnimation();const r=this.export();fc(this,r,t,e),this.zoomXTo(r)}haltAnimation(){var e;(e=this.currentAnimation)!=null&&e.animationInProgress&&(this.currentAnimation.finishAnimation(),this.doAutoScale())}zoomXTo(e,t){const r=hn({},e),s=this.scalePostProcessor(r,e);this.state.lockPriceToBarRatio&&Ks(s,this.zoomXYRatio),this.state.auto&&this.autoScaleModel.setAutoAndRecalculateState(s,!0),t?this.apply(s):ec(this.canvasAnimation,this,s)}setXScale(e,t){const r=this.export();super.setXScale(e,t,!1);const s=this.export(),i=this.scalePostProcessor(r,s);this.state.lockPriceToBarRatio&&Ks(i,this.zoomXYRatio),this.state.auto&&this.autoScaleModel.setAutoAndRecalculateState(i,!0),this.apply(i)}moveXStart(e){const t=this.export(),r=hn({},t);this.haltAnimation(),dc(t,e);const s=this.scalePostProcessor(r,t);this.state.auto&&this.autoScaleModel.setAutoAndRecalculateState(s,!0),this.apply(s)}moveYStart(e){if(this.haltAnimation(),!this.state.auto){const t=this.export();uc(t,e),this.apply(t)}}doAutoScale(e=!1){if(!this.isViewportAnimationInProgress()&&this.state.auto||e){const t=this.export();this.autoScaleModel.setAutoAndRecalculateState(t,!0),Ml(t,this.export())||this.apply(t)}}isViewportAnimationInProgress(){const e=this.currentAnimation;return e==null?void 0:e.animationInProgress}pushToHistory(e){this.history.push(e)}popFromHistory(){return this.history.pop()}clearHistory(){this.history=[]}isDefaultXBounds(){return this.xStart===0&&this.xEnd===0}isDefaultYBounds(){return this.yStart===0&&this.yEnd===0}isScaleReady(){return!this.isDefaultXBounds()&&!this.isDefaultYBounds()}autoScale(e=!0){this.config.components.yAxis.type==="percent"?this.state.auto=!0:this.state.auto=e,e&&(this.clearHistory(),this.doAutoScale())}setLockPriceToBarRatio(e=!1){const{type:t}=this.config.components.yAxis;if(t==="percent"||t==="logarithmic"){this.state.lockPriceToBarRatio=!1;return}e&&this.recalculateZoomXYRatio(),this.state.lockPriceToBarRatio=e}recalculateZoomXYRatio(){this.zoomXYRatio=cc(this.zoomX,this.zoomY)}}class bc extends ei{constructor(e,t,r,s){super(t,r,s),this.delegate=e,this.config=t,this.getBounds=r}doActivate(){this.addRxSubscription(this.delegate.xChanged.subscribe(()=>this.doAutoScale(this.state.auto)))}get xStart(){return this.delegate.xStart}set xStart(e){this.delegate.xStart=e}get xEnd(){return this.delegate.xEnd}set xEnd(e){this.delegate.xEnd=e}get zoomX(){return this.delegate.zoomX}set zoomX(e){this.delegate.zoomX=e}observeXChanged(){return this.delegate.xChanged}fireChanged(){this.delegate.changed.next(),this.changed.next()}}const Cc=tn().colors;class ht extends Rs{constructor(e,t,r,s,i,a,o,l=Cc){super(e,t),this.eventBus=r,this.candlesTransformersByChartType=a,this.candleWidthByChartType=o,this.colors=l,this.zippedHighLow=mc(),this.lastPriceMovement="none",this.lastVisualCandleChangedSubject=new G,this.meanCandleWidth=Vn,this._instrument=i,this.instrument=i,this.highLowProvider=Jl(this),this.scaleModel=s,this.name=i.symbol}get dataPoints(){return super.dataPoints}set dataPoints(e){super.dataPoints=e,this.applyPriceMovement()}get instrument(){return this._instrument}set instrument(e){var t;this._instrument=e,this.pricePrecisions=ze.computePrecisions((t=e.priceIncrements)!=null?t:[.01])}recalculateDataViewportIndexes(e=this.scaleModel.xStart,t=this.scaleModel.xEnd){super.recalculateDataViewportIndexes(e,t),this.recalculateZippedHighLow(),this.eventBus.fireDraw()}applyPriceMovement(){const e=Ue(this.dataPoints);e&&(this.lastPriceMovement=sn(e.open,e.close))}recalculateVisualPoints(){super.recalculateVisualPoints(),this.recalculateMeanCandleWidth(this.visualPoints)}recalculateZippedHighLow(){return this.zippedHighLow=js(this.visualPoints.slice(this.dataIdxStart,this.dataIdxEnd))}updateCurrentPrice(e){this.previousPrice=this.currentPrice||e,this.currentPrice=e,this.currentPrice!==this.previousPrice&&(this.lastPriceMovement=this.currentPrice>this.previousPrice?"up":"down")}updateCandleSeriesColors(e){this.colors=Ge(e,this.colors),this.recalculateVisualPoints()}observeLastVisualCandleChanged(){return this.lastVisualCandleChangedSubject.asObservable()}doDeactivate(){super.doDeactivate()}toVisualPoints(e,t=0){var r,s;if(e.length===0)return[];const i=this.config.type,a=[];let o=t;const l=(r=this.candleWidthByChartType[i])!=null?r:Us;for(let c=0;c<e.length;c++){const h=e[c],v=e[c-1],p=l(h),y=o+p/2,E=(s=this.candlesTransformersByChartType[i])!=null?s:Ws;a.push(E(h,{x:y,width:p,prevCandle:v,activeCandle:this.activeCandle})),o+=p}return a}recalculateMeanCandleWidth(e){e.length!==0?this.meanCandleWidth=e.reduce((t,r)=>t+r.width,0)/e.length:this.meanCandleWidth=Vn}setActiveCandle(e){this.activeCandle=e,this.recalculateVisualPoints()}clearData(){this.dataPoints=[],this.clearVisualCandles(),this.clearPrices()}clearPrices(){this.previousPrice=void 0,this.currentPrice=void 0,this.lastPriceMovement="none"}clearVisualCandles(){this.visualPoints=[]}}function Sv(n){switch(n){case"line":case"area":return!0;default:return!1}}class yc{constructor(e){this.config=e}draw(e,t,r,s){if(r instanceof ht){const i=Ie(t);if(i.length===0)return;s.singleColor?e.strokeStyle=s.singleColor:e.strokeStyle=r.colors.areaTheme.lineColor,r.hovered?e.lineWidth=this.config.selectedWidth:e.lineWidth=this.config.areaLineWidth;const a=r.extentComponent.getBounds(),o=i[0],l=r.view.toX(o.centerUnit);for(let c=0;c<i.length;c++){const h=i[c-1],v=i[c+1],p=i[c],y=r.view.toX(p.centerUnit),E=r.view.toY(p.close),R=a.y+a.height;if(h===void 0)e.beginPath(),e.lineTo(ve(y),R),e.moveTo(ve(y),E);else if(v===void 0){e.lineTo(ve(y),E),e.stroke(),e.lineTo(ve(y),R),e.lineTo(ve(l),R),e.closePath();let N;s.singleColor?e.fillStyle=s.singleColor:e.fillStyle=r.colors.areaTheme.startColor&&r.colors.areaTheme.stopColor?(N=e.createLinearGradient(0,0,0,a.height),N.addColorStop(0,r.colors.areaTheme.startColor),N.addColorStop(1,r.colors.areaTheme.stopColor),N):"",e.fill()}else e.lineTo(ve(y),E)}}}}function ti(n,e,t,r,s,i=4,a=!0,o=!1){n.save(),n.beginPath(),n.moveTo(e+i,t),n.lineTo(e+r-i,t),n.quadraticCurveTo(e+r,t,e+r,t+i),n.lineTo(e+r,t+s-i),n.quadraticCurveTo(e+r,t+s,e+r-i,t+s),n.lineTo(e+i,t+s),n.quadraticCurveTo(e,t+s,e,t+s-i),n.lineTo(e,t+i),n.quadraticCurveTo(e,t,e+i,t),n.closePath(),a&&n.fill(),o&&n.stroke(),n.restore()}function wc(n,e,t,r,s,i,a,o,l,c,h=4,v=!0,p=!1){const y=c==="right"?o:-o,E=c==="right"?h:-h,R=h;n.save(),n.beginPath(),l?n.moveTo(i+E,a):n.moveTo(i,a),l?(n.lineTo(i+y-E,a),n.quadraticCurveTo(i+y,a,i+y,a-R),n.lineTo(i+y,t+R),n.quadraticCurveTo(i+y,t,i+y-E,t),n.lineTo(e+E,t)):(n.lineTo(i+y,a),n.lineTo(i+y,t),n.lineTo(e,t)),l?(n.quadraticCurveTo(e,t,e-E/3,t+R/3),n.lineTo(r+E/3,s-R/3),n.quadraticCurveTo(r,s,r+E/3,s+R/3),n.lineTo(i-E/3,a-R/3),n.quadraticCurveTo(i,a,i+E/3,a)):(n.lineTo(r,s),n.lineTo(i,a)),n.closePath(),v&&n.fill(),p&&n.stroke(),n.restore()}function Sc(n,e,t,r,s,i=1){n.save(),n.lineWidth=i,n.beginPath(),n.moveTo(e,t),n.lineTo(r,s),n.stroke(),n.closePath(),n.restore()}function Ct(n,e){n.save(),n.lineWidth%2&&n.translate(.5,.5),e(),n.restore()}function ni(n,e,t){const r=Math.min(e.x,t.x)+.5,s=Math.min(e.y,t.y),i=Math.abs(e.x-t.x),a=Math.abs(e.y-t.y);n.fillRect(r,s,i,a)}const xv=n=>Array.isArray(n[0])?n:[n];class xc{constructor(e,t,r){this.paneManager=e,this.canvasModel=t,this.seriesDrawers=r}draw(){const e=this.canvasModel.ctx;Tt(Object.values(this.paneManager.paneComponents),t=>t.yExtentComponents).forEach(t=>{e.save(),yt(e,t.getBounds()),t.dataSeries.forEach(r=>this.drawSeries(e,r)),e.restore()})}drawSeries(e,t){if(t.config.visible){const r=t.config.type,s=this.seriesDrawers[r];if(s){const i=t.getSeriesInViewport(t.scaleModel.xStart-1,t.scaleModel.xEnd+1);i&&i.length>=1&&s.draw(e,i,t,{})}else console.error(`Data series drawer with type ${r} isn't registered!`)}}getCanvasIds(){return[this.canvasModel.canvasId]}}const yt=(n,e)=>{n.beginPath(),n.rect(e.x,e.y,e.width,e.height),n.clip(),n.closePath()},Dt=(n,e,t,r,s=e)=>{r.forceBold?n.lineWidth=r.forceBold:t.hovered?n.lineWidth=s:n.lineWidth=e};class Mc{constructor(e){this.config=e}setFillStyle(e,t,r,s){if(t.singleColor)e.strokeStyle=t.singleColor;else{const i=r.colors.barTheme;i&&(e.strokeStyle=i[`${s.name}Color`])}}draw(e,t,r,s){if(r instanceof ht){const i=Ie(t);Dt(e,this.config.barLineWidth,r,s),Ct(e,()=>{for(const a of i){this.setFillStyle(e,s,r,a),e.beginPath();const o=se(r.view.toX(a.centerUnit)),l=se(r.view.toX(a.startUnit)),[c,h,v,p]=a.yBodyKeyPoints(r.view),y=se(r.view.xPixels(a.width)/2),E=se(r.view.toY(a.close)),R=se(r.view.toY(a.open));this.config.showWicks?(e.moveTo(o,c),e.lineTo(o,p)):(e.moveTo(o,h),e.lineTo(o,v)),e.moveTo(o,E),e.lineTo(o+y,E),e.moveTo(l,R),e.lineTo(o,R),e.stroke()}})}}}class Pc{constructor(e,t){this.baseLineModel=e,this.canvasBoundContainer=t}draw(e,t,r,s){if(s!==void 0&&r instanceof ht){const i=Ie(t),a=this.baseLineModel.baselineYPercents,o=this.canvasBoundContainer.getBounds(Y.CHART),l=o.y+o.height*(a/100),c=i[0];for(let h=0;h<i.length;h++){const v=i[h],p=i[h-1],y=i[h+1],E=r.view.toX(c.centerUnit),R=r.view.toX(v.centerUnit),N=r.view.toY(v.close),k=p?r.view.toY(p.close)<l:!1,U=N<l;if(p!==void 0&&k!==U){ri(e,r,s,k);const Z=r.view.toX(p.centerUnit),K=r.view.toY(p.close),q=R-Z,$=N-K,J=q/$,ne=N-l,oe=J*ne,le=Z+(q-oe);e.lineTo(le,l),e.stroke(),e.lineTo(E,l),e.closePath(),e.fill(),e.beginPath(),e.moveTo(le,l)}p===void 0?(e.beginPath(),e.moveTo(R,N)):y===void 0?(ri(e,r,s,U),e.lineTo(R,N),e.stroke(),e.lineTo(R,l),e.lineTo(E,l),e.closePath(),e.fill(),e.beginPath(),e.moveTo(E,l),e.lineTo(R,l),e.strokeStyle=r.colors.baseLineTheme.baselineColor,e.stroke()):e.lineTo(R,N)}}}}const ri=(n,e,t,r)=>{t.singleColor?(n.fillStyle=t.singleColor,n.strokeStyle=t.singleColor):(n.fillStyle=r?e.colors.baseLineTheme.upperSectionFillColor:e.colors.baseLineTheme.lowerSectionFillColor,n.strokeStyle=r?e.colors.baseLineTheme.upperSectionStrokeColor:e.colors.baseLineTheme.lowerSectionStrokeColor)};class Tc{constructor(e){this.config=e,this.pixelLength=1,this.lineWidthCU=1,this.halfLineWidthCU=1}draw(e,t,r,s){if(r instanceof ht){const i=Ie(t);Dt(e,this.config.candleLineWidth,r,s,this.config.candleLineWidth),Ct(e,()=>{this.pixelLength=1/$e,this.halfLineWidthCU=e.lineWidth/2,this.lineWidthCU=e.lineWidth;for(const a of i){const{candleTheme:o,activeCandleTheme:l}=r.colors;o&&l&&this.drawCandle(e,s,r,a)}})}}drawCandle(e,t,r,s){const{candleTheme:i,activeCandleTheme:a}=r.colors,o=s.name,l=s.isActive?a:i,c=s.isHollow;t.singleColor?e.fillStyle=t.singleColor:c?e.fillStyle=l[`${o}WickColor`]:e.fillStyle=l[`${o}Color`];const h=se(r.view.toX(s.startUnit)),v=se(r.view.xPixels(s.width)),p=s.bodyHeight(r.view),[y,E,R,N]=s.yBodyKeyPoints(r.view),k=E===R?E+1:R,U=y===N?y+1:N,Z=l[`${o}Color`],K=o==="none"?Z:l[`${o}WickColor`];e.fillStyle=Z,t.singleColor?e.strokeStyle=t.singleColor:e.strokeStyle=K;const q=c||(s.hasBorder&&s.isActive?this.config.showActiveCandlesBorder:this.config.showCandlesBorder),$=this.config.showWicks;if(v<2)e.beginPath(),e.moveTo(h,$?y:E),e.lineTo(h,$?U:k),e.stroke();else if(v<3)e.beginPath(),e.moveTo(h,$?y:E),e.lineTo(h,$?U:k),e.moveTo(h+1,E),e.lineTo(h+1,k),e.stroke();else if(v===3){const J=v/$e;this.drawCandlesWicks(e,h+J,y,U,E,k),c||(e.beginPath(),e.moveTo(h+J,E),e.lineTo(h+J,k),e.stroke()),this.drawCandleBorder(e,t,l,s,h+this.halfLineWidthCU,E+this.halfLineWidthCU,v-this.lineWidthCU,p-this.lineWidthCU)}else{const J=se(r.view.toX(s.centerUnit));this.drawCandlesWicks(e,J,y,U,E,k-1);const ne=this.config.candlePaddingPercent,oe=Math.max(se(v*ne/2),this.pixelLength),le=h+oe,re=v-oe*2;c||(t.singleColor&&(e.fillStyle=t.singleColor),e.fillRect(le,E,re,p)),q&&this.drawCandleBorder(e,t,l,s,le+this.halfLineWidthCU,E+this.halfLineWidthCU,re-this.lineWidthCU,p-this.lineWidthCU)}}drawCandlesWicks(e,t,r,s,i,a){this.config.showWicks&&(e.beginPath(),e.moveTo(t,r),e.lineTo(t,i),e.moveTo(t,a),e.lineTo(t,s),e.stroke())}drawCandleBorder(e,t,r,s,i,a,o,l){if(t.singleColor)e.strokeStyle=t.singleColor;else{const c=s.name;e.strokeStyle=c==="none"?r[`${c}Color`]:r[`${c}WickColor`]}e.strokeRect(i,a,o,l)}}class _c{constructor(e){this.config=e}draw(e,t,r,s){if(r instanceof ht){const i=t.flat(),a=r.scaleModel.getBounds(),o=a.y+a.height;for(const l of i){e.beginPath();const c=l.name,h=this.config.barCapSize,v=r.colors.histogram;if(v===void 0)return;s.singleColor?e.fillStyle=s.singleColor:e.fillStyle=v[`${c}Bright`];const p=l.xStart(r.view),y=se(r.view.toY(l.close)),E=se(r.view.xPixels(l.width));e.fillRect(p,y,E,h);const R=e.createLinearGradient(0,y+h,0,o);s.singleColor?e.fillStyle=s.singleColor:(R.addColorStop(0,v[`${c}Cap`]),R.addColorStop(1,v[`${c}Bottom`]),e.fillStyle=R),E===0?(e.beginPath(),e.strokeStyle=R,e.moveTo(p,y+h),e.lineTo(p,o),e.stroke(),e.closePath()):e.fillRect(p,y+h,E,o-y-h)}}}}class Ac{constructor(e){this.config=e}draw(e,t,r,s){if(r instanceof ht){const i=Ie(t);Dt(e,this.config.lineWidth,r,s,this.config.selectedWidth);const a=r.colors.lineTheme;e.lineCap="round",s.singleColor&&(e.strokeStyle=s.singleColor);for(let o=1;o<i.length;o++){const l=i[o-1],c=i[o],h=c.name;s.singleColor||(e.strokeStyle=a[`${h}Color`]);const v=r.view.toX(l.centerUnit),p=r.view.toY(l.close),y=r.view.toX(c.centerUnit),E=r.view.toY(c.close);e.beginPath(),e.moveTo(v,p),e.lineTo(y,E),e.stroke()}}}}const Dc=1.5;class Ec{constructor(e){this.config=e}draw(e,t,r,s){var i;e.fillStyle=(i=s.singleColor)!=null?i:this.config.mainColor;for(const a of Ie(t)){e.beginPath();const o=se(r.view.toX(a.centerUnit)),l=se(r.view.toY(a.close));e.arc(o,l,Dc,0,Math.PI*2,!0),e.fill()}}}const Lc=["candle","bar","line","area","scatterPlot","hollow","histogram","baseline","trend"];class Ic{constructor(e,t,r){this.drawer=e,this.config=t,this.chartBounds=r}draw(e,t,r,s){this.isChartTypeAllowed()&&(this.beforeDraw(e),this.drawer.draw(e,t,r,s),this.afterDraw(e,r))}beforeDraw(e){e.restore(),e.save(),yt(e,this.chartBounds())}isChartTypeAllowed(){return Lc.includes(this.config.components.chart.type)}afterDraw(e,t){e.restore(),e.save(),yt(e,t.scaleModel.getBounds())}}class Oc{constructor(e){this.chartModel=e}draw(e,t,r,s){t.forEach((i,a)=>{var o;const l=r.getPaintConfig(a);e.fillStyle=(o=s.singleColor)!=null?o:l.color,i.forEach(c=>{const h=this.chartModel.getVisualCandle(pt(c.centerUnit)),v=c.close;if(h&&v===1){const p=this.chartModel.scaleModel.zoomX,y=se(Pe(h.width,p)),E=se(h.bodyHeight(this.chartModel.scaleModel)),R=h.xCenter(this.chartModel.scaleModel)-y/2,N=h.yBodyStart(this.chartModel.scaleModel),k=this.chartModel.config.components.chart.candlePaddingPercent,U=se(y*k/2),Z=R+U,K=y-U*2;e.fillRect(Z,N,K,E)}})})}}const si=(n,e,t)=>{n.length!==0&&n.forEach((r,s)=>{const{centerUnit:i,close:a}=r,o=t.toX(i),l=t.toY(a);s===0?e.moveTo(o,l):e.lineTo(o,l)})},Bc=/^(#)([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i,Rc=/^\s*(rgba?)\s*[(]\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*[\d.]+\s*)?[)]\s*$/i;function Fc(n){const e=Bc.exec(n)||Rc.exec(n);let t=[];return e&&(t=e.slice(2,5),e[1]==="#")?t.map(function(r){return parseInt(r,16)}):t}const ii={};function Yc(n,e){let t=ii[n+e];if(!t){const r=Fc(n);t=r&&"rgba("+r.join(",")+","+e+")",ii[n+e]=t}return t}class Hc{constructor(){}draw(e,t,r,s){r.config.visible&&(t.forEach((i,a)=>{var o;const l=r.getPaintConfig(a);Dt(e,l.lineWidth,r,s,l.hoveredLineWidth);const c=(o=s.singleColor)!=null?o:l.color;e.strokeStyle=c,this.drawLine(e,i,r.view)}),r.linkedDataSeriesModels.forEach((i,a)=>{if(oi(i.config.type)&&oi(r.config.type)&&i.config.visible){const o=[],l=r,c=l.getSeriesInViewport(l.scaleModel.xStart-1,l.scaleModel.xEnd+1),h=i.getSeriesInViewport(i.scaleModel.xStart-1,i.scaleModel.xEnd+1);c.forEach((v,p)=>{const y=Math.min(v.length,h[p].length);for(let N=0;N<y;N++){const k=[v[N].clone(),h[p][N].clone()];o.push({diffPoints:k})}const E=l.getPaintConfig(p).color,R=i.getPaintConfig(a).color;this.drawDifference(e,E,R,o,l,i,s)})}}))}drawLine(e,t,r){e.beginPath(),si(t,e,r),e.stroke()}drawDifference(e,t,r,s,i,a,o){const[l,c]=[[],[]];s.forEach(p=>{const[y,E]=p.diffPoints;l.push(y),c.push(E)});const h=ai(l,i.view),v=ai(c,a.view);this.fillCloud(e,r,h,v,o),this.fillCloud(e,t,v,h,o)}fillCloud(e,t,r,s,i){var a,o,l,c;e.save(),e.beginPath();const h=(o=(a=Yt(r))==null?void 0:a.x)!=null?o:0,v=(c=(l=Ue(r))==null?void 0:l.x)!=null?c:0;e.lineTo(h,0),r.forEach(p=>{e.lineTo(p.x,p.y)}),e.lineTo(v,0),e.closePath(),e.clip(),e.beginPath(),r.forEach((p,y)=>{y===0?e.moveTo(p.x,p.y):e.lineTo(p.x,p.y)}),s.slice().reverse().forEach(p=>{e.lineTo(p.x,p.y)}),e.closePath(),e.fillStyle=i.singleColor?i.singleColor:Yc(t||"#383838",.3),e.fill(),e.restore()}}const ai=(n,e)=>n.map(t=>{const{centerUnit:r,close:s}=t,i=e.toX(r),a=e.toY(s);return{x:i,y:a}}),oi=n=>n==="DIFFERENCE";class Nc{constructor(){}draw(e,t,r,s){const i=r.view.toY(0);t.forEach((a,o)=>{var l;const c=r.getPaintConfig(o);Dt(e,c.lineWidth,r,s,c.hoveredLineWidth),e.strokeStyle=(l=s.singleColor)!=null?l:c.color,e.beginPath(),a.forEach(h=>{const v=r.view.toX(h.centerUnit),p=r.view.toY(h.close);e.moveTo(v,ve(i)),e.lineTo(v,ve(p))}),e.stroke()})}}class kc{constructor(){}draw(e,t,r,s){t.forEach((i,a)=>{var o;const l=r.getPaintConfig(a);Dt(e,l.lineWidth,r,s,l.hoveredLineWidth),e.strokeStyle=(o=s.singleColor)!=null?o:l.color,this.drawLinePath(e,i,r.view)})}drawLinePath(e,t,r){e.beginPath(),si(t,e,r),e.stroke()}}class Wc{constructor(){}draw(e,t,r,s){t.forEach((i,a)=>{var o;const l=r.getPaintConfig(a),c=l.lineWidth;e.fillStyle=(o=s.singleColor)!=null?o:l.color,e.lineWidth=1,i.forEach(h=>{e.beginPath();const v=r.view.toX(h.centerUnit),p=r.view.toY(h.close);e.arc(v,p,c,0,Math.PI*2),e.fill()})})}}class Uc{constructor(e){this.config=e}draw(e,t,r,s){e.save(),t.forEach((i,a)=>{var o;const l=r.getPaintConfig(a);e.fillStyle=(o=s.singleColor)!=null?o:l.color;const c=l.lineWidth+"px "+this.config.components.yAxis.fontFamily;e.font=c,i.forEach(h=>{const v=r.getTextForPoint(h),p=Re(v,e,c),y=Qe(c,e),E=r.view.toX(h.centerUnit)-p/2,R=r.view.toY(h.close)+y;e.fillText(v,E,R)})}),e.restore()}}class zc{constructor(){}draw(e,t,r,s){t.forEach((i,a)=>{var o;const l=r.getPaintConfig(a);e.fillStyle=(o=s.singleColor)!=null?o:l.color,i.forEach(c=>{const h=r.view.toX(c.centerUnit),v=r.view.toY(c.close);this.drawCandleTriangle(e,h,v,l.lineWidth)})})}drawCandleTriangle(e,t,r,s){e.beginPath(),e.moveTo(t-s/2,r),e.lineTo(t,r-s),e.lineTo(t+s/2,r),e.fill()}}const Qn="resized_local",Xt="draw",Mv="draw_last_candle",Et={width:20,height:20};class li{constructor(e,t,r,s,i,a={}){this.eventBus=e,this.canvas=t,this.drawingManager=r,this.resizer=i,this.width=0,this.height=0,this.prevHeight=0,this.prevWidth=0,this.type=er;var o;s.push(this),this.parent=Vc(t);const l=t.getContext("2d",a);if(l===null)throw new Error("Couldn't get 2d context????");this.context=l,this._canvasId=(o=t.getAttribute("data-element"))!=null?o:"",this.updateCanvasWidthHeight(t,this.getChartResizerElement().getBoundingClientRect())}updateDPR(e){const{width:t,height:r}=e,s=window.devicePixelRatio;this.canvas.style.height=r+"px",this.canvas.style.width=t+"px",this.canvas.width=t*s,this.canvas.height=r*s,this.width=t,this.height=r,this.ctx.scale(s,s)}get canvasId(){return this._canvasId}get ctx(){return this.context}clear(){this.context.clearRect(0,0,this.width,this.height)}isLinked(){var e,t;return(t=(e=this.type)==null?void 0:e.linked)!=null?t:!1}fireDraw(){this.eventBus.fireDraw([this.canvasId])}updateCanvasWidthHeight(e,t=this.getChartResizerElement().getBoundingClientRect()){e.clientWidth!==this.width&&(e.width=e.clientWidth,this.width=e.clientWidth);const r=t.height;r!==this.height&&(e.style.height=r+"px",this.height=r,e.height=r,this.prevHeight=r)}getChartResizerElement(){var e;return(e=this.resizer)!=null?e:this.parent}isReady(){return this.width>Et.width&&this.height>Et.height}}const er={name:"candle"},Xc={candle:er,bar:{name:"candle"},line:{name:"line",linked:!0},area:{name:"area",linked:!0}};function jc(n,e,t,r,s,i,a){var o;const l=wt(n,e,s,i,a,t);return l.type=(o=Xc[r])!=null?o:er,l}function wt(n,e,t,r,s,i,a){const o=new li(n,e,r,s,i,a);return ci(o,t),o}function ci(n,e){const t=n.canvas;e.fixedSize&&(t.width=e.fixedSize.width,t.height=e.fixedSize.height,t.style.width=e.fixedSize.width+"px",t.style.height=e.fixedSize.height+"px",n.width=e.fixedSize.width,n.height=e.fixedSize.height),t.style.position="absolute",t.style.top="0",t.style.left="0",t.style.direction="ltr"}function Vc(n){let e=n;for(;e;){if(e.nodeType===1&&e.hasAttribute("data-chart-container"))return e;if(e.parentElement!==null)e=e.parentElement;else break}return e}let tr=!1,nr=0;const dn=new Map,rr=new Map,hi=()=>{tr||(tr=!0,nr=requestAnimationFrame(()=>{rr.forEach((n,e)=>{n(),rr.delete(e)}),dn.forEach((n,e)=>{n(),dn.delete(e)}),tr=!1}))},di=(n,e)=>{dn.set(n,e),hi()},Av=n=>{dn.delete(n)},sr=(n,e)=>{rr.set(n,e),hi()},un="HIT_TEST_",Dv=null;class Gc{constructor(e,t){this.chartResizeHandler=t,this.drawingOrder=[],this.drawersMap={},this.canvasIdsList=[],this.animFrameId=`draw_${Je()}`,this.drawHitTestCanvas=()=>{this.drawingOrder.forEach(r=>{r.indexOf(un)!==-1&&this.drawersMap[r].draw()})},e.on(Xt,r=>{t.wasResized()&&(this.canvasIdsList&&(r&&r.length!==0?this.canvasIdsList=this.canvasIdsList.concat(r):this.canvasIdsList=void 0),di(this.animFrameId,()=>{this.forceDraw(this.canvasIdsList),this.canvasIdsList=[],this.drawHitTestCanvas()}))})}redrawCanvasesImmediate(){this.chartResizeHandler.fireUpdates(),this.forceDraw()}drawLastBar(){this.drawingOrder.forEach(e=>{if(e.indexOf(un)===-1){const t=this.drawersMap[e];t.drawLastBar&&t.drawLastBar()}})}forceDraw(e){this.isDrawable()&&this.drawingOrder.forEach(t=>{if(t.indexOf(un)===-1){const r=this.drawersMap[t];if(!e||e.length===0){r.draw();return}xo(e,r.getCanvasIds()).length&&r.draw()}})}isDrawable(){var e,t,r,s;return((t=(e=this.chartResizeHandler.previousBCR)==null?void 0:e.height)!=null?t:0)>Et.width&&((s=(r=this.chartResizeHandler.previousBCR)==null?void 0:r.width)!=null?s:0)>Et.height}drawHitTestOnly(){this.drawHitTestCanvas()}addDrawer(e,t=Je()){this.drawingOrder.indexOf(t)===-1&&this.drawingOrder.push(t),this.drawersMap[t]=e}addDrawerAfter(e,t,r){this.addDrawer(e,t);const s=this.drawingOrder.indexOf(t);this.drawingOrder.splice(s,1);const i=this.drawingOrder.indexOf(r);this.drawingOrder.splice(i+1,0,t),this.reorderDrawers(this.drawingOrder)}addDrawerBefore(e,t,r){this.addDrawer(e,t);const s=this.drawingOrder.indexOf(r);if(s!==-1){const i=this.drawingOrder.indexOf(t);return this.drawingOrder.splice(i,1),this.drawingOrder.splice(s,0,t),this.reorderDrawers(this.drawingOrder),!0}return!1}getDrawerByName(e){return this.drawersMap[e]}getNameByDrawer(e){for(const t in this.drawersMap)if(this.drawersMap[t]===e)return t}removeDrawerByName(e){const t=this.drawersMap[e];this.removeDrawer(t)}removeDrawer(e){Object.keys(this.drawersMap).forEach(t=>{if(this.drawersMap[t]===e){delete this.drawersMap[t];const r=this.drawingOrder.indexOf(t);r!==-1&&this.drawingOrder.splice(r,1)}})}reorderDrawers(e){this.drawingOrder=$r(this.drawingOrder,e)}}class ui{static paneResizer(e){return`PANE_RESIZER_${e}`}}class $c{constructor(e,t,r){this.seriesDrawers=e,this.canvasModel=t,this.paneManager=r}draw(){const e=this.canvasModel.ctx;Tt(Object.values(this.paneManager.paneComponents),t=>t.yExtentComponents).forEach(t=>{e.save(),yt(e,t.getBounds()),t.dataSeries.forEach(r=>this.drawSeries(e,r)),e.restore()})}drawSeries(e,t){if(t.config.visible){const r=t.config.type,s=this.seriesDrawers[r];if(s){const i={singleColor:this.canvasModel.idToColor(t.id),forceBold:7};s.draw(e,t.getSeriesInViewport(t.scaleModel.xStart-1,t.scaleModel.xEnd+1),t,i)}}}getCanvasIds(){return[this.canvasModel.canvasId]}}const fi={disableChartPanning:!0};class vi extends te{constructor(e,t,r,s,i){super(),this.hitTest=e,this.dragCallbacks=t,this.canvasInputListener=r,this.chartPanComponent=s,this.dragComponentOptions=i,this.dragging=!1,this.draggedPixels=0,this.onDragStart=a=>{this.dragging=!0,this.draggedPixels=0,this.dragCallbacks.onDragStart&&this.dragCallbacks.onDragStart(a),this.dragComponentOptions.disableChartPanning&&this.chartPanComponent.deactivatePanHandlers()},this.onDragTick=a=>{this.dragging&&(this.draggedPixels+=a,this.dragCallbacks.onDragTick({delta:a,draggedPixels:this.draggedPixels}))},this.onDragEnd=()=>{this.dragging&&(this.dragging=!1,this.dragCallbacks.onDragEnd&&this.dragCallbacks.onDragEnd(this.draggedPixels),this.dragComponentOptions.disableChartPanning&&this.chartPanComponent.activateChartPanHandlers())}}doActivate(){super.doActivate()}doDeactivate(){super.doDeactivate()}}class fn extends vi{constructor(e,t,r,s,i=fi){super(e,t,r,s,i)}doActivate(){super.doActivate(),this.addRxSubscription(this.canvasInputListener.observeYDragStart(this.hitTest).subscribe(this.onDragStart)),this.addRxSubscription(this.canvasInputListener.observeYDrag().subscribe(this.onDragTick)),this.addRxSubscription(this.canvasInputListener.observeYDragEnd().subscribe(this.onDragEnd))}doDeactivate(){super.doDeactivate()}}const Zc="BASELINE_RESIZER";class Kc extends te{constructor(e,t,r,s,i,a,o){super(),this.chartModel=e,this.canvasModel=r,this.canvasInputListener=s,this.config=i,this.canvasBoundContainer=a,this.cursorHandler=o,this.resizerBounds={x:0,y:0,pageX:0,pageY:0,height:0,width:0},this.baselineYPercents=50,this.ht=Xn.hitTestOf(this.resizerBounds,{extensionY:this.config.components.paneResizer.dragZone}),this.dragTickCb=c=>{const{delta:h}=c,v=this.canvasBoundContainer.getBounds(Y.CHART),p=this.canvasInputListener.getCurrentPoint().y;h!==0&&el(p,v)&&(this.moveBaseLine(p),this.canvasModel.fireDraw())};const l=new fn(this.ht,{onDragTick:this.dragTickCb},s,t);this.addChildEntity(l)}doActivate(){super.doActivate(),this.addRxSubscription(this.canvasBoundContainer.observeBoundsChanged(Y.CHART).subscribe(()=>this.recalculateBounds())),this.chartModel.chartTypeChanged.subscribe(e=>{e==="baseline"?this.cursorHandler.setCursorForBounds("BASELINE_RESIZER",this.resizerBounds,this.config.components.baseline.cursor,this.config.components.baseline.dragZone):this.cursorHandler.removeCursorForCanvasEl("BASELINE_RESIZER")})}recalculateBounds(){const e=this.canvasBoundContainer.getBounds(Y.CHART),t=this.canvasBoundContainer.getBounds(Y.Y_AXIS);this.resizerBounds.x=e.x,this.resizerBounds.width=e.width+t.width,this.resizerBounds.height=this.config.components.baseline.height;const r=e.y+e.height*(this.baselineYPercents/100);this.resizerBounds.y=r,this.canvasBoundContainer.bounds[Zc]=this.resizerBounds}moveBaseLine(e){const t=this.canvasBoundContainer.getBounds(Y.CHART);this.baselineYPercents=(e-t.y)*100/t.height,this.resizerBounds.y=e}doDeactivate(){super.doDeactivate()}}const vn=n=>{var e;const t=Ft(n.close,n.open,n.hi,n.lo);if(!isFinite(t))throw new Error("Received candle without any price");const r=Ft(n.hi,Math.max(n.open,n.close),t),s=Ft(n.lo,Math.min(n.open,n.close),t),i=Ft(n.open,n.lo,t),a=Ft(n.close,n.hi,t);return{hi:r,lo:s,open:i,close:a,timestamp:n.timestamp,volume:(e=n.volume)!=null?e:0,expansion:n.expansion,idx:n.idx,impVolatility:n.impVolatility}},gi=n=>{for(let e=0;e<n.length;++e)n[e].idx=e},pi=n=>{n.forEach(e=>{e.idx=void 0})};class qc{constructor(){}draw(e,t,r){const s=r.view.toY(0),i=Ie(t),a=[[],[]];i.forEach((o,l,c)=>{a[o.close<this.previousValue(c,l)?1:0].push(o)}),a.forEach((o,l)=>{const c=r.getPaintConfig(l);e.strokeStyle=l===0?c.color:c.aditionalColor||"#FF00FF",e.lineWidth=c.lineWidth,e.beginPath(),o.forEach(h=>{const v=r.view.toX(h.centerUnit),p=r.view.toY(h.close);e.moveTo(v,ve(s)),e.lineTo(v,ve(p))}),e.stroke()})}previousValue(e,t){do t--;while(t>=0&&!isFinite(e[t]&&e[t].close));return e[t]?e[t].close:Number.NaN}}var Jc=Object.defineProperty,mi=Object.getOwnPropertySymbols,Qc=Object.prototype.hasOwnProperty,eh=Object.prototype.propertyIsEnumerable,bi=(n,e,t)=>e in n?Jc(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,th=(n,e)=>{for(var t in e||(e={}))Qc.call(e,t)&&bi(n,t,e[t]);if(mi)for(var t of mi(e))eh.call(e,t)&&bi(n,t,e[t]);return n};class nh{constructor(){this.symbol="MOCK",this.priceIncrements=[.01]}}class rh extends te{constructor(e,t,r,s,i,a,o,l,c,h,v,p){super(),this.chartModel=e,this.canvasModel=t,this.config=r,this.scaleModel=s,this.canvasBoundsContainer=i,this.drawingManager=a,this.hitTestCanvasModel=o,this.canvasInputListener=l,this.dataSeriesDrawers={},this.strToBarType=E=>{var R;return(R=this.barTypeValues.find(N=>N===E))!=null?R:"candle"},this.addChildEntity(this.chartModel),this.registerDefaultCandlesTransformers(),this.baselineModel=new Kc(this.chartModel,h,this.canvasModel,this.canvasInputListener,this.config,this.canvasBoundsContainer,p),this.addChildEntity(this.baselineModel);const y=new $c(this.dataSeriesDrawers,this.hitTestCanvasModel,v);this.drawingManager.addDrawerBefore(y,un+"DATA_SERIES","HIT_TEST_EVENTS"),this.dataSeriesDrawer=new xc(v,t,this.dataSeriesDrawers),this.drawingManager.addDrawer(this.dataSeriesDrawer,"DATA_SERIES"),this.registerDefaultDataSeriesDrawers(),this.backgroundDrawer=new Ul(c,this.config),a.addDrawer(this.backgroundDrawer,"MAIN_BACKGROUND"),p.setCursorForCanvasEl(Y.PANE_UUID(ae),r.components.chart.cursor)}doActivate(){super.doActivate()}registerDefaultCandlesTransformers(){this.registerCandlesTransformer("candle",Ws),this.registerCandlesTransformer("trend",Xl),this.registerCandlesTransformer("hollow",zl)}get barTypeValues(){return Ts(this.dataSeriesDrawers)}registerCandlesTransformer(e,t){this.chartModel.registerCandlesTransformer(e,t)}registerLastCandleLabelHandler(e,t){this.chartModel.registerLastCandleLabelHandler(e,t)}registerCandlesWidthCalculator(e,t){this.chartModel.registerCandlesWidthCalculator(e,t)}registerDefaultDataSeriesDrawers(){const e=new Tc(this.config.components.chart);this.registerDataSeriesTypeDrawer("candle",e),this.registerDataSeriesTypeDrawer("trend",e),this.registerDataSeriesTypeDrawer("hollow",e),this.registerDataSeriesTypeDrawer("bar",new Mc(this.config.components.chart)),this.registerDataSeriesTypeDrawer("line",new Ac(this.config.components.chart)),this.registerDataSeriesTypeDrawer("scatterPlot",new Ec(this.config.colors.scatterPlot)),this.registerDataSeriesTypeDrawer("area",new yc(this.config.components.chart)),this.registerDataSeriesTypeDrawer("baseline",new Pc(this.baselineModel,this.canvasBoundsContainer)),this.registerDataSeriesTypeDrawer("histogram",new _c(this.config.components.chart.histogram));const t=()=>this.canvasBoundsContainer.getBounds(Y.PANE_UUID(ae));this.registerDataSeriesTypeDrawer("LINEAR",new kc),this.registerDataSeriesTypeDrawer("HISTOGRAM",new Nc),this.registerDataSeriesTypeDrawer("TREND_HISTOGRAM",new qc),this.registerDataSeriesTypeDrawer("POINTS",new Wc),this.registerDataSeriesTypeDrawer("COLOR_CANDLE",new Ic(new Oc(this.chartModel),this.config,t)),this.registerDataSeriesTypeDrawer("TEXT",new Uc(this.config)),this.registerDataSeriesTypeDrawer("TRIANGLE",new zc),this.registerDataSeriesTypeDrawer("DIFFERENCE",new Hc)}setChartType(e){this.config.components.chart.type=e,this.chartModel.rememberCurrentTimeframe(),this.chartModel.mainCandleSeries.setType(e),this.chartModel.mainCandleSeries.updateCandleSeriesColors(th({},this.config.colors)),this.chartModel.mainCandleSeries.recalculateVisualPoints(),this.chartModel.chartTypeChanged.next(e)}resetChartScale(){this.chartModel.doBasicScale()}setTimestampRange(e,t){return this.chartModel.setTimestampRange(e,t)}setXScale(e,t){return this.scaleModel.setXScale(e,t)}setShowWicks(e){this.config.components.chart.showWicks=e,this.canvasModel.fireDraw()}setMainSeries(e){var t;const r=(t=e.instrument)!=null?t:this.chartModel.mainCandleSeries.instrument;this.chartModel.mainCandleSeries.instrument=r,this.chartModel.setAllSeries({candles:e.candles,instrument:r},this.chartModel.getSecondarySeries().map(s=>{var i;const a=(i=s.instrument)!=null?i:this.chartModel.mainCandleSeries.instrument,o=s.dataPoints;return pi(o),{candles:o,instrument:a}})),this.updatePriceIncrementsIfNeeded(r)}setSecondarySeries(e){var t;const r=(t=e.instrument)!=null?t:this.chartModel.mainCandleSeries.instrument,s=this.chartModel.setSecondaryCandleSeries(e.candles,r);if(this.updatePriceIncrementsIfNeeded(r),s)return s}setAllSeries(e,t=[]){var r;const s=(r=e.instrument)!=null?r:this.chartModel.mainCandleSeries.instrument;this.updatePriceIncrementsIfNeeded(s),t.forEach(i=>{var a;const o=(a=i.instrument)!=null?a:this.chartModel.mainCandleSeries.instrument;this.updatePriceIncrementsIfNeeded(o)}),this.chartModel.setAllSeries(e,t)}toXFromCandleIndex(e){return this.chartModel.toX(e)}toXFromTimestamp(e){return this.chartModel.candleFromTimestamp(e).xCenter(this.chartModel.scaleModel)}toY(e){return this.chartModel.toY(e)}updateAllSeries(e,t=[]){this.chartModel.updateAllSeries(e,t),this.canvasModel.fireDraw()}removeDataFrom(e){this.chartModel.removeDataFrom(e)}removeSecondarySeries(e){this.chartModel.removeSecondaryCandleSeries(e)}prependCandles(e,t){this.chartModel.prependCandles(e,t)}addLastCandle(e,t){this.chartModel.addLastCandle(e,t)}updateLastCandle(e,t){this.chartModel.updateLastCandle(e,t)}updateCandles(e,t){this.chartModel.updateCandles(e,t)}setOffsets(e){this.chartModel.setOffsets(e)}getDataSeriesDrawer(e){return this.dataSeriesDrawers[e]}registerDataSeriesTypeDrawer(e,t){this.dataSeriesDrawers[e]=t}updatePriceIncrementsIfNeeded(e){(!e.priceIncrements||!ze.validatePriceIncrementsOrPrecisions(e.priceIncrements))&&(e.priceIncrements=[ze.autoDetectIncrementOfValueRange(this.scaleModel.yEnd-this.scaleModel.yStart)])}observeOffsetsChanged(){return this.chartModel.offsetsChanged}observeChartTypeChanged(){return this.chartModel.chartTypeChanged}observeCandlesChanged(){return this.chartModel.observeCandlesChanged()}observeCandlesUpdated(){return this.chartModel.candlesUpdatedSubject}observeCandlesPrepended(){return this.chartModel.candlesPrependSubject}}class sh extends ht{constructor(e,t,r,s,i,a,o,l,c){super(t,r,s,i,a,o,l,c),this.baseModel=e}set visualPoints(e){super.visualPoints=e,this.baseModel.mainVisualPoints=super.visualPoints}get visualPoints(){return super.visualPoints}set dataPoints(e){super.dataPoints=e,this.baseModel.mainDataPoints=super.dataPoints}get dataPoints(){return super.dataPoints}recalculateMeanCandleWidth(e){super.recalculateMeanCandleWidth(e),this.baseModel.meanDataWidth=this.meanCandleWidth}}const ih=n=>e=>{if(e.length!==0){const t=e.slice(Math.max(e.length-n.state.defaultViewportItems,0)),r=t[0],s=t[t.length-1];n.setXScale(r.startUnit,s.startUnit+s.width+n.offsets.right),n.doAutoScale(!0),n.recalculateZoomXYRatio(),n.fireChanged()}},ah=(n,e)=>(t,r=null)=>{const[s,i]=t,a=e.candleFromTimestamp(s).startUnit,o=e.candleFromTimestamp(i).startUnit,l=r===null?0:e.mainCandleSeries.meanCandleWidth*2,c=r?a-l:a+l,h=r?o+l:o-l;n.setXScale(c,h)};var oh=Object.defineProperty,lh=Object.defineProperties,ch=Object.getOwnPropertyDescriptors,Ci=Object.getOwnPropertySymbols,hh=Object.prototype.hasOwnProperty,dh=Object.prototype.propertyIsEnumerable,yi=(n,e,t)=>e in n?oh(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,jt=(n,e)=>{for(var t in e||(e={}))hh.call(e,t)&&yi(n,t,e[t]);if(Ci)for(var t of Ci(e))dh.call(e,t)&&yi(n,t,e[t]);return n},ir=(n,e)=>lh(n,ch(e));class uh{constructor(e){this.config=e,this.usedChartColors={},this.symbolsToColorKeys={},this.secondaryChartColorsPool=this.createColorPool(this.config.colors.secondaryChartTheme),this.usedChartColors=Object.keys(this.secondaryChartColorsPool).reduce((t,r)=>ir(jt({},t),{[r]:0}),{})}createColorPool(e){return e.reduce((t,r,s)=>(t[`color${s}`]=ir(jt({},Wt(this.config.colors)),{lineTheme:jt({},r.lineTheme),areaTheme:jt({},r.areaTheme)}),t),{})}takeColorFromPool(e){let t=Number.MAX_SAFE_INTEGER,r="";for(const[s,i]of Object.entries(this.usedChartColors))i<t&&(t=i,r=s);return this.usedChartColors[r]=this.usedChartColors[r]+1,this.symbolsToColorKeys[e]=r,this.secondaryChartColorsPool[r]}addColorToPool(e){const t=this.symbolsToColorKeys[e];this.usedChartColors[t]&&(this.usedChartColors[t]=this.usedChartColors[t]-1)}updateColorConfig(e,t){var r,s;const i=this.secondaryChartColorsPool[this.usedChartColors[e]];if(i){const a=t;this.secondaryChartColorsPool[this.usedChartColors[e]]=ir(jt({},t),{lineTheme:Object.assign(i.lineTheme,(r=a.lineTheme)!=null?r:{}),areaTheme:Object.assign(i.areaTheme,(s=a.areaTheme)!=null?s:{})})}}}var fh=Object.defineProperty,wi=Object.getOwnPropertySymbols,vh=Object.prototype.hasOwnProperty,gh=Object.prototype.propertyIsEnumerable,Si=(n,e,t)=>e in n?fh(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,gn=(n,e)=>{for(var t in e||(e={}))vh.call(e,t)&&Si(n,t,e[t]);if(wi)for(var t of wi(e))gh.call(e,t)&&Si(n,t,e[t]);return n};class ph extends te{constructor(e,t,r,s,i,a,o,l,c,h){super(),this.chartBaseModel=e,this.paneManager=t,this.bus=r,this.canvasModel=s,this.config=i,this.scaleModel=a,this.formatterFactory=o,this.mainCanvasParent=l,this.canvasBoundsContainer=c,this.chartResizeHandler=h,this.prevChartWidth=0,this.prevYWidth=0,this.candleSeries=[],this.nextCandleTimeStampSubject=new G,this.axisTypeSetSubject=new G,this.chartTypeChanged=new G,this.mainInstrumentChangedSubject=new G,this.scaleInversedSubject=new G,this.offsetsChanged=new G,this.candlesTransformersByChartType={},this.lastCandleLabelsByChartType={},this.candleWidthByChartType={},this.lastTimeFrame=[0,0],this.FAKE_CANDLES_DEFAULT=100,this.toY=p=>this.mainCandleSeries.view.toY(p),this.chartTypeChanged.next(this.config.components.chart.type),this.secondaryChartColors=new uh(this.config);const v=new sh(this.chartBaseModel,this.paneManager.paneComponents[ae].mainYExtentComponent,this.paneManager.hitTestController.getNewDataSeriesHitTestId(),this.bus,this.scaleModel,new nh,this.candlesTransformersByChartType,this.candleWidthByChartType,gn({},this.config.colors));v.config.type=this.config.components.chart.type,this.candleSeries.push(v),a.addXConstraint((p,y)=>oc(y,this.mainCandleSeries.visualPoints,this.config.components.chart.minCandlesOffset,a.getBounds())),this.basicScaleViewportTransformer=ih(a),this.timeFrameViewportTransformer=ah(a,this),this.pane=this.paneManager.paneComponents[ae]}get mainCandleSeries(){return this.candleSeries[0]}get secondaryCandleSeries(){return this.candleSeries.filter(e=>e!==this.mainCandleSeries)}get candlesUpdatedSubject(){return this.chartBaseModel.dataUpdatedSubject}get candlesSetSubject(){return this.chartBaseModel.dataSetSubject}get candlesRemovedSubject(){return this.chartBaseModel.dataRemovedSubject}get candlesPrependSubject(){return this.chartBaseModel.dataPrependSubject}doActivate(){super.doActivate(),this.addRxSubscription(this.canvasBoundsContainer.observeBoundsChanged(Y.PANE_UUID(ae)).pipe(Ve(ms)).subscribe(e=>{this.handleChartResize(e)}))}handleChartResize(e){if(e.width>Et.width&&e.height>Et.height){const t=this.getEffectiveChartWidth(),r=this.getEffectiveYAxisWidth();if(this.prevChartWidth===0){this.scaleModel.isViewportValid()?this.scaleModel.recalculateZoom():this.doBasicScale(),this.prevChartWidth=t,this.prevYWidth=r;return}if(r!==this.prevYWidth){if(this.config.scale.keepZoomXOnYAxisChange){const i=tt(r-this.prevYWidth,this.scaleModel.zoomX);this.scaleModel.setXScale(this.scaleModel.xStart,this.scaleModel.xEnd-i)}else this.scaleModel.recalculateZoomX();this.prevYWidth=r,this.prevChartWidth=t;return}const s=tt(t-this.prevChartWidth,this.scaleModel.zoomX);this.scaleModel.setXScale(this.scaleModel.xStart-s,this.scaleModel.xEnd),this.scaleModel.recalculateZoomY(),this.prevYWidth=r,this.prevChartWidth=t}}setMainCandleSeries(e,t){this.mainCandleSeries.instrument=t,this.setAllSeries({candles:e,instrument:t},this.getSecondarySeries().map(r=>{const s=r.dataPoints;return pi(s),{candles:s,instrument:r.instrument}}))}setSecondaryCandleSeries(e,t=this.mainCandleSeries.instrument,r=!0){const s=pn(e.map(vn)),i=this.reindexCandlesBasedOnSeries(this.mainCandleSeries.dataPoints,s),a=this.secondarySeriesAdjustments(this.mainCandleSeries.dataPoints,i),l=this.secondaryCandleSeries.some(c=>c.instrument.symbol===t.symbol)?this.secondaryCandleSeries.find(c=>c.instrument.symbol===t.symbol):this.createSecondaryCandleSeriesModel(t);if(l)return l.dataPoints=a,r&&(this.scaleModel.doAutoScale(),l.recalculateVisualPoints(),this.candlesSetSubject.next(),this.bus.fireDraw([this.canvasModel.canvasId])),l}setAllSeries(e,t=[]){var r;this.mainCandleSeries.instrument=(r=e.instrument)!=null?r:this.mainCandleSeries.instrument,e.instrument&&this.mainInstrumentChangedSubject.next(e.instrument),this.rememberCurrentTimeframe();const s=pn(e.candles.map(vn));this.mainCandleSeries.clearData(),gi(s),this.mainCandleSeries.dataPoints=s,this.secondaryCandleSeries.filter(i=>t.filter(a=>{var o;return((o=a.instrument)==null?void 0:o.symbol)===i.instrument.symbol}).length===0).forEach(i=>this.removeSecondaryCandleSeries(i)),t.map(i=>this.setSecondaryCandleSeries(i.candles,i.instrument,!1)),this.candleSeries.forEach(i=>{i.recalculateDataViewportIndexes(),i.recalculateVisualPoints()}),this.chartBaseModel.recalculatePeriod(),this.autoScaleOnCandles(),this.scaleModel.doAutoScale(),this.candlesSetSubject.next(),this.bus.fireDraw([this.canvasModel.canvasId])}autoScaleOnCandles(){this.scaleModel.state.autoScaleOnCandles&&(this.doBasicScale(),this.scaleModel.autoScale(!0))}doBasicScale(){this.basicScaleViewportTransformer(this.mainCandleSeries.visualPoints),this.bus.fireDraw()}doPreviousTimeFrameScale(e=null){this.timeFrameViewportTransformer(this.lastTimeFrame,e),this.scaleModel.state.autoScaleOnCandles&&this.scaleModel.doAutoScale(!0),this.bus.fireDraw()}rememberCurrentTimeframe(){this.mainCandleSeries.visualPoints.length!==0&&(this.lastTimeFrame=[this.candleFromX(this.scaleModel.toX(this.scaleModel.xStart),!0).timestamp,this.candleFromX(this.scaleModel.toX(this.scaleModel.xEnd),!0).timestamp])}updateAllSeries(e,t=[]){e=gn({},e),e.instrument||(e.instrument=this.mainCandleSeries.instrument);const r=[e,...t];if(!this.candleSeries.every(l=>r.find(c=>{var h;return((h=c.instrument)==null?void 0:h.symbol)===l.instrument.symbol}))||t.length!==this.secondaryCandleSeries.length){console.error("All series update failed. Instruments for series are different.");return}const s=pn(e.candles.map(vn)),i=Mi(this.mainCandleSeries.dataPoints,s),a=i.candles;gi(a),this.mainCandleSeries.dataPoints=a,t.map(l=>{var c,h,v,p;const y=pn(l.candles.map(vn)),E=Mi((p=(v=this.findSecondarySeriesBySymbol((h=(c=l.instrument)==null?void 0:c.symbol)!=null?h:""))==null?void 0:v.dataPoints)!=null?p:[],y).candles;return this.setSecondaryCandleSeries(E,l.instrument,!1)}),this.candleSeries.forEach(l=>{l.recalculateVisualPoints(),l.recalculateDataViewportIndexes()});const o=this.chartBaseModel.mainVisualPoints.slice(0,i.prepended).reduce((l,c)=>l+c.width,0);this.scaleModel.moveXStart(this.scaleModel.xStart+o),this.candlesPrependSubject.next({prependedCandlesWidth:o,preparedCandles:s}),this.chartBaseModel.recalculatePeriod(),this.candlesUpdatedSubject.next(),this.bus.fireDraw()}removeDataFrom(e){Object.values(this.paneManager.paneComponents).forEach(t=>{t.dataSeries.forEach(r=>{const s=ct(r.dataPoints,e,a=>a.timestamp),i=s.exact?s.index:s.index+1;r.dataPoints=r.dataPoints.slice(0,i)})}),this.candlesRemovedSubject.next(),this.candlesUpdatedSubject.next(),this.canvasModel.fireDraw()}createSecondaryCandleSeriesModel(e){const t=gn(gn({},this.config.colors),this.secondaryChartColors.takeColorFromPool(e.symbol));return this.createCandleSeriesModel(e,t)}createCandleSeriesModel(e,t){const r=new ht(this.paneManager.paneComponents[ae].mainYExtentComponent,this.paneManager.hitTestController.getNewDataSeriesHitTestId(),this.bus,this.scaleModel,e,this.candlesTransformersByChartType,this.candleWidthByChartType,t);return r.config.type="line",this.candleSeries.push(r),r}removeSecondaryCandleSeries(e){return this.secondaryChartColors.addColorToPool(e.instrument.symbol),this.candleSeries=this.candleSeries.filter(t=>t!==e),e.deactivate(),this.paneManager.paneComponents[ae].removeDataSeries(e),this.scaleModel.doAutoScale(),e.colors}secondarySeriesAdjustments(e,t){const r=[];return e.forEach(s=>{var i;const a=(i=s.idx)!=null?i:0,o=t[a];if(o)r.push(o);else{let l=xi(t,a,-1);if(l||(l=xi(t,a,1)),l){const c=gl(l,a,!0);r.push(c)}}}),r}updateSecondaryCandleSeriesConfig(e,t,r){const s=Ge(e,tn().colors);this.secondaryChartColors.updateColorConfig(t,s);const i=this.findSecondarySeriesBySymbol(t);i&&(i.config.type=r,i.updateCandleSeriesColors(s),this.bus.fireDraw([this.canvasModel.canvasId])),this.bus.fireDraw([this.canvasModel.canvasId])}setAutoScale(e){this.scaleModel.autoScale(e)}getEffectiveYAxisWidth(){return this.canvasBoundsContainer.getBounds(Y.PANE_UUID_Y_AXIS(ae)).width}getEffectiveChartWidth(){return this.canvasBoundsContainer.getBounds(Y.PANE_UUID(ae)).width}getEffectiveChartHeight(){return this.canvasBoundsContainer.getBounds(Y.PANE_UUID(ae)).height}setOffsets(e){this.scaleModel.updateOffsets(e);const t=this.getCandlesCountWithRightOffset(),r=this.mainCandleSeries.visualPoints;this.hasCandles()&&t>=r.length&&this.scaleModel.setXScale(this.scaleModel.xStart,this.candleFromIdx(t).startUnit),this.offsetsChanged.next(),this.bus.fireDraw()}getOffsets(){return this.scaleModel.getOffsets()}fromY(e){return this.scaleModel.fromY(e)}priceFromY(e,t){return(t!=null?t:this.mainCandleSeries).view.priceFromY(e)}fromX(e){return this.scaleModel.fromX(e)}toX(e){const t=this.candleFromIdx(e);return this.scaleModel.toX(t.centerUnit)}getBaseLine(){return this.mainCandleSeries.getBaseLine()}candleFromX(e,t=!1,r=this.mainCandleSeries){const s=this.scaleModel.fromX(e);return this.candleFromUnit(s,t,r)}candleFromUnit(e,t=!1,r=this.mainCandleSeries){var s,i;const a=ct(r.visualPoints,e,v=>v.startUnit),o=r.visualPoints,l=this.getLastVisualCandle();o[a.index]!==void 0&&(e<0||l&&e>l.startUnit+l.width)&&(a.index+=pt((e-o[a.index].centerUnit)/this.mainCandleSeries.meanCandleWidth));const c=a.index,h=Math.max(Math.min(o.length-1,c),0);return(c<0||c>=o.length)&&t?zt(this.mainCandleSeries.dataPoints,c,this.chartBaseModel.period):(i=(s=o[h])==null?void 0:s.candle)!=null?i:zt(this.mainCandleSeries.dataPoints,h,this.chartBaseModel.period)}candleFromTimestamp(e,t=!0){return this.chartBaseModel.dataFromTimestamp(e,t)}candleFromIdx(e){return this.chartBaseModel.dataFromIdx(e)}isReady(){return this.canvasModel.isReady()&&this.hasCandles()}registerCandlesTransformer(e,t){this.candlesTransformersByChartType[e]=t}registerCandlesWidthCalculator(e,t){this.candleWidthByChartType[e]=t}registerLastCandleLabelHandler(e,t){this.lastCandleLabelsByChartType[e]=t}hasCandles(){return this.mainCandleSeries.visualPoints.length!==0}getVisualCandle(e){var t,r,s;const i=e-((s=(r=(t=this.mainCandleSeries.visualPoints[0])==null?void 0:t.candle)==null?void 0:r.idx)!=null?s:0);return this.mainCandleSeries.visualPoints[i]}getFirstIdx(){return this.mainCandleSeries.dataIdxStart}getLastIdx(){return this.mainCandleSeries.dataIdxEnd}getFirstTimestamp(e=!0){return e?this.candleFromIdx(this.getFirstIdx()).candle.timestamp:this.candleFromUnit(this.scaleModel.xStart,!0).timestamp}getLastTimestamp(e=!0){return e?this.candleFromIdx(this.getLastIdx()).candle.timestamp:this.candleFromUnit(this.scaleModel.xEnd,!0).timestamp}setTimestampRange(e,t){const r=this.candleFromTimestamp(e).startUnit,s=this.candleFromTimestamp(t),i=s.startUnit+s.width;return this.scaleModel.setXScale(r,i)}getLastCandle(){const e=this.mainCandleSeries.dataPoints;return Ue(e)}getLastVisualCandle(){const e=this.mainCandleSeries.visualPoints;return Ue(e)}getMaxCandlesFitLength(){return ve(this.getEffectiveChartWidth()/this.config.components.chart.minWidth)}getSecondarySeries(){return this.secondaryCandleSeries}isSeriesInstrument(e,t){return e.instrument.symbol===t}findSeriesBySymbol(e){return this.candleSeries.filter(t=>this.isSeriesInstrument(t,e))}findSecondarySeriesBySymbol(e){return this.secondaryCandleSeries.find(t=>this.isSeriesInstrument(t,e))}reindexCandlesBasedOnSeries(e,t){return t.reduce((r,s)=>{const i=s.timestamp,a=kt(i,!1,e,this.chartBaseModel.period);return a.index>=0&&a.index<e.length&&(s.idx=a.index,r[a.index]=s),r},[])}getPeriod(){return this.chartBaseModel.period}isCandleInViewport(e){return this.getFirstIdx()<=e&&e<=this.getLastIdx()}updateCandles(e,t=this.mainCandleSeries.instrument.symbol){const r=this.mainCandleSeries.instrument.symbol===t,s=this.findSeriesBySymbol(t);if(s.length===0){console.warn("updateCandles failed. Can't find series",t);return}s.forEach(i=>{const a=i.dataPoints;let o=!1,l=!1,c;e.forEach(h=>{var v;if(!h)return;const p=kt(h.timestamp,!0,a,this.getPeriod()),y=Math.min(p.index,a.length);o=o||y===a.length,a[y]=h,h.idx=y,i.dataPoints=a,i.recalculateDataViewportIndexes(),l=l||this.isCandleInViewport(y);const E=y>=a.length-1,R=c&&h.timestamp<c.timestamp;if(E&&!R&&(c=h),o&&c&&r&&l){const N=(v=this.candleWidthByChartType[this.config.components.chart.type])!=null?v:Us;this.scaleModel.moveXStart(this.scaleModel.xStart+N(c))}}),c&&i.updateCurrentPrice(c.close),l&&c&&e.length===1?this.bus.fireDraw([this.canvasModel.canvasId]):i.recalculateVisualPoints()}),this.scaleModel.doAutoScale(),this.candlesUpdatedSubject.next()}observeCandlesChanged(){return Me(this.candlesSetSubject,this.candlesUpdatedSubject)}getCandles(){return this.mainCandleSeries.dataPoints}getCandlesWithFake(e=0,t){let r=this.getCandles().slice();const s=this.getCandlesCount(),i=t!=null?t:s+this.FAKE_CANDLES_DEFAULT;r=r.slice(Math.max(0,e),Math.min(s,i));const a=[],o=[];for(let c=s;c<i;c++)a.push(zt(this.mainCandleSeries.dataPoints,c,this.getPeriod()));const l=Math.min(0,i);for(let c=e;c<l;c++)o.push(zt(this.mainCandleSeries.dataPoints,c,this.getPeriod()));return[...o,...r,...a]}getCandlesCount(){return this.mainCandleSeries.dataPoints.length}getCandlesCountWithRightOffset(){return this.getCandlesCount()+this.getOffsets().right}clearData(){this.candleSeries.forEach(e=>e.clearData())}prependCandles(e,t){const r=e.slice(),s=[];return t.forEach(i=>{const o=kt(i.timestamp,!1,e).index;o<0?s.push(i):e[o].timestamp===i.timestamp?r[o]=i:console.warn(`Couldn't update candle with timestamp ${i.timestamp}`)}),{prepended:s.length,candles:[...s,...r]}}addLastCandle(e,t=this.mainCandleSeries.instrument.symbol){this.updateCandles([e],t)}updateLastCandle(e,t=this.mainCandleSeries.instrument.symbol){this.updateCandles([e],t)}}const pn=n=>n.slice().sort((e,t)=>e.timestamp===t.timestamp?0:e.timestamp>t.timestamp?1:-1),xi=(n,e,t)=>{if(e>=n.length)return n[n.length-1];for(let r=e;r<n.length&&r>=0;r+=t){const s=n[r];if(s)return s}},Mi=(n,e)=>{const t=n.slice(),r=[],s=[];return e.forEach(i=>{const o=kt(i.timestamp,!0,n).index;o<0?r.push(i):o>=n.length?s.push(i):n[o].timestamp===i.timestamp?t[o]=i:console.warn(`Couldn't update candle with timestamp ${i.timestamp}`)}),{prepended:r.length,appended:s.length,candles:[...r,...t,...s]}};class Lt{constructor(e){this.canvasModel=e}draw(){this.canvasModel.clear()}getCanvasIds(){return[this.canvasModel.canvasId]}}class ar{constructor(e){this.drawers=e!=null?e:new Map}draw(){this.drawers.forEach(e=>e.draw())}addDrawer(e,t){const r=t!=null?t:"drawer"+this.drawers.size;this.drawers.set(r,e)}drawLastBar(){this.drawers.forEach(e=>e.drawLastBar&&e.drawLastBar())}removeDrawer(e){const t=Ps(this.drawers,e);t?this.drawers.delete(t):console.warn("Couldn't find drawer type")}removeDrawerByName(e){this.drawers.delete(e)}getDrawer(e){return this.drawers.get(e)}moveTop(e){const t=Ps(this.drawers,e);t?this.moveTopByName(t):console.warn("Couldn't find drawer type")}moveTopByName(e){if(this.drawers.size===1)return;const t=this.drawers.get(e);this.drawers.delete(e),t&&this.drawers.set(e,t)}getSize(){return this.drawers.size}getAll(){return this.drawers}getCanvasIds(){const e=Ie(Array.from(this.drawers).map(([,r])=>r.getCanvasIds())),t=new Set([...e]);return Array.from(t)}}class mh{constructor(e,t,r){this.model=e,this.crossToolCanvasModel=t,this.crossToolTypeDrawers=r}draw(){const e=this.crossToolTypeDrawers[this.model.type];e?this.model.currentHover&&e.draw(this.crossToolCanvasModel.ctx,this.model.currentHover):console.error(`No cross tool drawer type registered for drawer type ${this.model.type}`)}getCanvasIds(){return[this.crossToolCanvasModel.canvasId]}}class bh extends te{constructor(e,t,r,s){super(),this.config=e,this.crossToolCanvasModel=t,this.crossEventProducer=r,this.hoverProducer=s,this.currentHoverSubject=new lt(null),this.type="cross-and-labels",this.type=e.type}get currentHover(){return this.currentHoverSubject.getValue()}set currentHover(e){this.currentHoverSubject.next(e)}setType(e){this.type=e}doActivate(){super.doActivate(),this.addRxSubscription(this.hoverProducer.hoverSubject.subscribe(e=>{this.crossEventProducer.crossSubject.getValue()!==null&&e!==null?this.updateHover(e):this.currentHover=null,this.fireDraw()}))}fireDraw(){this.type!=="none"&&this.crossToolCanvasModel.fireDraw()}updateHover(e,t=this.config.magnetTarget){if(this.currentHover===null?this.currentHover={x:e.x,y:0,time:e.timeFormatted,paneId:e.paneId}:(this.currentHover.x=e.x,this.currentHover.time=e.timeFormatted),e.candleHover&&e.paneId===ae)switch(t){case"O":this.currentHover.y=e.candleHover.openY;break;case"C":this.currentHover.y=e.candleHover.closeY;break;case"H":this.currentHover.y=e.candleHover.highY;break;case"L":this.currentHover.y=e.candleHover.lowY;break;case"OHLC":this.currentHover.y=e.candleHover.closestOHLCY;break;case"none":this.currentHover.y=e.y;break}else this.currentHover.y=e.y;this.currentHoverSubject.next(this.currentHover)}}const Xe=4;function Ch(n,e,t,r,s,i,a,o=!1){var l,c,h,v,p,y,E;const R=i.align,N=(l=s.textFont)!=null?l:mt(i),k=s.bgColor,U=(c=s.textColor)!=null?c:Ht(k,a.labelTextColor,a.labelInvertedTextColor),Z=(h=s.paddingTop)!=null?h:Xe,K=(v=s.paddingBottom)!=null?v:Xe,q=(p=s.paddingEnd)!=null?p:Xe,$=pt(Qe(N,n)/2),J=r-$-Z,oe=r+$+K-J;if((r<e.y+oe/2||r>e.y+e.height-oe/2)&&!o)return;n.save(),n.fillStyle=k,n.strokeStyle=k;const le=pt(e.width/6),re=R==="right"?e.x:e.x+e.width,ce=R==="right"?re+le:re-le,fe=i.labelBoxMargin.end,de=fe-q,ue=e.width-le-de;wc(n,ce,J,re,J+pt(oe/2),ce,J+oe,ue,(E=(y=i.typeConfig.badge)==null?void 0:y.rounded)!=null?E:!1,R),n.fillStyle=U,n.font=N;const pe=R==="right"?e.x+e.width-Re(t,n,N)-fe:e.x+fe;n.fillText(t,pe,r+$-1),n.restore()}function yh(n,e,t,r,s,i,a,o=!1){var l,c,h,v,p,y,E,R,N,k,U;const Z=i.align,K=(l=s.textFont)!=null?l:mt(i),q=s.bgColor,$=(c=s.textColor)!=null?c:Ht(q,a.labelTextColor,a.labelInvertedTextColor),J=(h=i.typeConfig.rectangle)==null?void 0:h.paddings,ne=(p=(v=s.paddingTop)!=null?v:J==null?void 0:J.top)!=null?p:Xe,oe=(E=(y=s.paddingBottom)!=null?y:J==null?void 0:J.bottom)!=null?E:Xe,le=(N=(R=s.paddingEnd)!=null?R:J==null?void 0:J.end)!=null?N:Xe,re=s.paddingStart,ce=Qe(K,n),fe=r-ce/2-ne,ue=r+ce/2+oe-fe,pe=(U=s.rounded)!=null?U:(k=i.typeConfig.rectangle)==null?void 0:k.rounded;if((r<e.y+ue/2||r>e.y+e.height-ue/2)&&!o)return;n.save(),n.fillStyle=q,n.strokeStyle=q;const me=i.labelBoxMargin.end;n.font=K;const Fe=Re(t,n,K),Ye=me-le,He=re!==void 0?Fe+re+le:e.width-Ye,ft=Z==="right"?e.x+e.width-Ye-He:e.x+Ye,Mn=Z==="right"?e.x+e.width-Fe-me:me;pe?ti(n,ft,fe,He,ue,4,!0):n.fillRect(ft,fe,He,ue),n.fillStyle=$,n.fillText(t,Mn,r+ce/2-1),n.restore()}function wh(n,e,t,r,s,i,a,o=!1,l){var c,h,v,p,y,E,R,N,k;const U=i.align,Z=(c=s.textFont)!=null?c:mt(i),K=s.bgColor,q=(h=s.textColor)!=null?h:Ht(K,a.labelTextColor,a.labelInvertedTextColor),$=(v=i.typeConfig.rectangle)==null?void 0:v.paddings,J=(y=(p=s.paddingTop)!=null?p:$==null?void 0:$.top)!=null?y:Xe,ne=(R=(E=s.paddingBottom)!=null?E:$==null?void 0:$.bottom)!=null?R:Xe,oe=(k=(N=s.paddingEnd)!=null?N:$==null?void 0:$.end)!=null?k:Xe,le=s.paddingStart,re=Qe(Z,n),ce=r-re/2-J,de=r+re/2+ne-ce;if((r<e.y+de/2||r>e.y+e.height-de/2)&&!o)return;n.save(),n.fillStyle=K,n.strokeStyle=K;const ue=i.labelBoxMargin.end;n.font=Z;const pe=Re(t,n,Z),me=ue-oe,Fe=le!==void 0?pe+le+oe:e.width-me,Ye=U==="right"?e.x+e.width-me-Fe:e.x+me,He=U==="right"?e.x+e.width-pe-ue:ue;l&&cn(l,n,Ye,ce,Fe,de),n.fillStyle=q,n.fillText(t,He,r+re/2-1),n.restore()}function Sh(n,e,t=Xe){return Qe(n,e)/2+t}const xh="badge",Pi=4,Ti={badge:Ch,rectangle:yh,plain:wh};function _i(n,e,t,r,s,i,a,o){var l,c,h,v,p;const y=s.y,E=s.labelText,R=(l=s.mode)!=null?l:"label",N=(c=s.labelType)!=null?c:xh,k=s.description,U=(h=s.textFont)!=null?h:mt(a),Z=s.bgColor,K=(v=s.lineColor)!=null?v:Z,q=Re(k!=null?k:"",n,U)+8,$=ve(s.y),J=Qe(U,n),ne=y-J/2,le=y+J/2-ne;n.save(),n.fillStyle=Z,n.strokeStyle=K;const re=i.getBounds(Y.PANE_UUID(ae)),ce=Ti[N],fe=a.labels.descriptions,de=Mh(t,$,le),ue=()=>fe&&Ph(e,n,t,r,s,a.align,a);let pe,me;const Fe=2;a.align==="right"?(pe=re.x,me=fe?re.x+re.width-q:re.x+re.width+Fe):(pe=fe?re.x+q:re.x-Fe,me=re.x+re.width);const Ye=(p=s.lineY)!=null?p:s.y,He=()=>de&&Ct(n,()=>Sc(n,pe,Ye,me,Ye,1)),ft=()=>ce(n,t,E,y,s,a,o,!1,e);switch(R){case"line":He(),ue();break;case"line-label":He(),ue(),ft();break;case"label":ue(),ft();break;case"none":break}n.restore()}const Mh=(n,e,t)=>e>n.y+t/2&&e<n.y+n.height-t/2;function Ph(n,e,t,r,s,i="right",a){var o,l,c;const h=s.description;if(!h||h.length===0)return;const v=s.y,p=mt(a),y=Re(h,e,p),E=Qe(p,e),R=(o=s.paddingTop)!=null?o:Pi,N=(l=s.paddingBottom)!=null?l:Pi,k=v-E/2-R,Z=v+E/2+N-k;if(v<t.y+Z/2||v>t.y+t.height-Z/2)return;e.save();const K=y+5,q=4,$=y+q*2,J=r.x+r.width,ne=i==="right"?J-$:r.x+q;cn(n,e,ne,k,K,Z,.8),e.fillStyle=(c=s.descColor)!=null?c:s.bgColor,e.font=p;const oe=i==="right"?J-y-q*2:r.x+q*2;e.fillText(h,oe,v+E/2-1),e.restore()}class Ai{constructor(e,t,r,s=()=>!0,i){this.config=e,this.canvasBoundsContainer=t,this.paneManager=r,this.crossDrawPredicate=s,this.noLines=i}draw(e,t){this.crossDrawPredicate()&&Ct(e,()=>this.drawCrossTool(e,t))}drawCrossTool(e,t){var r,s,i,a,o;const l=this.canvasBoundsContainer.getBounds(Y.ALL_PANES),c=this.canvasBoundsContainer.getBoundsHitTest(Y.ALL_PANES,{extensionY:1e-4}),h=(r=this.config.components.xAxis.padding.top)!=null?r:0,v=(i=this.config.components.yAxis.typeConfig[(s=this.config.components.crossTool.yLabel.type)!=null?s:"badge"])==null?void 0:i.paddings,p=(a=v==null?void 0:v.start)!=null?a:0,y=(o=this.paneManager.paneComponents[t.paneId])==null?void 0:o.ht;if(c(t.x,l.y)){const E={start:[l.x,t.y],end:[l.x+l.width+p,t.y]},R={start:[t.x,l.y],end:[t.x,l.y+l.height+h]},N=y==null?void 0:y(t.x,t.y);this.noLines||(e.strokeStyle=this.config.colors.crossTool.lineColor,e.setLineDash(this.config.components.crossTool.lineDash),e.beginPath(),N&&(e.moveTo(...E.start),e.lineTo(...E.end)),e.moveTo(...R.start),e.lineTo(...R.end),e.stroke()),N&&this.drawYLabel(e,t),this.drawXLabel(e,t)}}drawXLabel(e,t){var r,s,i,a,o;const l=this.config.components.crossTool.xLabel.padding,c=this.config.components.crossTool.xLabel.margin,h=this.config.colors.crossTool;if(this.config.components.xAxis.visible){e.font=this.config.components.xAxis.fontSize+"px "+this.config.components.xAxis.fontFamily;const v=t.x,p=t.time,y=e.measureText(p).width,E=this.config.components.xAxis.fontSize,R=this.canvasBoundsContainer.getBounds(Y.X_AXIS);e.save(),e.fillStyle=h.labelBoxColor;const N=(r=l==null?void 0:l.left)!=null?r:0,k=(s=l==null?void 0:l.right)!=null?s:0,U=(i=l==null?void 0:l.top)!=null?i:0,Z=(a=l==null?void 0:l.bottom)!=null?a:0,K=(o=c==null?void 0:c.top)!=null?o:0,q=y+N+k,$=E+U+Z,J=Math.max(v-q/2,0),ne=R.y+K;ti(e,J,ne,q,$),e.fillStyle=h.labelTextColor;const oe=Math.max(v-y/2,N),le=R.y+K+E+U-1;e.fillText(p,oe,le),e.restore()}}drawYLabel(e,t){var r,s;const i=this.config.components.crossTool.yLabel.padding,a=this.config.colors.crossTool;if(this.config.components.yAxis.visible){const o=this.paneManager.paneComponents[t.paneId],l=t.y;if(!o)return;for(const c of o.yExtentComponents){const h=c.regularValueFromY(l),v=c.valueFormatter(h),p=this.canvasBoundsContainer.getBounds(Y.PANE_UUID_Y_AXIS(o.uuid,c.idx)),y=Ti[this.config.components.crossTool.yLabel.type];y(e,p,v,l,{textColor:a.labelTextColor,bgColor:a.labelBoxColor,paddingBottom:i==null?void 0:i.bottom,paddingEnd:i==null?void 0:i.end,paddingTop:i==null?void 0:i.top},(s=(r=c.yAxisComponent)==null?void 0:r.state)!=null?s:this.config.components.yAxis,this.config.colors.yAxis,!0)}}}}class Th{draw(){}}class _h extends te{constructor(e,t,r,s,i,a,o){super(),this.config=e,this.crossToolCanvasModel=t,this.canvasBoundsContainer=r,this.drawingManager=s,this.paneManager=i,this.crossToolTypeDrawers={},this.model=new bh(e.components.crossTool,this.crossToolCanvasModel,a,o),this.addChildEntity(this.model);const l=new Lt(this.crossToolCanvasModel);this.registerDefaultDrawerTypes();const c=new mh(this.model,this.crossToolCanvasModel,this.crossToolTypeDrawers),h=new ar;h.addDrawer(l,"CLEAR_CANVAS"),h.addDrawer(c,"CROSS_TOOL_DRAWER"),this.drawingManager.addDrawer(h,"CROSS_TOOL")}registerDefaultDrawerTypes(){this.registerCrossToolTypeDrawer("cross-and-labels",new Ai(this.config,this.canvasBoundsContainer,this.paneManager,()=>!0)),this.registerCrossToolTypeDrawer("just-labels",new Ai(this.config,this.canvasBoundsContainer,this.paneManager,()=>!0,!0)),this.registerCrossToolTypeDrawer("none",new Th)}setVisible(e){this.model.setType(e?"cross-and-labels":"none")}setType(e){this.model.setType(e)}observeCrossToolChanged(){return this.model.currentHoverSubject}setMagnetTarget(e){this.config.components.crossTool.magnetTarget=e}registerCrossToolTypeDrawer(e,t){this.crossToolTypeDrawers[e]=t}}const Ah=()=>n=>n.toString(),Dh=(n,e)=>{var t;const r="date.get"+(e((t=n.timezone)!=null?t:"")?"":"UTC"),s={YYYY:a("FullYear"),YY:a("FullYear")+" % 100",MMM:o("shortMonths","Month"),MMMM:l(o("shortMonths","Month")),M:"1+"+a("Month"),d:a("Date"),H:a("Hours"),m:a("Minutes"),s:a("Seconds"),sss:a("Milliseconds"),EEE:o("shortDays","Day"),SSS:"this.addTwoZeros("+a("Milliseconds")+")",T:"date.getTime()"};["s","m","H","d","M"].forEach(function(h){s[h+h]="this.addZero("+s[h]+")"});const i=new RegExp(Object.keys(s).sort().reverse().join("|"),"g");function a(h){return r+h+"()"}function o(h,v){return"this."+h+"["+a(v)+"]"}function l(h){return h+".toUpperCase()"}function c(h){return"' + ("+s[h]+") + '"}return function(h){var v;const p={shortDays:Eh(n),shortMonths:Lh(n),addZero(y){return y<10?"0"+y:y},addTwoZeros(y){return(y<100?"0":"")+(y<10?"0":"")+y},tzDate:e((v=n.timezone)!=null?v:"")||function(y){return y instanceof Date?y:new Date(+y)}};return new Function("date","date=this.tzDate(date); return '"+h.replace(i,c)+"'").bind(p)}};function Eh(n){var e;return(e=n.shortDays)!=null?e:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]}function Lh(n){var e;return(e=n.shortMonths)!=null?e:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]}const Di=(n,e,t)=>{if(n){if(typeof n=="string")return t(n);if(Array.isArray(n)){const r=n.filter(s=>{if(s.showWhen){const i=[];return s.showWhen.periodLessThen&&i.push(()=>{var a,o;return e<((o=(a=s.showWhen)==null?void 0:a.periodLessThen)!=null?o:0)}),s.showWhen.periodMoreThen&&i.push(()=>{var a,o;return e>=((o=(a=s.showWhen)==null?void 0:a.periodMoreThen)!=null?o:0)}),i.every(a=>a())}else return!0});if(r.length>0){const s=r[0];if(s.format)return t(s.format);if(s.customFormatter)return s.customFormatter}}}return Ah()},Ih={"rhombus-small":4,rhombus:6,"rhombus-large":8},Vt=(n,e)=>`${n}_${e}`;class Oh{constructor(e,t,r,s,i,a,o){this.backgroundCanvas=e,this.canvasModel=t,this.chartModel=r,this.config=s,this.canvasBoundsContainer=i,this.model=a,this.formatterProvider=o,this.customIcons={};const l=this.config.components.events.icons;l&&(this.createCustomIcon("earnings",l.earnings),this.createCustomIcon("dividends",l.dividends),this.createCustomIcon("splits",l.splits),this.createCustomIcon("conference-calls",l.conferenceCalls))}createCustomIcon(e,t){if(t){const r=this.createIconImage(t.normal),s=this.createIconImage(t.hover);this.customIcons[Vt(e,"normal")]=r,this.customIcons[Vt(e,"hover")]=s}}createIconImage(e){var t;const s=new DOMParser().parseFromString(e,"text/html").querySelector("svg");let i=0;s&&(i=parseInt((t=s.getAttribute("height"))!=null?t:"",10));const l="data:image/svg+xml;base64,"+btoa(e),c=new Image;return c.src=l,{img:c,svgHeight:i}}draw(){if(!this.config.components.events.visible)return;const e=this.canvasBoundsContainer.getBounds(Y.EVENTS),t=this.canvasBoundsContainer.getBounds(Y.ALL_PANES),r=this.canvasModel.ctx;r.save(),this.model.events.filter(s=>this.config.components.events.eventsVisibility[s.type]).forEach(s=>{const i=this.chartModel.candleFromTimestamp(s.timestamp).xCenter(this.chartModel.scaleModel);if(i>t.x&&i<t.x+t.width){const a=this.config.colors.events[s.type].color;r.strokeStyle=a,this.customIcons[Vt(s.type,"hover")]!==void 0?this.drawCustomSvgEvent(r,i,e,s):this.drawDefaultEvent(r,i,e,s,a),this.model.hoveredEvent.getValue()===s&&(r.beginPath(),r.moveTo(i,t.y),r.lineTo(i,e.y+e.height/2),r.stroke(),r.closePath(),this.config.components.xAxis.visible&&this.drawLabel(i,s))}}),r.restore()}drawCustomSvgEvent(e,t,r,s){const i=r.y+r.height/2,a=this.customIcons[Vt(s.type,"normal")],o=this.customIcons[Vt(s.type,"hover")];this.model.hoveredEvent.getValue()===s?e.drawImage(o.img,t-o.svgHeight/2,i-o.svgHeight/2):e.drawImage(a.img,t-a.svgHeight/2,i-a.svgHeight/2)}drawDefaultEvent(e,t,r,s,i){const a=r.y+r.height/2;e.fillStyle=i,e.lineWidth=1.5;const o=or(s);e.beginPath(),e.moveTo(t-o,a),e.lineTo(t,a-o),e.lineTo(t+o,a),e.lineTo(t,a+o),e.closePath(),this.model.hoveredEvent.getValue()===s?e.fill():e.stroke()}drawLabel(e,t){var r;const s=this.canvasModel.ctx,i=this.canvasBoundsContainer.getBounds(Y.X_AXIS),a=this.config.components.xAxis.fontFamily,o=this.config.components.xAxis.fontSize,l=(r=this.config.components.xAxis.padding.top)!=null?r:0,c=i.y+o-1+l;s.font=`${o}px ${a}`;const h=this.formatterProvider()(t.timestamp),v=s.measureText(h).width;cn(this.backgroundCanvas.ctx,s,e-v/2,i.y+1,v,i.height-1),s.fillStyle=this.config.colors.events[t.type].color,s.fillText(h,e-v/2,c)}getCanvasIds(){return[this.canvasModel.canvasId]}}function or(n){return Ih[n.style]}const mn=5;class Bh{constructor(e,t,r,s,i){this.hitTestCanvasModel=e,this.chartModel=t,this.config=r,this.canvasBoundsContainer=s,this.model=i}draw(){const e=this.hitTestCanvasModel.ctx,t=this.canvasBoundsContainer.getBounds(Y.EVENTS);e.save(),this.model.events.forEach((r,s)=>{const i=this.model.events[s-1],a=i&&this.chartModel.candleFromTimestamp(i.timestamp).xCenter(this.chartModel.scaleModel),o=this.chartModel.candleFromTimestamp(r.timestamp).xCenter(this.chartModel.scaleModel);if(o>t.x&&o<t.x+t.width){const l=this.config.colors.events[r.type].color;e.strokeStyle=l,e.fillStyle=l;const c=or(r);e.fillStyle=this.hitTestCanvasModel.idToColor(r.id);const h=(c+mn)*2;if(a!==void 0){const v=or(i);if(a+v>o-h/2){const y=c*2+mn;e.fillRect(a+v,t.y,y,t.height)}else e.fillRect(o-c-mn,t.y,h,t.height)}else e.fillRect(o-c-mn,t.y,h,t.height)}}),e.restore()}getCanvasIds(){return[this.hitTestCanvasModel.canvasId]}}var Rh=Object.defineProperty,Ei=Object.getOwnPropertySymbols,Fh=Object.prototype.hasOwnProperty,Yh=Object.prototype.propertyIsEnumerable,Li=(n,e,t)=>e in n?Rh(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Hh=(n,e)=>{for(var t in e||(e={}))Fh.call(e,t)&&Li(n,t,e[t]);if(Ei)for(var t of Ei(e))Yh.call(e,t)&&Li(n,t,e[t]);return n};const Ii=317,lr={DRAWINGS:[1,199],NEWS:[200,299],DATA_SERIES:[300,2999],EVENTS:[3e3,4e3]};class Nh extends li{constructor(e,t,r,s,i,a,o,l){super(e,t,i,o,l,{willReadFrequently:!0,desynchronized:!0}),this.canvasInputListener=r,this.canvasBoundsContainer=s,this.hitTestSubscribers=[],this.eventsSubscriptions=[],this.hoverSubject=new G,this.touchStartSubject=new G,this.dblClickSubject=new G,this.rightClickSubject=new G,this.curImgData=new Uint8ClampedArray(4),this.prevAnimationFrameId=-1,ci(this,a),t.style.visibility="hidden",this.enableUserControls()}enableUserControls(){if(this.eventsSubscriptions.length===0){const e=this.canvasBoundsContainer.getBoundsHitTest(Y.ALL_PANES),t=this.canvasInputListener.observeMouseMove().pipe(Nt(100,void 0,{trailing:!0})).subscribe(c=>this.eventHandler(c,"hover")),r=this.canvasInputListener.observeTouchStart().pipe(ye(()=>this.canvasInputListener.currentPoint)).subscribe(c=>this.eventHandler(c,"touchstart")),s=Me(this.canvasInputListener.observeMouseDown(e),this.canvasInputListener.observeTouchStart().pipe(ye(()=>this.canvasInputListener.currentPoint))).subscribe(c=>this.eventHandler(c,"mousedown")),i=Me(this.canvasInputListener.observeMouseUp(e),this.canvasInputListener.observeTouchEndDocument().pipe(ye(()=>this.canvasInputListener.currentPoint))).subscribe(c=>this.eventHandler(c,"mouseup")),a=this.canvasInputListener.observeDbClick(e).subscribe(c=>this.eventHandler(c,"dblclick")),o=this.canvasInputListener.observeContextMenu(e).pipe(ye(()=>Hh({},this.canvasInputListener.currentPoint))).subscribe(c=>{this.eventHandler(c,"contextmenu")}),l=this.canvasInputListener.observeWheel(e).subscribe(c=>setTimeout(()=>this.eventHandler(c,"zoom"),0));this.eventsSubscriptions.push(t,s,a,o,l,r,i)}}disableUserControls(){this.eventsSubscriptions.forEach(e=>e.unsubscribe()),this.eventsSubscriptions=[]}addSubscriber(e){this.hitTestSubscribers.push(e)}removeSubscriber(e){this.hitTestSubscribers=this.hitTestSubscribers.filter(t=>t===e)}idToColor(e){const t=(e*Ii).toString(16);return"#000000".substr(0,7-t.length)+t}colorToId(e){return e/Ii}observeHoverOnElement(){return this.hoverSubject.asObservable()}observeTouchStartOnElement(){return this.touchStartSubject.asObservable()}observeDblClickOnElement(){return this.dblClickSubject.asObservable()}observeRightClickOnElement(){return this.rightClickSubject.asObservable()}getPixel(e,t){const r=window.devicePixelRatio;return this.prevAnimationFrameId!==nr&&(this.curImgData=this.ctx.getImageData(e*r,t*r,1,1).data,this.prevAnimationFrameId=nr),this.curImgData}resolveModel(e){const t=this.getPixel(e.x,e.y),r=this.colorToId(t[0]*65536+t[1]*256+t[2]),s=Number(r),[i]=cr(this.hitTestSubscribers,s);return i==null?void 0:i.lookup(r)}resolveCursor(e){var t;if(!this.hitTestSubscribers.some(l=>l.resolveCursor!==void 0))return;const r=this.getPixel(e.x,e.y),s=this.colorToId(r[0]*65536+r[1]*256+r[2]),i=Number(s),[a]=cr(this.hitTestSubscribers,i),o=a==null?void 0:a.lookup(s);return(t=a==null?void 0:a.resolveCursor)==null?void 0:t.call(a,e,o)}eventHandler(e,t){var r,s,i,a,o,l,c;const h=this.getPixel(e.x,e.y),v=this.colorToId(h[0]*65536+h[1]*256+h[2]),p=Number(v),[y,E]=cr(this.hitTestSubscribers,p),R=y==null?void 0:y.lookup(v),N={point:e,model:R};switch(t){case"mousedown":R&&((r=y==null?void 0:y.onMouseDown)==null||r.call(y,R,e)),E.forEach(k=>k.onMouseDown&&k.onMouseDown(null,e));break;case"mouseup":R&&((s=y==null?void 0:y.onMouseUp)==null||s.call(y,R,e)),E.forEach(k=>k.onMouseUp&&k.onMouseUp(null,e));break;case"hover":R&&((i=y==null?void 0:y.onHover)==null||i.call(y,R,e)),E.forEach(k=>k.onHover&&k.onHover(null,e)),this.hoverSubject.next(N);break;case"touchstart":R&&((a=y==null?void 0:y.onTouchStart)==null||a.call(y,R,e)),E.forEach(k=>k.onTouchStart&&k.onTouchStart(null,e)),this.touchStartSubject.next(N);break;case"dblclick":R&&((o=y==null?void 0:y.onDblClick)==null||o.call(y,R,e)),this.dblClickSubject.next(N);break;case"contextmenu":R&&((l=y==null?void 0:y.onRightClick)==null||l.call(y,R,e)),this.rightClickSubject.next(N);break;case"zoom":R&&((c=y==null?void 0:y.onZoom)==null||c.call(y,R,e)),E.forEach(k=>k.onZoom&&k.onZoom(null,e));break;default:break}}}const cr=(n,e)=>{let t;const r=[];return n.forEach(s=>{const[i,a]=s.getIdRange();e>=i&&e<=a?t=s:r.push(s)}),[t,r]};var kh=Object.defineProperty,Wh=Object.defineProperties,Uh=Object.getOwnPropertyDescriptors,Oi=Object.getOwnPropertySymbols,zh=Object.prototype.hasOwnProperty,Xh=Object.prototype.propertyIsEnumerable,Bi=(n,e,t)=>e in n?kh(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,jh=(n,e)=>{for(var t in e||(e={}))zh.call(e,t)&&Bi(n,t,e[t]);if(Oi)for(var t of Oi(e))Xh.call(e,t)&&Bi(n,t,e[t]);return n},Vh=(n,e)=>Wh(n,Uh(e));class Gh extends te{constructor(e){super(),this.canvasModel=e,this.events=[],this.hoveredEvent=new lt(null)}setEvents(e){this.events=this.indexEvents(e)}indexEvents(e){const t=this.getIdRange()[0];return e.map((r,s)=>Vh(jh({},r),{id:s+t})).sort((r,s)=>r.timestamp-s.timestamp)}getIdRange(){return lr.EVENTS}lookup(e){return this.events.filter(t=>t.id===e)[0]}onHover(e,t){this.hoveredEvent.getValue()!==e&&(e&&(e.point=t),this.hoveredEvent.next(e),this.canvasModel.fireDraw())}onTouchStart(e,t){this.onHover(e,t)}}class $h extends te{constructor(e,t,r,s,i,a,o,l,c){super(),this.config=e,this.canvasModel=t,this.canvasBoundsContainer=i,this.drawingManager=a,this.formatterFactory=o,this.eventsXAxisLabelFormatterProvider=()=>Di(this.config.components.events.xAxisLabelFormat,s.getPeriod(),this.formatterFactory);const h=new Gh(t);this.eventsModel=h,this.addChildEntity(h),r.addSubscriber(h);const v=new Oh(c,t,s,e,i,h,this.eventsXAxisLabelFormatterProvider);this.drawingManager.addDrawer(v,"EVENTS");const p=new Bh(r,s,e,i,h);this.drawingManager.addDrawerBefore(p,"HIT_TEST_EVENTS","HIT_TEST_DRAWINGS"),l.setCursorForCanvasEl(Y.EVENTS,e.components.events.cursor)}setEvents(e){this.eventsModel.setEvents(e),this.canvasModel.fireDraw()}setVisible(e){this.config.components.events.visible=e,this.canvasBoundsContainer.recalculateBounds(),this.canvasModel.fireDraw()}setEventTypeVisible(e){Ge(this.config.components.events.eventsVisibility,e,{overrideExisting:!0,addIfMissing:!1}),this.canvasModel.fireDraw()}observeEventHovered(){return this.eventsModel.hoveredEvent.asObservable()}}class Zh{constructor(e,t,r,s,i,a,o,l=()=>!0,c){this.canvasModel=e,this.viewportModel=t,this.config=r,this.xBoundsProvider=s,this.yBoundsProvider=i,this.xLabelsProvider=a,this.yLabelsProvider=o,this.drawPredicate=l,this.getBaseLine=c}draw(){if(this.drawPredicate()){const e=this.canvasModel.ctx;Ct(e,()=>this.drawVertical(e)),Ct(e,()=>this.drawHorizontal(e)),Ct(e,()=>this.drawZeroLine(e))}}drawZeroLine(e){if(this.getBaseLine&&this.config.components.yAxis.type==="percent"&&this.config.components.yAxis.zeroPercentLine){const t=this.xBoundsProvider(),r=ve(this.getBaseLine());e.beginPath(),e.strokeStyle=this.config.colors.yAxis.zeroPercentLine,e.setLineDash([]),e.moveTo(t.x,r),e.lineTo(t.x+t.width,r),e.stroke(),e.closePath()}}drawVertical(e){const t=this.xLabelsProvider();if(t.length&&this.config.components.grid.vertical){e.lineWidth=this.config.components.grid.width,e.strokeStyle=this.config.colors.chartAreaTheme.gridColor,e.setLineDash(this.config.components.grid.dash||[]);const r=this.xBoundsProvider(),s=r.x+r.width;for(const i of t){const a=ve(this.viewportModel.toX(i.value));a>r.x&&a<s&&(e.beginPath(),e.moveTo(a,r.y),e.lineTo(a,r.y+r.height),e.stroke())}}}drawHorizontal(e){const t=this.yLabelsProvider();if(t.length&&this.config.components.grid.horizontal){e.lineWidth=this.config.components.grid.width,e.strokeStyle=this.config.colors.chartAreaTheme.gridColor,e.setLineDash(this.config.components.grid.dash||[]);const r=this.yBoundsProvider();for(const s of t){const i=ve(this.viewportModel.toY(s.value)),a=Sh(s.text,e,Xe);i>r.y+a&&i<r.y+r.height-a&&(e.beginPath(),e.moveTo(r.x,i),e.lineTo(r.x+r.width,i),e.stroke())}}}getCanvasIds(){return[this.canvasModel.canvasId]}}class Ri extends te{constructor(e,t,r,s,i,a,o,l,c,h,v){super(),this.drawerName=s,this.drawingManager=i,this.drawer=new Zh(e,t,r,a,o,l,c,v,h)}doDeactivate(){super.doDeactivate(),this.drawingManager.removeDrawer(this.drawer)}doActivate(){super.doActivate(),this.drawingManager.addDrawer(this.drawer,this.drawerName)}}class Kh{constructor(e,t,r,s){this.canvasModel=e,this.chartModel=t,this.config=r,this.canvasBoundsContainer=s}draw(){if(this.config.components.highLow.visible&&this.chartModel.isReady()){const{high:e,low:t,highIdx:r,lowIdx:s}=this.chartModel.mainCandleSeries.zippedHighLow,i=this.chartModel.mainCandleSeries.dataIdxStart,a=i+r,o=i+s,l=this.canvasModel.ctx;l.save(),l.font=this.config.components.highLow.font,this.drawMarkerLabel(l,a,e,"high"),this.drawMarkerLabel(l,o,t,"low"),l.restore()}}drawMarkerLabel(e,t,r,s){const i=this.getMarkerY(e,r,s==="low");if(!this.checkMarkerInBounds(i))return;const a=this.getMarkerText(r,s),o=this.getMarkerX(e,t,a);e.fillStyle=s==="high"?this.config.colors.highLowTheme.highColor:this.config.colors.highLowTheme.lowColor,e.fillText(a,o,i)}getMarkerText(e,t){const r=this.chartModel.pane.regularFormatter(e);return`${t==="high"?"H:":"L:"} ${r}`}getMarkerY(e,t,r=!1){const s=this.chartModel.toY(t);if(r){const i=Nn(e);return s+i}return s}checkMarkerInBounds(e){const t=this.canvasBoundsContainer.getBounds(Y.CHART);return e>t.y&&e<t.y+t.height}getMarkerX(e,t,r){let s=this.chartModel.toX(t);const i=this.canvasBoundsContainer.getBounds(Y.CHART),a=4,o=e.measureText(r).width;return s+a+o>i.width&&(s=s-(a+o)),s+a}getCanvasIds(){return[this.canvasModel.canvasId]}}class qh extends te{constructor(e,t,r,s,i){super();const a=new Kh(t,r,e,s);i.addDrawer(a,"HIGH_LOW")}}const Jh=["AFTER_MARKET","PRE_MARKET","NO_TRADING","REGULAR"],Qh=24*60*60*1e3;class ed extends te{constructor(e){super(),this.chartModel=e,this.highlights=[],this.visualHighlights={},this.highlightsUpdatedSubject=new G}activate(){this.addRxSubscription(this.chartModel.scaleModel.xChanged.subscribe(()=>this.highlights.length&&this.recalculateVisualHighlights()))}getHighlights(){return this.highlights}getVisualHighlights(){return this.visualHighlights}recalculateVisualHighlights(){this.visualHighlights={};const e=this.chartModel.getFirstTimestamp(),t=this.chartModel.getLastTimestamp()+Qh;Lo(this.highlights,e,t,td).forEach(s=>{var i;this.visualHighlights[s.type]||(this.visualHighlights[s.type]=[]),(i=this.visualHighlights[s.type])==null||i.push(s)})}setHighlights(e){this.highlights=e,this.highlights.sort((t,r)=>t.to-r.to),this.highlightsUpdatedSubject.next(this.highlights),this.highlights.length?this.recalculateVisualHighlights():this.visualHighlights={}}observeHighlightsUpdated(){return this.highlightsUpdatedSubject.asObservable()}}const td=n=>n.to,dt=[20,10];class nd{constructor(e,t,r,s,i){this.highlightsModel=e,this.chartModel=t,this.canvasModel=r,this.canvasBoundsContainer=s,this.config=i}draw(){var e,t,r,s;if(this.config.components.highlights.visible){const i=this.chartModel.getCandles(),a=this.canvasModel.ctx,o=this.highlightsModel.getVisualHighlights();if(this.highlightsModel.getHighlights().length&&i.length!==0&&this.chartModel.scaleModel.isScaleReady()){const c=this.canvasBoundsContainer.getBounds(Y.ALL_PANES);a.save(),yt(a,c);const h=(e=this.config.components.highlights.border.width)!=null?e:1,v=(t=this.config.components.highlights.border.dash)!=null?t:[0,0],p=(r=this.config.components.highlights.fontSize)!=null?r:11,y=(s=this.config.components.highlights.fontFamily)!=null?s:"monospace",E=`${p}px ${y}, monospace`;a.font=E,a.lineWidth=h,a.setLineDash(v),Jh.forEach(R=>{var N,k;const U=o[R];if(U){const Z=this.config.colors.highlights[R],K=(N=Z==null?void 0:Z.border)!=null?N:"#ffffff",q=(k=Z==null?void 0:Z.background)!=null?k:"#ffffff";a.save(),a.beginPath(),a.fillStyle=q,a.strokeStyle=K,U.forEach($=>{var J,ne,oe;const le=this.chartModel.candleFromTimestamp($.from),re=Pe(le.width,this.chartModel.scaleModel.zoomX),ce=le.xStart(this.chartModel.scaleModel),fe=this.chartModel.candleFromTimestamp($.to),de=Pe(fe.width,this.chartModel.scaleModel.zoomX),ue=fe.xStart(this.chartModel.scaleModel)+de;if($.border&&this.drawBorders($.border,a,ce+re,ue-de,c),a.fillRect(ce,c.y,ue-ce,c.y+c.height),$.label){const pe=(J=$.label.text)!=null?J:"",me=this.config.colors.highlights[$.type];a.save(),a.fillStyle=(ne=me==null?void 0:me.label)!=null?ne:"#ffffff";const Fe=Re(pe,a,E),[Ye,He]=this.resolveHighlightLabelPosition((oe=$.label.placement)!=null?oe:"left-left",c,[ce,ue],Fe);a.fillText(pe,Ye,He),a.restore()}}),a.closePath(),a.restore()}}),a.restore()}}}resolveHighlightLabelPosition(e,t,r,s){const[i,a]=r;switch(e){case"right-left":return[a-dt[1]-s,t.y+dt[0]];case"left-left":return[i-dt[1]-s,t.y+dt[0]];case"right-right":return[a+dt[1],t.y+dt[0]];case"left-right":default:return[i+dt[1],t.y+dt[0]]}}drawBorders(e,t,r,s,i){const a=e.left,o=e.right;a&&(t.beginPath(),t.moveTo(r,i.y),t.lineTo(r,i.y+i.height),t.stroke(),t.closePath()),o&&(t.beginPath(),t.moveTo(s,i.y),t.lineTo(s,i.y+i.height),t.stroke(),t.closePath())}getCanvasIds(){return[this.canvasModel.canvasId]}}const rd="HIGHLIGHTS_PLUGIN";class sd extends te{constructor(e,t,r,s,i,a){super(),this.eventBus=e,this.config=t,this.highlightsModel=new ed(r),this.addChildEntity(this.highlightsModel),this.highLightsDrawer=new nd(this.highlightsModel,r,s,i,t),a.addDrawer(this.highLightsDrawer,rd)}getHighlights(){return this.highlightsModel.getHighlights()}setHighlights(e){this.highlightsModel.setHighlights(e)}setHighlightsVisible(e=!0){this.config.components.highlights.visible=e,this.eventBus.fireDraw(this.highLightsDrawer.getCanvasIds())}observeHighlightsUpdated(){return this.highlightsModel.observeHighlightsUpdated()}}function id(){return w(function(n,e){var t,r=!1;n.subscribe(We(e,function(s){var i=t;t=s,r&&e.next([i,s]),r=!0}))})}function he(n,e){return w(function(t,r){var s=0;t.subscribe(We(r,function(i){return n.call(e,i,s++)&&r.next(i)}))})}var ad=Object.defineProperty,od=Object.defineProperties,ld=Object.getOwnPropertyDescriptors,Fi=Object.getOwnPropertySymbols,cd=Object.prototype.hasOwnProperty,hd=Object.prototype.propertyIsEnumerable,Yi=(n,e,t)=>e in n?ad(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Hi=(n,e)=>{for(var t in e||(e={}))cd.call(e,t)&&Yi(n,t,e[t]);if(Fi)for(var t of Fi(e))hd.call(e,t)&&Yi(n,t,e[t]);return n},Ni=(n,e)=>od(n,ld(e));const nt=4;class dd{constructor(e,t,r,s,i,a){this.config=e,this.chartModel=t,this.canvasModel=r,this.canvasBoundsContainer=s,this.formatterFactory=i,this.visualCandlesProvider=a}draw(){if(this.config.components.navigationMap.visible){const e=this.visualCandlesProvider();if(e.length){const t=this.canvasBoundsContainer.getBounds(Y.N_MAP),r=this.canvasBoundsContainer.getBounds(Y.N_MAP_BTN_L),s=this.canvasBoundsContainer.getBounds(Y.N_MAP_BTN_R),i=this.canvasBoundsContainer.getBounds(Y.N_MAP_KNOT_L),a=this.canvasBoundsContainer.getBounds(Y.N_MAP_KNOT_R),o=this.canvasBoundsContainer.getBounds(Y.N_MAP_SLIDER_WINDOW),l=this.canvasBoundsContainer.getBounds(Y.N_MAP_CHART),c=this.canvasModel.ctx;c.fillStyle=this.config.colors.navigationMap.backgroundColor,c.fillRect(t.x,t.y,t.width,t.height),c.strokeStyle=this.config.colors.paneResizer.lineColor,c.lineWidth=1,c.beginPath(),c.moveTo(t.x,t.y),c.lineTo(t.x+t.width,t.y),c.closePath(),c.stroke(),r.width!==0&&this.drawLeftArrowButton(c,r,this.config),s.width!==0&&this.drawRightArrowButton(c,s,this.config),c.fillStyle=this.config.colors.navigationMap.mapFillColor,c.beginPath(),c.moveTo(l.x,l.y+l.height);for(const h of e)c.lineTo(h[0],h[1]);if(c.lineTo(l.x+l.width,l.y+l.height),c.lineTo(l.x,l.y+l.height),c.closePath(),this.config.colors.navigationMap.mapGradientTopColor&&this.config.colors.navigationMap.mapGradientBottomColor){const h=c.createLinearGradient(l.x,l.y,l.x,l.y+l.height);h.addColorStop(0,this.config.colors.navigationMap.mapGradientTopColor),h.addColorStop(1,this.config.colors.navigationMap.mapGradientBottomColor),c.fillStyle=h}c.fill(),this.config.colors.navigationMap.mapColor&&(c.strokeStyle=this.config.colors.navigationMap.mapColor,c.stroke()),this.drawSlider(c,i,a,r,o),this.drawTimeLabels(c)}}}blockDrawSliderOnLeftArrow(e,t,r,s){e.x<=r.x+r.width&&(e.x=r.x+r.width,s.x=e.x+e.width,t.x=s.x+s.width)}drawSlider(e,t,r,s,i){this.blockDrawSliderOnLeftArrow(t,r,s,i),this.drawKnotButton(e,t,this.config,!0),this.drawKnotButton(e,r,this.config,!1),e.fillStyle=this.config.colors.navigationMap.sliderColor,e.fillRect(i.x,i.y,i.width,i.height)}drawLeftArrowButton(e,t,r){e.fillStyle=r.colors.navigationMap.buttonColor,e.fillRect(t.x,t.y,t.width,t.height),e.beginPath();const s=Math.round(t.x+t.width/2-nt/2),i=Math.round(t.y+t.height/2);e.moveTo(s,i),e.lineTo(s+nt,i+nt),e.lineTo(s+nt,i-nt),e.fillStyle=r.colors.navigationMap.buttonArrowColor,e.fill()}drawRightArrowButton(e,t,r){e.fillStyle=r.colors.navigationMap.buttonColor,e.fillRect(t.x,t.y,t.width,t.height),e.beginPath();const s=Math.round(t.x+t.width/2-nt/2),i=Math.round(t.y+t.height/2);e.moveTo(s,i-nt),e.lineTo(s,i+nt),e.lineTo(s+nt,i),e.fillStyle=r.colors.navigationMap.buttonArrowColor,e.fill()}drawKnotButton(e,t,r,s){const i=r.components.navigationMap.knots.border;e.fillStyle=r.colors.navigationMap.knotColor;const a=s?t.x-i:t.x+i;e.fillRect(a,t.y,t.width,t.height),e.lineWidth=r.components.navigationMap.knots.lineWidth,i>0&&(e.beginPath(),e.moveTo(a,t.y),e.lineTo(a,t.y+t.height),e.lineTo(a+t.width,t.y+t.height),e.lineTo(a+t.width,t.y),e.lineTo(a,t.y),e.lineWidth=i,e.strokeStyle=r.colors.navigationMap.knotBorderColor,e.stroke()),e.beginPath(),e.moveTo(a+t.width/2,t.y+t.height/4),e.lineTo(a+t.width/2,t.y+3*t.height/4),e.strokeStyle=r.colors.navigationMap.knotLineColor,e.stroke()}drawTimeLabels(e){const t=Ie(this.chartModel.mainCandleSeries.getSeriesInViewport()),r=this.config.components.navigationMap.timeLabels,s=r.visible;if(t.length&&s){const i=t[0].candle.timestamp,a=t[t.length-1].candle.timestamp,o=this.canvasBoundsContainer.getBounds(Y.N_MAP_LABEL_L),l=this.canvasBoundsContainer.getBounds(Y.N_MAP_LABEL_R),h={textFill:this.config.colors.navigationMap.timeLabelsTextColor,textFontFamily:r.fontFamily,textSize:`${r.fontSize}px`},v={dateFormat:r.dateFormat,padding:r.padding,textProperties:Ni(Hi({},h),{textAlign:"left"})},p={dateFormat:r.dateFormat,padding:r.padding,textProperties:Ni(Hi({},h),{textAlign:"right"})};this.drawTimeLabel(e,o,i,v),this.drawTimeLabel(e,l,a,p)}}drawTimeLabel(e,t,r,s){const i=s.padding,a=es(r,s.dateFormat,this.formatterFactory);qr(e,s.textProperties);const o=Nn(e),l=Qr(a);Io(e,l,t.x+i.x,t.y+o+i.y,s.textProperties)}getCanvasIds(){return[this.canvasModel.canvasId]}}class Gt extends vi{constructor(e,t,r,s,i=fi){super(e,t,r,s,i)}doActivate(){super.doActivate(),this.addRxSubscription(this.canvasInputListener.observeXDragStart(this.hitTest).subscribe(this.onDragStart)),this.addRxSubscription(this.canvasInputListener.observeXDrag().subscribe(this.onDragTick)),this.addRxSubscription(this.canvasInputListener.observeXDragEnd().subscribe(this.onDragEnd))}doDeactivate(){super.doDeactivate()}}const ki=4;class ud extends te{constructor(e,t,r,s,i,a){super(),this.bus=e,this.chartModel=t,this.scaleModel=r,this.canvasInputListeners=s,this.canvasBoundsContainer=i,this.chartPanComponent=a,this.leftKnotDragStartXRelative=0,this.rightKnotDragStartXRelative=0,this.lastMousePosition=0,this.leftKnotDragStart=y=>{const E=this.canvasBoundsContainer.getBounds(Y.N_MAP_CHART);this.leftKnotDragStartXRelative=y.x-E.x-ki},this.leftKnotDragTick=y=>{const{delta:E}=y,N=this.canvasBoundsContainer.getBounds(Y.N_MAP_CHART).width,k=(this.leftKnotDragStartXRelative+E)/N;this.canvasBoundsContainer.leftRatio=k,this.scaleModel.setXScale(Math.round(this.chartModel.mainCandleSeries.dataPoints.length*this.canvasBoundsContainer.leftRatio),this.scaleModel.xEnd)},this.rightKnotDragStart=y=>{const E=this.canvasBoundsContainer.getBounds(Y.N_MAP_CHART);this.rightKnotDragStartXRelative=y.x-E.x+ki},this.rightKnotDragTick=y=>{const{delta:E}=y,N=this.canvasBoundsContainer.getBounds(Y.N_MAP_CHART).width,k=(this.rightKnotDragStartXRelative+E)/N;this.canvasBoundsContainer.rightRatio=k,this.scaleModel.setXScale(this.scaleModel.xStart,Math.round(this.chartModel.mainCandleSeries.dataPoints.length*this.canvasBoundsContainer.rightRatio))},this.sliderDragStart=()=>{this.lastMousePosition=0},this.sliderDragTick=y=>{const{delta:E}=y,R=this.canvasBoundsContainer.getBounds(Y.N_MAP_CHART),N=this.chartModel.mainCandleSeries.meanCandleWidth/(R.width/this.chartModel.mainCandleSeries.dataPoints.length),k=(this.lastMousePosition-E)*N;this.scaleModel.moveXStart(this.scaleModel.xStart-k),this.lastMousePosition=E};const o=this.canvasBoundsContainer.getBoundsHitTest(Y.N_MAP_KNOT_L),l=this.canvasBoundsContainer.getBoundsHitTest(Y.N_MAP_KNOT_R),c=new Gt(o,{onDragStart:this.leftKnotDragStart,onDragTick:this.leftKnotDragTick},this.canvasInputListeners,this.chartPanComponent),h=new Gt(l,{onDragStart:this.rightKnotDragStart,onDragTick:this.rightKnotDragTick},this.canvasInputListeners,this.chartPanComponent);this.addChildEntity(c),this.addChildEntity(h);const v=this.canvasBoundsContainer.getBoundsHitTest(Y.N_MAP_SLIDER_WINDOW),p=new Gt(v,{onDragStart:this.sliderDragStart,onDragTick:this.sliderDragTick},this.canvasInputListeners,this.chartPanComponent);this.addChildEntity(p)}doActivate(){super.doActivate();const e=this.canvasBoundsContainer.getBoundsHitTest(Y.N_MAP_BTN_L);this.addRxSubscription(this.canvasInputListeners.observeClick(e).subscribe(()=>{this.scaleModel.moveXStart(this.scaleModel.xStart-1)})),this.addRxSubscription(this.canvasInputListeners.observeTouchStart(e).subscribe(()=>{this.scaleModel.moveXStart(this.scaleModel.xStart-1)}));const t=this.canvasBoundsContainer.getBoundsHitTest(Y.N_MAP_BTN_R);this.addRxSubscription(this.canvasInputListeners.observeClick(t).subscribe(()=>{this.scaleModel.moveXStart(this.scaleModel.xStart+1)})),this.addRxSubscription(this.canvasInputListeners.observeTouchStart(t).subscribe(()=>{this.scaleModel.moveXStart(this.scaleModel.xStart+1)})),this.addRxSubscription(this.scaleModel.xChanged.subscribe(()=>{const r=this.chartModel.mainCandleSeries;this.canvasBoundsContainer.leftRatio=r.dataIdxStart/(r.dataPoints.length-1),this.canvasBoundsContainer.rightRatio=r.dataIdxEnd/(r.dataPoints.length-1),this.canvasBoundsContainer.recalculateNavigationMapElementBounds(),this.bus.fireDraw()}))}}class fd extends te{constructor(e,t,r,s,i,a,o,l,c,h){super(),this.eventBus=e,this.chartModel=t,this.canvasModel=r,this.config=s,this.canvasInputListeners=i,this.canvasBoundsContainer=a,this.chartPanComponent=c,this.visualCandles=[];const v=new dd(s,t,r,a,l,()=>this.visualCandles);o.addDrawer(v,Y.N_MAP_CHART),this.navigationMapMoveHandler=new ud(this.eventBus,this.chartModel,this.chartModel.scaleModel,this.canvasInputListeners,this.canvasBoundsContainer,this.chartPanComponent),h.setCursorForCanvasEl(Y.N_MAP_CHART,s.components.navigationMap.cursors.chart),h.setCursorForCanvasEl(Y.N_MAP_BTN_L,s.components.navigationMap.cursors.buttonLeft),h.setCursorForCanvasEl(Y.N_MAP_BTN_R,s.components.navigationMap.cursors.buttonRight),h.setCursorForCanvasEl(Y.N_MAP_KNOT_L,s.components.navigationMap.cursors.leftResizer),h.setCursorForCanvasEl(Y.N_MAP_KNOT_R,s.components.navigationMap.cursors.rightResizer),h.setCursorForCanvasEl(Y.N_MAP_SLIDER_WINDOW,s.components.navigationMap.cursors.slider)}doActivate(){super.doActivate(),this.addRxSubscription(Me(this.chartModel.observeCandlesChanged(),this.canvasBoundsContainer.observeBoundsChanged(Y.N_MAP),this.chartModel.scaleModel.xChanged.pipe(id(),he(([e,t])=>{const s=e.start<0||e.end>0,i=t.start<0||t.end>0;return s&&!i||i}))).subscribe(()=>{this.config.components.navigationMap.visible&&(this.visualCandles=this.makeVisualCandles(),this.canvasModel.fireDraw())}))}makeVisualCandles(){var e;const t=this.chartModel.getCandles();if(!t.length)return[];const r=this.chartModel.mainCandleSeries.dataIdxStart,s=this.chartModel.mainCandleSeries.dataIdxEnd,i=Math.round(Math.max(-r,0)),a=Math.max(this.chartModel.getCandlesCountWithRightOffset(),s)+i;let o=Number.NEGATIVE_INFINITY,l=Number.POSITIVE_INFINITY;const c=this.canvasBoundsContainer.getBounds(Y.N_MAP_CHART),h=c.width,v=[];let p=0,y,E;for(y=0;y<h;y++)E=ve(y*a/h)-i,E in t?(v[y]=t[E].close,p=(e=v[y])!=null?e:0,o=Math.max(o,p),l=Math.min(l,p)):v[y]=0;return o-=l,v.map((R,N)=>[N+c.x,(o+l-R)*c.height/o+c.y])}setVisible(e=!0){var t;(t=this.config.components)!=null&&t.navigationMap&&(this.config.components.navigationMap.visible=e,this.eventBus.fire(Qn),this.canvasModel.fireDraw())}}class vd extends te{constructor(e,t,r){super(),this.scaleModel=e,this.canvasInputListeners=t,this.mainCanvasParent=r,this.touchedCandleIndexes=[0,0]}doActivate(){this.addRxSubscription(this.canvasInputListeners.observeTouchStart().subscribe(e=>this.handleTouchStartEvent(e))),this.addRxSubscription(this.canvasInputListeners.observeTouchMove().subscribe(e=>this.handleTouchMoveEvent(e)))}handleTouchStartEvent(e){e.touches.length===2&&(this.touchedCandleIndexes=this.getXPositions(e).map(t=>this.scaleModel.fromX(t)))}handleTouchMoveEvent(e){e.touches.length===2&&this.pinchHandler(this.touchedCandleIndexes,this.getXPositions(e))}getXPositions(e){const t=this.mainCanvasParent.getBoundingClientRect(),r=[0,0],s=document.body.scrollLeft||document.documentElement.scrollLeft;for(let i=0,a=e.touches.length;i<a;i++){const o=e.touches[i];r[i]=o.pageX-t.left-s}return r}pinchHandler(e,t){const r=(t[0]*e[1]-t[1]*e[0])/(t[0]-t[1]),s=r+(e[0]-e[1])/(t[0]-t[1])*this.scaleModel.getBounds().width;this.scaleModel.setXScale(r,s)}}const Wi=()=>{const n=/Mac|iPod|iPhone|iPad/i.test(navigator.userAgent),t=[/Android/i,/webOS/i,/BlackBerry/i,/Windows Phone/i].some(r=>navigator.userAgent.match(r));return n?"apple":t?"mobile":"other"},Ev=(n,e)=>n==="apple"||n==="mobile"?3:e,gd=/^((?!chrome|android).)*safari/i.test(navigator.userAgent),pd=!!window.chrome,Ui=typeof InstallTrigger!="undefined",md=navigator.platform.indexOf("Win")>-1,zi=n=>{let e=!1;const{wheelDeltaY:t,wheelDeltaX:r}=n;if(t||r){let s;if(gd)s=t===n.deltaY*-3||Math.abs(t+Math.sign(t))===Math.abs(Math.round(n.deltaY)*3)||Math.abs(t-Math.sign(t))===Math.abs(Math.round(n.deltaY)*3);else if(pd){if(s=t+Math.sign(t)===n.deltaY*-3?t+Math.sign(t)===n.deltaY*-3:t===n.deltaY*-3,md){const i=Math.round(n.deltaY)===t||Math.abs(Math.round(n.deltaY)+Math.sign(n.deltaY))===Math.abs(t)||Math.abs(Math.round(n.deltaY)-Math.sign(n.deltaY))===Math.abs(t);s=Math.abs(t)===Math.abs(n.deltaY)||i}}else Ui?Math.abs(n.deltaY)>Math.abs(n.deltaX)?s=!1:s=r===n.deltaX*-3:s=t===n.deltaY*-3;s&&(e=!0)}else n.deltaMode===0&&(e=!0);return Ui&&n.deltaY>=16&&Math.abs(n.deltaY)%16===0&&(e=!1),n.ctrlKey&&(e=!0),e},bd=n=>n.components.yAxis.type==="percent"?n.scale.zoomSensitivity/4:n.scale.zoomSensitivity;var hr=Math.pow;class Cd extends te{constructor(e,t,r,s,i,a,o,l){super(),this.bus=e,this.config=t,this.scaleModel=r,this.mainCanvasParent=s,this.canvasInputListener=i,this.canvasBoundsContainer=a,this.canvasAnimation=o,this.chartPanComponent=l,this.currentPoint={x:0,y:0},this.xDraggedCandlesDelta=0,this.lastXStart=0,this.wheelTrottleTime=15,this.zoomXHandler=v=>{const p=zi(v),y=v.deltaY<0,E=p?bd(this.config):this.config.scale.zoomSensitivity;if(this.config.scale.zoomToCursor){const N=this.canvasBoundsContainer.getBounds(Y.CANVAS).width,U=v.offsetX/N;this.scaleModel.zoomXToPercent(U,y,!1,E)}else this.scaleModel.zoomXToEnd(y,E);this.bus.fireDraw()},this.onXDragStart=()=>{this.canvasAnimation.forceStopAnimation(On),this.xDraggedCandlesDelta=0,this.lastXStart=this.scaleModel.xStart},this.onXDragTick=v=>{const{delta:p}=v;this.currentPoint.x=p;const y=tt(p,this.scaleModel.zoomX);this.scaleModel.moveXStart(this.lastXStart-y),this.bus.fireDraw()},this.touchHandler=new vd(this.scaleModel,this.canvasInputListener,this.mainCanvasParent);const c=this.canvasBoundsContainer.getBoundsHitTest(Y.ALL_PANES),h=new Gt(c,{onDragStart:this.onXDragStart,onDragTick:this.onXDragTick},this.canvasInputListener,this.chartPanComponent,{disableChartPanning:!1});this.addChildEntity(h)}doActivate(){super.doActivate();const e=this.canvasBoundsContainer.getBoundsHitTest(Y.ALL_PANES);this.addRxSubscription(Me(this.canvasInputListener.observeWheel(e),this.canvasInputListener.observePinch(e)).pipe(Nt(this.wheelTrottleTime,void 0,{trailing:!0,leading:!0})).subscribe(this.zoomXHandler)),this.addRxSubscription(this.canvasInputListener.observeScrollGesture().pipe(Nt(this.wheelTrottleTime,void 0,{trailing:!0,leading:!0})).subscribe(t=>{let r=-1;const s=Wi();(s==="apple"||s==="mobile")&&(r=1);let i=0,a=0;if(i+=t.deltaX*r,a+=t.deltaY*-r,i!==0&&Math.abs(i)>Math.abs(a)){const o=tt(i,this.scaleModel.zoomX);this.scaleModel.moveXStart(this.scaleModel.xStart-o)}else a!==0&&Math.abs(a)>Math.abs(i)&&this.zoomXHandler(t);this.bus.fireDraw()})),this.addRxSubscription(this.chartPanComponent.chartBaseModel.dataPrependSubject.asObservable().subscribe(({prependedCandlesWidth:t})=>{this.lastXStart+=t})),this.touchHandler.activate(),this.addSubscription(this.touchHandler.deactivate.bind(this.touchHandler))}registerChartYPanHandler(e,t){let r=e.yStart;const s=()=>{this.canvasAnimation.forceStopAnimation(On),this.currentPoint={x:0,y:0},r=e.yStart},i=o=>{const{delta:l}=o;if(this.currentPoint.y=l,e.state.auto)yd(this.currentPoint,e.state.autoScaleDisableOnDrag)&&e.autoScale(!1);else{const c=tt(e.state.inverse?-l:l,e.zoomY);e.moveYStart(r+c)}},a=new fn(t,{onDragTick:i,onDragStart:s},this.canvasInputListener,this.chartPanComponent,{disableChartPanning:!1});return this.addChildEntity(a),a}}const yd=(n,e)=>{if(!e.enabled)return!1;const t=Math.abs(n.y),r=hr(hr(Math.abs(n.x),2)+hr(t,2),.5),s=Math.abs(Math.acos(t/r));return t>e.yDiff&&s<e.edgeAngle};class wd extends te{constructor(e,t,r,s,i,a,o,l){super(),this.eventBus=e,this.mainScaleModel=t,this.canvasBoundsContainer=r,this.config=s,this.canvasAnimation=i,this.canvasInputListener=a,this.mainCanvasParent=o,this.chartBaseModel=l,this.chartPanComponents=[],this.chartAreaPanHandler=new Cd(this.eventBus,this.config,this.mainScaleModel,this.mainCanvasParent,this.canvasInputListener,this.canvasBoundsContainer,this.canvasAnimation,this),this.chartPanComponents.push(this.chartAreaPanHandler)}doActivate(){this.activateChartPanHandlers()}doDeactivate(){this.deactivatePanHandlers()}activateChartPanHandlers(){this.chartPanComponents.forEach(e=>e.activate())}deactivatePanHandlers(){this.chartPanComponents.forEach(e=>e.deactivate())}}const Xi=n=>e=>{const{top:t,bottom:r}=n(),s=e.high-e.low,i=s===0?1:s,a=i*t/100,o=i*r/100,l=e.low-o,c=e.high+a;return{low:l,high:c}},ji=(n,e)=>{const t=Xi(n);return{isHighLowActive:()=>!0,calculateHighLow:r=>{const s=e.calculateHighLow(r);return t(s)}}};function Sd(){return Fr(1)}function Vi(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];return Sd()(qt(n,Kt(n)))}function xd(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];var t=Kt(n);return w(function(r,s){(t?Vi(n,r,t):Vi(n,r)).subscribe(s)})}function Md(n){return he(function(e,t){return n<=t})}class Pd{constructor(e,t,r,s,i){this.config=e,this.boundsProvider=t,this.canvasModel=r,this.canvasAnimation=s,this.animationId=i}draw(){if(this.config.components.paneResizer.visible){const e=this.config.components.paneResizer.fixedMode,t=this.boundsProvider(),r=this.canvasModel.ctx,s=this.canvasAnimation.getColorAlphaAnimation(this.animationId),i=this.config.components.paneResizer.dragZone;!e&&s&&(r.fillStyle=s.getColor(0),r.fillRect(t.x,t.y-i,t.width,t.height+2*i)),r.fillStyle=this.config.colors.paneResizer.lineColor,this.config.animation.paneResizer.bgMode?r.fillRect(t.x,t.y,t.width,t.height):r.fillRect(t.x,t.y-i,t.width,t.height+2*i)}}getCanvasIds(){return[this.canvasModel.canvasId]}}class Td extends te{constructor(e,t,r,s,i,a,o,l,c,h,v){super(),this.id=e,this.boundsProvider=t,this.hitTest=r,this.dragTickCb=s,this.chartPanComponent=i,this.canvasModel=a,this.drawingManager=o,this.canvasInputListener=l,this.canvasAnimation=c,this.config=h,this.canvasBoundsContainer=v,this.initialY=0,this.resizeEvent$=new G,this.onYDragStart=()=>{this.config.components.crossTool.type="none",this.initialY=this.boundsProvider().y},this.onYDragEnd=()=>{this.config.components.crossTool.type="cross-and-labels",this.initialY=this.boundsProvider().y,this.canvasBoundsContainer.graphsHeightRatioChangedSubject.next(this.canvasBoundsContainer.graphsHeightRatio)},this.onYDragTick=p=>{const{delta:y,draggedPixels:E}=p;Math.abs(this.initialY-this.boundsProvider().y+E)>=0&&(this.dragTickCb(y),this.resizeEvent$.next())},this.animationId=`${this.id}_RESIZER`}doActivate(){if(super.doActivate(),!this.config.components.paneResizer.fixedMode){const r=new fn(this.hitTest,{onDragTick:this.onYDragTick,onDragStart:this.onYDragStart,onDragEnd:this.onYDragEnd},this.canvasInputListener,this.chartPanComponent);this.addChildEntity(r),this.config.animation.paneResizer.enabled&&this.addRxSubscription(this.canvasInputListener.observeMouseEnter(this.hitTest,!0).pipe(xd(!1),Ve(),Md(1)).subscribe(s=>{s?this.handleHoverAnimation("appearing"):this.handleHoverAnimation("fading")}))}const t=new Pd(this.config,this.boundsProvider,this.canvasModel,this.canvasAnimation,this.animationId);this.drawingManager.addDrawer(t,ui.paneResizer(this.id)),this.addSubscription(()=>this.drawingManager.removeDrawerByName(ui.paneResizer(this.id)))}doDeactivate(){super.doDeactivate(),this.resizeEvent$.complete()}handleHoverAnimation(e){let t;this.config.animation.paneResizer.bgMode?(t=this.canvasAnimation.getColorAlphaAnimation(this.animationId),(!t||!t.animationInProgress)&&this.canvasAnimation.startColorAlphaAnimation(this.animationId,[{color:this.config.colors.paneResizer.bgHoverColor,type:e}])):(t=this.canvasAnimation.getColorTransitionAnimation(this.animationId),(!t||!t.animationInProgress)&&this.canvasAnimation.startColorTransitionAnimation(this.animationId,[{startColor:this.config.colors.paneResizer.bgColor,endColor:this.config.colors.paneResizer.bgHoverColor,type:e}],this.config.animation.paneResizer.duration)),t&&t.animationInProgress&&t.revert()}}const _d=n=>e=>{let t;if(typeof e=="number")t=e;else if(typeof e=="string")t=Number(e);else return"\u2014";const[r]=n.dataSeries;if(r!==void 0){const s=ze.getPricePrecision(t,r.pricePrecisions);return t.toFixed(s)}return`${t}`},Ad=n=>(e,t)=>{const[r]=n.dataSeries;let s=e;const i=t!=null?t:r;i!==void 0&&(s=Ds(e,i.getBaseLine()));const a=s.toFixed(ze.DEFAULT_PRECISION).replace("-","\u2212")+" %";return a==="\u22120.00 %"?"0.00 %":a},Dd=n=>({percent:Ad(n),regular:_d(n)});class Ed extends te{constructor(e,t,r,s,i,a,o,l,c,h,v=new Set,p={regular:qn}){if(super(),this.paneUuid=e,this.idx=t,this.paneComponent=r,this.chartBaseModel=s,this.canvasBoundsContainer=i,this.hitTestController=a,this.dataSeriesCanvasModel=o,this.scaleModel=l,this.yAxisComponent=c,this.dragNDrop=h,this.dataSeries=v,this.formatters=p,this.getYAxisBounds=()=>this.canvasBoundsContainer.getBounds(Y.PANE_UUID_Y_AXIS(this.paneUuid,this.idx)),this.yAxisHT=this.canvasBoundsContainer.getBoundsHitTest(Y.PANE_UUID_Y_AXIS(this.paneUuid,this.idx)),this.toVisualPoints=y=>y.map(E=>new Ut(this.chartBaseModel.dataFromTimestamp(E.timestamp).centerUnit,E.close)),this.valueFormatter=(y,E)=>{var R;return((R=this.formatters[this.getAxisType()])!=null?R:this.formatters.regular)(y,E)},this.addChildEntity(l),c!==void 0){this.addChildEntity(c.yAxisScaleHandler),this.addSubscription(c.unsub);const y={getLargestLabel:()=>{var E;return(E=c.labelsGenerator.getLargestLabel())!=null?E:""},getYAxisIndex:()=>t,getYAxisAlign:()=>c.state.align,getPaneUUID:()=>r.uuid};this.canvasBoundsContainer.yAxisBoundsContainer.registerYAxisWidthContributor(y),this.addSubscription(()=>this.canvasBoundsContainer.yAxisBoundsContainer.removeYAxisWidthContributor(y))}this.setValueFormatters(Dd(this))}doDeactivate(){super.doDeactivate(),this.dataSeries.forEach(e=>e.deactivate())}getBounds(){return this.scaleModel.getBounds()}createDataSeries(){const e=new Rs(this,this.hitTestController.getNewDataSeriesHitTestId());return e.toVisualPoints=this.toVisualPoints,e}addDataSeries(e){this.dataSeries.add(e),this.dataSeries.size===1&&(this.mainDataSeries=e),this.paneComponent.updateView()}removeDataSeries(e){this.dataSeries.delete(e),this.paneComponent.updateView()}getAxisType(){return"regular"}get regularFormatter(){return this.formatters.regular}setValueFormatters(e){this.formatters=e}regularValueFromY(e){var t,r;return(r=(t=this.mainDataSeries)==null?void 0:t.view.priceFromY(e))!=null?r:this.scaleModel.fromY(e)}}const Gi=n=>({isHighLowActive:()=>!0,calculateHighLow:e=>{const t=Array.from(n.dataSeries).filter(r=>r.highLowProvider.isHighLowActive()).map(r=>r.highLowProvider.calculateHighLow(e));return Vs(t)}});class Ld{constructor(e,t){this.paneComponents=e,this.canvasModel=t,this.dataSeriesIdCounter=lr.DATA_SERIES[0],this.getNewDataSeriesHitTestId=()=>this.dataSeriesIdCounter++}getIdRange(){return lr.DATA_SERIES}get allDataSeries(){return Tt(Tt(Object.values(this.paneComponents),e=>e.yExtentComponents),e=>Array.from(e.dataSeries))}lookup(e){return this.allDataSeries.find(r=>r.id===e)}onHover(e){this.allDataSeries.forEach(t=>t.hovered=t.id===(e==null?void 0:e.id)),this.canvasModel.fireDraw()}onMouseDown(e){e&&this.handleYExtentDragStart(e)}onMouseUp(){this.handleYExtentDragEnd()}handleYExtentDragStart(e){Object.values(this.paneComponents).forEach(t=>t.yExtentComponents.forEach(r=>r.dragNDrop.deactivate())),e.extentComponent.dragNDrop.activate()}handleYExtentDragEnd(){Object.values(this.paneComponents).forEach(e=>e.yExtentComponents.forEach(t=>t.dragNDrop.activate()))}}class Id{constructor(e,t=()=>!0){this.dataProvider=e,this.dataUpdatedPredicate=t,this.calculatedInThisFrame=!1,this.animFrameId=`anim_cache_${Je()}`}calculateOrGet(){var e;return this.calculatedInThisFrame||(this.cache=this.dataProvider(),this.dataUpdatedPredicate()&&(this.calculatedInThisFrame=!0),di(this.animFrameId,()=>{this.calculatedInThisFrame=!1})),(e=this.cache)!=null?e:this.dataProvider()}forceCalculateOrGet(){return this.invalidate(),this.calculateOrGet()}getLastCachedValue(){return this.cache}updateCacheValue(e){this.cache=e}invalidate(){this.cache=void 0,this.calculatedInThisFrame=!1}}const Od=0,Bd=.01;class dr{constructor(e,t,r,s,i=!1,a,o,l=Bn,c=23){this.increment=e,this.startEndProvider=t,this.lengthProvider=r,this.valueFormatter=s,this.withZero=i,this.axisTypeProvider=a,this.baseLineProvider=o,this.labelFilter=l,this.singleLabelHeightPixels=c,this.gridDistanceMultipliers=[2,4,5,10],this.lastSingleLabelHeightValue=0,this.distanceBetweenLabelsChangeSubject=new G,this.newGeneratedLabelsSubject=new G,this.lastStart=0,this.lastEnd=0,this.labelsCache=new Id(()=>this.labelFilter(this.doGenerateLabels()))}generateRegularLabels(e,t,r){const s=[];this.withZero&&s.push({value:0,text:"0"});let i=we.roundToNearest(e,r);for(;i<t;){const a=we.roundToNearest(i,r),o=this.valueFormatter(a);s.push({value:a,text:o}),i=we.roundDecimal(i+r)}return s}generatePercentLabels(e,t,r){const s=[],i=this.baseLineProvider();let a=we.roundToNearest(e,r);for(;a<t;){const o=we.roundToNearest(a,r),l=Es(o,i),c=this.valueFormatter(l);s.push({value:o,text:c}),a=we.roundDecimal(a+r)}return s}generateLogarithmLabels(e,t,r){const s=[];let i=we.roundToNearest(e,r);for(;i<t;){const a=Kn(i),o=this.valueFormatter(a);s.push({value:i,text:o}),i=we.roundDecimal(i+r)}return s}doGenerateLabels(){var e;const t=this.lengthProvider();if(t<=0)return[];const[r,s]=this.calculateMinMax(),i=this.getAxisStep(r,s,t);this.lastSingleLabelHeightValue||(this.lastSingleLabelHeightValue=i);let a;const o=this.axisTypeProvider();if(o==="logarithmic"?a=this.generateLogarithmLabels(r,s,i):o==="percent"?a=this.generatePercentLabels(r,s,i):a=this.generateRegularLabels(r,s,i),this.lastSingleLabelHeightValue!==i&&this.labelsCache.cache){const l=(e=this.labelsCache.getLastCachedValue())!=null?e:[];this.distanceBetweenLabelsChangeSubject.next([l,a]),this.lastSingleLabelHeightValue=i}return this.newGeneratedLabelsSubject.next(a),a}calculateMinMax(){const[e,t]=this.startEndProvider(),r=this.lengthProvider(),s=dr.getLabelBounds(e,t,r);return[s[0],s[1]]}getAxisStep(e,t,r){const s=t-e,i=r/this.singleLabelHeightPixels,a=this.calculateIncrement(s),o=s/i;return this.calculateAxisStep(o,a)}observeDistanceBetweenLabelsChanged(){return this.distanceBetweenLabelsChangeSubject.asObservable()}observeLabelsChanged(){return this.newGeneratedLabelsSubject.asObservable()}calculateIncrement(e){if(this.increment)return this.increment;if(!isNaN(e)){const t=ze.autoDetectIncrementOfValueRange(e);return this.adjustIncrementOnAxisType(t)}return this.adjustIncrementOnAxisType(Bd)}adjustIncrementOnAxisType(e){switch(this.axisTypeProvider()){case"percent":return e;case"logarithmic":const[t]=this.calculateMinMax(),s=Kn(t)+e;return Ls(s)-t;case"regular":return e}}generateNumericLabels(){const[e,t]=this.startEndProvider();return(e!==this.lastStart||t!==this.lastEnd)&&this.labelsCache.invalidate(),this.lastStart=e,this.lastEnd=t,this.labelsCache.calculateOrGet()}static getLabelBounds(e,t,r){const s=Math.abs((t-e)*(Od/r));return[e-s,t+s]}calculateAxisStep(e,t){if(t===0)return console.error("NumericAxisLabelsGenerator failed at calculateAxisStep: increment = 0"),0;let r=t,s=t,i=0;for(;r<e&&r>0;)i>=this.gridDistanceMultipliers.length&&(i=0,s*=10),r=s*this.gridDistanceMultipliers[i++];return r}}class $i extends dr{constructor(e,t,r,s,i=()=>"regular",a=()=>1,o=23){super(e,()=>[r.yStart,r.yEnd],()=>r.getBounds().height,s,!1,i,a,void 0,o),this.chartModel=t}getLargestLabel(){var e;return((e=this.labelsCache.getLastCachedValue())!=null?e:[]).reduce((t,r)=>r.text.length>t.length?r.text:t,"")}calculateIncrement(e){var t;const r=(t=this.chartModel)==null?void 0:t.mainCandleSeries.instrument;if(this.chartModel&&r&&Array.isArray(r.priceIncrements)){const s=Ue(this.chartModel.getCandles()),i=s&&s.close?s.close:0,a=ze.getPriceIncrement(i,r.priceIncrements);return this.adjustIncrementOnAxisType(a)}return super.calculateIncrement(e)}}const Zi=10;class Ki extends te{constructor(e,t,r,s,i,a,o,l){if(super(),this.bus=e,this.viewportModel=s,this.canvasBoundsContainer=a,this.autoScaleCallback=l,this.yAxisDragEndSubject=new G,this.lastYStart=0,this.lastYEnd=0,this.lastYHeight=0,this.lastYPxHeight=0,this.onYDragStart=()=>{this.lastYStart=this.viewportModel.yStart,this.lastYEnd=this.viewportModel.yEnd,this.lastYHeight=this.viewportModel.yEnd-this.viewportModel.yStart,this.lastYPxHeight=this.canvasBoundsContainer.getBounds(Y.Y_AXIS).height},this.onYDragTick=c=>{const{delta:h}=c;let v;h<0?v=1/(1+-h/this.lastYPxHeight*(Zi-1)):v=1+h/this.lastYPxHeight*(Zi-1);const y=(this.lastYHeight*v-this.lastYHeight)/2,E=this.lastYStart-y,R=this.lastYEnd+y;this.autoScaleCallback(!1),this.viewportModel.setYScale(E,R),this.bus.fireDraw()},this.onYDragEnd=()=>{this.yAxisDragEndSubject.next()},t.customScale){const c=()=>t.type!=="percent",h=new fn(o,{onDragTick:ur(this.onYDragTick,c),onDragStart:ur(this.onYDragStart,c),onDragEnd:ur(this.onYDragEnd,c)},i,r,{disableChartPanning:!1});this.addChildEntity(h),t.customScaleDblClick&&i.observeDbClick(o).subscribe(()=>{l(!0),this.bus.fireDraw()})}}}const ur=(n,e)=>(...t)=>e()&&n(...t);class qi{constructor(e,t,r,s,i,a=()=>!0,o){this.fullConfig=e,this.yAxisState=t,this.canvasModel=r,this.labelsProvider=s,this.axisBounds=i,this.drawPredicate=a,this.toY=o}draw(){if(this.drawPredicate()){const e=this.labelsProvider(),t=this.axisBounds(),r=this.canvasModel.ctx;r.fillStyle=this.getBackgroundColor(),r.fillRect(t.x,t.y,t.width,t.height);const s=mt(this.yAxisState),i=Qe(s,r),a=this.getLabelTextColor();r.save(),yt(r,t),this.drawLabels(r,e,t,i,s,a),r.restore()}}drawLabels(e,t,r,s,i,a){e.fillStyle=a,e.font=i;const o=e.measureText("00.0"),l=o.actualBoundingBoxAscent+o.actualBoundingBoxDescent,c=r.y+l,h=r.y+r.height-l;t.forEach(v=>{const p=this.toY(v.value);p>c&&p<h&&Rd(e,r,v.text,p,s,i,this.yAxisState.labelBoxMargin.end,this.yAxisState.align)})}getCanvasIds(){return[this.canvasModel.canvasId]}getBackgroundColor(){return this.fullConfig.colors.yAxis.backgroundColor}getLabelTextColor(){return this.fullConfig.colors.yAxis.labelTextColor}}const Rd=(n,e,t,r,s,i,a,o)=>{const l=o==="right"?e.x+e.width-Re(t,n,i)-a:e.x+a;n.fillText(t,l,r+s/2-1)};function fr(n,e,t){var r=L(n)||e||t?{next:n,error:e,complete:t}:n;return r?w(function(s,i){var a;(a=r.subscribe)===null||a===void 0||a.call(r);var o=!0;s.subscribe(We(i,function(l){var c;(c=r.next)===null||c===void 0||c.call(r,l),i.next(l)},function(){var l;o=!1,(l=r.complete)===null||l===void 0||l.call(r),i.complete()},function(l){var c;o=!1,(c=r.error)===null||c===void 0||c.call(r,l),i.error(l)},function(){var l,c;o&&((l=r.unsubscribe)===null||l===void 0||l.call(r)),(c=r.finalize)===null||c===void 0||c.call(r)}))}):Pt}class Ji extends te{constructor(e,t,r){super(),this.scaleModel=e,this.yAxisLabelsGenerator=t,this.canvasBoundsContainer=r,this.labels=[],this.prevYAxisHeight=0,this.animFrameId=`anim_cache_${Je()}`}doActivate(){super.doActivate(),this.addRxSubscription(Me(this.scaleModel.yChanged,this.canvasBoundsContainer.observeBoundsChanged(Y.Y_AXIS).pipe(ye(e=>e.height),he(e=>ao(e,this.prevYAxisHeight,1.5)),fr(e=>{this.yAxisLabelsGenerator.labelsCache.invalidate(),this.prevYAxisHeight=e}))).subscribe(()=>this.updateLabels()))}updateLabels(){this.labels=this.yAxisLabelsGenerator.generateNumericLabels(),sr(this.animFrameId,()=>this.canvasBoundsContainer.updateYAxisWidths())}}class Fd extends te{constructor(e,t,r,s,i,a,o,l,c,h,v,p,y,E,R,N){super(),this.chartBaseModel=e,this.hitTestController=t,this.config=r,this.mainScaleModel=s,this.drawingManager=i,this.chartPanComponent=a,this.mainCanvasModel=o,this.canvasInputListener=l,this.userInputListenerComponents=c,this.canvasAnimation=h,this.cursorHandler=v,this.eventBus=p,this.canvasBoundsContainer=y,this.uuid=E,this.dataSeriesCanvasModel=R,this._paneOrder=0,this.yExtentComponents=[],this.getYAxisBounds=()=>this.canvasBoundsContainer.getBounds(Y.PANE_UUID_Y_AXIS(this.uuid)),this.valueFormatter=(U,Z)=>this.mainYExtentComponent.valueFormatter(U,Z);const k=this.createExtentComponent(N);this.mainYExtentComponent=k,this.ht=this.canvasBoundsContainer.getBoundsHitTest(Y.PANE_UUID(E),{extensionY:-this.config.components.paneResizer.dragZone})}get scaleModel(){return this.mainYExtentComponent.scaleModel}get dataSeries(){return Tt(this.yExtentComponents,e=>Array.from(e.dataSeries))}doActivate(){super.doActivate(),this.addRxSubscription(this.canvasBoundsContainer.observeBoundsChanged(Y.PANE_UUID(this.uuid)).pipe(Ve(ms)).subscribe(()=>{this.yExtentComponents.forEach(e=>e.scaleModel.recalculateZoomY()),this.dataSeriesCanvasModel.fireDraw()}))}createYAxisComponent(e,t,r,s,i){const a=Wt(this.config.components.yAxis),o=new $i(i,void 0,r,s,()=>"regular",()=>1,a.labelHeight),l=Y.PANE_UUID_Y_AXIS(e,t),c=new qi(this.config,a,this.mainCanvasModel,()=>o.generateNumericLabels(),()=>this.canvasBoundsContainer.getBounds(l),()=>this.config.components.yAxis.visible,r.toY.bind(r));this.drawingManager.addDrawerAfter(c,l,"Y_AXIS"),a.type="regular";const h=new Ki(this.eventBus,a,this.chartPanComponent,r,this.canvasInputListener,this.canvasBoundsContainer,this.canvasBoundsContainer.getBoundsHitTest(l),p=>r.autoScale(p)),v=new Ji(r,o,this.canvasBoundsContainer);return v.activate(),this.userInputListenerComponents.push(h),{labelsGenerator:o,drawer:c,yAxisScaleHandler:h,state:this.config.components.yAxis,unsub:()=>{this.drawingManager.removeDrawerByName(l),v.disable()}}}createGridComponent(e,t,r){return new Ri(this.mainCanvasModel,t,this.config,`PANE_${e}_grid_drawer`,this.drawingManager,()=>this.canvasBoundsContainer.getBounds(Y.PANE_UUID(e)),()=>this.canvasBoundsContainer.getBounds(Y.PANE_UUID(e)),()=>[],()=>r.generateNumericLabels())}createYPanHandler(e,t){const r=this.chartPanComponent.chartAreaPanHandler.registerChartYPanHandler(t,this.canvasBoundsContainer.getBoundsHitTest(Y.PANE_UUID(e)));return[()=>{this.chartPanComponent.chartAreaPanHandler.removeChildEntity(r),r.disable()},r]}addCursors(e){const t=Y.PANE_UUID_Y_AXIS(this.uuid,e);return this.cursorHandler.setCursorForCanvasEl(t,this.config.components.yAxis.cursor),()=>this.cursorHandler.removeCursorForCanvasEl(t)}createExtentComponent(e){var t,r,s,i,a,o;const l=this.yExtentComponents.length,c=()=>this.canvasBoundsContainer.getBounds(Y.PANE_UUID(this.uuid)),h=(t=e==null?void 0:e.scaleModel)!=null?t:new bc(this.mainScaleModel,this.config,c,this.canvasAnimation),v=(r=e==null?void 0:e.useDefaultYAxis)==null||r?this.createYAxisComponent(this.uuid,l,h,(i=(s=e==null?void 0:e.paneFormatters)==null?void 0:s.regular)!=null?i:qn,(a=e==null?void 0:e.increment)!=null?a:null):void 0,[p,y]=this.createYPanHandler(this.uuid,h),E=new Ed(this.uuid,l,this,this.chartBaseModel,this.canvasBoundsContainer,this.hitTestController,this.dataSeriesCanvasModel,h,v,y);if(E.addSubscription(p),E.addSubscription(this.addCursors(l)),e!=null&&e.paneFormatters&&E.setValueFormatters(e.paneFormatters),((o=e==null?void 0:e.useDefaultHighLow)!=null?o:!0)&&h.autoScaleModel.setHighLowProvider("default",ji(()=>({top:10,bottom:10,left:0,right:0,visible:!0}),Gi(E))),v){const N=this.createGridComponent(this.uuid,h,v.labelsGenerator);E.addChildEntity(N)}return E.activate(),this.yExtentComponents.push(E),this.canvasBoundsContainer.updateYAxisWidths(),E}removeExtentComponent(e){e.disable(),this.yExtentComponents.splice(e.idx,1),this.yExtentComponents.forEach((t,r)=>t.idx=r),this.canvasBoundsContainer.updateYAxisWidths()}updateView(){this.yExtentComponents.forEach(e=>{var t;e.scaleModel.doAutoScale(),(t=e.yAxisComponent)==null||t.labelsGenerator.generateNumericLabels()}),this.canvasBoundsContainer.updateYAxisWidths(),this.eventBus.fireDraw()}mergeYExtents(){for(let e=1;e<this.yExtentComponents.length;e++){const t=this.yExtentComponents[e];t.dataSeries.forEach(r=>r.moveToExtent(this.mainYExtentComponent)),t.disable()}this.canvasBoundsContainer.updateYAxisWidths(),this.yExtentComponents=[this.mainYExtentComponent]}getBounds(){return this.mainYExtentComponent.getBounds()}hide(){this._paneOrder=this.canvasBoundsContainer.panesOrder.indexOf(this.uuid),this.canvasBoundsContainer.removedPaneBounds(this.uuid),this.eventBus.fireDraw()}show(){this.canvasBoundsContainer.addPaneBounds(this.uuid,this._paneOrder),this.eventBus.fireDraw()}createDataSeries(){var e;return(e=this.mainYExtentComponent)==null?void 0:e.createDataSeries()}addDataSeries(e){this.mainYExtentComponent.addDataSeries(e),this.updateView()}removeDataSeries(e){this.mainYExtentComponent.removeDataSeries(e),this.updateView()}getAxisType(){return"regular"}moveUp(){this.canvasBoundsContainer.movePaneUp(this.uuid)}moveDown(){this.canvasBoundsContainer.movePaneDown(this.uuid)}canMoveUp(){const e=Yt(this.canvasBoundsContainer.panesOrder);return this.uuid!==e}canMoveDown(){const e=Ue(this.canvasBoundsContainer.panesOrder);return this.uuid!==e}get regularFormatter(){return this.mainYExtentComponent.formatters.regular}setPaneValueFormatters(e){this.mainYExtentComponent.setValueFormatters(e)}regularValueFromY(e){return this.mainYExtentComponent.regularValueFromY(e)}}class Yd extends te{constructor(e,t,r,s,i,a,o,l,c,h,v,p,y,E){super(),this.chartBaseModel=e,this.userInputListenerComponents=t,this.eventBus=r,this.mainScaleModel=s,this.canvasBoundsContainer=i,this.config=a,this.canvasAnimation=o,this.canvasInputListener=l,this.drawingManager=c,this.dataSeriesCanvasModel=h,this.cursorHandler=v,this.crossEventProducer=p,this.chartPanComponent=y,this.mainCanvasModel=E,this.paneComponents={},this.panesChangedSubject=new G,this.hitTestController=new Ld(this.paneComponents,this.dataSeriesCanvasModel);const R=this.createPane(ae,{useDefaultHighLow:!1,scaleModel:this.mainScaleModel,useDefaultYAxis:!1});R.mainYExtentComponent.scaleModel.autoScaleModel.setHighLowProvider("series",Gi(R.mainYExtentComponent)),s.autoScaleModel.setHighLowPostProcessor("offsets",Xi(()=>this.mainScaleModel.getOffsets()))}get panesOrder(){return this.canvasBoundsContainer.panesOrder}addBounds(e,t){return this.canvasBoundsContainer.addPaneBounds(e,t),()=>this.canvasBoundsContainer.removedPaneBounds(e)}addResizer(e){const t=this.canvasBoundsContainer.getBoundsHitTest(Y.PANE_UUID_RESIZER(e),{extensionY:this.config.components.paneResizer.dragZone}),r=()=>{this.canvasBoundsContainer.resizePaneVertically(e,this.canvasInputListener.getCurrentPoint().y),this.eventBus.fireDraw([this.mainCanvasModel.canvasId,"overDataSeriesCanvas"])},s=Y.PANE_UUID_RESIZER(e),i=new Td(s,()=>this.canvasBoundsContainer.getBounds(s),t,r,this.chartPanComponent,this.mainCanvasModel,this.drawingManager,this.canvasInputListener,this.canvasAnimation,this.config,this.canvasBoundsContainer);return this.userInputListenerComponents.push(i),i}getPaneIfHit(e){return Object.values(this.paneComponents).find(r=>this.canvasBoundsContainer.getBoundsHitTest(Y.PANE_UUID(r.uuid))(e.x,e.y))}createPane(e=Je(),t){if(this.paneComponents[e]!==void 0)return this.paneComponents[e];const r=new Fd(this.chartBaseModel,this.hitTestController,this.config,this.mainScaleModel,this.drawingManager,this.chartPanComponent,this.mainCanvasModel,this.canvasInputListener,this.userInputListenerComponents,this.canvasAnimation,this.cursorHandler,this.eventBus,this.canvasBoundsContainer,e,this.dataSeriesCanvasModel,t);return this.config.components.paneResizer.visible&&r.addChildEntity(this.addResizer(e)),r.addSubscription(this.addBounds(e,t==null?void 0:t.order)),r.addSubscription(this.addCursors(e)),r.addSubscription(this.crossEventProducer.subscribeMouseOverHT(e,r.ht)),this.paneComponents[e]=r,r.activate(),this.recalculateState(),r.mainYExtentComponent.scaleModel.autoScale(!0),this.panesChangedSubject.next(this.paneComponents),r}removePane(e){const t=this.paneComponents[e];t!==void 0&&(t.disable(),t.yExtentComponents.forEach(r=>r.disable()),delete this.paneComponents[e],this.recalculateState(),this.panesChangedSubject.next(this.paneComponents))}addCursors(e,t=this.config.components.chart.cursor){const r=Y.PANE_UUID(e),s=Y.PANE_UUID_RESIZER(e);return this.cursorHandler.setCursorForCanvasEl(r,t),this.config.components.paneResizer.visible&&this.cursorHandler.setCursorForCanvasEl(s,this.config.components.paneResizer.cursor,this.config.components.paneResizer.dragZone),()=>{this.cursorHandler.removeCursorForCanvasEl(r),this.config.components.paneResizer.visible&&this.cursorHandler.removeCursorForCanvasEl(s)}}recalculateState(){Object.values(this.paneComponents).forEach(e=>e.scaleModel.recalculateZoomY()),this.eventBus.fireDraw([this.mainCanvasModel.canvasId,"overDataSeriesCanvas"])}}class Hd extends te{constructor(e,t){super(),this.elements=e,this.canvasModel=t}doActivate(){super.doActivate()}createSnapshot(e){const t=this.canvasModel.canvas,r=this.canvasModel.ctx;if(r){r.clearRect(0,0,t.width,t.height);const s=t.width/window.devicePixelRatio,i=t.height/window.devicePixelRatio;return r.drawImage(this.elements.backgroundCanvas,0,0,s,i),r.drawImage(this.elements.mainCanvas,0,0,s,i),r.drawImage(this.elements.staticDrawingCanvas,0,0,s,i),r.drawImage(this.elements.dataSeriesCanvas,0,0,s,i),r.drawImage(this.elements.overDataSeriesCanvas,0,0,s,i),r.drawImage(this.elements.dynamicDrawingCanvas,0,0,s,i),r.drawImage(this.elements.crossToolCanvas,0,0,s,i),e&&e(r),new Promise((a,o)=>this.elements.snapshotCanvas.toBlob(l=>l?a(l):o("Blob is null")))}else return console.error("Snapshot isn't supported"),Promise.reject()}}const bn=.3,Nd=(n,e)=>{const t=e.barTheme[`${n}Color`];return Jt()(t).alpha(bn).toString()},kd=(n,e)=>{const t=e.volume[`${n}BarColor`];return Jt()(t).alpha(bn).toString()},Wd=(n,e)=>{const t=e.lineTheme[`${n}Color`];return Jt()(t).alpha(bn).toString()},vr=(n,e)=>{const t=e.candleTheme[`${n}Color`];return Jt()(t).alpha(bn).toString()},Ud=3;class Qi{constructor(e,t,r,s,i,a,o){this.canvasModel=e,this.config=t,this.volumesModel=r,this.chartModel=s,this.viewportModel=i,this.volumesColorByChartTypeMap=a,this.drawPredicate=o,this.volumeBarColors={down:"#FF00FF",up:"#FF00FF",none:"#FF00FF"}}calculateColors(e){var t;const r=(t=this.volumesColorByChartTypeMap[e])!=null?t:kd;this.volumeBarColors.down=r("down",this.config.colors),this.volumeBarColors.up=r("up",this.config.colors),this.volumeBarColors.none=r("none",this.config.colors)}draw(){if(this.config.components.volumes.visible&&this.drawPredicate()){this.calculateColors(this.config.components.chart.type);const e=this.canvasModel.ctx;e.save();const t=this.viewportModel.getBounds();yt(e,t),this.drawVolumes(),e.restore()}}drawLastBar(){this.config.components.volumes.visible}drawVolumes(){const e=this.volumesModel.volumeMax.getValue();if(e===0)return;const t=Ie(this.chartModel.mainCandleSeries.getSeriesInViewport(this.chartModel.scaleModel.xStart-1,this.chartModel.scaleModel.xEnd+1));t.forEach((r,s)=>{if(r.candle.volume){const i=this.viewportModel.getBounds(),a=i.height,o=t[s+1]!==void 0?se(this.viewportModel.toX(t[s+1].startUnit)):void 0,l=se(this.viewportModel.toX(r.startUnit)),c=o!==void 0?o-l:se(Pe(r.width,this.viewportModel.zoomX));if(this.config.components.volumes.showSeparately){const h=se(this.viewportModel.toY(r.candle.volume)),v=se(this.viewportModel.toY(0))-h;this.drawVolume(r,l,h,c,v)}else{const h=e/(a/Ud),v=Math.max(Pe(r.candle.volume,h),2),p=se(i.y+a-v);this.drawVolume(r,l,p,c,v)}}})}drawVolume(e,t,r,s,i){const a=this.canvasModel.ctx,o=r,l=r+i,c=e.name;a.fillStyle=this.volumeBarColors[c],a.strokeStyle=this.volumeBarColors[c],s===0?(a.beginPath(),a.moveTo(t,o),a.lineTo(t,Ms(l)),a.stroke()):a.fillRect(t,r,s,Ms(i))}getCanvasIds(){return[this.canvasModel.canvasId]}}const ea=5,zd=1e-10,Xd=/\.?0+$/,ta=/(\.[1-9]*)0+$/,jd=n=>{const e=(t,r)=>{const s=Math.pow(10,ea),i=Math.round(t*s)/s;return i<1&&i>=zd?i.toFixed(ea).replace(Xd,"").replace(ta,""):(i+"").replace(ta,"")+(r||"")};return Math.abs(n)>999999999?(n=Math.round(n/1e6)*1e6,e(n/1e9,"B")):Math.abs(n)>999999?(n=1e3*Math.round(n/1e3),e(n/1e6,"M")):Math.abs(n)>9999?e(n/1e3,"K"):e(n)},Cn=class extends te{constructor(n,e,t,r,s,i,a){super(),this.canvasModel=n,this.chartComponent=e,this.drawingManager=t,this.config=r,this.volumesModel=s,this.volumesColorByChartTypeMap=i,this.paneManager=a,r.components.volumes.showSeparately&&this.activateSeparateVolumes()}doActivate(){super.doActivate(),this.addRxSubscription(this.chartComponent.chartModel.candlesUpdatedSubject.subscribe(()=>{var n,e;return!((n=this.scaleModel)!=null&&n.isViewportValid())&&((e=this.scaleModel)==null?void 0:e.doAutoScale(!0))})),this.addRxSubscription(this.volumesModel.volumeMax.subscribe(()=>{var n;return(n=this.scaleModel)==null?void 0:n.doAutoScale()}))}activateSeparateVolumes(){if(this.paneManager.paneComponents[Cn.UUID]===void 0){const n=this.paneManager.createPane(Cn.UUID,{paneFormatters:{regular:jd},useDefaultHighLow:!1,increment:1}),{scaleModel:e}=n,t=ji(()=>({top:10,bottom:0,left:0,right:0,visible:!0}),this.volumesModel.highLowProvider);e.autoScaleModel.setHighLowProvider("volumes",t),e.doAutoScale(!0),this.scaleModel=e;const r=new Qi(this.canvasModel,this.config,this.volumesModel,this.chartComponent.chartModel,e,this.volumesColorByChartTypeMap,()=>this.config.components.volumes.showSeparately);this.drawingManager.addDrawer(r,"UNDERLAY_VOLUMES_AREA")}}deactiveSeparateVolumes(){this.paneManager.removePane(Cn.UUID),delete this.scaleModel,this.drawingManager.removeDrawerByName("UNDERLAY_VOLUMES_AREA")}fromY(n){var e,t;return(t=(e=this.scaleModel)==null?void 0:e.fromY(n))!=null?t:0}};let na=Cn;na.UUID="volumes";const Vd=Eo(n=>n.candle.volume);class Gd extends te{constructor(e,t){super(),this.chartComponent=e,this.scaleModel=t,this.volumeMax=new lt(0),this.highLowProvider={calculateHighLow:()=>({high:this.volumeMax.getValue(),low:0}),isHighLowActive:()=>!0}}doActivate(){super.doActivate(),this.addRxSubscription(Me(this.chartComponent.chartModel.observeCandlesChanged(),this.scaleModel.xChanged).subscribe(()=>this.updateVolumeMax())),this.addRxSubscription(this.chartComponent.chartModel.mainCandleSeries.observeLastVisualCandleChanged().subscribe(()=>this.recalculateLastVisualVolume()))}recalculateLastVisualVolume(){}updateVolumeMax(){var e;this.volumeMax.next((e=Yt(Vd(this.chartComponent.chartModel.mainCandleSeries.getSeriesInViewport().flat())))!=null?e:0)}}class $d extends te{constructor(e,t,r,s,i,a,o,l){super(),this.canvasModel=e,this.canvasBoundsContainer=s,this.config=a,this.volumesColorByChartTypeMap={},this.volumeVisibilityChangedSubject=new lt(!1),this.volumeIsSeparateModeChangedSubject=new lt(!1);const c=new Gd(t,r);this.volumesModel=c,this.yAxisComponent=l,this.addChildEntity(c),this.separateVolumes=new na(e,t,i,a,c,this.volumesColorByChartTypeMap,o),this.addChildEntity(this.separateVolumes);const h=new Qi(e,a,c,t.chartModel,r,this.volumesColorByChartTypeMap,()=>!a.components.volumes.showSeparately);i.addDrawer(h,"VOLUMES"),this.registerDefaultVolumeColorResolvers(),this.volumeVisibilityChangedSubject.next(a.components.volumes.visible),this.volumeIsSeparateModeChangedSubject.next(a.components.volumes.showSeparately)}registerDefaultVolumeColorResolvers(){this.registerVolumeColorResolver("candle",vr),this.registerVolumeColorResolver("trend",vr),this.registerVolumeColorResolver("hollow",vr),this.registerVolumeColorResolver("line",Wd),this.registerVolumeColorResolver("bar",Nd)}setShowVolumesSeparatly(e){this.config.components.volumes.showSeparately!==e&&(this.config.components.volumes.showSeparately=e,e?(this.separateVolumes.activateSeparateVolumes(),this.volumeIsSeparateModeChangedSubject.next(!0)):(this.separateVolumes.deactiveSeparateVolumes(),this.volumeIsSeparateModeChangedSubject.next(!1)))}doDeactivate(){super.doDeactivate(),this.setVisible(!1)}registerVolumeColorResolver(e,t){this.volumesColorByChartTypeMap[e]=t}setVisible(e=!0){this.config.components.volumes.visible=e,this.volumeVisibilityChangedSubject.next(e),this.config.components.volumes.showSeparately===!0&&(e?(this.separateVolumes.activateSeparateVolumes(),this.volumeIsSeparateModeChangedSubject.next(!0)):(this.separateVolumes.deactiveSeparateVolumes(),this.volumeIsSeparateModeChangedSubject.next(!1))),this.canvasBoundsContainer.recalculatePanesHeightRatios(),this.canvasModel.fireDraw()}}class Zd{constructor(e,t,r,s,i){this.config=e,this.canvasBoundsContainer=t,this.canvasModel=r,this.waterMarkConfigProvider=s,this.watermarkDataProvider=i,this.getConfig=(a=0,o,l,c,h,v)=>{const p=this.canvasModel.ctx,y=this.canvasBoundsContainer.getBounds(Y.PANE_UUID(ae)),{position:E,offsetY:R,offsetX:N}=this.config.components.waterMark;let k;switch(v?k=v:(p.font=yn(this.config,l),k=p.measureText(o).width,y.width-10<k&&(p.font=Kd(this.config,this.canvasBoundsContainer,l,k),k=p.measureText(o).width)),E){case"left-top":return{x:N+y.x,y:R+a+y.y,font:p.font,text:o,color:c};case"left-bottom":return{x:N+y.x,y:y.height-h-R+a+y.y,font:p.font,text:o,color:c};case"center":return{x:y.width/2-k/2+y.x,y:(y.height-h)/2+a+y.y,font:p.font,text:o,color:c}}}}draw(){var e,t,r,s,i,a,o;if((e=this.config.components.waterMark)!=null&&e.visible&&this.config.colors){const{firstRow:l,secondRow:c,thirdRow:h}=this.watermarkDataProvider(),v=this.waterMarkConfigProvider(),p=this.config.colors.waterMarkTheme,y=this.canvasModel.ctx;let E=0,R=0,N=0,k=0,U=0;if(y.save(),v.firstRowFontSize&&l){y.font=yn(this.config,v.firstRowFontSize);const $=y.measureText(l);E=$.actualBoundingBoxAscent+$.actualBoundingBoxDescent}if(v.secondRowFontSize&&c){y.font=yn(this.config,v.secondRowFontSize);const $=y.measureText(c);R=$.actualBoundingBoxAscent+$.actualBoundingBoxDescent,N=(t=v.firstRowBottomPadding)!=null?t:0}if(v.thirdRowFontSize&&h){y.font=yn(this.config,v.thirdRowFontSize);const $=y.measureText(h);k=$.actualBoundingBoxAscent+$.actualBoundingBoxDescent,U=(r=v.secondRowBottomPadding)!=null?r:0}const Z=(s=v.thirdRowBottomPadding)!=null?s:0,K=(i=v.logoHeight)!=null?i:0,q=E+R+N+k+U+Z+K;if(l&&this.drawWaterMark(this.getConfig(E,l,v.firstRowFontSize,p.firstRowColor,q)),c&&this.drawWaterMark(this.getConfig(E+N+R,c,v.secondRowFontSize,p.secondRowColor,q)),h&&this.drawWaterMark(this.getConfig(E+N+R+U+k,h,v.thirdRowFontSize,p.thirdRowColor,q)),this.logoImage){const $=this.getConfig(E+N+R+U+k+Z,"",v.thirdRowFontSize,p.thirdRowColor,q,v.logoWidth);this.canvasModel.ctx.drawImage(this.logoImage,$.x,$.y,(a=v.logoWidth)!=null?a:0,(o=v.logoHeight)!=null?o:0)}y.restore()}}getCanvasIds(){return[this.canvasModel.canvasId]}setLogoImage(e){this.logoImage=e}drawWaterMark(e){const t=e.text;if(!t||!t.length)return;const r=this.canvasModel.ctx;r.font=e.font,r.fillStyle=e.color;const s=e.x,i=e.y;r.fillText(t,s,i)}reset(){}}const Kd=(n,e,t,r)=>{const i=((o,l)=>e.getBounds(Y.CHART).width/l*o)(t,r);let a;return n.components&&n.components.waterMark&&(a=n.components.waterMark.fontFamily),i+"px "+a},yn=(n,e)=>{let t;return n.components&&n.components.waterMark&&(t=n.components.waterMark.fontFamily),e+"px "+t};var qd=Object.defineProperty,ra=Object.getOwnPropertySymbols,Jd=Object.prototype.hasOwnProperty,Qd=Object.prototype.propertyIsEnumerable,sa=(n,e,t)=>e in n?qd(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,ia=(n,e)=>{for(var t in e||(e={}))Jd.call(e,t)&&sa(n,t,e[t]);if(ra)for(var t of ra(e))Qd.call(e,t)&&sa(n,t,e[t]);return n};class eu extends te{constructor(e,t,r,s,i,a,o){super(),this.paneManager=e,this.chartModel=t,this.eventBus=r,this.config=s,this.canvasModel=a,this.waterMarkConfig=this.config.components.waterMark,this.waterMarkData=this.getWaterMarkData(),this.waterMarkDrawer=new Zd(this.config,i,a,()=>this.waterMarkConfig,()=>this.waterMarkData),this.addRxSubscription(Ge(i.observeBoundsChanged(Y.PANE_UUID(ae)),this.paneManager.panesChangedSubject).subscribe(l=>{this.waterMarkConfig=this.recalculateTextSize(l.width,l.height)})),this.addRxSubscription(this.chartModel.candlesSetSubject.subscribe(()=>{this.waterMarkData=this.getWaterMarkData()})),o.addDrawerAfter(this.waterMarkDrawer,"WATERMARK","DRAWINGS")}setWaterMarkVisible(e){this.config.components&&this.config.components.waterMark&&(this.config.components.waterMark.visible=e,this.canvasModel.fireDraw())}setWaterMarkData(e){this.waterMarkData=e,this.canvasModel.fireDraw()}getWaterMarkData(){return this.waterMarkData||{}}setWaterMarkConfig(e){if(!(!e||!this.config.components)){if(!this.config.components.waterMark)this.config.components.waterMark=JSON.parse(JSON.stringify(e));else{const t={};Ge(t,e),Ge(t,this.config.components.waterMark),this.config.components.waterMark=t}this.canvasModel.fireDraw()}}setLogoImage(e){this.waterMarkDrawer.setLogoImage(e)}recalculateTextSize(e,t){const i=v=>.15*Math.log(v)/Math.log(1.5)+1,a=i(e/1920),o=i(t/1080),l=Math.min(a,o),c=l>=0?l:0,h={firstRowFontSize:Math.round(this.config.components.waterMark.firstRowFontSize*c),secondRowFontSize:Math.round(this.config.components.waterMark.secondRowFontSize*c),thirdRowFontSize:Math.round(this.config.components.waterMark.thirdRowFontSize*c)};return ia(ia({},this.config.components.waterMark),h)}}const aa={x:4,y:4};function tu(n,e,t,r,s){var i,a;const o=(i=s.alignType)!=null?i:"middle",{fontSize:l,fontFamily:c,padding:h}=r.components.xAxis,v=(a=h.top)!=null?a:0,p=t.getBounds(Y.X_AXIS);e.save(),e.font=`bold ${l}px ${c}`;const E=e.measureText(s.text).width+aa.x*2;let R=0;const N=s.x;switch(o){case"start":R=N-E;break;case"end":R=N;break;case"middle":default:R=N-E/2;break}cn(n,e,R,p.y,E,p.height-1),o!=="middle"&&(e.strokeStyle=s.color,e.beginPath(),e.moveTo(N,p.y),e.lineTo(N,p.y+p.height),e.stroke()),e.fillStyle=s.color;const k=R+aa.x,U=p.y+v+l;e.fillText(s.text,k,U),e.restore()}class nu{constructor(e,t,r,s,i){this.backgroundCanvasModel=e,this.config=t,this.canvasModel=r,this.canvasBoundsContainer=s,this.xAxisLabelsModel=i}draw(){const e=this.canvasModel.ctx;this.drawHighlightedBackgroundBetweenLabels(),this.xAxisLabelsModel.labels.forEach(t=>{tu(this.backgroundCanvasModel.ctx,e,this.canvasBoundsContainer,this.config,t)})}drawHighlightedBackgroundBetweenLabels(){const e=this.canvasModel.ctx,t={},r=this.xAxisLabelsModel.labels.reduce((s,i)=>{if(i.subGroupId!==void 0){let a=s[i.subGroupId];a||(a=[],s[i.subGroupId]=a),a.push(i)}return s},t);Object.keys(r).forEach(s=>{const i=r[s];if(i.length===2){const a=this.canvasBoundsContainer.getBounds(Y.X_AXIS);e.fillStyle=gt.rgb(i[0].color).alpha(.1).toString(),ni(e,{x:i[0].x,y:a.y},{x:i[1].x,y:a.y+a.height})}})}getCanvasIds(){return[this.canvasModel.canvasId]}}const Lv="week-weekday",ru=["second","minute","hour","day","month","year"],su=["lessThanSecond"],iu=n=>ru.some(e=>e===n),au=n=>n==="week-weekday",ou=n=>su.some(e=>e===n),oa=n=>{const e={"!":!1,$:!1};return n.includes("!")&&(e["!"]=!0),n.includes("$")&&(e.$=!0),e},gr=n=>parseInt(n,10),la=n=>{const[e,...t]=n.split("_");if(iu(e)){const[r]=t,s=oa(r),i=gr(r);return{key:e,value:i,exact:s["!"]}}else if(au(e)){const[r,s]=t,i=oa(r),a=gr(r),o=gr(s);return{key:e,week:i.$?"$":a,weekday:o}}else return ou(e)?{key:e}:(console.warn(`${n} is not fit, check the documentation to see available formats https://webdev.prosp.devexperts.com:8095/docs/chart/x-axis`),null)};class wn{constructor(e,t,r,s,i,a=()=>!0){this.config=e,this.canvasModel=t,this.viewportModel=r,this.canvasBoundsContainer=s,this.labelsProvider=i,this.drawPredicate=a}draw(){var e;if(this.drawPredicate()){const t=this.canvasModel.ctx,r=this.config.colors.xAxis,s=this.config.components.xAxis.fontFamily,i=wn.getFontFromConfig(this.config),a=this.config.components.xAxis.fontSize,o=(e=this.config.components.xAxis.padding.top)!=null?e:0;t.save(),t.font=i,t.fillStyle=r.backgroundColor;const l=this.canvasBoundsContainer.getBounds(Y.X_AXIS);t.fillRect(l.x,l.y,l.width,l.height);const c=this.config.colors.xAxis.labelTextColor,h=this.labelsProvider();this.drawLabels(t,h,l,c,a,s,o),t.restore()}}drawLabels(e,t,r,s,i,a,o){const l=`${i}px ${a}`;e.fillStyle=s;for(const c of t){const h=this.viewportModel.toX(c.value)-Re(c.text,e,l)/2;if(h<0||h>r.width)continue;const v=r.y+i-1+o,p=c.text;e.font=l,e.fillText(p,h,v)}}static getFontFromConfig(e){return`${e.components.xAxis.fontStyle} ${e.components.xAxis.fontSize}px ${e.components.xAxis.fontFamily}`}getCanvasIds(){return[this.canvasModel.canvasId]}}const pr={lessThanSecond:0,second:100,minute:200,hour:300,day:400,"week-weekday":500,month:600,year:1e4},ca=n=>{switch(n.key){case"second":case"minute":case"hour":case"day":case"month":case"year":return pr[n.key]+n.value;case"lessThanSecond":return pr[n.key];case"week-weekday":return pr[n.key]+(n.week==="$"?9:n.week)+n.weekday*10}},ha=n=>{const e={};return n.forEach(t=>{const r=e[t.weight];r===void 0?e[t.weight]=[t]:r.push(t)}),e},lu=(n,e)=>{const t=Object.keys(n).map(s=>parseInt(s,10)).sort((s,i)=>i-s);let r=[];for(const s of t){const i=n[s];if(!i)continue;const a=[...r];r=[];const o=a.length,l=i.length;let c=0,h=1/0,v=-1/0;for(let p=0;p<l;p++){const y=i[p],E=y.idx;for(;c<o;){const R=a[c],N=R.idx;if(E>N)c++,r.push(R),v=N,h=1/0;else{h=N;break}}h-E>=e&&E-v>=e&&(r.push(y),v=E)}for(;c<o;)r.push(a[c]),c++}return r},cu=(n,e,t,r,s,i)=>{const a=wn.getFontFromConfig(e),o=Re(t.text,n,a),l=Re(r.text,n,a),c=s.toX(t.value)+o/2;return s.toX(r.value)-l/2-c<i};function mr(n){"@babel/helpers - typeof";return mr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},mr(n)}function Oe(n,e){if(e.length<n)throw new TypeError(n+" argument"+(n>1?"s":"")+" required, but only "+e.length+" present")}function Be(n){Oe(1,arguments);var e=Object.prototype.toString.call(n);return n instanceof Date||mr(n)==="object"&&e==="[object Date]"?new Date(n.getTime()):typeof n=="number"||e==="[object Number]"?new Date(n):((typeof n=="string"||e==="[object String]")&&typeof console!="undefined"&&(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"),console.warn(new Error().stack)),new Date(NaN))}function hu(n){return Oe(1,arguments),Be(n).getDay()===1}function du(n){return Oe(1,arguments),Be(n).getDay()===2}function uu(n){return Oe(1,arguments),Be(n).getDay()===3}function fu(n){return Oe(1,arguments),Be(n).getDay()===4}function vu(n){return Oe(1,arguments),Be(n).getDay()===5}function gu(n){return Oe(1,arguments),Be(n).getDay()===6}function pu(n){return Oe(1,arguments),Be(n).getDay()===0}function mu(n,e){var t;Oe(1,arguments);var r=n||{},s=Be(r.start),i=Be(r.end),a=i.getTime();if(!(s.getTime()<=a))throw new RangeError("Invalid interval");var o=[],l=s;l.setHours(0,0,0,0);var c=Number((t=e==null?void 0:e.step)!==null&&t!==void 0?t:1);if(c<1||isNaN(c))throw new RangeError("`options.step` must be a number greater than 1");for(;l.getTime()<=a;)o.push(Be(l)),l.setDate(l.getDate()+c),l.setHours(0,0,0,0);return o}function bu(n){Oe(1,arguments);var e=Be(n);return e.setDate(1),e.setHours(0,0,0,0),e}function Cu(n){Oe(1,arguments);var e=Be(n),t=e.getMonth();return e.setFullYear(e.getFullYear(),t+1,0),e.setHours(23,59,59,999),e}function da(n){Oe(1,arguments);var e=Be(n);return e.setHours(0,0,0,0),e}function ua(n,e){Oe(2,arguments);var t=da(n),r=da(e);return t.getTime()===r.getTime()}const yu=n=>{switch(n.key){case"lessThanSecond":return Mu(n);case"month":return Pu(n);case"second":case"minute":case"hour":case"day":case"year":return Tu(n);case"week-weekday":return _u(n);default:return()=>!1}},ut=(n,e)=>{switch(e){case"lessThanSecond":return n.getMilliseconds();case"month":return n.getMonth();case"second":return n.getSeconds();case"minute":return n.getMinutes();case"hour":return n.getHours();case"day":return n.getDate();case"year":return n.getFullYear();case"week-weekday":return n.getDate()}},br=n=>(e,t)=>{const r=ut(e,n),s=ut(t,n);return r!==s},wu=n=>(e,t)=>{const r=ut(e,n),s=ut(t,n);return r>=s},Su={1:hu,2:du,3:uu,4:fu,5:vu,6:gu,7:pu},xu=(n,e,t)=>{var r;const s=mu({start:bu(n),end:Cu(n)}),i=(r=Su[t])!=null?r:()=>!1;if(e==="$"){for(const a of s.reverse())if(i(a))return ua(n,a)}else{let a=1;for(const o of s)if(i(o)){if(a===e)return ua(n,o);a++}}return!1},fa=(n,e)=>e===1?n===1:n/e===1,va=(n,e)=>e===1?!0:n%e===0,Mu=n=>(e,t)=>wu(n.key)(e,t),Pu=n=>(e,t)=>{const r=br(n.key)(e,t),s=n.exact?fa(ut(e,n.key)+1,n.value):va(ut(e,n.key)+1,n.value);return r&&s},Tu=n=>(e,t)=>{const r=br(n.key)(e,t),s=n.exact?fa(ut(e,n.key),n.value):va(ut(e,n.key),n.value);return r&&s},_u=n=>(e,t)=>{const r=br(n.key)(e,t),s=xu(e,n.week,n.weekday);return r&&s},Au=n=>{switch(n.key){case"second":case"minute":return Du(n.value);case"hour":return Eu(n.value);case"day":return Lu(n.value);case"month":return Bu(n.value);case"year":return Ru(n.value);case"week-weekday":const e=Ou(n.week),t=Iu(n.weekday);return e&&t;case"lessThanSecond":return!0;default:return!1}},Du=n=>n>0&&n<=60,Eu=n=>n>0&&n<=24,Lu=n=>n>0&&n<=31,Iu=n=>ga(n)?n>=1&&n<=7:!1,Ou=n=>n==="$"?!0:ga(n)?n>=1&&n<=6:!1,Bu=n=>n>0&&n<=12,Ru=n=>n>0,ga=n=>!isNaN(n)&&isFinite(n),Fu=(n,e,t,r)=>{var s,i;const a=r(n.getTime()),o=r(e.getTime());for(const[l,c]of t)if(c(a,o))return l;return(i=(s=t[t.length-1])==null?void 0:s[0])!=null?i:0};function Cr(n,e,t){const r=new Array(n.length);let s=new Date(0);for(let i=0;i<n.length;i++){const a=n[i],o=new Date(a.candle.timestamp),l={weight:Fu(o,s,e,t)};r[i]=l,s=o}return r}const pa=n=>{const e={},t={};return $n(n).forEach(([r,s])=>{const i=la(r),a=i===null?!1:Au(i);if(i&&a){const o=ca(i);e[o]=s,t[o]=yu(i)}}),{weightToTimeFormatsDict:e,weightToTimeFormatMatcherDict:t}};class ma{constructor(e,t,r,s,i,a){this.eventBus=e,this.config=t,this.chartModel=r,this.scaleModel=s,this.timeZoneModel=i,this.canvasModel=a,this.labelsGroupedByWeight={},this.levelsCache={},this.weightToTimeFormatMatcherArray=[],this.weightToTimeFormatsDict={},this.extendedLabelsFilterConfig={minute_1:c=>c>=2},this.formatsByWeightMap=t.components.xAxis.formatsForLabelsConfig;const{weightToTimeFormatsDict:o,weightToTimeFormatMatcherDict:l}=pa(this.formatsByWeightMap);this.weightToTimeFormatMatcherArray=Object.entries(l).map(([c,h])=>[parseInt(c,10),h]).sort(([c],[h])=>h-c),this.weightToTimeFormatsDict=o}get labels(){return this.getLabelsFromChartType()}getLabelsFromChartType(){var e,t;const r=(t=(e=this.weightedCache)==null?void 0:e.labels)!=null?t:[];return this.config.components.chart.type==="equivolume"?this.postProcessing(r):r}getAllCandlesWithFake(){const e=this.chartModel.mainCandleSeries.visualPoints;if(e.length===0)return[];const r=Array.from({length:750}).map((s,i)=>Fs(this.chartModel.mainCandleSeries.dataPoints,this.chartModel.mainCandleSeries.visualPoints,this.chartModel.mainCandleSeries.meanCandleWidth,e.length+i,this.chartModel.getPeriod()));return[...e,...r]}mapWeightedPointsToLabels(e,t){const r=new Array(e.length);return e.forEach((s,i)=>{var a;const o=t[i],l=this.weightToTimeFormatsDict[s.weight],c=this.timeZoneModel.getDateTimeFormatter(l)(o.candle.timestamp);r[i]={weight:s.weight,idx:(a=o.candle.idx)!=null?a:0,value:o.centerUnit,time:o.candle.timestamp,text:c}}),r}setFormatsForLabelsConfig(e){const{weightToTimeFormatsDict:t,weightToTimeFormatMatcherDict:r}=pa(e);this.formatsByWeightMap=e,this.weightToTimeFormatMatcherArray=Object.entries(r).map(([s,i])=>[parseInt(s,10),i]).sort(([s],[i])=>i-s),this.weightToTimeFormatsDict=t,this.generateWeightedLabels()}generateWeightedLabels(){const e=this.getAllCandlesWithFake(),t=Cr(e,this.weightToTimeFormatMatcherArray,this.timeZoneModel.tzOffset(this.config.timezone)),r=this.mapWeightedPointsToLabels(t,e);this.labelsGroupedByWeight=ha(r),this.weightedCache=void 0,this.levelsCache={},this.recalculateCachedLabels()}getLabelsFromCache(e){if(this.levelsCache[e])return this.levelsCache[e]}updateLastLabel(e){const t=this.chartModel.mainCandleSeries.visualPoints[this.chartModel.mainCandleSeries.visualPoints.length-2];if(t){const s=Cr([t,e],this.weightToTimeFormatMatcherArray,this.timeZoneModel.tzOffset(this.config.timezone)),i=this.mapWeightedPointsToLabels([s[1]],[e]),[a]=i;this.labelsGroupedByWeight=Object.entries(this.labelsGroupedByWeight).reduce((o,[l,c])=>{const h=c.findIndex(p=>p.idx===a.idx);let v=c;if(h!==-1&&(v=c.filter(p=>p.idx!==a.idx)),parseInt(l,10)===a.weight){const p=v.findIndex(y=>y.idx>a.idx);p!==-1?v=[...v.slice(0,p),a,...v.slice(p)]:v.push(a)}return o[l]=v,o},{}),this.weightedCache=void 0,this.levelsCache={},this.recalculateCachedLabels()}}updateHistoryLabels(e){const t=e.concat(this.chartModel.mainCandleSeries.visualPoints[e.length]),r=Cr(t,this.weightToTimeFormatMatcherArray,this.timeZoneModel.tzOffset(this.config.timezone)),s=this.mapWeightedPointsToLabels(r,t),i=ha(s),a=Wt(i);for(const c in this.labelsGroupedByWeight)a[c]===void 0&&(a[c]=this.labelsGroupedByWeight[c]);const o=this.chartModel.mainCandleSeries.visualPoints[e.length-1],l=Object.entries(a).sort(([c],[h])=>parseInt(h,10)-parseInt(c,10)).reduce((c,[h,v])=>{const p=parseInt(h,10),y=this.labelsGroupedByWeight[p];if(p===this.weightToTimeFormatMatcherArray[0][0]&&y.shift(),y){const E=y.map(R=>(R.idx=R.idx+e.length,R.value=o.startUnit+o.width+R.value,R));i[p]?c[h]=v.concat(E):c[h]=E}else c[h]=v;return c},{});this.labelsGroupedByWeight=l,this.weightedCache=void 0,this.levelsCache={},this.recalculateCachedLabels()}generateLabels(){this.generateWeightedLabels()}recalculateLabels(){this.recalculateCachedLabels()}recalculateCachedLabels(){if(Object.getOwnPropertyNames(this.labelsGroupedByWeight).length===0)return;const e=this.config.components.xAxis.fontSize,t=Object.values(this.formatsByWeightMap).reduce((a,o)=>Math.max(o.length,a),1),r=e*t,s=Pe(this.chartModel.mainCandleSeries.meanCandleWidth,this.scaleModel.zoomX),i=Math.round(r/s);if(!(i<0&&!isFinite(s))&&(this.weightedCache===void 0||i!==this.weightedCache.coverUpLevel)){const a=this.getLabelsFromCache(i);if(a){this.weightedCache={labels:a,coverUpLevel:i};return}const o=lu(this.filterLabelsByExtendedRules(this.labelsGroupedByWeight,i),i);this.levelsCache[i]=o,this.weightedCache={labels:o,coverUpLevel:i},this.eventBus.fireDraw()}}postProcessing(e){var t,r;const s=[];let i=0,a=1;for(;a<=e.length-1;){const o=e[i],l=e[a];cu(this.canvasModel.ctx,this.config,o,l,this.scaleModel,30)?((t=l.weight)!=null?t:0)>((r=o.weight)!=null?r:0)&&(i=a):(s.push(o),i=a,a===e.length-1&&s.push(l)),a++}return s}filterLabelsByExtendedRules(e,t){const r=$n(this.extendedLabelsFilterConfig).reduce((s,i)=>{if(!i)return s;const[a,o]=i;if(o){const l=la(a);if(l){const c=ca(l);s[c]=o}}return s},{});return $n(e).reduce((s,[i,a])=>(r[i]&&r[i](t)||(s[i]=a),s),{})}}class Yu extends te{constructor(e,t){super(),this.eventBus=e,this.labelProviders=t,this.labels=[],this.initModel(),this.addSubscription(this.eventBus.on(Xt,()=>this.recalculateLabels()))}initModel(){this.recalculateLabels()}recalculateLabels(){this.labels=[];for(const e of this.labelProviders)this.labels.push(...e.getUnorderedLabels())}}class Hu extends te{constructor(e,t,r,s,i){super(),this.scaleModel=e,this.canvasInputListener=t,this.canvasBoundsContainer=r,this.chartPanComponent=s,this.chartModel=i,this.lastXStart=0,this.lastXWidth=0,this.lastXPxWidth=0,this.onXDragStart=()=>{this.lastXStart=this.scaleModel.xStart,this.lastXWidth=this.scaleModel.xEnd-this.scaleModel.xStart;const o=this.canvasBoundsContainer.getBounds(Y.X_AXIS);this.lastXPxWidth=o.width-this.canvasInputListener.currentPoint.x},this.onXDragTick=o=>{const{delta:l}=o,c=this.lastXPxWidth-l;if(c<0)return;const h=this.lastXPxWidth/c,v=this.lastXWidth*h,p=this.lastXStart+(this.lastXWidth-v);this.scaleModel.setXScale(p,this.scaleModel.xEnd)};const a=new Gt(this.canvasBoundsContainer.getBoundsHitTest(Y.X_AXIS),{onDragStart:this.onXDragStart,onDragTick:this.onXDragTick},this.canvasInputListener,this.chartPanComponent,{disableChartPanning:!1});this.addChildEntity(a)}doActivate(){super.doActivate(),this.addRxSubscription(this.canvasInputListener.observeDbClick(this.canvasBoundsContainer.getBoundsHitTest(Y.X_AXIS)).subscribe(()=>this.chartModel.doBasicScale())),this.addRxSubscription(this.chartModel.candlesPrependSubject.subscribe(({prependedCandlesWidth:e})=>this.lastXStart+=e))}}class Nu extends te{constructor(e,t,r,s,i,a,o,l,c,h,v,p,y){super(),this.eventBus=e,this.config=t,this.canvasModel=r,this.chartComponent=s,this.scaleModel=i,this.chartResizeHandler=l,this.timeZoneModel=h;const E=new ma(e,t,s.chartModel,i,h,this.canvasModel);this.xAxisLabelsGenerator=E,this.xAxisLabelsModel=new Yu(e,[]);const R=new ar;c.addDrawer(R,"X_AXIS"),this.xAxisDrawer=new wn(t,r,i,a,()=>this.xAxisLabelsGenerator.labels,()=>t.components.xAxis.visible),R.addDrawer(this.xAxisDrawer),this.xAxisLabelsDrawer=new nu(y,t,r,a,this.xAxisLabelsModel),R.addDrawer(this.xAxisLabelsDrawer),this.xAxisScaleHandler=new Hu(i,o,a,v,this.chartComponent.chartModel),this.addChildEntity(this.xAxisScaleHandler),p.setCursorForCanvasEl(Y.X_AXIS,t.components.xAxis.cursor)}doActivate(){super.doActivate(),this.addRxSubscription(Me(this.chartComponent.chartModel.candlesSetSubject,this.timeZoneModel.observeTimeZoneChanged()).subscribe(()=>{this.xAxisLabelsGenerator.generateLabels()})),this.addRxSubscription(this.chartComponent.chartModel.candlesPrependSubject.pipe(he(({preparedCandles:e})=>e.length!==0),ye(({preparedCandles:e})=>this.chartComponent.chartModel.mainCandleSeries.visualPoints.slice(0,e.length))).subscribe(e=>{Wo.includes(this.config.components.chart.type)&&this.xAxisLabelsGenerator.updateHistoryLabels&&this.xAxisLabelsGenerator.updateHistoryLabels(e)})),this.addRxSubscription(Me(this.scaleModel.xChanged,this.chartResizeHandler.canvasResized).pipe(Nt(50,void 0,{trailing:!0,leading:!0})).subscribe(()=>{this.xAxisLabelsGenerator.recalculateLabels()})),this.addRxSubscription(this.chartComponent.chartModel.candlesUpdatedSubject.pipe(ye(()=>Ue(this.chartComponent.chartModel.mainCandleSeries.visualPoints)),Ve((e,t)=>{var r,s;return((r=e==null?void 0:e.candle)==null?void 0:r.timestamp)===((s=t==null?void 0:t.candle)==null?void 0:s.timestamp)}),he(Gr)).subscribe(e=>{this.xAxisLabelsGenerator.updateLastLabel&&this.xAxisLabelsGenerator.updateLastLabel(e)}))}getDrawer(){return this.xAxisDrawer}registerXAxisLabelsProvider(e){this.xAxisLabelsModel.labelProviders.push(e)}setVisible(e){var t;(t=this.config.components)!=null&&t.xAxis&&(this.config.components.xAxis.visible=e,this.eventBus.fireDraw())}setFormatsForLabelsConfig(e){this.xAxisLabelsGenerator instanceof ma?this.xAxisLabelsGenerator.setFormatsForLabelsConfig(e):console.error("Format config for x-axis is not available")}isVisible(){var e,t;return(t=(e=this.config.components)==null?void 0:e.xAxis.visible)!=null?t:!1}}const rt="#FF00FF",ku=(n,e)=>n==="down"?e.lastPrice.textNegative:n==="up"?e.lastPrice.textPositive:e.lastPrice.textSelected,Wu=(n,e)=>{const t=e.barTheme[`${n}Color`];return t!=null?t:rt},Uu=(n,e)=>{const t=e.lineTheme[`${n}Color`];return t!=null?t:rt},zu=(n,e)=>{const t=e.candleTheme[`${n}Color`];return t!=null?t:rt},Xu=(n,e)=>{const t=e.areaTheme.lineColor;return t!=null?t:rt},ju=(n,e)=>{const t=e.scatterPlot.mainColor;return t!=null?t:rt},Vu=(n,e)=>{const t=e.histogram[`${n}Cap`];return t!=null?t:rt},Gu=(n,e)=>{const t=n==="up"?e.baseLineTheme.upperSectionStrokeColor:e.baseLineTheme.lowerSectionStrokeColor;return t!=null?t:rt},ba=(n,e)=>{const t=e.candleTheme[`${n}WickColor`];return t!=null?t:rt},$u=()=>(console.warn("Fallback for label default color"),rt);var Zu=Object.defineProperty,Ca=Object.getOwnPropertySymbols,Ku=Object.prototype.hasOwnProperty,qu=Object.prototype.propertyIsEnumerable,ya=(n,e,t)=>e in n?Zu(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Sn=(n,e)=>{for(var t in e||(e={}))Ku.call(e,t)&&ya(n,t,e[t]);if(Ca)for(var t of Ca(e))qu.call(e,t)&&ya(n,t,e[t]);return n};class Ju{constructor(e,t,r,s){this.chartModel=e,this.config=t,this.lastCandleLabelsByChartType=r,this.resolveLabelColorFn=s}getUnorderedLabels(){const e=[];if(this.config.components.yAxis.labels.settings.lastPrice.mode!=="none"){const r=this.getYAxisVisualLabel(this.chartModel.mainCandleSeries),s=r&&Sn(Sn({},r),this.getLabelDrawConfig(this.chartModel.mainCandleSeries,!0));if(s){const i={labels:[s]},a=this.lastCandleLabelsByChartType[this.config.components.chart.type];a==null||a(i,this.chartModel.mainCandleSeries),e.push(i)}this.chartModel.candleSeries.forEach((i,a)=>{if(a===0)return;const o=this.getYAxisVisualLabel(i),l=o&&Sn(Sn({},o),this.getLabelDrawConfig(i,!1));if(l){const c={labels:[l]},h=this.lastCandleLabelsByChartType[i.config.type];h==null||h(c,this.chartModel.mainCandleSeries),e.push(c)}})}return e}getYAxisVisualLabel(e){const t=Ue(e.dataPoints);if(t){const r=e.view.toY(t.close);if(isFinite(r)){const s=this.config.components.yAxis.labels.settings.lastPrice.mode,i=this.config.components.yAxis.labels.settings.lastPrice.type;return{y:r,labelWeight:0,labelText:this.chartModel.pane.valueFormatter(t.close,e),mode:s,labelType:i,description:e.instrument.symbol}}}return null}getLabelDrawConfig(e,t){const r=e.colors.labels,s=this.resolveLabelColorFn(e.config.type),{rectLabelTextColor:i,rectLabelInvertedTextColor:a}=this.chartModel.config.colors.yAxis;let o="#FFFFFF",l="#FFFFFF";return r&&(o=s(e.lastPriceMovement,e.colors),l=t?ku(e.lastPriceMovement,r):i),{bgColor:o,textColor:Ht(o,l,a),rounded:!0}}}function Qu(n,e){if(n.filter(i=>i!==null).length<=1)return n.map(i=>i.y);const t=e-2,r=n.map((i,a)=>ef(i,a,t)).filter(Gr).sort(tf),s=new Array(r.length);return r.forEach((i,a)=>{if(i===null)return;const o=r[a+1];if(o&&o.top<i.bottom){const l=o.labelWeight-i.labelWeight===1?2:0,c=i.bottom-o.top+l;o.top+=c,o.bottom+=c}s[i.actualIndex]=(i.top+i.bottom)/2}),s}const ef=(n,e,t)=>n?{top:n.y-t/2,bottom:n.y+t/2,labelWeight:n.weight,actualIndex:e}:null,tf=(n,e)=>{const t=n.top,r=e.top;return t>r?1:t<r||t===r&&n.labelWeight<e.labelWeight?-1:0};var nf=Object.defineProperty,rf=Object.defineProperties,sf=Object.getOwnPropertyDescriptors,wa=Object.getOwnPropertySymbols,af=Object.prototype.hasOwnProperty,of=Object.prototype.propertyIsEnumerable,Sa=(n,e,t)=>e in n?nf(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,xa=(n,e)=>{for(var t in e||(e={}))af.call(e,t)&&Sa(n,t,e[t]);if(wa)for(var t of wa(e))of.call(e,t)&&Sa(n,t,e[t]);return n},Ma=(n,e)=>rf(n,sf(e));const yr={MAIN:"MAIN"};class lf extends te{constructor(e,t,r,s,i,a){super(),this.eventBus=e,this.chartModel=t,this.canvasBoundsContainer=r,this.config=s,this.canvasModel=i,this.updateYAxisWidth=a,this.orderedLabels=[],this.customLabels={},this.labelsProviders={},this.labelsPositionRecalculatedSubject=new G,this.animFrameId=`anim_cache_${Je()}`,this.initModel()}doActivate(){super.doActivate(),this.addRxSubscription(Me(this.chartModel.observeCandlesChanged(),this.canvasBoundsContainer.observeBoundsChanged(Y.PANE_UUID(ae)),this.chartModel.nextCandleTimeStampSubject,this.canvasBoundsContainer.barResizerChangedSubject,this.chartModel.scaleModel.changed).subscribe(()=>{this.updateLabels()}))}initModel(){this.initLabelsGroups(),this.recalculateLabels(),this.canvasModel.fireDraw()}initLabelsGroups(){if(Object.keys(this.labelsProviders).length!==0)for(const e of Object.keys(this.labelsProviders))this.createGroup(e),Object.entries(this.labelsProviders[e]).forEach(([t,r])=>{this.addToGroup(r,e,t)})}updateLabels(e=!1){this.recalculateLabels(),sr(this.animFrameId,()=>{e&&this.updateYAxisWidth(),this.canvasModel.fireDraw()})}recalculateLabels(){var e,t;this.orderedLabels=[];const r=this.config.components.yAxis.fontSize+((e=this.config.components.yAxis.labelBoxMargin.top)!=null?e:0)+((t=this.config.components.yAxis.labelBoxMargin.bottom)!=null?t:0);for(const s of Object.values(this.labelsProviders)){const i=Ie(Object.values(s).map(l=>l.getUnorderedLabels())),a=Ie(i.map(l=>l.labels)).map(l=>{var c;return{y:l.y,weight:(c=l.labelWeight)!=null?c:Number.POSITIVE_INFINITY}}),o=Qu(a,r);i.forEach(l=>{const c=o.splice(0,l.labels.length);this.orderedLabels.push(this.updateLabelsCoordinates(l,c))})}this.orderedLabels=this.orderedLabels.reverse()}createGroup(e){!this.labelsProviders[e]&&(this.labelsProviders[e]={})}addToGroup(e,t,r){this.labelsProviders[t]&&(Object.values(this.labelsProviders[t]).includes(e)||(this.labelsProviders[t][r]=e))}updateLabelsCoordinates(e,t){return Ma(xa({},e),{labels:e.labels.map((r,s)=>Ma(xa({},r),{lineY:r.y,y:t[s]}))})}observeLabelsPositionsRecalculated(){return this.labelsPositionRecalculatedSubject.asObservable()}registerYAxisLabelsProvider(e,t,r){var s;const i=(s=this.labelsProviders[e])!=null?s:{};i[r]=t,this.labelsProviders[e]=i,this.initModel()}unregisterYAxisLabelsProvider(e,t){var r;const s=(r=this.labelsProviders[e])!=null?r:{};delete s[t],this.labelsProviders[e]&&Object.keys(this.labelsProviders[e]).length===0&&delete this.labelsProviders[e],this.initModel()}}class cf{constructor(e,t,r,s,i,a,o){this.labelsProvider=e,this.yAxisLabelsCanvasModel=t,this.backgroundCanvasModel=r,this.yAxisState=s,this.canvasBoundsContainer=i,this.yAxisColors=a,this.customLabels=o}draw(){const e=this.yAxisLabelsCanvasModel.ctx,t=this.backgroundCanvasModel.ctx,r=this.canvasBoundsContainer.getBounds(Y.PANE_UUID_Y_AXIS(ae)),s=this.canvasBoundsContainer.getBounds(Y.ALL_PANES);this.drawHighlightedBackgroundBetweenLabels(),this.labelsProvider().forEach(a=>{var o;const l=(o=a.bounds)!=null?o:r;a.labels.forEach(c=>{var h;return _i(e,t,l,s,c,this.canvasBoundsContainer,(h=a.axisState)!=null?h:this.yAxisState,this.yAxisColors)})}),Object.values(this.customLabels).forEach(a=>_i(e,t,r,s,a,this.canvasBoundsContainer,this.yAxisState,this.yAxisColors))}drawHighlightedBackgroundBetweenLabels(){const e=this.yAxisLabelsCanvasModel.ctx,t=this.labelsProvider(),r={};t.forEach(s=>{s.labels.forEach(i=>{var a,o,l;if(i.subGroupId){const c=(a=r[i.subGroupId])!=null?a:[];if(r[i.subGroupId]=c,c.push(i),c.length===2){const h=(o=s.bounds)!=null?o:this.canvasBoundsContainer.getBounds(Y.PANE_UUID_Y_AXIS(ae));e.save(),e.fillStyle=(l=c[0].highlightColor)!=null?l:c[0].bgColor;const[v,p]=c[0].y>c[1].y?[c[1].y,c[0].y]:[c[0].y,c[1].y];ni(e,{x:h.x,y:ps(v,h)},{x:h.x+h.width-6,y:ps(p,h)}),e.restore()}}})})}getCanvasIds(){return[this.yAxisLabelsCanvasModel.canvasId]}}class hf extends te{constructor(e,t,r,s,i,a,o){super(),this.config=r,this.canvasBoundsContainer=s,this.canvasModel=i,this.chartModel=a;const l=e.valueFormatter;this.yAxisLabelsGenerator=new $i(null,a,o,l,()=>this.config.components.yAxis.type,()=>this.chartModel.getBaseLine(),r.components.yAxis.labelHeight),this.yAxisBaseLabelsModel=new Ji(o,this.yAxisLabelsGenerator,this.canvasBoundsContainer),this.addChildEntity(this.yAxisBaseLabelsModel),this.yAxisLabelsModel=new lf(t,this.chartModel,this.canvasBoundsContainer,this.config,i,()=>this.canvasBoundsContainer.updateYAxisWidths()),this.addChildEntity(this.yAxisLabelsModel),this.canvasBoundsContainer.yAxisBoundsContainer.registerYAxisWidthContributor({getLargestLabel:()=>{var c;return((c=this.yAxisLabelsGenerator.labelsCache.getLastCachedValue())!=null?c:[]).map(h=>h.text).concat(this.yAxisLabelsModel.orderedLabels.flatMap(h=>h.labels).map(h=>h.labelText)).reduce((h,v)=>v.length>h.length?v:h,"")},getYAxisIndex:()=>0,getYAxisAlign:()=>this.config.components.yAxis.align,getPaneUUID:()=>e.uuid})}doActivate(){super.doActivate(),this.addRxSubscription(Me(this.chartModel.candlesSetSubject).subscribe(()=>{this.yAxisLabelsGenerator.labelsCache.invalidate(),this.yAxisLabelsModel.updateLabels(),this.yAxisBaseLabelsModel.updateLabels(),this.canvasModel.fireDraw()}))}}class df extends te{constructor(e,t,r,s,i,a,o,l,c,h,v,p,y){super(),this.eventBus=e,this.config=t,this.canvasModel=r,this.yAxisLabelsCanvasModel=s,this.backgroundCanvasModel=i,this.chartModel=a,this.scaleModel=o,this.canvasBoundsContainer=c,this.cursorHandler=y,this.axisTypeSetSubject=new G,this.labelsColorByChartTypeMap={},this.state=t.components.yAxis;const E=new ar;this.drawer=E;const R=new Lt(this.yAxisLabelsCanvasModel);E.addDrawer(R,"YAXIS_CLEAR"),this.registerDefaultLabelColorResolver(),h.addDrawer(E,"Y_AXIS"),this.yAxisScaleHandler=new Ki(e,this.state,v,o,l,c,c.getBoundsHitTest(Y.PANE_UUID_Y_AXIS(ae)),Z=>o.autoScale(Z)),this.addChildEntity(this.yAxisScaleHandler),this.yAxisModel=new hf(p.paneComponents[ae],e,this.config,c,r,a,o),this.addChildEntity(this.yAxisModel),p.paneComponents[ae].yAxisLabelsGenerator=this.yAxisModel.yAxisLabelsGenerator;const N=new qi(t,this.state,r,()=>this.yAxisModel.yAxisBaseLabelsModel.labels,()=>c.getBounds(Y.Y_AXIS),()=>this.state.visible,a.pane.scaleModel.toY.bind(a.pane.scaleModel));E.addDrawer(N);const k=new cf(()=>this.yAxisModel.yAxisLabelsModel.orderedLabels,this.yAxisLabelsCanvasModel,this.backgroundCanvasModel,this.state,this.canvasBoundsContainer,this.config.colors.yAxis,this.yAxisModel.yAxisLabelsModel.customLabels);E.addDrawer(k);const U=new Ju(this.chartModel,this.config,this.chartModel.lastCandleLabelsByChartType,this.getLabelsColorResolver.bind(this));this.registerYAxisLabelsProvider(U,yr.MAIN),p.paneComponents[ae].mainYExtentComponent.getAxisType=()=>this.state.type,this.updateCursor()}updateCursor(){this.state.type==="percent"?this.cursorHandler.setCursorForCanvasEl(Y.PANE_UUID_Y_AXIS(ae),this.config.components.yAxis.resizeDisabledCursor):this.cursorHandler.setCursorForCanvasEl(Y.PANE_UUID_Y_AXIS(ae),this.config.components.yAxis.cursor)}updateOrderedLabels(e=!1){this.yAxisModel.yAxisLabelsModel.updateLabels(e)}doActivate(){super.doActivate()}registerDefaultLabelColorResolver(){this.registerLabelColorResolver("candle",zu),this.registerLabelColorResolver("bar",Wu),this.registerLabelColorResolver("line",Uu),this.registerLabelColorResolver("area",Xu),this.registerLabelColorResolver("scatterPlot",ju),this.registerLabelColorResolver("histogram",Vu),this.registerLabelColorResolver("baseline",Gu),this.registerLabelColorResolver("trend",ba),this.registerLabelColorResolver("hollow",ba)}registerYAxisLabelsProvider(e,t=yr.MAIN,r=Je()){return this.yAxisModel.yAxisLabelsModel.registerYAxisLabelsProvider(t,e,r),r}addSimpleYAxisLabel(e,t){this.yAxisModel.yAxisLabelsModel.customLabels[e]=t,this.canvasModel.fireDraw()}deleteSimpleYAxisLabel(e){delete this.yAxisModel.yAxisLabelsModel.customLabels[e],this.canvasModel.fireDraw()}unregisterYAxisLabelsProvider(e=yr.MAIN,t){return this.yAxisModel.yAxisLabelsModel.unregisterYAxisLabelsProvider(e,t),t}registerYAxisWidthContributor(e){this.canvasBoundsContainer.yAxisBoundsContainer.registerYAxisWidthContributor(e)}setAxisType(e){e!==this.state.type&&(this.state.type=e,this.axisTypeSetSubject.next(e),this.scaleModel.autoScale(!0),this.yAxisModel.yAxisLabelsModel.updateLabels(!0),this.updateCursor())}setYAxisAlign(e){this.state.align=e,this.canvasBoundsContainer.updateYAxisWidths(),this.eventBus.fireDraw()}setVisible(e){this.state.visible=e,this.eventBus.fireDraw()}isVisible(){return this.state.visible}setLockPriceToBarRatio(e=!1){this.scaleModel.setLockPriceToBarRatio(e)}changeLabelMode(e,t){this.state.labels.settings[e].mode=t,this.yAxisModel.yAxisLabelsModel.updateLabels()}changeLabelAppearance(e,t){this.state.labels.settings[e].type=t,this.yAxisModel.yAxisLabelsModel.updateLabels()}togglePriceScaleInverse(e){this.scaleModel.state.inverse=e,this.scaleModel.inverseY=e,this.scaleModel.scaleInversedSubject.next(e)}changeLabelsDescriptionVisibility(e){this.state.labels.descriptions=e,this.canvasModel.fireDraw()}registerLabelColorResolver(e,t){this.labelsColorByChartTypeMap[e]=t}getLabelsColorResolver(e){var t;return(t=this.labelsColorByChartTypeMap[e])!=null?t:$u}}class uf{constructor(){this.UNKNOWN_ARR=[],this.handlers={},this.muted=!1,this.unsub=(e,t)=>{const r=this.handlers[e];r!==void 0&&Ao.call(r,t)},this.add=(e,t,r)=>(t in this.handlers?e.call(this.handlers[t],r):this.handlers[t]=[r],this.unsub.bind(this,t,r)),this.on=(e,t)=>this.add(this.UNKNOWN_ARR.push,e,t),this.observe=e=>{const t=new G,r=t.next.bind(t),s=t.unsubscribe.bind(t);return this.on(e,r),t.unsubscribe=()=>{this.unsub(e,r),s()},t.asObservable()},this.onPrior=(e,t)=>this.add(this.UNKNOWN_ARR.unshift,e,t),this.off=this.unsub,this.fire=(e,...t)=>{var r;if(!this.muted){const s=(r=this.handlers[e])!=null?r:[];let i;for(i=0,s.length;i<s.length;i++)s[i].apply(null,t)}},this.fireAsync=(e,t)=>{if(!this.muted)return window.setTimeout(this.fire.bind(this,e,t),0)},this.setMuted=e=>{this.muted=e},this.clear=()=>{this.handlers={}}}fireDraw(e){this.fire(Xt,e)}}class ff extends te{constructor(e,t,r,s){super(),r.observeTouchStart().pipe(ye(i=>s.components.chart.highlightActiveCandle?i:void 0),Ve()).subscribe(i=>{i&&this.setCandleAsActive(i,e,t)})}setCandleAsActive(e,t,r){if(e.touches.length===1){const s=e.touches.item(0);if(s!==null){const i=this.getTouchXPosition(s,t),a=r.candleFromX(i);a&&r.mainCandleSeries.setActiveCandle(a)}}}getTouchXPosition(e,t){const r=t.getBoundingClientRect(),s=document.body.scrollLeft||document.documentElement.scrollLeft;return e.pageX-r.left-s}}class vf{constructor(e,t,r,s,i){this.frameElement=e,this.resizerElement=t,this.bus=r,this.canvasModels=s,this.config=i,this.previousBCR=void 0,this.animFrameId=`resize_${Je()}`,this.canvasResized=new G,this.elementResizeDetector=new ResizeObserver(()=>this.handleResize())}subscribeResize(){this.elementResizeDetector.observe(this.resizerElement)}handleResize(){sr(this.animFrameId,()=>this.fireUpdates())}fireUpdates(){const e=this.resizerElement.getBoundingClientRect(),t={x:e.x,y:e.y,width:e.width,height:e.height};this.config||(this.frameElement.style.height=this.resizerElement.clientHeight+"px"),(this.previousBCR===void 0||this.isBCRDimensionsDiffer(this.previousBCR,t))&&(this.previousBCR=t,this.canvasModels.forEach(r=>this.previousBCR&&r.updateDPR(this.previousBCR)),this.canvasResized.next(t),this.bus.fire(Qn,t),this.bus.fire(Xt))}isBCRDimensionsDiffer(e,t){return e.height!==t.height||e.width!==t.width}unsubscribeAnimationUpdate(){if(this.resizerElement)try{this.elementResizeDetector.unobserve(this.resizerElement)}catch(e){console.warn("ChartResizeHandler.ts, unsubscribeAnimationUpdate failed")}}wasResized(){return this.previousBCR!==void 0}}var gf=Array.isArray,pf=Object.getPrototypeOf,mf=Object.prototype,bf=Object.keys;function Cf(n){if(n.length===1){var e=n[0];if(gf(e))return{args:e,keys:null};if(yf(e)){var t=bf(e);return{args:t.map(function(r){return e[r]}),keys:t}}}return{args:n,keys:null}}function yf(n){return n&&typeof n=="object"&&pf(n)===mf}var wf=Array.isArray;function Sf(n,e){return wf(e)?n.apply(void 0,g([],P(e))):n(e)}function xf(n){return ye(function(e){return Sf(n,e)})}function Mf(n,e){return n.reduce(function(t,r,s){return t[r]=e[s],t},{})}function Pf(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];var t=Kt(n),r=Za(n),s=Cf(n),i=s.args,a=s.keys;if(i.length===0)return qt([],t);var o=new xe(Tf(i,t,a?function(l){return Mf(a,l)}:Pt));return r?o.pipe(xf(r)):o}function Tf(n,e,t){return t===void 0&&(t=Pt),function(r){Pa(e,function(){for(var s=n.length,i=new Array(s),a=s,o=s,l=function(h){Pa(e,function(){var v=qt(n[h],e),p=!1;v.subscribe(We(r,function(y){i[h]=y,p||(p=!0,o--),o||r.next(t(i.slice()))},function(){--a||r.complete()}))},r)},c=0;c<s;c++)l(c)},r)}}function Pa(n,e,t){n?qe(t,n,e):e()}class _f extends te{constructor(e,t){super(),this.canvasInputListener=e,this.canvasBoundsContainer=t,this.panesSubscriptions={},this.crossSubject=new lt(null)}doActivate(){super.doActivate()}fireCrossClose(){this.crossSubject.next(null)}unsubscribeMouseOver(e){var t;(t=this.panesSubscriptions[e])==null||t.unsubscribe()}subscribeMouseOver(e,t,r){const s=t.map(a=>this.canvasBoundsContainer.getBoundsHitTest(a,r)),i=(a,o)=>s.some(l=>l(a,o));return this.subscribeMouseOverHT(e,i)}subscribeMouseOverHT(e,t){const r=this.canvasInputListener.observeMouseMoveDocument(),s=this.canvasInputListener.observeMouseEnter(t);let i=!1;const a=Pf([r,s]).pipe(he(([,o])=>!i||i&&o)).subscribe(([o,l])=>{if(l){const c=[o.x,o.y,e];this.crossSubject.next(c),i=!1}else this.crossSubject.next(null),i=!0});return this.panesSubscriptions[e]=a,()=>a.unsubscribe()}}class Af{constructor(e,t,r,s){this.visualCandle=e,this.price=t,this.priceFormatter=r,this.toY=s}get high(){return this.visualCandle.high}get low(){return this.visualCandle.low}get open(){return this.visualCandle.open}get close(){return this.visualCandle.close}get volume(){return this.visualCandle.candle.volume}get openY(){return this.toY(this.open)}get closeY(){return this.toY(this.close)}get highY(){return this.toY(this.high)}get lowY(){return this.toY(this.low)}get openFormatted(){return this.priceFormatter(this.open)}get closeFormatted(){return this.priceFormatter(this.close)}get highFormatted(){return this.priceFormatter(this.high)}get lowFormatted(){return this.priceFormatter(this.low)}get closestOHLCY(){return this.toY([this.close,this.open,this.high,this.low].sort((e,t)=>Math.abs(e-this.price)-Math.abs(t-this.price))[0])}}class Df{constructor(e){this.chartModel=e}getData(e){const{x:t,y:r}=e,i=this.chartModel.candleFromX(t).idx||0,a=this.chartModel.getVisualCandle(i),o=this.chartModel.priceFromY(r);return a&&new Af(a,o,this.chartModel.pane.regularFormatter,this.chartModel.toY)}}class Ef{constructor(e){this.chartModel=e}getData(e){const{x:t}=e,s=this.chartModel.candleFromX(t).idx||0;return this.chartModel.candleSeries.map(a=>{const o=a.dataPoints[s],l=this.chartModel.pane.regularFormatter(o==null?void 0:o.close);return{instrument:a.instrument.symbol,price:l,id:a.id}})}}var Lf=Object.defineProperty,If=Object.defineProperties,Of=Object.getOwnPropertyDescriptors,Ta=Object.getOwnPropertySymbols,Bf=Object.prototype.hasOwnProperty,Rf=Object.prototype.propertyIsEnumerable,_a=(n,e,t)=>e in n?Lf(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,$t=(n,e)=>{for(var t in e||(e={}))Bf.call(e,t)&&_a(n,t,e[t]);if(Ta)for(var t of Ta(e))Rf.call(e,t)&&_a(n,t,e[t]);return n},wr=(n,e)=>If(n,Of(e));class Ff extends te{constructor(e,t,r,s,i,a,o,l,c){super(),this.crossEventProducer=e,this.scaleModel=t,this.config=r,this.chartModel=s,this.canvasInputListener=i,this.canvasBoundsContainer=a,this.paneManager=o,this.timeZoneModel=l,this.formatterFactory=c,this.hoverSubject=new lt(null),this.longTouchActivated=!1,this.xFormatter=()=>"";const h=new Df(this.chartModel),v=new Ef(this.chartModel);this.hoverProducerParts={candleHover:h,compareSeriesHover:v}}get hover(){return this.hoverSubject.getValue()}doActivate(){super.doActivate(),this.addRxSubscription(this.chartModel.candlesSetSubject.subscribe(()=>{const t=this.chartModel.getLastVisualCandle();t&&this.createAndFireHoverFromCandle(t)})),this.addRxSubscription(this.chartModel.candlesUpdatedSubject.subscribe(()=>{const t=this.chartModel.getLastVisualCandle();this.hover!==null&&t!==void 0&&t.candle.timestamp===this.hover.timestamp&&this.updateHover(t)})),this.addRxSubscription(this.crossEventProducer.crossSubject.subscribe(t=>{t===null?this.hoverSubject.next(null):this.createAndFireHover(t)})),this.addRxSubscription(this.scaleModel.xChanged.subscribe(()=>this.fireLastCross())),this.addRxSubscription(this.canvasInputListener.observeTouchStart().subscribe(t=>{const r=t.touches[0].clientX,s=t.touches[0].clientY-this.canvasBoundsContainer.canvasOnPageLocation.y;this.chartModel.candleFromX(r,!0)&&this.createAndFireHover([r,s,""])}));const e=this.canvasBoundsContainer.getBoundsHitTest(Y.ALL_PANES);this.addRxSubscription(this.canvasInputListener.observeLongTouch(e).subscribe(t=>{this.paneManager.chartPanComponent.deactivatePanHandlers(),this.longTouchActivated=!0;const r=t.touches[0].clientX,s=t.touches[0].clientY-this.canvasBoundsContainer.canvasOnPageLocation.y;this.createAndFireHover([r,s,""])})),this.addRxSubscription(this.canvasInputListener.observeTouchEndDocument().subscribe(()=>{this.paneManager.chartPanComponent.activateChartPanHandlers(),this.longTouchActivated&&(this.longTouchActivated=!1,this.crossEventProducer.fireCrossClose())})),this.addRxSubscription(Me(this.chartModel.candlesSetSubject,this.timeZoneModel.observeTimeZoneChanged()).subscribe(()=>this.recalculateCrossToolXFormatter()))}recalculateCrossToolXFormatter(){const e=this.config.components.crossTool.xAxisLabelFormat;this.xFormatter=Di(e,this.chartModel.getPeriod(),this.formatterFactory)}createHoverFromCandle(e){const t=e.xCenter(this.chartModel.scaleModel),r=this.chartModel.scaleModel.toY(e.close);return this.createHover(t,r,ae)}createHover(e,t,r){if(this.chartModel.getCandles().length===0)return;const i=this.chartModel.candleFromX(e,!0).timestamp,a={x:e,y:t,timestamp:i,timeFormatted:this.xFormatter(i),paneId:r},o=Object.entries(this.hoverProducerParts).reduce((l,c)=>wr($t({},l),{[c[0]]:c[1].getData(a)}),{});return $t($t({},a),o)}createAndFireHoverFromCandle(e){const t=this.createHoverFromCandle(e);this.fireHover(t)}updateHover(e){const t=this.createHoverFromCandle(e);if(this.hover&&t){const r=wr($t({},t),{x:this.hover.x,y:this.hover.y});this.fireHover(r)}}createAndFireHover([e,t,r]){const s=this.createHover(e,t,r);this.fireHover(s)}fireHover(e){var t;if(e){if(Hn()&&this.config.components.crossTool.type!=="none"){const r=(t=e.candleHover)==null?void 0:t.visualCandle.candle;r&&this.chartModel.mainCandleSeries.setActiveCandle(r)}this.hoverSubject.next(e)}else this.crossEventProducer.fireCrossClose()}fireLastCross(){const e=this.crossEventProducer.crossSubject.getValue();e&&this.createAndFireHover(e)}registerHoverProducerPart(e,t){this.hoverProducerParts=wr($t({},this.hoverProducerParts),{[e]:t})}unregisterHoverProducerPart(e){delete this.hoverProducerParts[e]}}function Te(n,e,t,r){return n.addEventListener(t,e,r),function(){n.removeEventListener(t,e,r)}}var Yf=Object.defineProperty,Aa=Object.getOwnPropertySymbols,Hf=Object.prototype.hasOwnProperty,Nf=Object.prototype.propertyIsEnumerable,Da=(n,e,t)=>e in n?Yf(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,kf=(n,e)=>{for(var t in e||(e={}))Hf.call(e,t)&&Da(n,t,e[t]);if(Aa)for(var t of Aa(e))Nf.call(e,t)&&Da(n,t,e[t]);return n},Wf=(n=>(n[n.left=0]="left",n[n.middle=1]="middle",n[n.right=2]="right",n))(Wf||{});const St=class extends te{constructor(n,e){super(),this.eventBus=n,this.element=e,this.xDragStartSubject=new G,this.xDragSubject=new G,this.xDragTickSubject=new G,this.xDragEndSubject=new G,this.yDragStartSubject=new G,this.yDragSubject=new G,this.yDragTickSubject=new G,this.yDragEndSubject=new G,this.mouseMoveSubject=new G,this.mouseMoveDocumentSubject=new G,this.clickSubject=new G,this.clickDocumentSubject=new G,this.dbClickSubject=new G,this.mouseDownSubject=new G,this.mouseUpSubject=new G,this.mouseUpDocumentSubject=new G,this.wheelSubject=new G,this.touchStartSubject=new G,this.touchMoveSubject=new G,this.touchEndSubject=new G,this.touchCancelSubject=new G,this.contextMenuSubject=new G,this.longTouchSubject=new G,this.pinchSubject=new G,this.scrollGestureSubject=new G,this.mouseLeavesCanvasSubject=new G,this.dragStartPoint={x:0,y:0},this.prevDragPoint={x:0,y:0},this.currentPoint={x:0,y:0},this.currentPointDocument={x:0,y:0},this.dragging=!1,this.canvasBounds={x:0,y:0,pageX:0,pageY:0,width:0,height:0},this.documentDragListeners=[],this.dragProcessListener=()=>{this.xDragSubject.next(this.currentPoint.x-this.dragStartPoint.x),this.yDragSubject.next(this.currentPoint.y-this.dragStartPoint.y),this.xDragTickSubject.next(this.currentPoint.x-this.prevDragPoint.x),this.yDragTickSubject.next(this.currentPoint.y-this.prevDragPoint.y),this.prevDragPoint.x=this.currentPoint.x,this.prevDragPoint.y=this.currentPoint.y},this.dragStartListener=t=>{this.isDraggable(t)&&(this.updateCurrentPoints(t),this.dragging=!0,this.dragStartEvent=t,this.documentDragListeners.forEach(r=>r()),this.dragStartPoint=St.copyPoint(this.currentPoint),this.xDragStartSubject.next(this.dragStartPoint),this.yDragStartSubject.next(this.dragStartPoint),this.prevDragPoint=kf({},this.dragStartPoint),St.DRAG_EVENTS.forEach(r=>{document.addEventListener(r,this.dragProcessListener,!0);const s=document.removeEventListener.bind(document,r,this.dragProcessListener,!0);this.documentDragListeners.push(s),this.addSubscription(s)}),this.dragProcessListener())},this.dragListener=()=>this.mouseMoveDocumentSubject.next(this.currentPoint),this.updateElementOffsetListener=()=>this.mouseMoveSubject.next(this.currentPoint),this.dragEndListener=()=>{this.dragging=!1,this.documentDragListeners.forEach(t=>t()),this.xDragEndSubject.next(),this.yDragEndSubject.next()},this.clickHandler=()=>this.clickSubject.next(this.currentPoint),this.updateCurrentPoints=t=>{this.updateCurrentDocumentPoint(t),this.updateCurrentMousePoint(t)}}isDraggable(n){return n instanceof MouseEvent?n.button===0:n instanceof TouchEvent}startDragging(n){this.updateCurrentPoints(n),this.dragStartListener(n)}movePointer(n){this.updateCurrentPoints(n),this.dragListener(),this.updateElementOffsetListener(),this.dragging&&this.dragProcessListener()}stopDragging(){this.dragEndListener()}fixTextSelection(){const n=e=>(e.preventDefault(),!1);this.element.addEventListener("selectstart",n,!1),this.addSubscription(this.element.removeEventListener.bind(this.element,"selectstart",n,!1))}doActivate(){this.fixTextSelection(),this.documentDragListeners=[],St.DRAG_START_EVENTS.forEach(s=>{this.element.addEventListener(s,this.dragStartListener),this.addSubscription(()=>this.element.removeEventListener(s,this.dragStartListener))}),this.trackMousePosition(),St.DRAG_EVENTS.forEach(s=>{document.addEventListener(s,this.dragListener),this.addSubscription(document.removeEventListener.bind(document,s,this.dragListener)),this.element.addEventListener(s,this.updateElementOffsetListener),this.addSubscription(this.element.removeEventListener.bind(this.element,s,this.updateElementOffsetListener))}),St.DRAG_END_EVENTS.forEach(s=>{document.addEventListener(s,this.dragEndListener),this.addSubscription(document.removeEventListener.bind(document,s,this.dragEndListener))}),this.addSubscription(Te(this.element,this.clickHandler,"click"));const n=s=>{this.clickDocumentSubject.next(s)};this.addSubscription(Te(document,n,"click"));const e=Wi();if(e==="apple"||e==="mobile"){const i=(()=>{let a=null;return()=>{a?(this.dbClickSubject.next(this.currentPoint),clearTimeout(a),a=null):a=window.setTimeout(()=>{a=null},250)}})();this.addSubscription(Te(this.element,i,"touchend"))}const t=(s,i=500,a=2)=>{s.preventDefault();let o=null;const l={x:s.touches[0].clientX,y:s.touches[0].clientY};let c={x:0,y:0};const h=p=>{c={x:p.touches[0].clientX,y:p.touches[0].clientY},(Math.sqrt(Math.pow(c.x-l.x,2)+Math.pow(c.y-l.y,2))>a||p.touches.length>1)&&v()},v=()=>{o&&(clearTimeout(o),o=null),this.element.removeEventListener("touchend",v),this.element.removeEventListener("touchmove",h)};o=setTimeout(()=>this.longTouchSubject.next(s),i),this.element.addEventListener("touchmove",h,{passive:!0}),this.element.addEventListener("touchend",v)};this.addSubscription(Te(this.element,s=>t(s),"touchstart")),this.addSubscription(Te(this.element,()=>this.dbClickSubject.next(this.currentPoint),"dblclick")),this.addSubscription(Te(this.element,s=>this.touchStartSubject.next(s),"touchstart")),this.addSubscription(Te(this.element,s=>this.touchMoveSubject.next(s),"touchmove",!0)),this.addSubscription(Te(this.element,s=>this.touchEndSubject.next(s),"touchend")),this.addSubscription(Te(this.element,s=>this.touchCancelSubject.next(s),"touchcancel")),this.addSubscription(Te(this.element,s=>{s.ctrlKey?this.pinchSubject.next(s):zi(s)?this.scrollGestureSubject.next(s):this.wheelSubject.next(s),s.preventDefault()},"wheel")),this.addSubscription(Te(this.element,s=>this.contextMenuSubject.next(s),"contextmenu")),this.addSubscription(Te(this.element,()=>this.mouseDownSubject.next(this.currentPoint),"mousedown")),this.addSubscription(Te(this.element,()=>this.mouseUpSubject.next(this.currentPoint),"mouseup")),this.addSubscription(Te(document,()=>this.mouseUpDocumentSubject.next(this.currentPoint),"mouseup")),this.addRxSubscription(this.eventBus.observe(Qn).subscribe(()=>{const s=this.element.getBoundingClientRect();this.canvasBounds.x=s.left,this.canvasBounds.y=s.top,this.canvasBounds.width=s.width,this.canvasBounds.height=s.height}));const r=()=>{this.mouseLeavesCanvasSubject.next(!0)};this.element.addEventListener("mouseleave",r,!1),this.addSubscription(this.element.removeEventListener.bind(this.element,"mouseleave",r,!1))}getCurrentMousePoint(){return this.currentPoint}trackMousePosition(){St.DRAG_EVENTS.forEach(n=>{document.addEventListener(n,this.updateCurrentPoints,!0),this.addSubscription(()=>document.removeEventListener(n,this.updateCurrentPoints,!0))})}updateCurrentDocumentPoint(n){"pageX"in n?this.currentPointDocument.x=n.pageX:n.touches!==void 0&&(this.currentPointDocument.x=n.touches[0].pageX),"pageY"in n?this.currentPointDocument.y=n.pageY:n.touches!==void 0&&(this.currentPointDocument.y=n.touches[0].pageY)}updateCurrentMousePoint(n){const e=this.element.getBoundingClientRect();"clientX"in n?this.currentPoint.x=n.clientX-e.left:n.touches!==void 0&&(this.currentPoint.x=n.touches[0].clientX-e.left),"clientY"in n?this.currentPoint.y=n.clientY-e.top:n.touches!==void 0&&(this.currentPoint.y=n.touches[0].clientY-e.top)}static copyPoint(n){return{x:n.x,y:n.y}}observeMouseMove(n=()=>!0){return this.mouseMoveSubject.asObservable().pipe(he(()=>n(this.currentPoint.x,this.currentPoint.y)))}observeMouseMoveNoDrag(){return this.mouseMoveSubject.asObservable().pipe(he(()=>!this.dragging))}observeMouseMoveDocument(n=()=>!0){return this.mouseMoveDocumentSubject.asObservable().pipe(he(()=>n(this.currentPoint.x,this.currentPoint.y)))}observeMouseMoveDocumentAnyElement(n=()=>!0){return this.mouseMoveDocumentSubject.asObservable().pipe(he(()=>n(this.currentPointDocument.x,this.currentPointDocument.y)),ye(()=>this.currentPointDocument))}observeClickOnDocument(){return this.clickDocumentSubject.asObservable()}observeXDragStart(n=()=>!0){return this.xDragStartSubject.asObservable().pipe(he(()=>n(this.currentPoint.x,this.currentPoint.y)))}observeXDrag(n=()=>!0){return this.xDragSubject.pipe(he(()=>n(this.currentPoint.x,this.currentPoint.y)))}observeXDragEnd(n=()=>!0){return this.xDragEndSubject.asObservable().pipe(he(()=>n(this.currentPoint.x,this.currentPoint.y)))}observeXDragTick(){return this.xDragTickSubject.asObservable()}observeYDragStart(n=()=>!0){return this.yDragStartSubject.asObservable().pipe(he(()=>n(this.currentPoint.x,this.currentPoint.y)))}observeYDrag(n=()=>!0){return this.yDragSubject.asObservable().pipe(he(()=>n(this.currentPoint.x,this.currentPoint.y)))}observeYDragEnd(n=()=>!0){return this.yDragEndSubject.asObservable().pipe(he(()=>n(this.currentPoint.x,this.currentPoint.y)))}observeYDragTick(){return this.yDragTickSubject.asObservable()}observeMouseEnter(n=()=>!0,e=!1){const t=this.mouseMoveSubject.asObservable().pipe(he(()=>!(e&&this.dragging)),ye(()=>n(this.currentPoint.x,this.currentPoint.y))),r=this.observeMouseLeavesCanvas().pipe(ye(()=>!1));return Me(t,r).pipe(Ve())}observeMouseLeavesCanvas(){return this.mouseLeavesCanvasSubject.asObservable()}observeClick(n=()=>!0){return this.clickSubject.asObservable().pipe(he(()=>n(this.currentPoint.x,this.currentPoint.y)))}observeDbClick(n=()=>!0){return this.dbClickSubject.asObservable().pipe(he(()=>n(this.currentPoint.x,this.currentPoint.y)))}observeWheel(n=()=>!0){return this.wheelSubject.asObservable().pipe(he(()=>n(this.currentPoint.x,this.currentPoint.y)))}observePinch(n=()=>!0){return this.pinchSubject.asObservable().pipe(he(()=>n(this.currentPoint.x,this.currentPoint.y)))}observeScrollGesture(){return this.scrollGestureSubject.asObservable()}observeTouchStart(n=()=>!0){return this.touchStartSubject.asObservable().pipe(he(()=>n(this.currentPoint.x,this.currentPoint.y)))}observeTouchMove(n=()=>!0){return this.touchMoveSubject.asObservable().pipe(he(()=>n(this.currentPoint.x,this.currentPoint.y)))}observeTouchEndDocument(){return this.touchEndSubject.asObservable()}observeTouchCancelDocument(){return this.touchCancelSubject.asObservable()}observeMouseDown(n=()=>!0){return this.mouseDownSubject.asObservable().pipe(he(()=>n(this.currentPoint.x,this.currentPoint.y)))}observeMouseUp(n=()=>!0){return this.mouseUpSubject.asObservable().pipe(he(()=>n(this.currentPoint.x,this.currentPoint.y)))}observeMouseUpDocument(n=()=>!0){return this.mouseUpDocumentSubject.asObservable().pipe(he(()=>n(this.currentPoint.x,this.currentPoint.y)))}observeContextMenu(n=()=>!0){return this.contextMenuSubject.asObservable().pipe(he(()=>n(this.currentPoint.x,this.currentPoint.y)),fr(e=>e.preventDefault()))}observeLongTouch(n=()=>!0){return this.longTouchSubject.asObservable().pipe(he(()=>n(this.currentPoint.x,this.currentPoint.y)),fr(e=>e.preventDefault()))}getCurrentPoint(){return this.currentPoint}};let xn=St;xn.DRAG_START_EVENTS=["mousedown","touchstart"],xn.DRAG_EVENTS=["mousemove","touchmove"],xn.DRAG_END_EVENTS=["mouseup","touchend","touchcancel"];var Uf=_e(722),zf=function(n){I(e,n);function e(t,r,s){t===void 0&&(t=1/0),r===void 0&&(r=1/0),s===void 0&&(s=jn);var i=n.call(this)||this;return i._bufferSize=t,i._windowTime=r,i._timestampProvider=s,i._buffer=[],i._infiniteTimeWindow=!0,i._infiniteTimeWindow=r===1/0,i._bufferSize=Math.max(1,t),i._windowTime=Math.max(1,r),i}return e.prototype.next=function(t){var r=this,s=r.isStopped,i=r._buffer,a=r._infiniteTimeWindow,o=r._timestampProvider,l=r._windowTime;s||(i.push(t),!a&&i.push(o.now()+l)),this._trimBuffer(),n.prototype.next.call(this,t)},e.prototype._subscribe=function(t){this._throwIfClosed(),this._trimBuffer();for(var r=this._innerSubscribe(t),s=this,i=s._infiniteTimeWindow,a=s._buffer,o=a.slice(),l=0;l<o.length&&!t.closed;l+=i?1:2)t.next(o[l]);return this._checkFinalizedStatuses(t),r},e.prototype._trimBuffer=function(){var t=this,r=t._bufferSize,s=t._timestampProvider,i=t._buffer,a=t._infiniteTimeWindow,o=(a?1:2)*r;if(r<1/0&&o<i.length&&i.splice(0,i.length-o),!a){for(var l=s.now(),c=0,h=1;h<i.length&&i[h]<=l;h+=2)c=h;c&&i.splice(0,c+1)}},e}(G);const Xf=Symbol("MEMOIZE_CLEAR_FUNCTION");function jf(n){const e={},t=function(){const r=Array.prototype.slice.call(arguments),s=Ea(r);return typeof e[s]=="undefined"&&(e[s]=n.apply(this,r)),e[s]}.bind(this);return t[Xf]=function(){const r=Array.prototype.slice.call(arguments),s=Ea(r);delete e[s]},t}const Iv=n=>e=>{let t=!1,r,s=[];const i=a=>{r=e(...a),t=!0,s=a};return(...a)=>{const o=a.length;if(t&&o===0)return r;if(!t||s.length!==o)return i(a),r;for(let l=0;l<o;l++)if(!n.equals(s[l],a[l]))return i(a),r;return r}};function Ea(n){if(!n.every(t=>typeof t=="number"||typeof t=="string"||typeof t=="boolean"))throw Error("Arguments to memoized function can only be strings or numbers");return JSON.stringify(n)}const La=jf(Uf.getTimezoneOffset),Vf=(n,e)=>new Date(e).getTimezoneOffset()*60*1e3+La(n,e);class Gf{constructor(e){this.config=e,this.timeZoneChangedSubject=new zf,this.currentTzOffset=t=>this.getOffset(this.config.timezone,t),this.formatterCache={},this.getOffset=(t,r)=>Vf(t,r),this.dateTimeFormatterFactory=this.initFormatterFactory(this.config.dateFormatter)}setTimeZone(e){this.config.timezone=e,this.formatterCache={},this.timeZoneChangedSubject.next(e)}observeTimeZoneChanged(){return this.timeZoneChangedSubject.asObservable()}initFormatterFactory(e){let t;if(e&&typeof e=="function")t=e;else if(e&&e.createFormatterFunction&&typeof e.createFormatterFunction=="function"){const r=e.createFormatterFunction;t=s=>r(s).bind(e)}else t=Dh(this.config,this.tzOffset);return t}getFormatterFactory(){return this.dateTimeFormatterFactory}getDateTimeFormatter(e){return this.formatterCache[e]===void 0&&(this.formatterCache[e]=this.dateTimeFormatterFactory(e)),this.formatterCache[e]}tzOffset(e){const t=s=>-new Date(s).getTimezoneOffset()*$f;let r;return e?r=s=>La(e,s):r=t,s=>new Date(+s+r(s)-t(s))}}const $f=60*1e3;class Zt{constructor(e,t={}){this.components=[],this.chartComponents=[],this.userInputListenerComponents=[],this.canvasModels=[];var r,s;this.parentElement=e;const i=t;Uo(i),this.config=i;const a=dl(i);e.innerHTML="",e.appendChild(a.content),this.id=(r=e.getAttribute("data-id"))!=null?r:"",i.fixedSize&&(e.style.width=i.fixedSize.width+"px",e.style.height=i.fixedSize.height+"px");const o=new Gf(i);this.timeZoneModel=o;const l=this.timeZoneModel.getFormatterFactory(),c=ul(e);this.elements=c;const h=new uf;this.bus=h;const v=new vf(e,(s=c.chartResizer)!=null?s:e,h,this.canvasModels,i);this.chartResizeHandler=v,v.subscribeResize(),this.components.push(v.unsubscribeAnimationUpdate.bind(v));const p=new Gc(h,v);this.drawingManager=p;const y=jc(h,c.mainCanvas,c.chartResizer,this.config.components.chart.type,this.config,p,this.canvasModels);this.mainCanvasModel=y;const E=wt(h,c.overDataSeriesCanvas,i,p,this.canvasModels,c.chartResizer);this.overSeriesCanvasModel=E;const R=new Lt(E);p.addDrawer(R,"OVER_SERIES_CLEAR"),this.dataSeriesCanvasModel=wt(h,c.dataSeriesCanvas,i,p,this.canvasModels,c.chartResizer);const N=new Lt(this.dataSeriesCanvasModel);p.addDrawer(N,"SERIES_CLEAR");const k=wt(h,c.yAxisLabelsCanvas,i,p,this.canvasModels,c.chartResizer),U=new Xn(i,h,y,l,v);this.canvasBoundsContainer=U;const Z=c.mainCanvas.parentElement;if(Z===null)throw new Error("Couldn't get main canvas parent");const K=new xn(h,Z);this.canvasInputListener=K,this.chartComponents.push(this.canvasInputListener);const q=new Nh(h,c.hitTestCanvas,K,U,p,i,this.canvasModels,c.chartResizer);this.hitTestCanvasModel=q;const $=new Lt(q);p.addDrawer($,"HIT_TEST_CLEAR");const J=new Co(h);this.canvasAnimation=J;const ne=new ei(i,()=>U.getBounds(Y.CHART),J);this.scaleModel=ne;const oe=wt(h,c.backgroundCanvas,i,p,this.canvasModels,c.chartResizer,{willReadFrequently:!0});this.backgroundCanvasModel=oe,this.cursorHandler=new ll(c.canvasArea,K,U,q),this.chartComponents.push(this.cursorHandler),this.crossEventProducer=new _f(K,U),this.chartComponents.push(this.crossEventProducer);const le=new Yl("candle"),re=new wd(h,ne,U,i,J,K,Z,le);this.chartPanComponent=re,this.chartComponents.push(re),this.userInputListenerComponents.push(re.chartAreaPanHandler);const ce=new Yd(le,this.userInputListenerComponents,h,ne,U,i,J,K,p,this.dataSeriesCanvasModel,this.cursorHandler,this.crossEventProducer,re,y);this.paneManager=ce,this.chartComponents.push(ce),this.chartModel=new ph(le,ce,h,this.dataSeriesCanvasModel,i,ne,l,Z,U,v);const fe=new rh(this.chartModel,this.dataSeriesCanvasModel,i,ne,U,p,q,K,oe,re,ce,this.cursorHandler);this.chartComponents.push(fe),this.chartComponent=fe;const de=this.chartComponent.chartModel;this.chartModel=de,this.canvasBoundsContainer.setMainCandleSeries(this.chartModel.mainCandleSeries),q.addSubscriber(ce.hitTestController),this.xAxisComponent=new Nu(h,i,y,fe,ne,U,K,v,this.drawingManager,o,re,this.cursorHandler,oe),this.chartComponents.push(this.xAxisComponent),this.userInputListenerComponents.push(this.xAxisComponent.xAxisScaleHandler);const ue=new Lt(y);p.addDrawer(ue,"MAIN_CLEAR");const pe=new ff(Z,de,K,i);this.chartComponents.push(pe),this.watermarkComponent=new eu(ce,de,h,i,U,E,p),this.chartComponents.push(this.watermarkComponent);const me=wt(h,c.crossToolCanvas,i,p,this.canvasModels,c.chartResizer);this.highlightsComponent=new sd(h,i,de,y,U,p),this.chartComponents.push(this.highlightsComponent),i.useUTCTimeOverride&&i.dateFormatter&&!i.dateFormatter.utcTimeOverride&&(i.dateFormatter.utcTimeOverride=this.createUTCTimeOverrideConfig(de)),this.navigationMapComponent=new fd(h,de,y,i,K,U,p,l,re,this.cursorHandler),this.chartComponents.push(this.navigationMapComponent),this.userInputListenerComponents.push(this.navigationMapComponent.navigationMapMoveHandler);const Fe=new qh(i,this.dataSeriesCanvasModel,de,U,p);this.chartComponents.push(Fe),this.yAxisComponent=new df(h,i,y,k,oe,de,ne,this.canvasInputListener,U,this.drawingManager,re,ce,this.cursorHandler),this.chartComponents.push(this.yAxisComponent),this.userInputListenerComponents.push(this.yAxisComponent.yAxisScaleHandler),this.volumesComponent=new $d(this.dataSeriesCanvasModel,fe,ne,U,p,i,ce,this.yAxisComponent),this.chartComponents.push(this.volumesComponent);const Ye=new Ri(y,ne,i,"GRID",p,()=>this.canvasBoundsContainer.getBounds(Y.ALL_PANES),()=>this.canvasBoundsContainer.getBounds(Y.PANE_UUID(ae)),()=>this.xAxisComponent.xAxisLabelsGenerator.labels,()=>this.yAxisComponent.yAxisModel.yAxisBaseLabelsModel.labels,()=>this.chartModel.toY(this.chartModel.getBaseLine()),()=>i.components.grid.visible);this.chartComponents.push(Ye),this.hoverProducer=new Ff(this.crossEventProducer,ne,i,de,K,this.canvasBoundsContainer,this.paneManager,o,l),this.chartComponents.push(this.hoverProducer),this.crossToolComponent=new _h(i,me,U,p,ce,this.crossEventProducer,this.hoverProducer),this.chartComponents.push(this.crossToolComponent);const He=wt(h,c.snapshotCanvas,i,p,this.canvasModels,c.chartResizer),ft=new Hd(this.elements,He);this.snapshotComponent=ft,this.chartComponents.push(ft);const Mn=new $h(i,E,q,de,U,p,l,this.cursorHandler,oe);this.eventsComponent=Mn,this.chartComponents.push(Mn),this.chartComponents.forEach(nv=>nv.activate()),this.enableUserControls(),p.reorderDrawers(i.drawingOrder),this.clearer=So(this.components)}createUTCTimeOverrideConfig(e){const t=new RegExp("HH|H|mm|m|s|ss|sss|SSS");return{pattern:"MM/dd/YY",test:r=>t.test(r)&&(e.getPeriod()||0)>=86400}}static mergeConfig(e,t){for(const r in t)r in e?typeof e[r]=="object"&&Zt.mergeConfig(e[r],t[r]):e[r]=t[r];return e}getConfig(){return this.config}setRtl(e){this.config.rtl=e,this.bus.fire(Xt)}setChartType(e){this.chartComponent.setChartType(e)}disableUserControls(){this.userInputListenerComponents.forEach(e=>e.deactivate()),this.hitTestCanvasModel.disableUserControls()}enableUserControls(){this.userInputListenerComponents.forEach(e=>e.activate()),this.hitTestCanvasModel.enableUserControls()}setGridConfig(e){var t,r,s,i,a;const o=this.config.components.grid;o.visible=(t=e.visible)!=null?t:!1,o.dash=(r=e.dash)!=null?r:[0,0],o.width=(s=e.width)!=null?s:1,o.color=(i=e.color)!=null?i:"#FFFFFF",this.config.colors.chartAreaTheme.gridColor=(a=e.color)!=null?a:"#FFFFFF",this.redraw()}setGridVisible(e){this.config.components&&this.config.components.grid&&(this.config.components.grid.visible=e,this.redraw())}setGridVertical(e){this.config.components.grid.vertical=e,this.redraw()}setGridHorizontal(e){this.config.components.grid.horizontal=e,this.redraw()}deactivate(){this.clearer(),this.disableUserControls(),this.chartComponents.forEach(e=>e.deactivate())}redraw(){this.bus.fireDraw()}getOffsets(){return this.config.components&&this.config.components.offsets}showSeparateVolumes(e=!1){this.volumesComponent&&(this.volumesComponent.setShowVolumesSeparatly(e),this.canvasBoundsContainer.updateYAxisWidths())}setAutoScale(e=!0){this.scaleModel.autoScale(e)}setShowCandleBorders(e=!0){this.config.components&&this.config.components.chart&&(this.config.components.chart.showCandlesBorder=e,this.redraw())}valueToY(e){return this.chartModel.toY(e)}setHighLowVisible(e=!0){this.config.components&&this.config.components.highLow&&(this.config.components.highLow.visible=e,this.redraw())}setCrossToolVisible(e="cross-and-labels"){this.config.components&&this.config.components.crossTool&&(this.config.components.crossTool.type=e,this.redraw())}setHighlightsVisible(e=!0){var t;(t=this.config.components)!=null&&t.highlights&&(this.config.components.highlights.visible=e,this.redraw())}setHighlightsData(e){this.highlightsComponent.setHighlights(e)}setColors(e){Ge(this.config.colors,e,{addIfMissing:!0,overrideExisting:!0}),this.redraw()}addMouseMoveOnChartElementHandler(e,t){const r=this.canvasBoundsContainer.getBoundsHitTest(e),s=this.canvasInputListener.observeMouseMove(r).subscribe(t);return()=>s.unsubscribe()}addMouseEnterOnChartElementHandler(e,t,r=!1){const s=this.canvasBoundsContainer.getBoundsHitTest(e),i=this.canvasInputListener.observeMouseEnter(s,r).subscribe(t);return()=>i.unsubscribe()}addClickOnChartElementHandler(e,t){const r=this.canvasBoundsContainer.getBoundsHitTest(e),s=this.canvasInputListener.observeClick(r).subscribe(t);return()=>s.unsubscribe()}addDragEventsListener(e,t){const r=this.canvasBoundsContainer.getBoundsHitTest(e),s=Me(this.canvasInputListener.observeYDrag(r),this.canvasInputListener.observeXDrag(r)).subscribe(t);return()=>s.unsubscribe()}destroy(){this.bus.setMuted(!0),this.chartComponents.forEach(e=>e.disable()),this.parentElement.childNodes.forEach(e=>e.remove()),this.parentElement.style.width="",this.parentElement.style.height=""}registerComponent(e,t){const r=e(this);this.components.push(r),t&&t(r),r.activate()}registerPaneFormatters(e,t){var r;(r=this.paneManager.paneComponents[e])==null||r.setPaneValueFormatters(t)}}var Zf=Object.defineProperty,Kf=Object.defineProperties,qf=Object.getOwnPropertyDescriptors,Ia=Object.getOwnPropertySymbols,Jf=Object.prototype.hasOwnProperty,Qf=Object.prototype.propertyIsEnumerable,Oa=(n,e,t)=>e in n?Zf(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,ev=(n,e)=>{for(var t in e||(e={}))Jf.call(e,t)&&Oa(n,t,e[t]);if(Ia)for(var t of Ia(e))Qf.call(e,t)&&Oa(n,t,e[t]);return n},tv=(n,e)=>Kf(n,qf(e));const Ba=(n,e={})=>new Zt(n,e);window.DXChart=tv(ev({},window.DXChart),{ChartBootstrap:Zt,createChart:Ba})})(),rv=Pn})();})();
|