From 20afbf605822281816218aa43fccef006d23a680 Mon Sep 17 00:00:00 2001 From: jenkins Date: Wed, 17 Apr 2024 14:38:38 +0000 Subject: [PATCH] Release v27.004 (from 1ca8700b) --- changelog.md | 36 +- ...rt-bottom-toolbar.4d02fadc540256bf733e.js} | 4 +- ...de4.js => library.f0eab6b94b0505cb64c2.js} | 466 +++++++++--------- ...a94.js => runtime.c40b52a0e272d23ced6d.js} | 2 +- ...s => study-market.6dd3b88a86eba6172f5c.js} | 24 +- charting_library/charting_library.cjs.js | 2 +- charting_library/charting_library.d.ts | 173 +++++-- charting_library/charting_library.esm.js | 2 +- charting_library/charting_library.js | 2 +- .../charting_library.standalone.js | 2 +- charting_library/datafeed-api.d.ts | 22 +- charting_library/package.json | 2 +- package.json | 2 +- 13 files changed, 425 insertions(+), 314 deletions(-) rename charting_library/bundles/{chart-bottom-toolbar.90c0a4f4e79f0973fd8f.js => chart-bottom-toolbar.4d02fadc540256bf733e.js} (99%) rename charting_library/bundles/{library.73b161994e130a790de4.js => library.f0eab6b94b0505cb64c2.js} (77%) rename charting_library/bundles/{runtime.13083b9d6b700c731a94.js => runtime.c40b52a0e272d23ced6d.js} (98%) rename charting_library/bundles/{study-market.b04732ea1491ac587015.js => study-market.6dd3b88a86eba6172f5c.js} (50%) diff --git a/changelog.md b/changelog.md index a35dd7a0..199ece22 100644 --- a/changelog.md +++ b/changelog.md @@ -5,6 +5,37 @@ +## Version 27.004 + +*Date: Wed Apr 17 2024* + +**Breaking Changes** + +- **Fixed time parameters in CrossHairMovedEventParams.** In version 26.001, we changed the `time` property of [`CrossHairMovedEventParams`](https://www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.CrossHairMovedEventParams) to be a timestamp in the selected time zone. +In this version, we reverted that change, and `time` represents a UTC timestamp again. Additionally, we introduced a new [`userTime`](https://www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.CrossHairMovedEventParams#usertime) property that represents a timestamp in the selected time zone. + +**Improvements** + +- **Added ability to disable pulse animation when chart type is set to Line.** New _disable_pulse_animation_ featureset allows users to disable the pulse animation when chart type is set to Line. + +**Bug Fixes** + +- **Fixed the price scale placement.** The [price scale](https://www.tradingview.com/charting-library-docs/latest/ui_elements/Price-Scale) should be placed back to its original position when a change made through the _Settings_ dialog is canceled. Fixes [#4991](https://github.com/tradingview/charting_library/issues/4991) +- **Fixed the 52 Week High/Low indicator issue.** The 52 Week High/Low indicator no longer adds an empty space to the price scale when less than 52 weeks of historic bars are available. Fixes [#8137](https://github.com/tradingview/charting_library/issues/8137) [#8469](https://github.com/tradingview/charting_library/issues/8469) +- **Only calculate VWAP value when entire anchor period is loaded.** The VWAP indicator will only calculate values for the input anchor period if all bars in that period have been loaded. +- **Fixed a trailing stop modification dialog error.** Fixed a problem where opening the Order Ticket for a trailing stop position caused a "ReferenceError: isPositionLikeItem is not defined" error to be thrown. +- **Fixed the incorrect point position for the Long Position drawing.** The `getPositionPoints()` method will now return correct point positions. Fixes [#8230](https://github.com/tradingview/charting_library/issues/8230) +- **`BREAKING CHANGE` Position line price label does not use the correct price formatter.** The price scale will now correctly reflect the value when a formatter is used with [`createPositionLine`](https://www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.IChartWidgetApi#createpositionline). +Both [`createOrderLine`](https://www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.IChartWidgetApi#createorderline) and [`createPositionLine`](https://www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.IChartWidgetApi#createpositionline) methods behave similarly to the corresponding actions made in the UI via [Order Ticket](https://www.tradingview.com/charting-library-docs/latest/trading_terminal/order-ticket). +Fixes [#8413](https://github.com/tradingview/charting_library/issues/8413) [#8324](https://github.com/tradingview/charting_library/issues/8324) + +**Documentation** + +- **New User accounts article.** Refer to [User accounts](https://www.tradingview.com/charting-library-docs/latest/trading_terminal/account-manager/user-accounts) for information on how to manage user accounts in the [Account Manager](https://www.tradingview.com/charting-library-docs/latest/trading_terminal/account-manager). +- **Session documentation updates.** The [Symbology](https://www.tradingview.com/charting-library-docs/latest/connecting_data/Symbology#session) and [Extended sessions](https://www.tradingview.com/charting-library-docs/latest/connecting_data/Extended-Sessions) articles now include more information on how to specify sessions and corrections for them. +- **New Save user settings article.** Refer to the [Save user settings](https://www.tradingview.com/charting-library-docs/latest/saving_loading/user-settings) article for information on how to store user settings. +- **Updated Watchlist article.** Explore our latest [Watchlist](https://www.tradingview.com/charting-library-docs/latest/trading_terminal/Watch-List) article that describes how to customize and handle the watchlist's data. + ## Version 27.003 *Date: Thu Mar 14 2024* @@ -15,6 +46,7 @@ - **Added the unloadUnusedCharts method.** The [`unloadUnusedCharts`](https://www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.IChartingLibraryWidget#unloadunusedcharts) method deletes non-visible charts from a multiple-chart layout. Use this method to prevent the library's inherent behavior to restore previously displayed charts instead of creating new charts when changing layouts. `Trading Platform Only` +- **Added a new type that reflects the ID of the created indicator.** A new [`study_event`](../api/interfaces/Charting_Library.SubscribeEventsMap.md#study_event) type was added: `create`. It returns the `id` of the newly created indicator. **Bug Fixes** @@ -601,7 +633,3 @@ Please use [settings_adapter](https://www.tradingview.com/charting-library-docs/ - Type of `formatter` field in [column description](../api/interfaces/Broker.AccountManagerColumnBase#formatter) has been changed to [StandardFormatterName | FormatterName](../api/enums/Charting_Library.StandardFormatterName). - `property` field has been removed from `column description`. Use [dataFields](../api/interfaces/Broker.AccountManagerColumnBase#datafields) field instead. - Type of `formatter` field in [SummaryField](../api/interfaces/Broker.AccountManagerSummaryField) has been changed to [StandardFormatterName](../api/enums/Charting_Library.StandardFormatterName). - -## Older Versions - -For breaking changes on older versions of the library please consult this page: [Breaking Changes](https://github.com/tradingview/charting_library/wiki/Breaking-Changes) diff --git a/charting_library/bundles/chart-bottom-toolbar.90c0a4f4e79f0973fd8f.js b/charting_library/bundles/chart-bottom-toolbar.4d02fadc540256bf733e.js similarity index 99% rename from charting_library/bundles/chart-bottom-toolbar.90c0a4f4e79f0973fd8f.js rename to charting_library/bundles/chart-bottom-toolbar.4d02fadc540256bf733e.js index 89aed3cf..2e7049dc 100644 --- a/charting_library/bundles/chart-bottom-toolbar.90c0a4f4e79f0973fd8f.js +++ b/charting_library/bundles/chart-bottom-toolbar.4d02fadc540256bf733e.js @@ -1,11 +1,11 @@ (self.webpackChunktradingview=self.webpackChunktradingview||[]).push([[7260],{59142:function(e,t){var s,r,a;r=[t],s=function(e){"use strict";function t(e){if(Array.isArray(e)){for(var t=0,s=Array(e.length);t{e.exports={loader:"loader-UL6iwcBa",static:"static-UL6iwcBa",item:"item-UL6iwcBa","tv-button-loader":"tv-button-loader-UL6iwcBa",medium:"medium-UL6iwcBa",small:"small-UL6iwcBa",black:"black-UL6iwcBa", white:"white-UL6iwcBa",gray:"gray-UL6iwcBa",primary:"primary-UL6iwcBa"}},22436:e=>{e.exports={item:"item-GJX1EXhk",interactive:"interactive-GJX1EXhk",hovered:"hovered-GJX1EXhk",disabled:"disabled-GJX1EXhk",active:"active-GJX1EXhk",shortcut:"shortcut-GJX1EXhk",normal:"normal-GJX1EXhk",big:"big-GJX1EXhk",iconCell:"iconCell-GJX1EXhk",icon:"icon-GJX1EXhk",checkmark:"checkmark-GJX1EXhk",content:"content-GJX1EXhk",label:"label-GJX1EXhk",checked:"checked-GJX1EXhk",toolbox:"toolbox-GJX1EXhk",showToolboxOnHover:"showToolboxOnHover-GJX1EXhk",arrowIcon:"arrowIcon-GJX1EXhk",subMenu:"subMenu-GJX1EXhk",invisibleHotkey:"invisibleHotkey-GJX1EXhk"}},29122:e=>{e.exports={item:"item-WJDah4zD",emptyIcons:"emptyIcons-WJDah4zD",loading:"loading-WJDah4zD",disabled:"disabled-WJDah4zD",interactive:"interactive-WJDah4zD",hovered:"hovered-WJDah4zD",normal:"normal-WJDah4zD",big:"big-WJDah4zD",icon:"icon-WJDah4zD",label:"label-WJDah4zD",title:"title-WJDah4zD",nested:"nested-WJDah4zD",shortcut:"shortcut-WJDah4zD",remove:"remove-WJDah4zD"}},45719:e=>{e.exports={separator:"separator-Pf4rIzEt"}},92910:e=>{e.exports={separator:"separator-QjUlCDId",small:"small-QjUlCDId",normal:"normal-QjUlCDId",large:"large-QjUlCDId"}},4618:e=>{e.exports={tabs:"tabs-NGf0gcnH",tab:"tab-NGf0gcnH",noBorder:"noBorder-NGf0gcnH",disabled:"disabled-NGf0gcnH",active:"active-NGf0gcnH",defaultCursor:"defaultCursor-NGf0gcnH",slider:"slider-NGf0gcnH",content:"content-NGf0gcnH"}},26996:(e,t,s)=>{"use strict";s.d(t,{Loader:()=>o});var r=s(50959),a=s(97754),n=s(25650),i=s.n(n);function o(e){const{className:t,size:s="medium",staticPosition:n,color:o="black"}=e,l=a(i().item,i()[o],i()[s]);return r.createElement("span",{className:a(i().loader,n&&i().static,t)},r.createElement("span",{className:l}),r.createElement("span",{className:l}),r.createElement("span",{className:l}))}},47201:(e,t,s)=>{"use strict";function r(...e){return t=>{for(const s of e)void 0!==s&&s(t)}}s.d(t,{createSafeMulticastEventHandler:()=>r})},42142:(e,t,s)=>{"use strict";s.d(t,{FragmentMap:()=>a});var r=s(50959);function a(e){if(e.map){return r.Children.toArray(e.children).map(e.map)}return e.children}},99025:(e,t,s)=>{"use strict";s.d(t,{Hint:()=>o});var r=s(50959),a=s(97754),n=s.n(a),i=s(22436);function o(e){const{text:t="",className:s}=e;return r.createElement("span",{className:n()(i.shortcut,s)},t)}},23829:(e,t,s)=>{"use strict";s.d(t,{ContextMenuItem:()=>p});var r=s(50959),a=s(97754),n=s.n(a),i=s(9745),o=s(26996),l=s(54627),c=s(99025),d=s(39750),u=s(79978),h=s(69311),m=s(29122);function p(e){const{className:t,isTitle:s,isLoading:a,isHovered:p,active:g,checkable:v,disabled:_,checked:b,icon:f,iconChecked:y,hint:S,subItems:E,label:k,styledLabel:C,onClick:x,children:T,toolbox:w,jsxLabel:M,size:A="normal"}=e,z=(0,r.useContext)(l.EmptyIconsContext),I=!!E.length;return a?r.createElement("li",{className:n()(t,m.item,m.loading,m[A])},r.createElement(o.Loader,null)):r.createElement("li",{className:n()(t,m.item,m.interactive,s&&m.title,_&&m.disabled,p&&m.hovered,g&&m.active,z&&m.emptyIcons,m[A]),onClick:x },r.createElement(i.Icon,{className:n()(m.icon),icon:function(){if(v&&b)return y||f||d;return f}()}),r.createElement("span",{className:n()(m.label)},!M&&C?C.map((({text:e,...t},s)=>r.createElement("span",{key:s,style:t},e))):null!=M?M:k),!!w&&r.createElement(i.Icon,{onClick:function(){w&&w.action()},className:m.remove,icon:h}),!I&&S&&r.createElement(c.Hint,{className:m.shortcut,text:S}),I&&r.createElement(i.Icon,{className:m.nested,icon:u}),T)}},54627:(e,t,s)=>{"use strict";s.d(t,{EmptyIconsContext:()=>r});const r=s(50959).createContext(!1)},1109:(e,t,s)=>{"use strict";s.d(t,{Separator:()=>i});var r=s(50959),a=s(97754),n=s(45719);function i(e){return r.createElement("div",{className:a(n.separator,e.className)})}},51613:(e,t,s)=>{"use strict";s.d(t,{PopupMenuSeparator:()=>o});var r=s(50959),a=s(97754),n=s.n(a),i=s(92910);function o(e){const{size:t="normal",className:s,ariaHidden:a=!1}=e;return r.createElement("div",{className:n()(i.separator,"small"===t&&i.small,"normal"===t&&i.normal,"large"===t&&i.large,s),role:"separator","aria-hidden":a})}},40173:(e,t,s)=>{"use strict";function r(e,t,s={}){return Object.assign({},e,function(e,t,s={}){const r=Object.assign({},t);for(const a of Object.keys(t)){const n=s[a]||a;n in e&&(r[a]=[e[n],t[a]].join(" "))}return r}(e,t,s))}s.d(t,{mergeThemes:()=>r})},6132:(e,t,s)=>{"use strict";var r=s(22134);function a(){}function n(){}n.resetWarningCache=a,e.exports=function(){function e(e,t,s,a,n,i){if(i!==r){var o=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw o.name="Invariant Violation",o}}function t(){return e}e.isRequired=e;var s={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:n,resetWarningCache:a};return s.PropTypes=s,s}},19036:(e,t,s)=>{e.exports=s(6132)()},22134:e=>{"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},47102:e=>{e.exports={accessible:"accessible-NQERJsv9",active:"active-NQERJsv9"}},44242:e=>{e.exports={title:"title-u3QJgF_p"}},64264:e=>{e.exports={toolbar:"toolbar-BXXUwft2",dateRangeWrapper:"dateRangeWrapper-BXXUwft2",seriesControlWrapper:"seriesControlWrapper-BXXUwft2",dateRangeExpanded:"dateRangeExpanded-BXXUwft2",dateRangeCollapsed:"dateRangeCollapsed-BXXUwft2",item:"item-BXXUwft2",last:"last-BXXUwft2",inline:"inline-BXXUwft2",dateRange:"dateRange-BXXUwft2",hidden:"hidden-BXXUwft2",collapsed:"collapsed-BXXUwft2"}},7458:e=>{e.exports={button:"button-Hfju7pW_"}},50242:e=>{e.exports={button:"button-uToIfRbZ"}},56812:e=>{e.exports={separator:"separator-yDfG9Ccu"}},97086:e=>{e.exports={headerMenuText:"headerMenuText-AcJrLng7"}},85616:e=>{e.exports={button:"button-x1dCOTP3",disabled:"disabled-x1dCOTP3",hover:"hover-x1dCOTP3",clicked:"clicked-x1dCOTP3",accessible:"accessible-x1dCOTP3"}},91348:e=>{e.exports={item:"item-SqYYy1zF"}},22586:e=>{e.exports={slider:"slider-3kCW6DWs", -inner:"inner-3kCW6DWs"}},21648:e=>{e.exports={sliderRow:"sliderRow-k2h4OAz8"}},36898:(e,t,s)=>{"use strict";s.d(t,{useMouseClickAutoBlur:()=>i});var r=s(50959),a=s(76460),n=s(16838);function i(e,t=!0){(0,r.useEffect)((()=>{if(!n.PLATFORM_ACCESSIBILITY_ENABLED||!t)return;const s=t=>{const s=e.current;null!==s&&document.activeElement instanceof HTMLElement&&((0,a.isKeyboardClick)(t)||s.contains(document.activeElement)&&"INPUT"!==document.activeElement.tagName&&document.activeElement.blur())};return window.addEventListener("click",s,!0),()=>window.removeEventListener("click",s,!0)}),[t])}},81351:(e,t,s)=>{"use strict";s.d(t,{AccessibleMenuItem:()=>u});var r=s(50959),a=s(97754),n=s.n(a),i=s(3343),o=s(50238),l=s(16838),c=s(16396),d=s(47102);function u(e){const{className:t,...s}=e,[a,u]=(0,o.useRovingTabindexElement)(null);return r.createElement(c.PopupMenuItem,{...s,className:n()(l.PLATFORM_ACCESSIBILITY_ENABLED&&d.accessible,e.isActive&&d.active,t),reference:a,tabIndex:u,onKeyDown:function(e){if(!l.PLATFORM_ACCESSIBILITY_ENABLED||e.target!==e.currentTarget)return;const t=(0,i.hashFromEvent)(e);13!==t&&32!==t||(e.preventDefault(),a.current instanceof HTMLElement&&a.current.click())},"data-role":l.PLATFORM_ACCESSIBILITY_ENABLED?"menuitem":void 0,"aria-disabled":l.PLATFORM_ACCESSIBILITY_ENABLED&&e.isDisabled||void 0})}},82962:(e,t,s)=>{"use strict";s.d(t,{ToolWidgetMenuSummary:()=>i});var r=s(50959),a=s(97754),n=s(44242);function i(e){return r.createElement("div",{className:a(e.className,n.title)},e.children)}},88066:(e,t,s)=>{"use strict";s.d(t,{DEFAULT_TOOLBAR_BUTTON_THEME:()=>o,ToolbarButton:()=>l});var r=s(50959),a=s(31409),n=s(50238),i=s(16838);const o=a.DEFAULT_TOOL_WIDGET_BUTTON_THEME,l=(0,r.forwardRef)((function(e,t){const{tooltip:s,...o}=e,[l,c]=(0,n.useRovingTabindexElement)(t);return r.createElement(a.ToolWidgetButton,{"aria-label":i.PLATFORM_ACCESSIBILITY_ENABLED?s:void 0,...o,tag:i.PLATFORM_ACCESSIBILITY_ENABLED?"button":"div",ref:l,tabIndex:c,"data-tooltip":s})}))},48889:(e,t,s)=>{"use strict";s.d(t,{ToolbarIconButton:()=>o});var r=s(50959),a=s(50238),n=s(16838),i=s(50813);const o=(0,r.forwardRef)((function(e,t){const{tooltip:s,...o}=e,[l,c]=(0,a.useRovingTabindexElement)(t);return r.createElement(i.ToolWidgetIconButton,{"aria-label":n.PLATFORM_ACCESSIBILITY_ENABLED?s:void 0,...o,tag:n.PLATFORM_ACCESSIBILITY_ENABLED?"button":"div",ref:l,tabIndex:c,"data-tooltip":s})}))},50298:(e,t,s)=>{"use strict";s.d(t,{ToolbarMenuButton:()=>d});var r=s(50959),a=s(39416),n=s(8087),i=s(50238),o=s(16838),l=s(36898),c=s(81261);const d=(0,r.forwardRef)((function(e,t){const{tooltip:s,menuReference:d=null,...u}=e,[h,m]=(0,i.useRovingTabindexElement)(null),p=(0,a.useFunctionalRefObject)(d);return(0,l.useMouseClickAutoBlur)(p),r.createElement(n.ToolWidgetMenu,{"aria-label":o.PLATFORM_ACCESSIBILITY_ENABLED?s:void 0,...u,ref:t,tag:o.PLATFORM_ACCESSIBILITY_ENABLED?"button":"div",reference:h,tabIndex:m,"data-tooltip":s,menuReference:p,onMenuKeyDown:c.handleAccessibleMenuKeyDown,onMenuFocus:e=>(0,c.handleAccessibleMenuFocus)(e,h)})}))}, +inner:"inner-3kCW6DWs"}},31071:e=>{e.exports={sliderRow:"sliderRow-k2h4OAz8"}},36898:(e,t,s)=>{"use strict";s.d(t,{useMouseClickAutoBlur:()=>i});var r=s(50959),a=s(76460),n=s(16838);function i(e,t=!0){(0,r.useEffect)((()=>{if(!n.PLATFORM_ACCESSIBILITY_ENABLED||!t)return;const s=t=>{const s=e.current;null!==s&&document.activeElement instanceof HTMLElement&&((0,a.isKeyboardClick)(t)||s.contains(document.activeElement)&&"INPUT"!==document.activeElement.tagName&&document.activeElement.blur())};return window.addEventListener("click",s,!0),()=>window.removeEventListener("click",s,!0)}),[t])}},81351:(e,t,s)=>{"use strict";s.d(t,{AccessibleMenuItem:()=>u});var r=s(50959),a=s(97754),n=s.n(a),i=s(3343),o=s(50238),l=s(16838),c=s(16396),d=s(47102);function u(e){const{className:t,...s}=e,[a,u]=(0,o.useRovingTabindexElement)(null);return r.createElement(c.PopupMenuItem,{...s,className:n()(l.PLATFORM_ACCESSIBILITY_ENABLED&&d.accessible,e.isActive&&d.active,t),reference:a,tabIndex:u,onKeyDown:function(e){if(!l.PLATFORM_ACCESSIBILITY_ENABLED||e.target!==e.currentTarget)return;const t=(0,i.hashFromEvent)(e);13!==t&&32!==t||(e.preventDefault(),a.current instanceof HTMLElement&&a.current.click())},"data-role":l.PLATFORM_ACCESSIBILITY_ENABLED?"menuitem":void 0,"aria-disabled":l.PLATFORM_ACCESSIBILITY_ENABLED&&e.isDisabled||void 0})}},82962:(e,t,s)=>{"use strict";s.d(t,{ToolWidgetMenuSummary:()=>i});var r=s(50959),a=s(97754),n=s(44242);function i(e){return r.createElement("div",{className:a(e.className,n.title)},e.children)}},88066:(e,t,s)=>{"use strict";s.d(t,{DEFAULT_TOOLBAR_BUTTON_THEME:()=>o,ToolbarButton:()=>l});var r=s(50959),a=s(31409),n=s(50238),i=s(16838);const o=a.DEFAULT_TOOL_WIDGET_BUTTON_THEME,l=(0,r.forwardRef)((function(e,t){const{tooltip:s,...o}=e,[l,c]=(0,n.useRovingTabindexElement)(t);return r.createElement(a.ToolWidgetButton,{"aria-label":i.PLATFORM_ACCESSIBILITY_ENABLED?s:void 0,...o,tag:i.PLATFORM_ACCESSIBILITY_ENABLED?"button":"div",ref:l,tabIndex:c,"data-tooltip":s})}))},48889:(e,t,s)=>{"use strict";s.d(t,{ToolbarIconButton:()=>o});var r=s(50959),a=s(50238),n=s(16838),i=s(50813);const o=(0,r.forwardRef)((function(e,t){const{tooltip:s,...o}=e,[l,c]=(0,a.useRovingTabindexElement)(t);return r.createElement(i.ToolWidgetIconButton,{"aria-label":n.PLATFORM_ACCESSIBILITY_ENABLED?s:void 0,...o,tag:n.PLATFORM_ACCESSIBILITY_ENABLED?"button":"div",ref:l,tabIndex:c,"data-tooltip":s})}))},50298:(e,t,s)=>{"use strict";s.d(t,{ToolbarMenuButton:()=>d});var r=s(50959),a=s(39416),n=s(8087),i=s(50238),o=s(16838),l=s(36898),c=s(81261);const d=(0,r.forwardRef)((function(e,t){const{tooltip:s,menuReference:d=null,...u}=e,[h,m]=(0,i.useRovingTabindexElement)(null),p=(0,a.useFunctionalRefObject)(d);return(0,l.useMouseClickAutoBlur)(p),r.createElement(n.ToolWidgetMenu,{"aria-label":o.PLATFORM_ACCESSIBILITY_ENABLED?s:void 0,...u,ref:t,tag:o.PLATFORM_ACCESSIBILITY_ENABLED?"button":"div",reference:h,tabIndex:m,"data-tooltip":s,menuReference:p,onMenuKeyDown:c.handleAccessibleMenuKeyDown,onMenuFocus:e=>(0,c.handleAccessibleMenuFocus)(e,h)})}))}, 54079:(e,t,s)=>{"use strict";s.d(t,{Toolbar:()=>u});var r=s(50959),a=s(50151),n=s(47201),i=s(3343),o=s(16838),l=s(71468),c=s(39416),d=s(36898);const u=(0,r.forwardRef)((function(e,t){const{onKeyDown:s,orientation:u,blurOnEscKeydown:h=!0,blurOnClick:m=!0,...p}=e,g=o.PLATFORM_ACCESSIBILITY_ENABLED?{role:"toolbar","aria-orientation":u}:{},v=(0,c.useFunctionalRefObject)(t);return(0,r.useLayoutEffect)((()=>{if(!o.PLATFORM_ACCESSIBILITY_ENABLED)return;const e=(0,a.ensureNotNull)(v.current),t=()=>{const t=(0,o.queryTabbableElements)(e).sort(o.navigationOrderComparator);if(0===t.length){const[t]=(0,o.queryFocusableElements)(e).sort(o.navigationOrderComparator);if(void 0===t)return;(0,l.becomeMainElement)(t)}if(t.length>1){const[,...e]=t;for(const t of e)(0,l.becomeSecondaryElement)(t)}};return window.addEventListener("keyboard-navigation-activation",t),()=>window.removeEventListener("keyboard-navigation-activation",t)}),[]),(0,d.useMouseClickAutoBlur)(v,m),r.createElement("div",{...p,...g,ref:v,onKeyDown:(0,n.createSafeMulticastEventHandler)((function(e){if(!o.PLATFORM_ACCESSIBILITY_ENABLED)return;if(e.defaultPrevented)return;if(!(document.activeElement instanceof HTMLElement))return;const t=(0,i.hashFromEvent)(e);if(h&&27===t)return e.preventDefault(),void document.activeElement.blur();if("vertical"!==u&&37!==t&&39!==t)return;if("vertical"===u&&38!==t&&40!==t)return;const s=e.currentTarget,r=(0,o.queryFocusableElements)(s).sort(o.navigationOrderComparator);if(0===r.length)return;const a=r.indexOf(document.activeElement);if(-1===a)return;e.preventDefault();const n=()=>{const e=(a+r.length-1)%r.length;(0,l.becomeSecondaryElement)(r[a]),(0,l.becomeMainElement)(r[e]),r[e].focus()},c=()=>{const e=(a+r.length+1)%r.length;(0,l.becomeSecondaryElement)(r[a]),(0,l.becomeMainElement)(r[e]),r[e].focus()};switch((0,o.mapKeyCodeToDirection)(t)){case"inlinePrev":"vertical"!==u&&n();break;case"inlineNext":"vertical"!==u&&c();break;case"blockPrev":"vertical"===u&&n();break;case"blockNext":"vertical"===u&&c()}}),s)})}))},33279:(e,t,s)=>{"use strict";s.r(t),s.d(t,{BottomToolbarRenderer:()=>gt});var r=s(50959),a=s(962),n=s(11542),i=s(19036),o=s(97754),l=s.n(o),c=s(14483),d=s(50298),u=s(12811),h=s(59064),m=s(90692),p=s(81351),g=s(51613),v=s(50151),_=s(51768),b=s(95366),f=s(57898),y=s(36274);const S=e=>n.t(null,{plural:"{str} minutes",count:e,replace:{str:`${e}`}},s(60144)),E=e=>n.t(null,{plural:"{str} hours",count:e,replace:{str:`${e}`}},s(17174)),k=e=>n.t(null,{plural:"{str} months",count:e,replace:{str:`${e}`}},s(28039)),C={1:{resolution:"1",text:S(1)},3:{resolution:"3",text:S(3)},5:{resolution:"5",text:S(5)},15:{resolution:"15",text:S(15)},30:{resolution:"30",text:S(30)},45:{resolution:"45",text:S(45)},60:{resolution:"60",text:E(1)},120:{resolution:"120",text:E(2)},180:{resolution:"180",text:E(3)},240:{resolution:"240",text:E(4)},"1D":{resolution:"1D",text:(w=1,n.t(null,{plural:"{str} days",count:w,replace:{str:`${w}`}},s(74262)))},"1W":{resolution:"1W",text:(T=1,n.t(null,{plural:"{str} weeks",count:T,replace:{str:`${T}`}},s(14074)))},"1M":{ resolution:"1M",text:k(1)},"3M":{resolution:"3M",text:k(3)},"6M":{resolution:"6M",text:k(6)},"12M":{resolution:"12M",text:(x=1,n.t(null,{plural:"{str} years",count:x,replace:{str:`${x}`}},s(8222)))}};var x,T,w;function M(e){const t=function(e){const t=e.value.value,r=y.Interval.parse(t);if(!r.isValid()){if("YTD"===t)return n.t(null,{context:"timeframe_title"},s(87556));if("ALL"===t)return n.t(null,{context:"timeframe_title"},s(74944));if("LASTSESSION"===t)return A(1)}if(r.isMinutes()){const e=r.multiplier();return e%60!=0?(i=e,n.t(null,{plural:"{str} minutes",count:i,replace:{str:`${i}`},context:"timeframe_title"},s(44795))):(a=e/60,n.t(null,{plural:"{str} hours",count:a,replace:{str:`${a}`},context:"timeframe_title"},s(89020)))}var a;var i;if(r.isDays())return A(r.multiplier());if(r.isWeeks())return(e=>n.t(null,{plural:"{str} weeks",count:e,replace:{str:`${e}`},context:"timeframe_title"},s(67518)))(r.multiplier());if(r.isMonths()){const e=r.multiplier();return e%12!=0?(o=e,n.t(null,{plural:"{str} months",count:o,replace:{str:`${o}`},context:"timeframe_title"},s(3189))):(e=>n.t(null,{plural:"{str} years",count:e,replace:{str:`${e}`},context:"timeframe_title"},s(6598)))(e/12)}var o;return e.description||e.text}(e),r=function(e){const t=e.targetResolution,r=y.Interval.parse(t);if(r.isMinutes()){const e=r.multiplier();return e%60!=0?(i=e,n.t(null,{plural:"{str} minutes intervals",count:i,replace:{str:`${i}`},context:"timeframe_title"},s(56347))):(a=e/60,n.t(null,{plural:"{str} hours intervals",count:a,replace:{str:`${a}`},context:"timeframe_title"},s(54028)))}var a;var i;if(r.isDays())return(e=>n.t(null,{plural:"{str} days intervals",count:e,replace:{str:`${e}`},context:"timeframe_title"},s(81693)))(r.multiplier());if(r.isWeeks())return(e=>n.t(null,{plural:"{str} weeks intervals",count:e,replace:{str:`${e}`},context:"timeframe_title"},s(58667)))(r.multiplier());if(r.isMonths()){const e=r.multiplier();return e%12!=0?(o=e,n.t(null,{plural:"{str} months intervals",count:o,replace:{str:`${o}`},context:"timeframe_title"},s(99773))):(e=>n.t(null,{plural:"{str} years intervals",count:e,replace:{str:`${e}`},context:"timeframe_title"},s(57849)))(e/12)}var o;return C[t].text}(e);return n.t(null,{replace:{timePeriod:t,timeInterval:r},context:"timeframe_title"},s(29505))}const A=e=>n.t(null,{plural:"{str} days",count:e,replace:{str:`${e}`},context:"timeframe_title"},s(42908));class z{constructor(e){this._state={ranges:[]},this._change=new f.Delegate,this._rangeChangedListenerBound=this._onRangeChanged.bind(this);const{chartWidget:t}=this._context=e;t.withModel(null,(()=>{const e=t.model(),s=e.mainSeries();s.onStatusChanged().subscribe(this,this._updateAvailableRanges),c.enabled("update_timeframes_set_on_symbol_resolve")&&s.dataEvents().symbolResolved().subscribe(this,this._updateAvailableRanges),s.priceScale().properties().childs().lockScale.subscribe(this,this._updateAvailableRanges);const r=e.model().appliedTimeFrame();r.subscribe(this._rangeChangedListenerBound),this._rangeChangedListenerBound(r.value()), this._updateAvailableRanges()}))}state(){return this._state}onChange(){return this._change}selectRange(e){this._setState({activeRange:e.value.value});const{chartWidgetCollection:t}=this._context,s={val:e.value,res:e.targetResolution};t.setTimeFrame(s)}destroy(){const{chartWidget:e}=this._context;e.withModel(null,(()=>{const t=e.model(),s=t.mainSeries();s.onStatusChanged().unsubscribe(this,this._updateAvailableRanges),c.enabled("update_timeframes_set_on_symbol_resolve")&&s.dataEvents().symbolResolved().unsubscribe(this,this._updateAvailableRanges),s.priceScale().properties().childs().lockScale.unsubscribe(this,this._updateAvailableRanges),t.model().appliedTimeFrame().unsubscribe(this._rangeChangedListenerBound)})),this._change.destroy()}_setState(e){this._state=Object.assign({},this._state,e),this._change.fire(this._state)}_onRangeChanged(e){let t;null!==e&&"period-back"===e.val.type&&(t=e.val.value),this._setState({activeRange:t})}_updateAvailableRanges(){const{availableTimeFrames:e,chartWidget:t}=this._context;if(!t.hasModel())return;const s=t.model().mainSeries(),r=s.status();if(2===r||1===r)return;const a=e(s.symbolInfo(),s.status()).map((e=>({...e,description:""===e.description?M(e):e.description})));0!==a.length&&this._setState({ranges:a})}}const I=(0,b.registryContextType)();function L(e){var t;return(t=class extends r.PureComponent{constructor(e,t){super(e,t),this._handleUpdate=e=>{this.setState(e)},this._handleSelectRange=e=>{var t,s;(0,_.trackEvent)("GUI","Chart Bottom Toolbar",`range ${e.value}`),null===(s=(t=this.props).onSelectRange)||void 0===s||s.call(t,e),this._binding.selectRange(e)},(0,b.validateRegistry)(t,{availableTimeFrames:i.any.isRequired,chartWidgetCollection:i.any.isRequired,chartWidget:i.any.isRequired}),D.has(t.chartWidget)||D.set(t.chartWidget,new z(t));const s=this._binding=(0,v.ensureDefined)(D.get(t.chartWidget));this.state=s.state()}componentDidMount(){this._binding.onChange().subscribe(this,this._handleUpdate)}componentWillUnmount(){this._binding.onChange().unsubscribe(this,this._handleUpdate)}render(){return r.createElement(e,{goToDateButton:this.props.goToDateButton,className:this.props.className,ranges:this.state.ranges,activeRange:this.state.activeRange,onSelectRange:this._handleSelectRange})}}).contextType=I,t}const D=new WeakMap;var B=s(64358),N=s(23829),R=s(1109),W=s(53180),j=s(90752),P=s(7458);function H(e){const{ranges:t,activeRange:s,onSelectRange:a}=e;return r.createElement(r.Fragment,null,t.map((e=>r.createElement(N.ContextMenuItem,{key:e.value.value,label:e.description||e.text,active:s===e.value.value,checked:s===e.value.value,checkable:!0,disabled:!1,onClick:n.bind(null,e),doNotCloseOnClick:!1,subItems:[]}))));function n(e){e&&a&&a(e),(0,h.globalCloseMenu)()}}function U(e){const{onGoToDateClick:t}=e;return r.createElement(r.Fragment,null,r.createElement(R.Separator,{className:P.separator}),r.createElement(N.ContextMenuItem,{icon:j,label:(0,W.appendEllipsis)(n.t(null,void 0,s(369))),onClick:t,active:!1,checked:!1,checkable:!1,disabled:!1,doNotCloseOnClick:!1,subItems:[] -}))}const F={title:n.t(null,void 0,s(60222)),goToDate:(0,W.appendEllipsis)(n.t(null,void 0,s(369)))},O=(0,b.registryContextType)();class Y extends r.PureComponent{constructor(e,t){super(e,t),this._handleGoToDateClick=()=>{const{chartWidget:e}=this.context;(0,B.showGoToDateDialog)(e),(0,h.globalCloseMenu)()},this._handleRangeSelect=e=>{e&&this.props.onSelectRange&&this.props.onSelectRange(e),(0,h.globalCloseMenu)()},this._renderChildren=e=>{const{ranges:t,activeRange:s,goToDateButton:a}=this.props;return e?r.createElement(r.Fragment,null,r.createElement(H,{ranges:t,activeRange:s,onSelectRange:this._handleRangeSelect}),a&&r.createElement(U,{onGoToDateClick:this._handleGoToDateClick})):r.createElement(r.Fragment,null,t.map((e=>r.createElement(p.AccessibleMenuItem,{key:e.value.value,label:e.description||e.text,isActive:s===e.value.value,onClick:this._handleRangeSelect,onClickArg:e}))),a&&r.createElement(g.PopupMenuSeparator,null),a&&r.createElement(p.AccessibleMenuItem,{label:F.goToDate,onClick:this._handleGoToDateClick}))},(0,b.validateRegistry)(t,{chartWidget:i.any.isRequired})}render(){return r.createElement(m.MatchMedia,{rule:"screen and (max-width: 430px)"},(e=>r.createElement(d.ToolbarMenuButton,{className:l()(P.button,this.props.className),content:F.title,arrow:!0,verticalAttachEdge:u.VerticalAttachEdge.Top,verticalDropDirection:u.VerticalDropDirection.FromBottomToTop,horizontalMargin:4,"data-name":"date-ranges-menu",isDrawer:e,onClick:this._trackClick},this._renderChildren(e))))}_trackClick(){0}}Y.contextType=O;const J=L(Y);var X=s(4618);const G=X;function V(e){return class extends r.PureComponent{constructor(){super(...arguments),this.activeTab={current:null}}componentDidUpdate(){(0,v.ensureNotNull)(this._slider).style.transition="transform 350ms",this._componentDidUpdate()}componentDidMount(){this._componentDidUpdate()}render(){const{className:t}=this.props,s=this._generateTabs();return r.createElement("div",{className:o(t,X.tabs),"data-name":this.props["data-name"]},s,r.createElement(e,{reference:e=>{this._slider=e}}))}_generateTabs(){return this.activeTab.current=null,r.Children.map(this.props.children,(e=>{const t=e,s=Boolean(t.props.isActive),a={reference:e=>{s&&(this.activeTab.current=e),t.props.reference&&t.props.reference(e)}};return r.cloneElement(t,a)}))}_componentDidUpdate(){const e=(0,v.ensureNotNull)(this._slider).style;if(this.activeTab.current){const t=this.activeTab.current.offsetWidth,s=this.activeTab.current.offsetLeft;e.transform=`translateX(${s}px)`,e.width=`${t}px`,e.opacity="1"}else e.opacity="0"}}}V((function(e){return r.createElement("div",{className:X.slider,ref:e.reference})}));var q=s(40173),Z=s(88066),$=s(91348);(0,q.mergeThemes)(Z.DEFAULT_TOOLBAR_BUTTON_THEME,$);function K(e){const{reference:t,text:s,tooltip:a,isActive:n,className:i,onClick:l,theme:c=$,...d}=e,u=o(i,c.item,{[c.isActive]:n});return r.createElement(Z.ToolbarButton,{...d,ref:t,text:s,isActive:n,tooltip:a,className:u,onClick:l})}var Q=s(22586);const ee=(0,q.mergeThemes)(G,Q);var te=s(21648);const se=V((function(e){ +}))}const F={title:n.t(null,void 0,s(60222)),goToDate:(0,W.appendEllipsis)(n.t(null,void 0,s(369)))},O=(0,b.registryContextType)();class Y extends r.PureComponent{constructor(e,t){super(e,t),this._handleGoToDateClick=()=>{const{chartWidget:e}=this.context;(0,B.showGoToDateDialog)(e),(0,h.globalCloseMenu)()},this._handleRangeSelect=e=>{e&&this.props.onSelectRange&&this.props.onSelectRange(e),(0,h.globalCloseMenu)()},this._renderChildren=e=>{const{ranges:t,activeRange:s,goToDateButton:a}=this.props;return e?r.createElement(r.Fragment,null,r.createElement(H,{ranges:t,activeRange:s,onSelectRange:this._handleRangeSelect}),a&&r.createElement(U,{onGoToDateClick:this._handleGoToDateClick})):r.createElement(r.Fragment,null,t.map((e=>r.createElement(p.AccessibleMenuItem,{key:e.value.value,label:e.description||e.text,isActive:s===e.value.value,onClick:this._handleRangeSelect,onClickArg:e}))),a&&r.createElement(g.PopupMenuSeparator,null),a&&r.createElement(p.AccessibleMenuItem,{label:F.goToDate,onClick:this._handleGoToDateClick}))},(0,b.validateRegistry)(t,{chartWidget:i.any.isRequired})}render(){return r.createElement(m.MatchMedia,{rule:"screen and (max-width: 430px)"},(e=>r.createElement(d.ToolbarMenuButton,{className:l()(P.button,this.props.className),content:F.title,arrow:!0,verticalAttachEdge:u.VerticalAttachEdge.Top,verticalDropDirection:u.VerticalDropDirection.FromBottomToTop,horizontalMargin:4,"data-name":"date-ranges-menu",isDrawer:e,onClick:this._trackClick},this._renderChildren(e))))}_trackClick(){0}}Y.contextType=O;const J=L(Y);var X=s(4618);const G=X;function V(e){return class extends r.PureComponent{constructor(){super(...arguments),this.activeTab={current:null}}componentDidUpdate(){(0,v.ensureNotNull)(this._slider).style.transition="transform 350ms",this._componentDidUpdate()}componentDidMount(){this._componentDidUpdate()}render(){const{className:t}=this.props,s=this._generateTabs();return r.createElement("div",{className:o(t,X.tabs),"data-name":this.props["data-name"]},s,r.createElement(e,{reference:e=>{this._slider=e}}))}_generateTabs(){return this.activeTab.current=null,r.Children.map(this.props.children,(e=>{const t=e,s=Boolean(t.props.isActive),a={reference:e=>{s&&(this.activeTab.current=e),t.props.reference&&t.props.reference(e)}};return r.cloneElement(t,a)}))}_componentDidUpdate(){const e=(0,v.ensureNotNull)(this._slider).style;if(this.activeTab.current){const t=this.activeTab.current.offsetWidth,s=this.activeTab.current.offsetLeft;e.transform=`translateX(${s}px)`,e.width=`${t}px`,e.opacity="1"}else e.opacity="0"}}}V((function(e){return r.createElement("div",{className:X.slider,ref:e.reference})}));var q=s(40173),Z=s(88066),$=s(91348);(0,q.mergeThemes)(Z.DEFAULT_TOOLBAR_BUTTON_THEME,$);function K(e){const{reference:t,text:s,tooltip:a,isActive:n,className:i,onClick:l,theme:c=$,...d}=e,u=o(i,c.item,{[c.isActive]:n});return r.createElement(Z.ToolbarButton,{...d,ref:t,text:s,isActive:n,tooltip:a,className:u,onClick:l})}var Q=s(22586);const ee=(0,q.mergeThemes)(G,Q);var te=s(31071);const se=V((function(e){ return r.createElement("div",{className:o(e.className,ee.slider),ref:e.reference},r.createElement("div",{className:ee.inner}))}));const re=L((function(e){const{className:t,ranges:s,activeRange:a,onSelectRange:n}=e;return r.createElement(se,{className:o(te.sliderRow,t),"data-name":"date-ranges-tabs"},s.map((e=>r.createElement(K,{key:e.value.value,value:e.value.value,"data-name":`date-range-tab-${e.value.value}`,isActive:a===e.value.value,onClick:n&&n.bind(null,e),text:e.text,tooltip:e.description||e.text}))))}));var ae=s(61814),ne=s(68335),ie=s(48889),oe=s(92574),le=s(50242);const ce=(0,ae.hotKeySerialize)({keys:[(0,ne.humanReadableModifiers)(ne.Modifiers.Alt,!1),"G"],text:"{0} + {1}"}),de=(0,b.registryContextType)();class ue extends r.PureComponent{constructor(e,t){super(e,t),this._handleClick=()=>{const{chartWidget:e}=this.context;(0,_.trackEvent)("GUI","Chart Bottom Toolbar","go to"),(0,B.showGoToDateDialog)(e)},(0,b.validateRegistry)(t,{chartWidget:i.any.isRequired})}render(){const{className:e,ranges:t}=this.props;return t.length>0&&r.createElement(ie.ToolbarIconButton,{icon:oe,onClick:this._handleClick,"data-tooltip-hotkey":ce,tooltip:n.t(null,void 0,s(369)),"data-name":"go-to-date",className:o(le.button,e)})}}ue.contextType=de;const he=L(ue);var me=s(76460),pe=s(88270),ge=s(79206),ve=s(39347),_e=s(41249),be=s(92216),fe=s(16164),ye=s(10643),Se=s(85616);const Ee=(0,q.mergeThemes)(Z.DEFAULT_TOOLBAR_BUTTON_THEME,{isDisabled:Se.disabled,button:Se.button});const ke=(0,b.registryContextType)();class Ce extends r.PureComponent{constructor(e,t){super(e,t),this._timeFormatter=new ge.TimeFormatter((0,be.getHourMinuteSecondFormat)(fe.timeHoursFormatProperty.value())),this._tickInterval=void 0,this._element=null,this._menuShown=!1,this._preventShowingMenu=!1,this._tickClock=()=>{const{chartApiInstance:e}=this.context;if(void 0!==this._timezone){const t=(0,_e.utc_to_cal)(this._timezone,e.serverTime());this.setState({time:this._timeFormatter.format(t)})}},this._getActions=()=>{if(!this.props.withMenu)return[];const{chartWidget:e}=this.context;return function(e){e.updateActions();const t=e.actions();return t&&t.applyTimeZone instanceof ve.Action?t.applyTimeZone.getSubItems():[]}(e)},this._handleRef=e=>{this._element=e},this._onMouseDown=()=>{this._preventShowingMenu=this._menuShown},this._showMenu=e=>{if(this._preventShowingMenu)return void ye.ContextMenuManager.hideAll();const t=(0,v.ensureNotNull)(this._element),s=this._getActions();if(0===s.length)return;const r=t.getBoundingClientRect();ye.ContextMenuManager.showMenu(s,{clientX:r.left,clientY:r.top,attachToYBy:"bottom"},{returnFocus:!0,takeFocus:!0,isKeyboardEvent:(0,me.isKeyboardClick)(e)},{menuName:"TimezoneMenuContextMenu"},(()=>{this._menuShown=!1})).then((()=>{this._menuShown=!0}))},(0,b.validateRegistry)(t,{chartWidget:i.any.isRequired,chartApiInstance:i.any.isRequired}),this.state={time:""}}componentDidMount(){const{chartWidget:e}=this.context;this._tickInterval=setInterval(this._tickClock,1e3),e.withModel(null,(()=>{const t=e.model() ;t.model().mainSeries().dataEvents().symbolResolved().subscribe(this,this.updateTimezonesButton),t.model().properties().childs().timezone.subscribe(this,this.updateTimezonesButton),fe.timeHoursFormatProperty.subscribe(this,this._timeHoursFormatPropertyChanged)}))}componentWillUnmount(){const{chartWidget:e}=this.context;clearInterval(this._tickInterval),e.withModel(null,(()=>{const t=e.model();t.model().mainSeries().dataEvents().symbolResolved().unsubscribe(this,this.updateTimezonesButton),t.model().properties().childs().timezone.unsubscribe(this,this.updateTimezonesButton),fe.timeHoursFormatProperty.unsubscribe(this,this._timeHoursFormatPropertyChanged)}))}render(){const{className:e,withMenu:t}=this.props,{time:a}=this.state,i=void 0!==this._timezone?(0,pe.parseTzOffset)(this._timezone.name()).string:null;return r.createElement(Z.ToolbarButton,{onMouseDown:this._onMouseDown,ref:this._handleRef,onClick:this._showMenu,isDisabled:!t,theme:Ee,"data-name":"time-zone-menu",tooltip:t?n.t(null,void 0,s(87492)):void 0,className:e,text:a&&i&&`${a} (${i})`})}updateTimezonesButton(){const{chartWidget:e}=this.context;if(!e.hasModel())return;if(null===e.model().mainSeries().symbolInfo())return;let t=e.model().model().timezone();if("exchange"===t){const s=(0,v.ensureNotNull)(e.model().mainSeries().symbolInfo()).timezone;s&&(t=s)}this._timezone=(0,_e.get_timezone)(t),this._tickClock()}_timeHoursFormatPropertyChanged(){this._timeFormatter=new ge.TimeFormatter((0,be.getHourMinuteSecondFormat)(fe.timeHoursFormatProperty.value())),this.updateTimezonesButton()}}Ce.contextType=ke;var xe=s(56812);function Te(e){return r.createElement("span",{className:o(xe.separator,e.className)})}var we=s(54079),Me=s(36298),Ae=s(49483);class ze{constructor(e,t,s){this._highlighted=!1,this._chartWidget=e,this._priceScaleGetter=t,this._owner=s,this._setHighlight=this._setHighlight.bind(this),this._removeHighlight=this._removeHighlight.bind(this)}destroy(){this._highlighted&&this._removeHighlight()}handlers(){const e=Ae.CheckMobile.any();return{onMouseEnter:e?void 0:this._setHighlight,onMouseLeave:e?void 0:this._removeHighlight}}_setHighlight(){if(!this._chartWidget.hasModel())return;const e=this._chartWidget.model().model(),t=e.paneForSource(e.mainSeries()),s=this._priceScaleGetter();if(null===t||null===s)return;const r=this._chartWidget.paneByState(t);if(null!==r){const t=r.rightPriceAxisesContainer().findAxisWidgetForScale(s);let a=null;null!==t&&(a=t.axisInfo());const n=r.leftPriceAxisesContainer().findAxisWidgetForScale(s);null!==n&&(a=n.axisInfo());const i=r.highlightedPriceAxis();null!==a&&i.value().axis!==a&&(i.setValue({owner:this._owner,axis:a}),e.lightUpdate(),this._highlighted=!0)}}_removeHighlight(){if(!this._chartWidget.hasModel())return;const e=this._chartWidget.model().model(),t=e.paneForSource(e.mainSeries());if(null===t)return;const s=this._chartWidget.paneByState(t);if(null!==s){const t=s.highlightedPriceAxis(),r=t.value();null!==r.axis&&r.owner===this._owner&&(t.setValue({owner:this._owner,axis:null}),e.lightUpdate(),this._highlighted=!1) }}}const Ie=(0,b.registryContextType)(),Le=new Me.TranslatedString("toggle log scale",n.t(null,void 0,s(60166)));const De=(0,b.registryContextType)(),Be=new Me.TranslatedString("toggle auto scale",n.t(null,void 0,s(63060)));const Ne=(0,b.registryContextType)(),Re=new Me.TranslatedString("toggle percentage scale",n.t(null,void 0,s(68642)));const We=(0,b.registryContextType)();var je=s(42142),Pe=s(21861),He=s(82962),Ue=s(11678),Fe=s(97086);const Oe=new Me.TranslatedString("change session",n.t(null,void 0,s(65303))),Ye={hint:n.t(null,void 0,s(25866)),headerMenuText:n.t(null,void 0,s(44794))},Je=(0,b.registryContextType)();class Xe extends r.PureComponent{constructor(e,t){super(e,t),(0,b.validateRegistry)(t,{chartWidget:i.any.isRequired,chartApiInstance:i.any.isRequired}),this.state={availableSessions:[]}}componentDidMount(){const{chartWidget:e}=this.context;e.withModel(null,(()=>{const t=e.model();t.model().mainSeries().dataEvents().symbolResolved().subscribe(this,this.updateSessionButton),t.model().mainSeries().properties().childs().sessionId.subscribe(this,this.updateSessionButton),this.updateSessionButton()}))}componentWillUnmount(){const{chartWidget:e}=this.context;e.withModel(null,(()=>{const t=e.model();t.model().mainSeries().dataEvents().symbolResolved().unsubscribe(this,this.updateSessionButton),t.model().mainSeries().properties().childs().sessionId.unsubscribe(this,this.updateSessionButton)}))}render(){const{className:e,withMenu:t}=this.props,{sessionName:s,sessionDescription:a}=this.state;return r.createElement(d.ToolbarMenuButton,{arrow:!1,isDisabled:!t,content:s,className:e,closeOnClickOutside:!0,tooltip:t?a:void 0,"data-name":"session-menu",verticalDropDirection:u.VerticalDropDirection.FromBottomToTop,verticalAttachEdge:u.VerticalAttachEdge.Top,onClick:this._trackClick},this._menuItems())}updateSessionButton(){var e,t;const{chartWidget:s}=this.context;if(!s.model())return;const r=s.model().mainSeries().symbolInfo();if(null===r)return;const a=r.subsession_id,n=null!==(t=null===(e=r.subsessions)||void 0===e?void 0:e.filter((e=>!e.private)))&&void 0!==t?t:[],i=n.find((e=>e.id===a));this.setState({sessionId:a,sessionName:(0,Ue.translateSessionShortDescription)((null==i?void 0:i.description)||""),sessionDescription:(0,Ue.translateSessionDescription)((null==i?void 0:i.description)||""),availableSessions:n})}_menuItems(){if(!this.props.withMenu)return[];const{chartWidget:e}=this.context,{availableSessions:t}=this.state;if(!e.model())return[];const s=e.model().mainSeries(),a=[r.createElement(He.ToolWidgetMenuSummary,{key:"header_menu_text",className:Fe.headerMenuText},Ye.headerMenuText.toUpperCase())];for(const n of t){const t={category:"SetSession",event:n.id},i=()=>{e.model().setProperty(s.properties().childs().sessionId,n.id,Oe)};a.push(r.createElement(p.AccessibleMenuItem,{key:n.id,label:(0,Ue.translateSessionDescription)(n.description),isActive:this.state.sessionId===n.id,trackEventObject:t,onClick:i}))}return a}_trackClick(){0}}Xe.contextType=Je;var Ge=s(21868),Ve=s(72026),qe=s(51267),Ze=s(64264);const $e={ diff --git a/charting_library/bundles/library.73b161994e130a790de4.js b/charting_library/bundles/library.f0eab6b94b0505cb64c2.js similarity index 77% rename from charting_library/bundles/library.73b161994e130a790de4.js rename to charting_library/bundles/library.f0eab6b94b0505cb64c2.js index d07d435f..cf153cbf 100644 --- a/charting_library/bundles/library.73b161994e130a790de4.js +++ b/charting_library/bundles/library.f0eab6b94b0505cb64c2.js @@ -56,95 +56,95 @@ id:"smoothingLength",name:"Smoothing Length",defval:9,type:"integer",min:1,max:1 start:s,stop:o}),s=null),null===n&&this._isInPreMarketSession(h)&&(n=c),null===s&&this._isInPostMarketSession(h)&&(s=c),null!==n&&this._isInPreMarketSession(a)&&!this._isInPreMarketSession(h)&&(t.push({start:n,stop:o}),n=null),o=c,a=h}return null!==n&&t.push({start:n,stop:e[e.length-1]}),null!==s&&i.push({start:s,stop:e[e.length-1]}),{preMarket:t,postMarket:i}}_isInPreMarketSession(e){return this._anyEntryContains(this._preMarketSessionEntries,e)}_isInPostMarketSession(e){return this._anyEntryContains(this._postMarketSessionEntries,e)}_anyEntryContains(e,t){if(void 0===e)return!1;for(let i=0;ie?1:0,h={};function d(e,t,i,s,r){let n=r,o=0;if(isNaN(e.get(t-1)))return{index:NaN,value:NaN};for(let i=0;ie.symbol.index+1,h.nz=(e,t=0)=>isFinite(e)?e:t,h.na=function(e){return 0===arguments.length?NaN:isNaN(e)?1:0},h.isZero=e=>Math.abs(e)<=1e-10?1:0,h.toBool=e=>isFinite(e)&&!h.isZero(e),h.eq=(e,t)=>h.isZero(e-t),h.neq=(e,t)=>c(!h.eq(e,t)),h.ge=(e,t)=>c(h.isZero(e-t)||e>t),h.gt=(e,t)=>c(!h.isZero(e-t)&&e>t),h.lt=(e,t)=>c(!h.isZero(e-t)&&ec(h.isZero(e-t)||eisNaN(e)||isNaN(t)?NaN:h.isZero(e)||h.isZero(t)?0:1,h.or=(e,t)=>isNaN(e)||isNaN(t)?NaN:h.isZero(e)&&h.isZero(t)?0:1,h.not=e=>isNaN(e)?NaN:h.isZero(e)?1:0,h.eps=()=>l,h.greaterOrEqual=(e,t,i)=>t-e<(i||l),h.lessOrEqual=(e,t,i)=>e-t<(i||l),h.equal=(e,t,i)=>Math.abs(e-t)<(i||l),h.greater=(e,t,i)=>e-t>(i||l),h.less=(e,t,i)=>t-e>(i||l),h.compare=(e,t,i)=>h.equal(e,t,i)?0:h.greater(e,t,i)?1:-1,h.max=Math.max,h.min=Math.min,h.pow=Math.pow,h.abs=Math.abs,h.log=Math.log,h.log10=e=>Math.log(e)/Math.LN10,h.sqrt=Math.sqrt,h.sign=e=>isNaN(e)?NaN:h.isZero(e)?0:e>0?1:-1,h.exp=Math.exp,h.sin=Math.sin,h.cos=Math.cos,h.tan=Math.tan,h.asin=Math.asin,h.acos=Math.acos,h.atan=Math.atan,h.floor=Math.floor,h.ceil=Math.ceil,h.round=Math.round,h.avg=(...e)=>{if(2===e.length)return(e[0]+e[1])/2;let t=0;for(let i=0;ie.symbol.open,h.high=e=>e.symbol.high,h.low=e=>e.symbol.low,h.close=e=>e.symbol.close,h.hl2=e=>(e.symbol.high+e.symbol.low)/2,h.hlc3=e=>(e.symbol.high+e.symbol.low+e.symbol.close)/3,h.ohlc4=e=>(e.symbol.open+e.symbol.high+e.symbol.low+e.symbol.close)/4,h.volume=e=>e.symbol.volume,h.updatetime=e=>e.symbol.updatetime,h.time=e=>e.symbol.bartime(),h.period=e=>e.symbol.period,h.tickerid=e=>e.symbol.tickerid,h.currencyCode=e=>e.symbol.currencyCode,h.unitId=e=>e.symbol.unitId,h.ticker=e=>e.symbol.ticker,h.interval=e=>e.symbol.interval,h.isdwm=e=>e.symbol.isdwm(),h.isintraday=e=>!e.symbol.isdwm(),h.isdaily=e=>"D"===e.symbol.resolution,h.isweekly=e=>"W"===e.symbol.resolution,h.ismonthly=e=>"M"===e.symbol.resolution,h.year=(e,t)=>h.timepart(e.symbol,r.YEAR,t),h.month=(e,t)=>h.timepart(e.symbol,r.MONTH,t),h.weekofyear=(e,t)=>h.timepart(e.symbol,r.WEEK_OF_YEAR,t),h.dayofmonth=(e,t)=>h.timepart(e.symbol,r.DAY_OF_MONTH,t), h.dayofweek=(e,t)=>h.timepart(e.symbol,r.DAY_OF_WEEK,t),h.hour=(e,t)=>h.timepart(e.symbol,r.HOUR_OF_DAY,t),h.minute=(e,t)=>h.timepart(e.symbol,r.MINUTE,t),h.second=(e,t)=>h.timepart(e.symbol,r.SECOND,t),h.add_days_considering_dst=(e,t,i)=>r.add_days_considering_dst(r.get_timezone(e),t,i),h.add_years_considering_dst=(e,t,i)=>r.add_years_considering_dst(r.get_timezone(e),t,i),h.selectSessionBreaks=(e,t)=>{if(h.isdwm(e)||void 0===e.symbol.session.timezone)return[];const i=(0,s.newBarBuilder)(e.symbol.period,e.symbol.session,null),r=[],n=t.length;if(i.moveTo(t[n-1]),1===n&&i.startOfBar(0)===t[0])r.push(t[0]);else{for(let e=n-2;e>=0;--e){const s=t[e];if(s>=i.startOfBar(0))continue;i.moveTo(s);const n=t[e+1];r.push(n)}r.reverse()}return r},h.selectPreAndPostMarketTimes=(e,t)=>{var i,s;if(h.isdwm(e)||void 0===e.symbol.session.timezone)return{preMarket:[],postMarket:[]};return new n(e.symbol.session.timezone,null!==(i=e.symbol.preMarketSubsession)&&void 0!==i?i:null,null!==(s=e.symbol.postMarketSubsession)&&void 0!==s?s:null).getPreAndPostMarketTimes(t)},h.iff=(e,t,i)=>h.not(e)?i:t,h.rising=(e,t)=>{for(let i=1;ie.get(0))return 0;return 1},h.falling=(e,t)=>{for(let i=1;i{const s=r.utc_to_cal(e.session.timezone,i||e.bartime());return r.get_part(s,t)},h.rsi=(e,t)=>h.isZero(t)?100:h.isZero(e)?0:100-100/(1+e/t),h.sum=(e,t,i)=>{const s=i.new_var(),r=h.nz(e.get())+h.nz(s.get(1))-h.nz(e.get(t));return s.set(r),r},h.sma=(e,t,i)=>{const s=h.sum(e,t,i);return h.na(e.get(t-1))?NaN:s/t},h.smma=(e,t,i)=>{const s=i.new_var(e),r=h.sma(s,t,i),n=i.new_var(),o=(n.get(1)*(t-1)+e)/t;return n.set(h.na(n.get(1))?r:o),n.get(0)},h.rma=(e,t,i)=>{const s=h.sum(e,t,i),r=t-1,n=e.get(r),o=i.new_var(),a=o.get(1),l=e.get(),c=h.na(n)?NaN:h.na(a)?s/t:(l+a*r)/t;return o.set(c),c},h.fixnan=(e,t)=>{const i=t.new_var();return isNaN(e)?i.get(1):(i.set(e),e)},h.tr=(e,t)=>{let i=t.new_var(h.close(t)).get(1);return e&&isNaN(i)&&(i=h.close(t)),h.max(h.max(h.high(t)-h.low(t),h.abs(h.high(t)-i)),h.abs(h.low(t)-i))},h.atr=(e,t)=>{const i=t.new_var(h.tr(void 0,t));return h.rma(i,e,t)},h.ema=(e,t,i)=>{const s=h.sum(e,t,i),r=i.new_var(),n=e.get(0),o=e.get(t-1),a=r.get(1),l=h.na(o)?NaN:h.na(a)?s/t:2*(n-a)/(t+1)+a;return r.set(l),l},h.wma=(e,t,i)=>{let s=0;for(let i=t=Math.round(t);i>=0;i--){s+=(t-i)*e.get(i)}return 2*s/(t*(t+1))},h.vwma=(e,t,i)=>{const s=i.new_var(h.volume(i)),r=i.new_var(e.get(0)*h.volume(i));return h.sma(r,t,i)/h.sma(s,t,i)},h.swma=(e,t)=>(e.get(0)+2*e.get(1)+2*e.get(2)+e.get(3))/6,h.supertrend=(e,t,i)=>{const s=h.atr(t,i),r=i.new_var(s).get(1),n=h.hl2(i);let o=n+s*e,a=n-s*e;const l=h.close(i),c=i.new_var(l).get(1),d=i.new_var(),u=h.nz(d.get(1)),p=i.new_var(),_=h.nz(p.get(1));a=h.gt(a,u)||h.lt(c,u)?a:u,d.set(a),o=h.lt(o,_)||h.gt(c,_)?o:_,p.set(o);let m=h.na();const g=i.new_var(),f=g.get(1);m=h.na(r)?1:f===_?l>o?-1:1:l-d(e,t,0,((e,t)=>h.lt(e,t)),Number.MAX_VALUE).index, h.lowest=(e,t,i)=>d(e,t,0,((e,t)=>h.lt(e,t)),Number.MAX_VALUE).value,h.highestbars=(e,t,i)=>-d(e,t,0,((e,t)=>h.gt(e,t)),Number.MIN_VALUE).index,h.highest=(e,t,i)=>d(e,t,0,((e,t)=>h.gt(e,t)),Number.MIN_VALUE).value,h.cum=(e,t)=>{const i=t.new_var(),s=h.nz(i.get(1))+e;return i.set(s),s},h.accdist=e=>{const t=h.high(e),i=h.low(e),s=h.close(e),r=h.volume(e);return h.cum(s===t&&s===i||t===i?0:r*(2*s-i-t)/(t-i),e)},h.correlation=(e,t,i,s)=>{const r=h.sma(e,i,s),n=h.sma(t,i,s),o=s.new_var(e.get()*t.get());return(h.sma(o,i,s)-r*n)/Math.sqrt(h.variance2(e,r,i)*h.variance2(t,n,i))},h.stoch=(e,t,i,s,r)=>{const n=h.highest(t,s,r),o=h.lowest(i,s,r);return h.fixnan(100*(e.get()-o)/(n-o),r)},h.tsi=(e,t,i,s)=>{const r=s.new_var(h.change(e)),n=s.new_var(h.abs(h.change(e))),o=s.new_var(h.ema(r,i,s)),a=s.new_var(h.ema(n,i,s));return h.ema(o,t,s)/h.ema(a,t,s)},h.cross=(e,t,i)=>{if(isNaN(e)||isNaN(t))return!1;const s=i.new_var((r=e-t)<0?-1:0===r?0:1);var r;return!isNaN(s.get(1))&&s.get(1)!==s.get()},h.linreg=(e,t,i)=>{let s=0,r=0,n=0,o=0;for(let i=0;i{const r=s.new_var(),n=s.new_var(),o=s.new_var(),a=h.high(s),l=h.low(s),c=h.close(s),d=s.new_var(a),u=s.new_var(l),p=s.new_var(c),_=s.new_var();let m=_.get(1),g=n.get(1),f=o.get(1);n.set(g),o.set(f);let v=!1;const y=u.get(1),S=u.get(2),b=d.get(1),w=d.get(2),C=p.get(),P=p.get(1);2===h.n(s)&&(h.greater(C,P)?(r.set(1),o.set(d.get()),m=y,f=d.get()):(r.set(-1),o.set(u.get()),m=b,f=u.get()),v=!0,n.set(e),g=e);let x=m+g*(f-m);return 1===r.get()?h.greater(x,u.get())&&(v=!0,r.set(-1),x=Math.max(d.get(),o.get()),o.set(u.get()),n.set(e)):h.less(x,d.get())&&(v=!0,r.set(1),x=Math.min(u.get(),o.get()),o.set(d.get()),n.set(e)),v||(1===r.get()?h.greater(d.get(),o.get())&&(o.set(d.get()),n.set(Math.min(n.get()+t,i))):h.less(u.get(),o.get())&&(o.set(u.get()),n.set(Math.min(n.get()+t,i)))),1===r.get()?(x=Math.min(x,y),h.n(s)>2&&(x=Math.min(x,S))):(x=Math.max(x,b),h.n(s)>2&&(x=Math.max(x,w))),_.set(x),x},h.alma=(e,t,i,s)=>{const r=Math.floor(i*(t-1)),n=t/s*(t/s),o=[];let a=0;for(let e=0;ee.get()-e.get(1),h.roc=(e,t)=>{const i=e.get(t);return 100*(e.get()-i)/i},h.dev=(e,t,i)=>{const s=h.sma(e,t,i);return h.dev2(e,t,s)},h.dev2=(e,t,i)=>{let s=0;for(let r=0;r{const s=h.variance(e,t,i);return h.sqrt(s)},h.variance=(e,t,i)=>{const s=h.sma(e,t,i);return h.variance2(e,s,t)},h.variance2=(e,t,i)=>{let s=0;for(let r=0;r{if(h.na(e.get(t-1)))return NaN;let i=0;const s=e.get();for(let r=1;r{if(void 0===e.symbol.session.timezone)return()=>!1;const t=(0,s.newBarBuilder)(e.symbol.period,e.symbol.session,null) -;return e=>t.indexOfBar(e)===o.SessionStage.POST_SESSION&&(t.moveTo(e),!0)},h.error=e=>{throw new a.StudyError(e)},h.dmi=(e,t,i)=>{const s=i.new_var(h.high(i)),r=i.new_var(h.low(i)),n=h.change(s),o=-h.change(r),a=i.new_var(h.na(n)||h.na(o)?h.na():h.and(h.gt(n,o),h.gt(n,0))?n:0),l=i.new_var(h.na(o)?h.na():h.and(h.gt(o,n),h.gt(o,0))?o:0),c=h.atr(e,i),d=h.fixnan(100*h.rma(a,e,i)/c,i),u=h.fixnan(100*h.rma(l,e,i)/c,i);let p=d+u;h.isZero(p)&&(p+=1);const _=Math.abs(d-u)/p*100,m=i.new_var(_),g=h.rma(m,t,i),f=i.new_var(g);return[d,u,_,g,(f.get(0)+f.get(e-1))/2]},h.zigzag=(e,t,i)=>new m(e,t,i).lastPrice(),h.zigzagbars=(e,t,i)=>{const s=new m(e,t,i);return-1===s.lastIndex()?NaN:s.lastIndex()-h.n(i)};const u=0,p=1;class _{constructor(e,t,i,s,r){this._areaRight=e,this._areaLeft=t,this._pivotType=i,this._series=s,this._currentIndex=r.new_var(0),this._currentValue=r.new_var(NaN),this._pivotIndex=r.new_var(-1),this._index=h.n(r),this._isNewBar=r.symbol.isNewBar;const n=this._currentIndex.get(1),o=this._currentValue.get(1),a=this._pivotIndex.get(1);this._index>1&&(this._currentIndex.set(n),this._currentValue.set(o),this._pivotIndex.set(a))}isPivotFound(){return-1!==this._pivotIndex.get()}pivotIndex(){return this._pivotIndex.get()}currentValue(){return this._currentValue.get()}pivotType(){return this._pivotType}reset(){this._currentValue.set(NaN),this._currentIndex.set(0),this._pivotIndex.set(-1)}isRightSideOk(e){return e-this._currentIndex.get()===this._areaRight}isViolate(e,t){if(e<1||isNaN(this._currentValue.get()))return!0;const i=this._series.get(this._index-e);return!!isNaN(i)||(i===this._currentValue.get()?t:this._pivotType===p?i>this._currentValue.get():ithis._areaRight}update(){if(this._isNewBar&&this.isPivotFound()&&this.reset(),this.processPoint(this._index),this.isRightSideOk(this._index)){if(-1===this._pivotIndex.get()){let e=!0;for(let t=0;t1&&this.addPivot(n,o,a),this.processPivot(this._pivotHigh),this.processPivot(this._pivotLow)}addPivot(e,t,i){this._lastIndex.set(e),this._lastVal.set(t),this._lastType.set(i)}updatePivot(e,t){this._lastIndex.set(e),this._lastVal.set(t)} -lastPrice(){return this._lastVal.get()}lastIndex(){return this._lastIndex.get()}addPoint(e,t,i){if(isNaN(this._lastVal.get()))return void this.addPivot(e,t,i);const s=this._lastVal.get();if(this._lastType.get()===i){return void((i===p?t>s:tthis._deviation&&this.addPivot(e,t,i)}processPivot(e){e.update(),this._isBarClosed&&e.isPivotFound()&&this.addPoint(e.pivotIndex(),e.currentValue(),e.pivotType())}}},53130:(e,t,i)=>{"use strict";i.d(t,{anchoredVWAPStudyItem:()=>n});var s=i(50151),r=i(49581);const n={name:"Anchored VWAP",metainfo:{_metainfoVersion:51,description:"Anchored VWAP",shortDescription:"Anchored VWAP",format:{type:"inherit"},id:"AnchoredVWAP@tv-basicstudies-1",is_hidden_study:!0,is_price_study:!0,defaults:{inputs:{start_time:0,source:"hlc3"},styles:{VWAP:{color:"#1e88e5",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,display:15}}},inputs:[{defval:0,id:"start_time",isHidden:!0,max:253370764800,min:-253370764800,name:"Start time",type:"time"},{defval:"hlc3",id:"source",name:"Source",options:["open","high","low","close","hl2","hlc3","ohlc4"],type:"source"}],plots:[{id:"VWAP",type:"line"}],styles:{VWAP:{histogramBase:0,title:"VWAP"}}},constructor:class{constructor(){this._isNewSession=null,this._firstBarTime=0}init(e,t){this._firstBarTime=t(0),this._isNewSession=null}main(e,t,i){if(void 0===i)return[NaN];(0,s.assert)(e.symbol.time===i.time);const n=i.time;if(n&&n{"use strict";i.d(t,{OHLCV:()=>r});var s=i(49581);class r{main(e){return[s.Std.open(e),s.Std.high(e),s.Std.low(e),s.Std.close(e),s.Std.volume(e),s.Std.updatetime(e),void 0,void 0,void 0,void 0]}}},82808:(e,t,i)=>{"use strict";i.d(t,{pivotPointsStandardStudyItem:()=>d});var s=i(36274),r=i(47609),n=i(49581);class o{constructor(){this.p=NaN,this.r1=NaN,this.s1=NaN,this.r2=NaN,this.s2=NaN,this.r3=NaN,this.s3=NaN,this.r4=NaN,this.s4=NaN,this.r5=NaN,this.s5=NaN,this.startIndex__t=NaN,this.endIndex__t=NaN}}class a{constructor(){this.pivots=[]}}function l(e,t){e.setUTCMonth(e.getUTCMonth()+t)}function c(e,t){if(n.Std.ismonthly(e)){let i=new Date(t);return i.getUTCDay()=1&&t.multiplier()<=15?"1D":"1W";case s.ResolutionKind.Seconds:case s.ResolutionKind.Ticks:return"1D"}throw new Error("Unexpected resolution type: "+e.symbol.resolution)}(e);case"Daily":return"1D";case"Weekly":return"1W";case"Monthly":return"1M";case"Yearly":return"12M";default:throw new Error("No such pivTimeFrame: "+t)}}const d={name:"Pivot Points Standard",metainfo:{_metainfoVersion:44,defaults:{inputs:{kind:"Traditional",lookBack:15,pivTimeFrame:"Auto",showHistoricalPivots:!0},precision:"4"},description:"Pivot Points Standard",id:"PivotPointsStandard@tv-basicstudies-80",inputs:[{defval:"Traditional",id:"kind",name:"Type",options:["Traditional","Fibonacci","Woodie","Classic","DeMark","Camarilla","Floor"],type:"text"},{defval:!0,id:"showHistoricalPivots",name:"Show historical pivots",type:"bool"},{defval:"Auto",id:"pivTimeFrame",name:"Pivots Timeframe",options:["Auto","Daily","Weekly","Monthly","Yearly"],type:"text"},{defval:15,id:"lookBack",max:5e3,min:1,name:"Number of Pivots Back",type:"integer"}],is_price_study:!0,linkedToSeries:!0,shortDescription:"Pivots",format:{type:"price",precision:4}},constructor:class{constructor(){this._secondaryRes="1D",this._firstMainSeriesBarTime=NaN}init(e,t){const i=t(0),s=t(1),o=t(2),l=t(3);this._data=new a,this._firstMainSeriesBarTime=NaN,this._kindPP=function(e){switch(e){case"Traditional":return 0;case"Fibonacci":return 1;case"Woodie":return 2;case"Classic":return 3;case"DeMark":return 4;case"Camarilla":return 5;case"Floor":return 6;default:throw new Error("Unknown kind "+e)}}(i),this._showHistoricalPivots=s,this._historicalPivotsToKeep=l,this._pivTimeFrame=o,this._isValidResolution=function(e,t){return!(n.Std.isdaily(e)&&"Daily"===t||n.Std.isweekly(e)&&("Daily"===t||"Weekly"===t)||n.Std.ismonthly(e)&&("Daily"===t||"Weekly"===t||"Monthly"===t))}(e,this._pivTimeFrame),this._isValidResolution||n.Std.error("You cannot see this pivot timeframe on this resolution"),this._isValidResolution&&(this._secondaryRes=h(e,this._pivTimeFrame),void 0!==e.symbol.info&&(0,r.findSuitableResolutionToBuildFrom)(this._secondaryRes,e.symbol.info).error&&(this._isValidResolution=!1,n.Std.error(`Resolution ${this._secondaryRes} is not supported for this symbol`))),e.new_sym(e.symbol.tickerid,this._secondaryRes)}main(e,t,i){if(!this._isValidResolution)return null;if(e.is_main_symbol(i))return isNaN(this._firstMainSeriesBarTime)&&(this._firstMainSeriesBarTime=e.symbol.time,this._removeUnusedPivots()),e.symbol.isLastBar&&e.symbol.isNewBar?this._createResponse():null;e.select_sym(1);const s=e.new_var(n.Std.open(e)),r=e.new_var(n.Std.high(e)),a=e.new_var(n.Std.low(e)),l=e.new_var(n.Std.close(e)),h=e.new_var(n.Std.time(e)),d=this._data,u=s.get(0),p=h.get(0),_=s.get(1),m=r.get(1),g=a.get(1),f=l.get(1),v=e.symbol.isLastBar;if(0!==d.pivots.length&&e.symbol.isNewBar){const e=d.pivots[d.pivots.length-1];e.endIndex__t!==p&&(e.endIndex__t=p)} -if(0===e.symbol.index||!e.symbol.isNewBar)return e.select_sym(0),null;const y=function(e,t,i,s,r,a,l,c){const h=new o;let d=NaN;const u=i-s;switch(c){case 0:d=(i+s+r)/3,h.p=d,h.r1=2*d-s,h.s1=2*d-i,h.r2=d+(i-s),h.s2=d-(i-s),h.r3=2*d+(i-2*s),h.s3=2*d-(2*i-s),h.r4=3*d+(i-3*s),h.s4=3*d-(3*i-s),h.r5=4*d+(i-4*s),h.s5=4*d-(4*i-s);break;case 1:d=(i+s+r)/3,h.p=d,h.r1=d+.382*u,h.s1=d-.382*u,h.r2=d+.618*u,h.s2=d-.618*u,h.r3=d+u,h.s3=d-u;break;case 2:d=(i+s+2*e)/4,h.p=d,h.r1=2*d-s,h.s1=2*d-i,h.r2=d+u,h.s2=d-u,h.r3=i+2*(d-s),h.s3=s-2*(i-d),h.r4=h.r3+u,h.s4=h.s3-u;break;case 3:d=(i+s+r)/3,h.p=d,h.r1=2*d-s,h.s1=2*d-i,h.r2=d+u,h.s2=d-u,h.r3=d+2*u,h.s3=d-2*u,h.r4=d+3*u,h.s4=d-3*u;break;case 4:let o=NaN;o=n.Std.equal(t,r)?i+s+2*r:n.Std.greater(r,t)?2*i+s+r:2*s+i+r,d=o/4,h.p=d,h.r1=o/2-s,h.s1=o/2-i;break;case 5:d=(i+s+r)/3,h.p=d,h.r1=r+1.1*u/12,h.s1=r-1.1*u/12,h.r2=r+1.1*u/6,h.s2=r-1.1*u/6,h.r3=r+1.1*u/4,h.s3=r-1.1*u/4,h.r4=r+1.1*u/2,h.s4=r-1.1*u/2;break;case 6:d=(i+s+r)/3,h.p=d,h.r1=2*d-s,h.s1=2*d-i,h.r2=d+(i-s),h.s2=d-(i-s),h.r3=d-h.s1+h.r2,h.s3=2*d-(2*i-s);break;default:throw new Error("Unknown kind")}return h.startIndex__t=a,h.endIndex__t=l,h}(u,_,m,g,f,p,c(e,p),this._kindPP);return e.select_sym(0),this._showHistoricalPivots||(d.pivots=[]),d.pivots.push(y),d.pivots.length>this._historicalPivotsToKeep&&d.pivots.shift(),v?this._createResponse():null}_createResponse(){return 0===this._data.pivots.length?null:{nonseries:!0,type:"non_series_data",data:{data:this._data}}}_removeUnusedPivots(){const e=Math.max(this._data.pivots.findIndex((e=>e.startIndex__t>this._firstMainSeriesBarTime))-1,0);e>0&&this._data.pivots.splice(0,e)}}}},81821:(e,t,i)=>{"use strict";i.d(t,{ratioStudyItem:()=>n});var s=i(87302);class r extends s.SpreadRatioBase{_doCalculation(e,t,i,s){return e*t/(i*s)}}const n={name:"Ratio",metainfo:{_metainfoVersion:15,defaults:s.spreadRatioDefaults,plots:s.spreadRatioPlots,styles:s.spreadRatioStyles,description:"Ratio",shortDescription:"Ratio",is_price_study:!1,inputs:s.spreadRatioInputs,id:"Ratio@tv-basicstudies-1",format:{type:"price",precision:2}},constructor:r}},65097:(e,t,i)=>{"use strict";i.d(t,{regressionTrendStudyItem:()=>n});var s=i(49581);function r(e,t,i){const r={slope:NaN,average:NaN,intercept:NaN,stdDev:NaN,upDev:NaN,downDev:NaN,pearsons:NaN};return 0===e.length||(function(e,t){let i=0,s=0,r=0,n=0;for(let t=0;tn&&(n=u),u=d-i[s],u>o&&(o=u),u=e[s];const _=u-r.average,m=d-p;u-=d,a+=u*u,l+=_*_,c+=m*m,h+=_*m,d+=r.slope}r.stdDev=Math.sqrt(a/(0===u?1:u)),r.pearsons=s.Std.isZero(l)||s.Std.isZero(c)?0:h/Math.sqrt(l*c),r.upDev=n,r.downDev=o}(e,t,i,r)),r}const n={name:"Regression Trend",metainfo:{_metainfoVersion:51,description:"Regression Trend",format:{type:"inherit"},id:"RegressionTrend@tv-basicstudies-144", -is_hidden_study:!0,is_price_study:!0,shortDescription:"Reg Trend",defaults:{inputs:{"first bar time":0,"last bar time":0,"lower diviation":-2,source:"close","upper diviation":2,"use lower diviation":!0,"use upper diviation":!0},styles:{}},inputs:[{defval:2,id:"upper diviation",max:500,min:-500,name:"Upper Deviation",type:"float"},{defval:-2,id:"lower diviation",max:500,min:-500,name:"Lower Deviation",type:"float"},{defval:!0,id:"use upper diviation",name:"Use Upper Deviation",type:"bool"},{defval:!0,id:"use lower diviation",name:"Use Lower Deviation",type:"bool"},{defval:0,id:"first bar time",isHidden:!0,max:253370764800,min:-253370764800,name:"First bar time",type:"time"},{defval:0,id:"last bar time",isHidden:!0,max:253370764800,min:-253370764800,name:"Last bar time",type:"time"},{defval:"close",id:"source",name:"Source",options:["open","high","low","close","hl2","hlc3","ohlc4"],type:"source"}],plots:[]},constructor:class{constructor(){this._resultSent=!1}init(e,t){this._resultSent=!1,this._data={baseLine:{startPrice:NaN,endPrice:NaN},upLine:{startPrice:NaN,endPrice:NaN},downLine:{startPrice:NaN,endPrice:NaN},pearsons:NaN,startIndex__t:NaN,endIndex__t:NaN}}main(e,t){const i=t(6),n=e.new_unlimited_var(s.Std.time(e)),o=e.new_unlimited_var(s.Std.high(e)),a=e.new_unlimited_var(s.Std.low(e)),l=e.new_unlimited_var(s.Std[i](e));if(!e.symbol.isLastBar)return null;if(this._resultSent)return null;const c=t(0),h=t(1),d=t(2),u=t(3),p=t(4),_=t(5),m=n.indexOf(p),g=n.indexOf(_),f=[],v=[],y=[],S=[];for(let e=m;e>=g;--e)f.push(n.get(e)),v.push(o.get(e)),y.push(a.get(e)),S.push(l.get(e));return this._updateData(f,d,c,u,h,p,_,r(S,v,y)),this._resultSent=!0,{type:"non_series_data",nonseries:!0,data:{data:this._data}}}_updateData(e,t,i,s,r,n,o,a){const l=e.length-1;this._data.baseLine.startPrice=a.intercept,this._data.baseLine.endPrice=a.intercept+a.slope*l;const c=a.intercept+(t?a.stdDev*i:a.upDev);this._data.upLine.startPrice=c,this._data.upLine.endPrice=c+a.slope*l;const h=a.intercept+(s?a.stdDev*r:-a.downDev);this._data.downLine.startPrice=h,this._data.downLine.endPrice=h+a.slope*l,this._data.pearsons=a.pearsons,this._data.startIndex__t=n,this._data.endIndex__t=o}}}},87302:(e,t,i)=>{"use strict";i.d(t,{SpreadRatioBase:()=>l,spreadRatioDefaults:()=>c,spreadRatioFilledAreas:()=>_,spreadRatioInputs:()=>h,spreadRatioPalettes:()=>p,spreadRatioPlots:()=>d,spreadRatioStyles:()=>u});var s=i(33013),r=i(72877),n=i(49581),o=i(87095);const a="rgba(0, 0, 0, 0)";class l{init(e,t){e.new_sym(t(1),n.Std.period(e)),this._source=t(0),this._scaleFactor1=1,this._scaleFactor2=1}main(e,t){const i=e.symbol.time,s=n.Std[this._source](e);e.select_sym(1);const r=n.Std[this._source](e),o=e.new_unlimited_var(r),a=e.new_unlimited_var(e.symbol.time);if(e.select_sym(0),isNaN(i))return null;let l=a.indexOf(i);-1!==l&&a.get(l)!==i&&(l=-1);const c=l<0?NaN:o.get(l),h=this._doCalculation(this._scaleFactor1,s,this._scaleFactor2,c);return[h,0,n.Std.ge(h,0),n.Std.lt(h,0)]}}const c={styles:{plot1:{linestyle:0,linewidth:2,plottype:r.LineStudyPlotStyle.Line,trackPrice:!1, -transparency:35,color:"#800080",display:15},plotBaseline:{linestyle:0,linewidth:2,plottype:r.LineStudyPlotStyle.Line,trackPrice:!1,transparency:0,color:a,display:0}},palettes:{negativePalette:{colors:[{color:(0,o.applyAlpha)((0,s.getHexColorByName)("color-ripe-red-500"),.5),style:0,width:0},{color:a,style:0,width:0}]},positivePalette:{colors:[{color:(0,o.applyAlpha)((0,s.getHexColorByName)("color-minty-green-500"),.5),style:0,width:0},{color:a,style:0,width:0}]}},filledAreasStyle:{negativeFill:{color:"",transparency:0,visible:!0,fillType:void 0},positiveFill:{color:"",transparency:0,visible:!0,fillType:void 0}},precision:2,inputs:{source:"close",symbol2:""}},h=[{defval:"close",id:"source",name:"Source",options:["open","high","low","close","hl2","hlc3","ohlc4"],type:"text"},{id:"symbol2",name:"Symbol",type:"symbol",confirm:!0}],d=[{id:"plot1",type:"line"},{id:"plotBaseline",type:"line"},{id:"plotNegativeFill",type:"colorer",target:"negativeFill",palette:"negativePalette"},{id:"plotPositiveFill",type:"colorer",target:"positiveFill",palette:"positivePalette"}],u={plot1:{title:"Plot",histogramBase:0},plotBaseline:{title:"Baseline",isHidden:!0}},p={negativePalette:{valToIndex:{0:0,1:1},colors:[{name:"Color"}]},positivePalette:{valToIndex:{0:0,1:1},colors:[{name:"Color"}]}},_=[{id:"negativeFill",objAId:"plot1",objBId:"plotBaseline",type:"plot_plot",title:"Negative fill",palette:"negativePalette",fillToIntersection:!0},{id:"positiveFill",objAId:"plot1",objBId:"plotBaseline",type:"plot_plot",title:"Positive fill",palette:"positivePalette",fillToIntersection:!0}]},39944:(e,t,i)=>{"use strict";i.d(t,{spreadStudyItem:()=>n});var s=i(87302);class r extends s.SpreadRatioBase{_doCalculation(e,t,i,s){return e*t-i*s}}const n={name:"Spread",metainfo:{_metainfoVersion:15,defaults:s.spreadRatioDefaults,plots:s.spreadRatioPlots,styles:s.spreadRatioStyles,palettes:s.spreadRatioPalettes,filledAreas:s.spreadRatioFilledAreas,description:"Spread",shortDescription:"Spread",is_price_study:!1,inputs:s.spreadRatioInputs,id:"Spread@tv-basicstudies-1",format:{type:"price",precision:2}},constructor:r}},56437:(e,t,i)=>{"use strict";i.d(t,{VbPCheckHaveVolumeExpr:()=>r});var s=i(49581);class r{constructor(e){this._haveAnyVolume=!1,this._isDisabled=!1,this._seriesGetter=e}update(e,t){if(this._haveAnyVolume||this._isDisabled)return;const i=this._seriesGetter.volume().get(e);0!==i&&Number.isFinite(i)&&(this._haveAnyVolume=!0),t&&(this._haveAnyVolume||s.Std.error("The data vendor doesn't provide volume data for this symbol."),this._isDisabled=!0)}}},89529:(e,t,i)=>{"use strict";i.d(t,{VolumeByPriceExpr:()=>_});var s=i(50151),r=i(37160),n=i(36274),o=i(29779);class a extends o.GraphicsObj{constructor(e,t,i,r,n,o){super(e),(0,s.assert)(t({index:e.index,offset:e.offset,level:e.level})))}}}class u extends o.GraphicsObj{constructor(e,t,i,s,r=!1,n=!1){super(e),this._endIndex=this._mixinJSONObject.createTimeField(i,"endIndex"),this._extendLeft=this._mixinJSONObject.createField(r,"extendLeft"),this._extendRight=this._mixinJSONObject.createField(n,"extendRight"),this._level=this._mixinJSONObject.createDoubleField(s,"level"),this._startIndex=this._mixinJSONObject.createTimeField(t,"startIndex")}isNaN(){return super.isNaN()||Number.isNaN(this._level.get())||this._startIndex.get()<0||this._endIndex.get()<0||this._startIndex.get()===this._endIndex.get()&&!this._extendLeft.get()&&!this._extendRight.get()}jsonName(){return"horizlines"}primitiveData(){return{id:this.id(),startIndex:this._startIndex.get(), -endIndex:this._endIndex.get(),extendLeft:this._extendLeft.get(),extendRight:this._extendRight.get(),level:this._level.get()}}startIndex(){return this._startIndex.get()}setStartIndex(e){this._startIndex.set(e)&&this._processObjUpdate()}endIndex(){return this._endIndex.get()}setEndIndex(e){this._endIndex.set(e)&&this._processObjUpdate()}level(){return this._level.get()}setLevel(e){this._level.set(e)&&this._processObjUpdate()}isExtendLeft(){return this._extendLeft.get()}setExtendLeft(e){this._extendLeft.set(e)&&this._processObjUpdate()}extendLeft(){return this.isExtendLeft()}isExtendRight(){return this._extendRight.get()}setExtendRight(e){this._extendRight.set(e)&&this._processObjUpdate()}extendRight(){return this.isExtendRight()}}class p{constructor(){this._map=new Map}get(e){const t=this._innerMap(e.start);return t&&t.get(e.end)}set(e,t){this._innerMap(e.start,!0).set(e.end,t)}clear(){this._map.clear()}size(){let e=0;return this._map.forEach((t=>e+=t.size)),e}_innerMap(e,t){let i=this._map.get(e);return void 0===i&&t&&(i=new Map,this._map.set(e,i)),i}}class _{constructor(e,t,i,r,n,o,a,c,h,d,u,_,m,g,f){this._freezedBoxes=new l.GraphicsList,this._freezedHists=new l.GraphicsList,this._freezedPocs=new l.GraphicsList,this._freezedVAHists=new l.GraphicsList,this._currentHistsGr=new l.GraphicsList,this._currentVAHistsGr=new l.GraphicsList,this._currentHists=[],this._currentHistsMap=new p,this._currentBox=null,this._currentPoc=null,this._historyBarSet=[],this._prevRtBar=null,this._minPrice=Number.POSITIVE_INFINITY,this._maxPrice=Number.NEGATIVE_INFINITY,this._leftBoxTime=null,this._rightBoxTime=null,this._actualRightBoxTime=null,this._needRecalc=!1,this._largestHistItem=null,this._rowsLayout=null,this._currentVAStart=0,this._currentVAEnd=0,this._previousVAStart=0,this._previousVAEnd=0,this._idsGenerator=null,(0,s.assert)(1===e||2===e),this._numOfSubHists=e,this._outHists=r,this._outBoxLines=n,this._outPocLines=o,this._extendPocLeftRight=a,this._outVAHists=c,this._vaVolumePercent=h,this._rowsLayoutSupplier=d,this._outHists.addStable(this._freezedHists),this._outVAHists.addStable(this._freezedVAHists),this._maxHHistItems=u,this._layoutIsAutoselected=g,this._leftBoxTimeMutable=_,this._rightBoxTimeMutable=m,this._actualRightBoxTime=null!=f?f:m,this._ctx=t,this._seriesGetter=i}update(e){this._supplyRowsLayout(this._ctx),null===this._currentBox&&this._initCurrentBox(),null===this._currentPoc&&this._initCurrentPoc();const t=this._timeScale().get(e);this._leftBoxTime=this._leftBoxTimeMutable,this._rightBoxTime=this._rightBoxTimeMutable,this._ctx.symbol.isLastBar&&!Number.isNaN(this._rightBoxTime)&&(this._rightBoxTime=Math.min(t+n.Interval.parse(this._ctx.symbol.interval+this._ctx.symbol.resolution).inMilliseconds(t)-1,this._rightBoxTime));const i=c.Std.greaterOrEqual(this._seriesClose().get(e),this._seriesOpen().get(e)),s={high:this._seriesHigh().get(e),low:this._seriesLow().get(e),volume:this._seriesVol().get(e),isUp:i,time:t};this._updateCurrentHistogram(s), -this._currentHists.length>0&&(this._largestHistItem=this._getLargestHistItem(),this._updateCurrentPoc(),this._seriesGetter.developingPoc().set(this._currentPoc.level()),this._updateValueArea(),this._vaVolumePercent>0&&(this._seriesGetter.developingVAHigh().set(this._currentHists[this._currentVAEnd].priceHigh()),this._seriesGetter.developingVALow().set(this._currentHists[this._currentVAStart].priceLow()))),this._updateCurrentBox(),this._rebuildOutData()}setIdsGeneratorProxy(e){this._idsGenerator=e}nextGraphicsObjId(){return(0,s.ensureNotNull)(this._idsGenerator).nextGraphicsObjId()}pushEraseObjCmd(e,t){(0,s.ensureNotNull)(this._idsGenerator).pushEraseObjCmd(e,t)}popEraseCmds(){return(0,s.ensureNotNull)(this._idsGenerator).popEraseCmds()}_timeScale(){return this._seriesGetter.time()}_seriesLow(){return this._seriesGetter.low()}_seriesHigh(){return this._seriesGetter.high()}_seriesVol(){return this._seriesGetter.volume()}_seriesOpen(){return this._seriesGetter.open()}_seriesClose(){return this._seriesGetter.close()}_freezeCurrentHistogramAndCleanup(){null!==this._currentBox&&this._freezedBoxes.add(this._currentBox),c.Std.greater(this._getVolume(this._currentHists),0)&&(this._freezedHists.addAll(this._currentHistsGr),this._freezedVAHists.addAll(this._currentVAHistsGr),null!==this._currentPoc&&this._freezedPocs.add(this._currentPoc)),this._currentHists=[],this._currentHistsGr.clear(),this._currentHistsMap.clear(),this._initCurrentBox(),this._initCurrentPoc(),this._currentVAHistsGr.clear(),this._historyBarSet=[],this._minPrice=Number.POSITIVE_INFINITY,this._maxPrice=Number.NEGATIVE_INFINITY,this._prevRtBar=null,this._leftBoxTime=null,this._rightBoxTime=null}_supplyRowsLayout(e){null===this._rowsLayout&&e.symbol.isFirstBar&&e.symbol.isNewBar&&(this._rowsLayout=this._rowsLayoutSupplier())}_updateCurrentHistogram(e){if(this._needRecalc=!1,c.Std.greater(this._minPrice,e.low)&&(this._minPrice=e.low,this._needRecalc=!0),c.Std.less(this._maxPrice,e.high)&&(this._maxPrice=e.high,this._needRecalc=!0),this._ctx.symbol.isBarClosed&&this._historyBarSet.length>0){const t=this._historyBarSet[this._historyBarSet.length-1];t.time===e.time&&(this._prevRtBar=t,this._historyBarSet.pop())}this._needRecalc&&0===(0,s.ensureNotNull)(this._rowsLayout).type()?(this._recalculateCurrentResultsOnHistoryBarSet(),this._applyUpdateToCurrentResults(e,!1)):this._applyUpdateToCurrentResults(e,!0),this._ctx.symbol.isBarClosed?((0,s.assert)(null===this._prevRtBar||e.time===this._prevRtBar.time),this._historyBarSet.push(e),this._prevRtBar=null):this._prevRtBar=e}_getMidLevel(e){return(e.priceHigh()+e.priceLow())/2}_getMidLevelFromList(e){return e.length%2==0?e[e.length/2].priceLow():this._getMidLevel(e[Math.floor(e.length/2)])}_getLargestHistItem(){let e=[],t=this._currentHists[0];for(const i of this._currentHists)c.Std.greater(i.ratesSum(),t.ratesSum())?(t=i,e=[t]):c.Std.equal(i.ratesSum(),t.ratesSum())&&e.push(i);if(e.length>1){const i=this._getMidLevelFromList(this._currentHists);t=e[e.length-1];for(let s=e.length-2;s>=0;s--){const r=e[s] -;c.Std.lessOrEqual(Math.abs(this._getMidLevel(r)-i),Math.abs(this._getMidLevel(t)-i))&&(t=r)}}return t}_initCurrentPoc(){this._currentPoc=new u(this,0,0,0)}_updateCurrentPoc(){const e=(0,s.ensureNotNull)(this._currentPoc);e.setStartIndex((0,s.ensureNotNull)(this._leftBoxTime)),e.setEndIndex((0,s.ensureNotNull)(this._actualRightBoxTime)),e.setExtendLeft(this._extendPocLeftRight),e.setExtendRight(this._extendPocLeftRight);const t=this._getMidLevel((0,s.ensureNotNull)(this._largestHistItem));e.setLevel(t)}_getVolume(e){let t=0;for(const i of e)t+=i.ratesSum();return t}_getPocHistItemIndex(){for(let e=0;e=0,`ERROR - PocHistItemIndex == ${e}`),this._currentVAStart=e-1,this._currentVAEnd=e+1;const t=this._getVolume(this._currentHists)*this._vaVolumePercent*.01;let i=this._currentHists[e].ratesSum(),r=0,n=null;for(;c.Std.lessOrEqual(i+r,t)&&(i+=r,0===n?--this._currentVAStart:1===n&&++this._currentVAEnd,-1!==this._currentVAStart||this._currentVAEnd!==this._currentHists.length);){let t,i;if(this._currentVAStart>-1)if(t=this._currentHists[this._currentVAStart].ratesSum(),this._currentVAEndthis._getMidLevel(this._currentHists[this._currentVAStart])&&e.priceLow()0&&(e=this._currentHists[0].priceLow(),t=this._currentHists[this._currentHists.length-1].priceHigh());const i=[],r=(0, -s.ensureNotNull)(this._leftBoxTime),n=(0,s.ensureNotNull)(this._actualRightBoxTime);i.push(new h(r,e)),i.push(new h(r,t)),i.push(new h(n,t)),i.push(new h(n,e)),(0,s.ensureNotNull)(this._currentBox).setPoints(i)}_recalculateCurrentResultsOnHistoryBarSet(){for(let e=0;e0&&(this._largestHistItem=this._getLargestHistItem(),this._updateCurrentPoc()),this._updateCurrentBox()}_applyUpdateToCurrentResults(e,t){t&&null!==this._prevRtBar&&this._addHistoryBarToHistogram(this._prevRtBar,this._historyBarSet.length-1,this._currentHists,this._currentHistsMap,-1),this._addHistoryBarToHistogram(e,this._historyBarSet.length-1,this._currentHists,this._currentHistsMap,1),this._updateLastBarTimeInHistogram(this._currentHists)}_addHistoryBarToHistogram(e,t,i,r,n){(0,s.assert)(-1===n||1===n,"Please set sign argument either +1 or -1");const o=e.low,a=e.high,l=isNaN(e.volume)?0:e.volume,h=e.isUp,d=(0,s.ensureNotNull)(this._rowsLayout);d.init(this._ctx.symbol.minTick,this._minPrice,this._maxPrice,o,a);const u=d.rowWidth();if(!c.Std.greater(u,0))return;d.calculate();const p=d.getIndexLowVbP(),_=d.getIndexHighVbP(),m=d.getStartPrice();if(p===_){const e=p*u+m,t=(p+1)*u+m;this._updateResult({start:e,end:t},n*l,h,i,r)}else{let e=0;for(let t=p;t<=_;t++){const s=t*u+m,c=(t+1)*u+m,d=this._rowCoeff(s,c,o,a),p=d*l;e+=d,this._updateResult({start:s,end:c},n*p,h,i,r)}(0,s.assert)(c.Std.equal(e,1,.05),`totalCoeff not equal 1! totalConf = ${e}`)}}_updateResult(e,t,i,r,n){const o=this._createRates(i,t);(0,s.assert)(null!==this._leftBoxTime,"leftBoxTime is not set (equals null)"),(0,s.assert)(null!==this._rightBoxTime,"rightBoxTime is not set (equals null)");const l=(0,s.ensureNotNull)(this._leftBoxTime),h=(0,s.ensureNotNull)(this._actualRightBoxTime);let d=n.get(e);if(void 0===d)d=new a(this,e.start,e.end,o,l,h),n.set(e,d),this._verifyHistogramSizeIsNotTooLarge(n.size()),this._currentHistsGr.add(d),_._addInOrder(d,r,0,r.length,((e,t)=>{let i=c.Std.compare(e.firstBarTime(),t.firstBarTime());return 0!==i?i:(i=c.Std.compare(e.priceLow(),t.priceLow()),0!==i?i:c.Std.compare(e.priceHigh(),t.priceHigh()))}));else{const e=[];for(let t=0;t0?_._addInOrder(e,t,o+1,s,n):t.splice(o,0,e)}}},19762:(e,t,i)=>{"use strict";i.d(t,{VolumeProfileBase:()=>u,maxHHistItems:()=>h,numOfSubHists:()=>d});var s=i(14483),r=i(36274);class n{constructor(e,t){this._minTick=NaN,this._minPrice=NaN,this._maxPrice=NaN,this._low=NaN,this._high=NaN,this._startPrice=NaN,this._indexLowVbP=NaN,this._indexHighVbP=NaN,this._rowSize=e,this._type=t}init(e,t,i,s,r){this._minTick=e,this._minPrice=t,this._maxPrice=i,this._low=s,this._high=r}getStartPrice(){return this._startPrice}setStartPrice(e){this._startPrice=e}getIndexLowVbP(){return this._indexLowVbP}setIndexLowVbP(e){this._indexLowVbP=e}getIndexHighVbP(){return this._indexHighVbP}setIndexHighVbP(e){this._indexHighVbP=e}type(){return this._type}}class o extends n{constructor(e){super(e,0)}calculate(){this.setStartPrice(this._minPrice);const e=this.rowWidth();let t=Math.floor((this._low-this._minPrice)/e),i=Math.ceil((this._high-this._minPrice)/e)-1;t=Math.max(t,0),i=Math.max(i,0),i=Math.min(i,this._rowSize-1),t=Math.min(t,i),this.setIndexLowVbP(t),this.setIndexHighVbP(i)}rowWidth(){return Math.max((this._maxPrice-this._minPrice)/this._rowSize,this._minTick)}}class a extends n{constructor(e){super(e,1)}calculate(){this.setStartPrice(0);const e=this.rowWidth();let t=Math.floor(this._low/e);const i=Math.ceil(this._high/e)-1;t=Math.min(t,i),this.setIndexLowVbP(t),this.setIndexHighVbP(i)}rowWidth(){return this._minTick*this._rowSize}}var l=i(49581),c=i(40367);function h(){return 6e3}function d(e){switch(e){case"Delta":case"Up/Down":return 2;case"Total":return 1;default:l.Std.error(`Invalid study argument value: ${e}`)}}class u{findBasicResolutionForFromTo(e,t,i,n){const o=(0,c.getVolumeProfileResolutionForPeriod)(e.value(),t,i,n),a=r.Interval.parse(o);return s.enabled("charting_library_debug_mode")&&console.log(`Selected resolution ${a.value()} for (${e.value()}, ${t}, ${i})`),a -}verifyRowSizeInput(e,t){"Number Of Rows"===t&&e>6e3&&l.Std.error('Histogram is too large, please reduce "Row Size" input.')}_getRowsLayout(e,t){return"Number Of Rows"===e?new o(t):new a(t)}}},82597:(e,t,i)=>{"use strict";i.d(t,{volumeProfileFixedRangeBSStudyItem:()=>w,volumeProfileFixedRangeVbPStudyItem:()=>b});var s=i(50151),r=i(19762),n=i(72877),o=i(90164),a=i(36274),l=i(79999),c=i(748),h=i(43945),d=i(31584),u=i(1386),p=i(56437),_=i(95586),m=i(89529);class g extends m.VolumeByPriceExpr{constructor(e,t,i,s,r,n,o,a,l,c,h,d,u){super(e,t,i,n,o,a,!1,l,c,(()=>h),d,s,r,!1,u),this._firstBarTime=s,this._lastBarTime=r}update(e){this._supplyRowsLayout(this._ctx),this.timeInRequestedRange(e)&&super.update(e)}timeInRequestedRange(e){const t=this._timeScale().get(e);return this._firstBarTime<=t&&t=this._firstBarTime){const e=this._developingPocSeries.getLeftOrEqual(n),t=this._developingVAHighSeries.getLeftOrEqual(n),i=this._developingVALowSeries.getLeftOrEqual(n);r.data.push([e,t,i])}else r.data.push([NaN,NaN,NaN])}return r}time(){return this._timeSeries}open(){return this._openSeries}high(){return this._highSeries}low(){return this._lowSeries}close(){return this._closeSeries}volume(){return this._volumeSeries}developingPoc(){return this._developingPocSeries}developingVAHigh(){return this._developingVAHighSeries}developingVALow(){return this._developingVALowSeries}}function S(e){return{constructor:y,name:e.description,metainfo:{_metainfoVersion:51,shortDescription:"VPFR",format:{type:"volume"},is_price_study:!0,defaults:{graphics:{hhists:{histBars2:{colors:["#1592e6","#fbc123"],direction:o.HHistDirection.LeftToRight,percentWidth:30,showValues:!1,transparencies:[76,76],valuesColor:"#424242",visible:!0},histBarsVA:{colors:["#1592e6","#fbc123"],direction:o.HHistDirection.LeftToRight,percentWidth:30,showValues:!1,transparencies:[30,30],valuesColor:"#424242",visible:!0}},horizlines:{pocLines:{color:"#ff0000",style:_.LineStyle.Solid,visible:!0,width:2}},polygons:{histBoxBg:{color:"#37a6ef",transparency:94}}},inputs:{first_bar_time:0,last_bar_time:0,rows:24,rowsLayout:"Number Of Rows",subscribeRealtime:!0,vaVolume:70,volume:"Up/Down"},styles:{developingPoc:{color:"#ff0000",linestyle:_.LineStyle.Solid,linewidth:1, -plottype:n.LineStudyPlotStyle.StepLine,trackPrice:!1,transparency:0,display:0},developingVAHigh:{color:"#0000ff",linestyle:_.LineStyle.Solid,linewidth:1,plottype:n.LineStudyPlotStyle.StepLine,trackPrice:!1,transparency:0,display:0},developingVALow:{color:"#0000ff",linestyle:_.LineStyle.Solid,linewidth:1,plottype:n.LineStudyPlotStyle.StepLine,trackPrice:!1,transparency:0,display:0}}},graphics:{hhists:{histBars2:{location:o.HHistLocation.Absolute,title:"Volume Profile",titles:["Up Volume","Down Volume"]},histBarsVA:{location:o.HHistLocation.Absolute,title:"Value Area",titles:["Value Area Up","Value Area Down"]}},horizlines:{pocLines:{name:"POC",showPrice:!0}},polygons:{histBoxBg:{mouseTouchable:!1,name:"Histogram Box",showBorder:!1}}},inputs:[{defval:"Number Of Rows",id:"rowsLayout",name:"Rows Layout",options:["Number Of Rows","Ticks Per Row"],type:"text"},{defval:24,id:"rows",max:1e6,min:1,name:"Row Size",type:"integer"},{defval:"Up/Down",id:"volume",name:"Volume",options:["Up/Down","Total","Delta"],type:"text"},{defval:0,id:"first_bar_time",isHidden:!0,max:253370764800,min:-253370764800,name:"First Bar Time",type:"time"},{defval:0,id:"last_bar_time",isHidden:!0,max:253370764800,min:-253370764800,name:"Last Bar Time",type:"time"},{defval:70,id:"vaVolume",max:100,min:0,name:"Value Area Volume",type:"integer"},{defval:!0,id:"subscribeRealtime",isHidden:!0,name:"SubscribeRealtime",type:"bool"}],plots:[{id:"developingPoc",type:"line"},{id:"developingVAHigh",type:"line"},{id:"developingVALow",type:"line"}],styles:{developingPoc:{histogramBase:0,title:"Developing Poc"},developingVAHigh:{histogramBase:0,title:"Developing VA High"},developingVALow:{histogramBase:0,title:"Developing VA Low"}},...e}}}const b=S({id:"VbPFixed@tv-volumebyprice-57",description:"Volume Profile Fixed Range"}),w=S({id:"VbPFixed@tv-basicstudies-152",description:"Fixed Range",is_hidden_study:!0})},19999:(e,t,i)=>{"use strict";i.d(t,{VolumeProfileOutputSeries:()=>n});var s=i(50151),r=i(78071);class n{constructor(){this._histPos=-1,this._hist=new Float64Array(2e3),this._times=new Float64Array(2e3)}addHist(e){if(this._histPos>=0){const t=this._times[this._histPos];(0,s.assert)(t<=e,"History order violation"),this._histPos+=t===e?0:1}else this._histPos+=1;if(this._histPos===this._hist.length){const e=new Float64Array(2*this._hist.length);e.set(this._hist),this._hist=e;const t=new Float64Array(this._hist.length);t.set(this._times),this._times=t}this._hist[this._histPos]=NaN,this._times[this._histPos]=e}removeLastIfNaN(){Number.isNaN(this.get(0))&&(this._histPos-=1)}get(e){(0,s.assert)(0===e);const t=this._histPos-e;return this._hist[t]}getLeftOrEqual(e){const t=(0,r.upperbound)(this._times,e,((e,t)=>e{"use strict";i.d(t,{volumeProfileVisibleRangeStudyItem:()=>v});var s=i(50151),r=i(19762),n=i(90164),o=i(36274),a=i(79999),l=i(89529),c=i(31584) -;class h extends l.VolumeByPriceExpr{constructor(e,t,i,s,r,n,o,a,l,h,d){super(e,t,i,n,new c.GraphicsList,o,!0,a,l,(()=>h),d,s,r,!1),this._firstBarTime=s,this._lastBarTime=r}update(e){this._supplyRowsLayout(this._ctx),this.timeInRequestedRange(e)&&super.update(e)}timeInRequestedRange(e){const t=this._timeScale().get(e);return this._firstBarTime<=t&&t=this._firstBarTime){const e=this._developingPocSeries.getLeftOrEqual(n),t=this._developingVAHighSeries.getLeftOrEqual(n),i=this._developingVALowSeries.getLeftOrEqual(n);r.data.push([e,t,i])}else r.data.push([NaN,NaN,NaN])}return r}time(){return this._timeSeries}open(){return this._openSeries}high(){return this._highSeries}low(){return this._lowSeries}close(){return this._closeSeries}volume(){return this._volumeSeries}developingPoc(){return this._developingPocSeries}developingVAHigh(){return this._developingVAHighSeries}developingVALow(){return this._developingVALowSeries}}const v={constructor:f,name:"Volume Profile Visible Range",metainfo:{_metainfoVersion:51,id:"VbPVisible@tv-basicstudies-49",description:"Volume Profile Visible Range",shortDescription:"VPVR",format:{type:"volume"},is_price_study:!0,linkedToSeries:!0,palettes:{},inputs:[{id:"rowsLayout",name:"Rows Layout",defval:"Number Of Rows",options:["Number Of Rows","Ticks Per Row"],type:"text"},{id:"rows",name:"Row Size",defval:24,max:1e6,min:1,type:"integer"},{id:"volume",name:"Volume",defval:"Up/Down",options:["Up/Down","Total","Delta"],type:"text"},{id:"first_visible_bar_time",name:"First Visible Bar Time",defval:0,isHidden:!0,max:253370764800,min:-253370764800,type:"time"},{id:"last_visible_bar_time",name:"Last Visible Bar Time",defval:0,isHidden:!0,max:253370764800,min:-253370764800,type:"time"},{id:"vaVolume",name:"Value Area Volume",defval:70,max:100,min:0,type:"integer"}],plots:[{id:"developingPoc",type:"line"},{id:"developingVAHigh",type:"line"},{id:"developingVALow",type:"line"}],graphics:{hhists:{histBars2:{location:n.HHistLocation.Relative,title:"Volume Profile",titles:["Up Volume","Down Volume"]},histBarsVA:{location:n.HHistLocation.Relative,title:"Value Area",titles:["Value Area Up","Value Area Down"]}},horizlines:{pocLines:{name:"POC",showPrice:!0}}},defaults:{graphics:{hhists:{histBars2:{colors:["#1592e6","#fbc123"],direction:n.HHistDirection.RightToLeft,percentWidth:30,showValues:!1,transparencies:[76,76],valuesColor:"#424242", -visible:!0},histBarsVA:{colors:["#1592e6","#fbc123"],direction:n.HHistDirection.RightToLeft,percentWidth:30,showValues:!1,transparencies:[30,30],valuesColor:"#424242",visible:!0}},horizlines:{pocLines:{color:"#ff0000",style:0,visible:!0,width:2}}},inputs:{first_visible_bar_time:0,last_visible_bar_time:0,rows:24,rowsLayout:"Number Of Rows",vaVolume:70,volume:"Up/Down"},styles:{developingPoc:{color:"#ff0000",linestyle:0,linewidth:1,plottype:9,trackPrice:!1,transparency:0,display:0},developingVAHigh:{color:"#0000ff",linestyle:0,linewidth:1,plottype:9,trackPrice:!1,transparency:0,display:0},developingVALow:{color:"#0000ff",linestyle:0,linewidth:1,plottype:9,trackPrice:!1,transparency:0,display:0}}},styles:{developingPoc:{histogramBase:0,title:"Developing Poc"},developingVAHigh:{histogramBase:0,title:"Developing VA High"},developingVALow:{histogramBase:0,title:"Developing VA Low"}}}}},43910:(e,t,i)=>{"use strict";i.d(t,{StudyEngine:()=>r});var s=i(65507);class r{constructor(e){this.runner=new s.ScriptRunner(e)}stop(){this.runner.stop()}isStarted(){return this.runner.isStarted}}},85898:(e,t,i)=>{"use strict";i.d(t,{StudyError:()=>s});class s extends Error{constructor(e){super(e),this.studyError=!0}}},43945:(e,t,i)=>{"use strict";i.d(t,{EraseAll:()=>r,EraseObj:()=>s,GraphicsCmds:()=>n});class s{constructor(e,t){this.id=e,this.type=t}primitiveData(){return{action:"one",id:this.id,type:this.type}}}class r{primitiveData(){return{action:"all"}}}class n{constructor(){this.erase=[],this.create=null,this._modified=!1}primitiveData(e){if(this.isNaN())return null;const t={},i=this.create&&this.create.primitiveData(e);return null!==i&&(t.create=i),null!==this.erase&&this.erase.length>0&&(t.erase=this.erase.map((e=>e.primitiveData()))),void 0===t.create&&void 0===t.erase?null:t}setCreate(e){this.create=e,this.create.forEachList((e=>e.setOwner(this)))}isNaN(){return(null===this.erase||0===this.erase.length)&&null===this.create}isModified(){return this._modified}setModified(e){this._modified=e}dirty(){this._modified=!0}setOwner(e){throw new Error("Unsupported")}}},79999:(e,t,i)=>{"use strict";i.d(t,{GraphicsListColl:()=>s});class s{constructor(){this._stable=[],this._variable=null,this._owner=null}addStable(e){e.setOwner(this),this._stable.push(e)}setVariable(e){this._variable=e,null!==this._variable&&this._variable.setOwner(this)}primitivesData(e){const t=[];return this._forEach((i=>t.push(...i.primitivesData(e)))),t}deleteErasedItems(){this._forEach((e=>e.deleteErasedItems()))}markPostedItems(){this._forEach((e=>e.markPostedItems()))}isNaN(){return this._all((e=>e.isNaN()))}dirty(){null!==this._owner&&this._owner.dirty()}setOwner(e){this._owner=e}_forEach(e){for(const t of this._stable)e(t);null!==this._variable&&e(this._variable)}_all(e){for(const t of this._stable)if(!e(t))return!1;return null===this._variable||e(this._variable)}}},31584:(e,t,i)=>{"use strict";i.d(t,{GraphicsList:()=>n});var s=i(29779),r=i(76958);class n{constructor(){this._items=[],this._owner=null}primitivesData(e){const t=[] -;for(const i of this._items)e.isIgnoredObj(i)||t.push(i.primitiveData());return t}get(e){return this._items[e]}set(e,t){return this.dirty(),t.setOwner(this),this._items[e]=t,t}addAtIndex(e,t){this.dirty(),t.setOwner(this),this._items[e]=t}clear(){this._unsetOwner(this._items),this._items=[],this.dirty()}addAllFromNumber(e,t){this.setOwner(t),this._items.splice(e,0,...t._items);return this._setCachedDataValid(!1),true}addAll(e){this.setOwner(e),this._items.push(...e._items);return this._setCachedDataValid(!1),true}remove(e){const t=this._items[e];return this._items.splice(e,1),t.unsetOwner(this),this.dirty(),t}getItems(){return this._items}size(){return this._items.length}add(e){e.setOwner(this),this._items.push(e);return this._setCachedDataValid(!1),true}deleteErasedItems(){this._items=this._items.filter((e=>!e.isErased()))}markPostedItems(){for(const e of this._items)e.markAsPosted()}isNaN(){if(0===this._items.length)return!0;for(const e of this._items){if(!(0,r.isNaNable)(e))return!1;if(!e.isNaN())return!1}return!0}setOwner(e){this._owner=e}dirty(){null!==this._owner&&this._owner.dirty()}_unsetOwner(e){for(const t of e)t instanceof s.GraphicsObj&&t.unsetOwner(this)}_setCachedDataValid(e){e||this.dirty()}}},29779:(e,t,i)=>{"use strict";i.d(t,{GraphicsObj:()=>l});var s=i(49581);class r{constructor(e,t,i,s){this._value=e,this._name=t,this._owner=i,this._comparer=void 0!==s?s:(e,t)=>null==e?null!=t:e===t}getName(){return this._name}set(e){const t=this._comparer(this._value,e);return t&&this._owner.dirty(),this._value=e,t}get(){return this._value}}class n{constructor(e,t,i){this._owner=null,this._value=e,this._name=t,this._owner=i}getName(){return this._name}set(e){return this._value!==e&&(this._value=e,null!==this._owner&&this._owner.dirty(),!0)}get(){return this._value}}class o extends r{constructor(e,t,i,s){super(e,t,i,s)}}class a{constructor(e){this._owner=e}createField(e,t){return new r(e,t,this)}createDoubleField(e,t){return new r(e,t,this,((e,t)=>!s.Std.equal(e,t)))}createDoubleArrayField(e,t){return new o(e,t,this,((e,t)=>{if(e===t)return!1;const i=e.length;if(t.length!==i)return!0;for(let r=0;r{"use strict";function s(e){return Boolean(e.isNaN)}i.d(t,{isNaNable:()=>s})},1386:(e,t,i)=>{"use strict";i.d(t,{JStudyDataUpdate:()=>d});var s=i(43945);class r{constructor(){this.isUpdate=!1,this.graphicsCmds=new s.GraphicsCmds,this._offsetsChanged=!1,this._disableGraphicsAndData=!1}isNaN(){return this.graphicsCmds.isNaN()}primitiveData(e){const t={};if(!this._disableGraphicsAndData){const i=this.graphicsCmds.primitiveData(e);null!==i&&(t.graphicsCmds=i)}return this.isUpdate&&(t.isUpdate=!0),void 0===t.graphicsCmds?void 0:t}disable(){this._disableGraphicsAndData=!0}checkForChangeAndResetChangedState(e){const t=this._offsetsChanged,i=this.graphicsCmds.isModified();this.graphicsCmds.setModified(!1),this._offsetsChanged=!1;return i||t||0!==e.length}}var n=i(1722),o=i(76958);function a(e){return Boolean(e.isPosted)}class l{isIgnoredObj(e,t){return l.isIgnoredObjDefault(e,t)}static isIgnoredObjDefault(e,t){if(void 0===t)return l.isIgnoredObjNaNable(e);const i=e[t];return l.isIgnoredByGeneralRules(e,t)||l.isIgnoredObjNaNable(i)||l.isIgnoredObjListOfNaNables(i)}static isIgnoredObjNaNable(e){return(0,o.isNaNable)(e)&&e.isNaN()}static isIgnoredObjListOfNaNables(e){if(!(0,n.isArray)(e))return!1;let t=!0;for(const i of e)if(!(0,o.isNaNable)(i)||!i.isNaN()){t=!1;break}return t}static isIgnoredObjPosted(e){return a(e)&&e.isPosted()}static isIgnoredObjErased(e){return a(e)&&e.isErased()}static isIgnoredByGeneralRules(e,t){const i=e[t];return(0,n.isArray)(i)&&0===i.length}}class c{isIgnoredObj(e,t){if(void 0===t)return l.isIgnoredObjDefault(e)||l.isIgnoredObjErased(e);const i=e[t];return l.isIgnoredObjDefault(e,t)||l.isIgnoredObjErased(i)}}class h{isIgnoredObj(e,t){if(void 0===t)return l.isIgnoredObjDefault(e)||l.isIgnoredObjErased(e)||l.isIgnoredObjPosted(e);const i=e[t];return l.isIgnoredObjDefault(e,t)||l.isIgnoredObjErased(i)||l.isIgnoredObjPosted(i)}}class d extends class extends class{constructor(e){this._dataObj=new r,this._isDirty=!1,this._eraseCmds=[],this._enableCmdDataStudy=e}init(e){this._dataObj.graphicsCmds.setCreate(e),this.update(!0)}dataObj(){return this._dataObj}setEraseCmds(e){this._eraseCmds=e}resetDirtyState(){this._isDirty=!1}disable(){this._dataObj.disable()}}{constructor(e){super(e),this._snapshotPredicate=new c,this._dataSnapShot={}}getData(){return this._dataSnapShot}getUpdate(){return this._isDirty?this._dataSnapShot:{}}update(e){(this._dataObj.checkForChangeAndResetChangedState(this._eraseCmds)||e)&&(null!==this._dataObj.graphicsCmds.create&&(this._dataObj.graphicsCmds.create.deleteErasedObjs(),this._dataObj.graphicsCmds.erase=[new s.EraseAll]),this._makeSnapshot(),this._isDirty=!0)}_makeSnapshot(){this._json=this._dataObj.primitiveData(this._snapshotPredicate),this._dataSnapShot={json:this._json}}}{constructor(e){super(e),this._updatePredicate=new h,this._sendShapshotOnly=!0,this._isFirstNotForcedUpdate=!0}update(e){ -(this._dataObj.checkForChangeAndResetChangedState(this._eraseCmds)||e)&&(null!==this._dataObj.graphicsCmds.create&&(this._dataObj.graphicsCmds.erase=[new s.EraseAll]),this._dataObj.isUpdate=!0,this._makeSnapshot(),null!==this._dataObj.graphicsCmds.create&&(this._dataObj.graphicsCmds.erase=this._eraseCmds),this._dataObj.isUpdate=!0,this._jsonUpdate=this._dataObj.primitiveData(this._updatePredicate),null!==this._dataObj.graphicsCmds.create&&this._dataObj.graphicsCmds.create.deleteErasedAndMarkPostedObjs(),this._sendShapshotOnly=e||this._isFirstNotForcedUpdate,this._isFirstNotForcedUpdate=Boolean(e),this._isDirty=!0)}getUpdate(){return this._isDirty?this._enableCmdDataStudy?{json:this._sendShapshotOnly?this._json:void 0,jsonUpdate:this._sendShapshotOnly?void 0:this._jsonUpdate}:{json:this._json,jsonUpdate:this._sendShapshotOnly?void 0:this._jsonUpdate}:{}}}},748:(e,t,i)=>{"use strict";i.d(t,{Container:()=>n,StudyGraphicsData:()=>r});var s=i(50151);class r{constructor(){this._horizlines=[],this._hhists=[],this._polygons=[],this._vertlines=[],this._containersCache=[],this._containerNamesCache=[],this._containersMapCache=new Map,this._addToCache("horizlines",this._horizlines),this._addToCache("hhists",this._hhists),this._addToCache("polygons",this._polygons),this._addToCache("vertlines",this._vertlines)}primitiveData(e){const t={};let i=!1;for(const s of this._containerNamesCache){const r=[],n=this.getObjsContainer(s);for(const t of n){if(t.isNaN())continue;const i=t.primitiveData(e);i.data.length>0&&r.push(i)}r.length>0&&(t[s]=r,i=!0)}return i?t:null}deleteErasedAndMarkPostedObjs(){this.forEachList((e=>{e.deleteErasedItems(),e.markPostedItems()}))}deleteErasedObjs(){this.forEachList((e=>e.deleteErasedItems()))}getObjsContainer(e){return(0,s.ensureDefined)(this._containersMapCache.get(e))}forEachList(e){for(const t of this._containersCache)for(const i of t)e(i.data)}_addToCache(e,t){this._containersCache.push(t),this._containerNamesCache.push(e),this._containersMapCache.set(e,t)}}class n{constructor(e,t){this.styleId=e,this.data=t}isNaN(){return this.data.isNaN()}primitiveData(e){return{styleId:this.styleId,data:this.data.primitivesData(e)}}}},24172:(e,t,i)=>{"use strict";const s=i(33013).getHexColorByName;var r=i(49581).Std;const n=s("color-ripe-red-100"),o=s("color-ripe-red-200"),a=s("color-ripe-red-500"),l=s("color-ripe-red-900"),c=s("color-ripe-red-a200"),h=s("color-minty-green-100"),d=s("color-minty-green-400"),u=s("color-minty-green-500");JSServer.studyLibrary=[{name:"Accumulation/Distribution",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Accumulation/Distribution",shortDescription:"Accum/Dist",is_price_study:!1,inputs:[],id:"Accumulation/Distribution@tv-basicstudies-1",scriptIdPart:"",name:"Accumulation/Distribution",format:{type:"volume"}}, -constructor:function(){this.f_0=function(e,t,i,s){return r.or(r.and(r.eq(e,t),r.eq(e,i)),r.eq(t,i))?0:(2*e-i-t)/(t-i)*s},this.main=function(e,t){this._context=e,this._input=t;var i=this.f_0(r.close(this._context),r.high(this._context),r.low(this._context),r.volume(this._context));return[r.cum(i,this._context)]}}},{name:"Accumulative Swing Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:10}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"ASI",histogramBase:0,joinPoints:!1}},description:"Accumulative Swing Index",shortDescription:"ASI",is_price_study:!1,inputs:[{id:"in_0",name:"Limit Move Value",defval:10,type:"float",min:.1,max:1e5}],id:"Accumulative Swing Index@tv-basicstudies-1",scriptIdPart:"",name:"Accumulative Swing Index",format:{type:"volume"}},constructor:function(){this.f_0=function(e,t){var i=t.new_var(r.open(t)),s=t.new_var(r.high(t)),n=t.new_var(r.low(t)),o=t.new_var(r.close(t)),a=r.abs(s-o.get(1)),l=r.abs(n-o.get(1)),c=r.abs(s-n),h=r.abs(o.get(1)-i.get(1)),d=r.max(a,l),u=r.iff(a>=r.max(l,c),a-.5*l+.25*h,r.iff(l>=r.max(a,c),l-.5*a+.25*h,c+.25*h));return r.iff(0===u,0,(o-o.get(1)+.5*(o-i)+.25*(o.get(1)-i.get(1)))/u*d/e*50)},this.f_1=function(e,t){var i=this.f_0(e,t);return r.cum(i,t)},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0);return[this.f_1(i,this._context)]}}},{name:"Advance/Decline",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:10}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Advance/Decline",shortDescription:"AD",is_price_study:!1,inputs:[{id:"in_0",name:"length",defval:10,type:"integer",min:1,max:2e3}],id:"Advance/Decline@tv-basicstudies-1",scriptIdPart:"",name:"Advance/Decline",format:{precision:2,type:"price"}},constructor:function(){this.f_0=function(e,t){return r.gt(e,t)},this.f_1=function(e,t){return r.lt(e,t)},this.f_2=function(e,t){return 0===t?e:e/t},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this.f_0(r.close(this._context),r.open(this._context)),n=this._context.new_var(s),o=r.sum(n,i,this._context),a=this.f_1(r.close(this._context),r.open(this._context)),l=this._context.new_var(a),c=r.sum(l,i,this._context);return[this.f_2(o,c)]}}},{name:"Arnaud Legoux Moving Average",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:9,in_1:.85,in_2:6}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Arnaud Legoux Moving Average",shortDescription:"ALMA",is_price_study:!0,inputs:[{id:"in_0",name:"Window Size",defval:9, -type:"integer",min:0,max:5e3},{id:"in_1",name:"Offset",defval:.85,type:"float",min:-1e12,max:1e12},{id:"in_2",name:"Sigma",defval:6,type:"float",min:-1e12,max:1e12}],id:"Arnaud Legoux Moving Average@tv-basicstudies-1",scriptIdPart:"",name:"Arnaud Legoux Moving Average",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=r.close(this._context),s=this._input(0),n=this._input(1),o=this._input(2),a=this._context.new_var(i);return[r.alma(a,s,n,o)]}}},{name:"Aroon",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FB8C00"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:14}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],styles:{plot_0:{title:"Upper",histogramBase:0,joinPoints:!1},plot_1:{title:"Lower",histogramBase:0,joinPoints:!1}},description:"Aroon",shortDescription:"Aroon",is_price_study:!1,inputs:[{id:"in_0",name:"length",defval:14,type:"integer",min:1,max:2e3}],id:"Aroon@tv-basicstudies-1",scriptIdPart:"",name:"Aroon",format:{precision:2,type:"percent"}},constructor:function(){this.f_0=function(e,t){return 100*(e+t)/t},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=r.high(this._context),n=i+1,o=this._context.new_var(s),a=r.highestbars(o,n,this._context),l=this.f_0(a,i),c=r.low(this._context),h=this._context.new_var(c),d=r.lowestbars(h,n,this._context);return[l,this.f_0(d,i)]}}},{name:"Average Price",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,id:"AveragePrice@tv-basicstudies-1",scriptIdPart:"",name:"Average Price",description:"Average Price",shortDescription:"Average Price",is_price_study:!0,plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:"#2196F3"}},inputs:{}},styles:{plot_0:{title:"Plot"}},inputs:[],format:{type:"inherit"}},constructor:function(){this.main=function(e,t){return this._context=e,this._input=t,[r.ohlc4(this._context)]}}},{name:"Average Directional Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:c}},inputs:{in_0:14,in_1:14}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"ADX",histogramBase:0,joinPoints:!1,isHidden:!1}},description:"Average Directional Index",shortDescription:"ADX",is_price_study:!1,inputs:[{id:"in_0",name:"ADX Smoothing",defval:14,type:"integer",min:-1e12,max:1e12},{id:"in_1",name:"DI Length",defval:14,type:"integer",min:-1e12,max:1e12}],id:"average_directional_Index@tv-basicstudies-1",scriptIdPart:"",name:"Average Directional Index",format:{precision:2,type:"price"}},constructor:function(){this.f_0=function(e){ -var t=this._context.new_var(r.high(this._context)),i=r.change(t),s=this._context.new_var(r.low(this._context)),n=-r.change(s),o=this._context.new_var(r.tr(void 0,this._context)),a=r.rma(o,e,this._context),l=this._context.new_var(r.and(r.gt(i,n),r.gt(i,0))?i:0),c=r.fixnan(100*r.rma(l,e,this._context)/a,this._context),h=this._context.new_var(r.and(r.gt(n,i),r.gt(n,0))?n:0);return[c,r.fixnan(100*r.rma(h,e,this._context)/a,this._context)]},this.f_1=function(e,t){var i=this.f_0(e),s=i[0],n=i[1],o=s+n,a=this._context.new_var(r.abs(s-n)/(r.eq(o,0)?1:o));return[100*r.rma(a,t,this._context)]},this.main=function(e,t){return this._context=e,this._input=t,this._context.setMinimumAdditionalDepth(this._input(0)+this._input(1)),this.f_1(this._input(1),this._input(0))}}},{name:"Average True Range",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:l}},inputs:{in_0:14}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Average True Range",shortDescription:"ATR",is_price_study:!1,inputs:[{id:"in_0",name:"length",defval:14,type:"integer",min:1,max:2e3}],id:"Average True Range@tv-basicstudies-1",scriptIdPart:"",name:"Average True Range",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){var i=t(0);return[r.atr(i,e)]}}},{name:"Awesome Oscillator",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:1,trackPrice:!1,transparency:0,visible:!0,color:"#000080"}},palettes:{palette_0:{colors:{0:{color:a,width:1,style:0},1:{color:u,width:1,style:0}}}},inputs:{}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",palette:"palette_0",target:"plot_0",type:"colorer"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Awesome Oscillator",shortDescription:"AO",is_price_study:!1,palettes:{palette_0:{colors:{0:{name:"Color 0"},1:{name:"Color 1"}}}},inputs:[],id:"Awesome Oscillator@tv-basicstudies-1",scriptIdPart:"",name:"Awesome Oscillator",format:{type:"inherit"}},constructor:function(){this.f_0=function(e,t){return e-t},this.f_1=function(e){return r.le(e,0)?0:1},this.main=function(e,t){this._context=e,this._input=t;var i=r.hl2(this._context),s=this._context.new_var(i),n=r.sma(s,5,this._context),o=this._context.new_var(i),a=r.sma(o,34,this._context),l=this.f_0(n,a),c=l,h=this._context.new_var(l),d=r.change(h);return[c,this.f_1(d)]}}},{name:"Accelerator Oscillator",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:1,trackPrice:!1,transparency:0,visible:!0,color:"#000080"}},palettes:{palette_0:{colors:{0:{color:a,width:1,style:0},1:{color:u,width:1,style:0}}}},inputs:{}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",palette:"palette_0",target:"plot_0",type:"colorer"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}}, -description:"Accelerator Oscillator",shortDescription:"AO",is_price_study:!1,palettes:{palette_0:{colors:{0:{name:"Color 0"},1:{name:"Color 1"}}}},inputs:[],id:"Accelerator Oscillator@tv-basicstudies-1",scriptIdPart:"",name:"Accelerator Oscillator",format:{type:"inherit"}},constructor:function(){this.f_0=function(e,t){return e-t},this.f_1=function(e){return r.le(e,0)?0:1},this.main=function(e,t){this._context=e,this._input=t;var i=r.hl2(this._context),s=this._context.new_var(i),n=r.sma(s,5,this._context),o=this._context.new_var(i),a=r.sma(o,34,this._context),l=this.f_0(n,a),c=this._context.new_var(l),h=r.sma(c,5,this._context),d=this.f_0(l,h),u=this._context.new_var(d),p=r.change(u);return[d,this.f_1(p)]}}},{name:"Balance of Power",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:c}},inputs:{}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Balance of Power",shortDescription:"Balance of Power",is_price_study:!1,inputs:[],id:"Balance of Power@tv-basicstudies-1",scriptIdPart:"",name:"Balance of Power",format:{precision:2,type:"price"}},constructor:function(){this.f_0=function(e,t,i,s){return(e-t)/(i-s)},this.main=function(e,t){return this._context=e,this._input=t,[this.f_0(r.close(this._context),r.open(this._context),r.high(this._context),r.low(this._context))]}}},{name:"Bollinger Bands",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FF6D00"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_2:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},filledAreasStyle:{fill_0:{color:"#2196F3",transparency:95,visible:!0}},inputs:{in_0:20,in_1:2}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"}],styles:{plot_0:{title:"Median",histogramBase:0,joinPoints:!1},plot_1:{title:"Upper",histogramBase:0,joinPoints:!1},plot_2:{title:"Lower",histogramBase:0,joinPoints:!1}},description:"Bollinger Bands",shortDescription:"BB",is_price_study:!0,filledAreas:[{id:"fill_0",objAId:"plot_1",objBId:"plot_2",type:"plot_plot",title:"Plots Background"}],inputs:[{id:"in_0",name:"length",defval:20,type:"integer",min:1,max:1e4},{id:"in_1",name:"mult",defval:2,type:"float",min:.001,max:50}],id:"Bollinger Bands@tv-basicstudies-1",scriptIdPart:"",name:"Bollinger Bands",format:{type:"inherit"}},constructor:function(){this.f_0=function(e,t){return e*t},this.f_1=function(e,t){return e+t},this.f_2=function(e,t){return e-t},this.main=function(e,t){this._context=e,this._input=t;var i=r.close(this._context),s=this._input(0),n=this._input(1),o=this._context.new_var(i),a=r.sma(o,s,this._context),l=this._context.new_var(i),c=r.stdev(l,s,this._context),h=this.f_0(n,c) -;return[a,this.f_1(a,h),this.f_2(a,h)]}}},{name:"Bollinger Bands %B",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:d}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:1},{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:0}],filledAreasStyle:{fill_0:{color:"#26A69A",transparency:90,visible:!0}},inputs:{in_0:20,in_1:2}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,zorder:1}},description:"Bollinger Bands %B",shortDescription:"BB %B",is_price_study:!1,bands:[{id:"hline_0",name:"UpperLimit",zorder:-1.1},{id:"hline_1",name:"LowerLimit",zorder:-1.11}],filledAreas:[{id:"fill_0",objAId:"hline_0",objBId:"hline_1",type:"hline_hline",title:"Hlines Background",zorder:-2}],inputs:[{id:"in_0",name:"length",defval:20,type:"integer",min:1,max:1e4},{id:"in_1",name:"mult",defval:2,type:"float",min:.001,max:50}],id:"Bollinger Bands %B@tv-basicstudies-1",scriptIdPart:"",name:"Bollinger Bands %B",format:{precision:2,type:"price"},usePlotsZOrder:!0},constructor:function(){this.f_0=function(e,t){return e*t},this.f_1=function(e,t){return e+t},this.f_2=function(e,t){return e-t},this.f_3=function(e,t,i){return(e-t)/(i-t)},this.main=function(e,t){this._context=e,this._input=t;var i=r.close(this._context),s=this._input(0),n=this._input(1),o=this._context.new_var(i),a=r.sma(o,s,this._context),l=this._context.new_var(i),c=r.stdev(l,s,this._context),h=this.f_0(n,c),d=this.f_1(a,h),u=this.f_2(a,h);return[this.f_3(i,u,d)]}}},{name:"Bollinger Bands Width",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FF6D00"}},inputs:{in_0:20,in_1:2}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Bollinger Bands Width",shortDescription:"BBW",is_price_study:!1,inputs:[{id:"in_0",name:"length",defval:20,type:"integer",min:1,max:1e4},{id:"in_1",name:"mult",defval:2,type:"float",min:.001,max:50}],id:"Bollinger Bands Width@tv-basicstudies-1",scriptIdPart:"",name:"Bollinger Bands Width",format:{precision:2,type:"price"}},constructor:function(){this.f_0=function(e,t){return e*t},this.f_1=function(e,t){return e+t},this.f_2=function(e,t){return e-t},this.f_3=function(e,t,i){return(e-t)/i},this.main=function(e,t){this._context=e,this._input=t;var i=r.close(this._context),s=this._input(0),n=this._input(1),o=this._context.new_var(i),a=r.sma(o,s,this._context),l=this._context.new_var(i),c=r.stdev(l,s,this._context),h=this.f_0(n,c),d=this.f_1(a,h),u=this.f_2(a,h);return[this.f_3(d,u,a)]}}},{name:"Chaikin Money Flow",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#43A047"}},bands:[{color:"#787B86",linestyle:2,linewidth:1, -visible:!0,value:0}],inputs:{in_0:20}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,zorder:1}},description:"Chaikin Money Flow",shortDescription:"CMF",is_price_study:!1,bands:[{id:"hline_0",name:"Zero",zorder:-1}],inputs:[{id:"in_0",name:"length",defval:20,type:"integer",min:1,max:2e3}],id:"Chaikin Money Flow@tv-basicstudies-1",scriptIdPart:"",name:"Chaikin Money Flow",format:{precision:2,type:"price"},usePlotsZOrder:!0},constructor:function(){this.f_0=function(e,t,i,s){return r.or(r.and(r.eq(e,t),r.eq(e,i)),r.eq(t,i))?0:(2*e-i-t)/(t-i)*s},this.f_1=function(e,t){return e/t},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this.f_0(r.close(this._context),r.high(this._context),r.low(this._context),r.volume(this._context)),n=this._context.new_var(s),o=r.sum(n,i,this._context),a=r.volume(this._context),l=this._context.new_var(a),c=r.sum(l,i,this._context);return[this.f_1(o,c)]}}},{name:"Chaikin Oscillator",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#EC407A"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:0}],inputs:{in_0:3,in_1:10}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,zorder:1}},description:"Chaikin Oscillator",shortDescription:"Chaikin Osc",is_price_study:!1,bands:[{id:"hline_0",name:"Zero",zorder:-1}],inputs:[{id:"in_0",name:"short",defval:3,type:"integer",min:1,max:2e3},{id:"in_1",name:"long",defval:10,type:"integer",min:1,max:2e3}],id:"Chaikin Oscillator@tv-basicstudies-1",scriptIdPart:"",name:"Chaikin Oscillator",format:{type:"volume"},usePlotsZOrder:!0},constructor:function(){this.f_0=function(e,t){return e-t},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=r.accdist(this._context),o=this._context.new_var(n),a=r.ema(o,i,this._context),l=this._context.new_var(n),c=r.ema(l,s,this._context);return[this.f_0(a,c)]}}},{name:"Chaikin Volatility",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!1,id:"Chaikin Volatility@tv-basicstudies-1",scriptIdPart:"",name:"Chaikin Volatility",description:"Chaikin Volatility",shortDescription:"Chaikin Volatility",plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:"#AB47BC"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:0}],inputs:{periods:10,rocLookback:10}},styles:{plot_0:{title:"Plot",zorder:1}},bands:[{id:"hline_0",name:"Zero",zorder:-1}],inputs:[{id:"periods",type:"integer",name:"Periods"},{id:"rocLookback",type:"integer",name:"Rate of Change Lookback"}],format:{type:"volume"},usePlotsZOrder:!0},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,this.period=this._input(0),this.rocLookback=this._input(1)},this.main=function(e,t){this._context=e,this._input=t, -this._context.setMinimumAdditionalDepth(this.period+this.rocLookback);var i=this._context.new_var(r.high(this._context)-r.low(this._context)),s=this._context.new_var(r.ema(i,this.period,this._context));return[r.roc(s,this.rocLookback)]}}},{name:"Chande Kroll Stop",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FF6D00"}},inputs:{in_0:10,in_1:1,in_2:9}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],styles:{plot_0:{title:"Long",histogramBase:0,joinPoints:!1},plot_1:{title:"Short",histogramBase:0,joinPoints:!1}},description:"Chande Kroll Stop",shortDescription:"Chande Kroll Stop",is_price_study:!0,inputs:[{id:"in_0",name:"p",defval:10,type:"integer",min:1,max:4999},{id:"in_1",name:"x",defval:1,type:"integer",min:1,max:1e12},{id:"in_2",name:"q",defval:9,type:"integer",min:1,max:1e12}],id:"Chande Kroll Stop@tv-basicstudies-1",scriptIdPart:"",name:"Chande Kroll Stop",format:{type:"inherit"}},constructor:function(){this.f_0=function(e,t,i){return e-t*i},this.f_1=function(e,t,i){return e+t*i},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=this._input(2),o=r.high(this._context),a=this._context.new_var(o),l=r.highest(a,i,this._context),c=r.atr(i,this._context),h=this.f_0(l,s,c),d=this._context.new_var(o),u=r.lowest(d,i,this._context),p=this.f_1(u,s,c),_=this._context.new_var(h),m=r.highest(_,n,this._context),g=this._context.new_var(p);return[r.lowest(g,n,this._context),m]}}},{name:"Chande Momentum Oscillator",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:9}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Chande Momentum Oscillator",shortDescription:"ChandeMO",is_price_study:!1,inputs:[{id:"in_0",name:"length",defval:9,type:"integer",min:1,max:2e3}],id:"Chande Momentum Oscillator@tv-basicstudies-1",scriptIdPart:"",name:"Chande Momentum Oscillator",format:{type:"price",precision:2}},constructor:function(){this.f_0=function(e){return r.ge(e,0)?e:0},this.f_1=function(e){return r.ge(e,0)?0:-e},this.f_2=function(e,t){return 100*e/t},this.f_3=function(e,t){return this.f_2(e-t,e+t)},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=r.close(this._context),n=this._context.new_var(s),o=r.change(n),a=this.f_0(o),l=this.f_1(o),c=this._context.new_var(a),h=r.sum(c,i,this._context),d=this._context.new_var(l),u=r.sum(d,i,this._context);return[this.f_3(h,u)]}}},{name:"Chop Zone",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:5,trackPrice:!1,transparency:0,visible:!0,color:"#000080"}},palettes:{palette_0:{ -colors:{0:{color:"#26C6DA",width:1,style:0},1:{color:"#43A047",width:1,style:0},2:{color:"#A5D6A7",width:1,style:0},3:{color:u,width:1,style:0},4:{color:"#D50000",width:1,style:0},5:{color:"#E91E63",width:1,style:0},6:{color:"#FF6D00",width:1,style:0},7:{color:"#FFB74D",width:1,style:0},8:{color:"#FDD835",width:1,style:0}}}},inputs:{}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",palette:"palette_0",target:"plot_0",type:"colorer"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,isHidden:!1}},description:"Chop Zone",shortDescription:"Chop Zone",is_price_study:!1,palettes:{palette_0:{colors:{0:{name:"Color 0"},1:{name:"Color 1"},2:{name:"Color 2"},3:{name:"Color 3"},4:{name:"Color 4"},5:{name:"Color 5"},6:{name:"Color 6"},7:{name:"Color 7"},8:{name:"Color 8"}},valToIndex:{0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8}}},inputs:[],id:"chop_zone@tv-basicstudies-1",scriptIdPart:"",name:"Chop Zone",format:{precision:0,type:"price"}},constructor:function(){this.f_0=function(){var e=r.close(this._context),t=r.hlc3(this._context),i=this._context.new_var(r.high(this._context)),s=r.highest(i,30,this._context),n=r.lowest(i,30,this._context),o=25/(s-n)*n,a=this._context.new_var(e),l=this._context.new_var(r.ema(a,34,this._context)),c=(l.get(1)-l.get(0))/t*o,h=r.sqrt(1+c*c),d=r.round(180*r.acos(1/h)/3.141592653589793),u=r.iff(r.gt(c,0),-d,d),p=r.and(r.gt(u,-2.14),r.le(u,-.71))?7:8,_=r.and(r.gt(u,-3.57),r.le(u,-2.14))?6:p,m=r.and(r.gt(u,-5),r.le(u,-3.57))?5:_,g=r.le(u,-5)?4:m,f=r.and(r.lt(u,2.14),r.ge(u,.71))?3:g,v=r.and(r.lt(u,3.57),r.ge(u,2.14))?2:f,y=r.and(r.lt(u,5),r.ge(u,3.57))?1:v;return[1,r.ge(u,5)?0:y]},this.main=function(e,t){return this._context=e,this._input=t,this.f_0()}}},{name:"Choppiness Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:61.8},{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:38.2}],filledAreasStyle:{fill_0:{color:"#2196F3",transparency:90,visible:!0}},inputs:{in_0:14}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,zorder:1}},description:"Choppiness Index",shortDescription:"CHOP",is_price_study:!1,bands:[{id:"hline_0",name:"UpperLimit",zorder:-1.1},{id:"hline_1",name:"LowerLimit",zorder:-1.11}],filledAreas:[{id:"fill_0",objAId:"hline_0",objBId:"hline_1",type:"hline_hline",title:"Hlines Background",zorder:-2}],inputs:[{id:"in_0",name:"length",defval:14,type:"integer",min:1,max:2e3}],id:"Choppiness Index@tv-basicstudies-1",scriptIdPart:"",name:"Choppiness Index",format:{type:"price",precision:2},usePlotsZOrder:!0},constructor:function(){this.f_0=function(e,t,i,s){return 100*r.log10(e/(t-i))/s},this.main=function(e,t){this._context=e,this._input=t -;var i=this._input(0),s=r.atr(1,this._context),n=this._context.new_var(s),o=r.sum(n,i,this._context),a=r.high(this._context),l=this._context.new_var(a),c=r.highest(l,i,this._context),h=r.low(this._context),d=this._context.new_var(h),u=r.lowest(d,i,this._context),p=r.log10(i);return[this.f_0(o,c,u,p)]}}},{name:"Commodity Channel Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},smoothedMA:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!1}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:100},{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:-100}],filledAreasStyle:{fill_0:{color:"#2196F3",transparency:90,visible:!0}},inputs:{in_0:20,smoothingLine:"SMA",smoothingLength:20}},plots:[{id:"plot_0",type:"line"},{id:"smoothedMA",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,zorder:2},smoothedMA:{title:"Smoothed MA",histogramBase:0,joinPoints:!1,zorder:1}},description:"Commodity Channel Index",shortDescription:"CCI",is_price_study:!1,bands:[{id:"hline_0",name:"UpperLimit",zorder:-1.1},{id:"hline_1",name:"LowerLimit",zorder:-1.11}],filledAreas:[{id:"fill_0",objAId:"hline_0",objBId:"hline_1",type:"hline_hline",title:"Hlines Background",zorder:-2}],inputs:[{id:"in_0",name:"length",defval:20,type:"integer",min:1,max:2e3},{id:"smoothingLine",name:"Smoothing Line",defval:"SMA",type:"text",options:["SMA","EMA","WMA"],hideWhenPlotsHidden:["smoothedMA"]},{id:"smoothingLength",name:"Smoothing Length",defval:20,type:"integer",min:1,max:1e4,hideWhenPlotsHidden:["smoothedMA"]}],id:"Commodity Channel Index@tv-basicstudies-1",scriptIdPart:"",name:"Commodity Channel Index",format:{precision:2,type:"price"},usePlotsZOrder:!0},constructor:function(){this.f_0=function(e,t,i){return(e-t)/(.015*i)},this.main=function(e,t){this._context=e,this._input=t;var i=r.hlc3(this._context),s=this._input(0),n=this._input(1),o=this._input(2);this._context.setMinimumAdditionalDepth(s+o);var a,l=this._context.new_var(i),c=r.sma(l,s,this._context),h=this._context.new_var(i),d=r.dev(h,s,this._context),u=this.f_0(i,c,d),p=this._context.new_var(u);return"EMA"===n?a=r.ema(p,o,this._context):"WMA"===n?a=r.wma(p,o,this._context):"SMA"===n&&(a=r.sma(p,o,this._context)),[u,a]}}},{name:"Connors RSI",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:70},{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:30}],filledAreasStyle:{fill_0:{color:"#2196F3",transparency:90,visible:!0}},inputs:{in_0:3,in_1:2,in_2:100}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"CRSI",histogramBase:0,joinPoints:!1,zorder:1}},description:"Connors RSI",shortDescription:"CRSI",is_price_study:!1,bands:[{id:"hline_0",name:"UpperLimit", -zorder:-1.1},{id:"hline_1",name:"LowerLimit",zorder:-1.11}],filledAreas:[{id:"fill_0",objAId:"hline_0",objBId:"hline_1",type:"hline_hline",title:"Hlines Background",zorder:-2}],inputs:[{id:"in_0",name:"RSI Length",defval:3,type:"integer",min:1},{id:"in_1",name:"UpDown Length",defval:2,type:"integer",min:1},{id:"in_2",name:"ROC Length",defval:100,type:"integer",min:1}],id:"Connors RSI@tv-basicstudies-1",scriptIdPart:"",name:"Connors RSI",format:{precision:2,type:"price"},usePlotsZOrder:!0},constructor:function(){var e;this.f_1=function(e,t,i){var s=i.new_var(r.max(r.change(e),0));return r.rma(s,t,i)},this.f_2=function(e,t,i){var s=i.new_var(-r.min(r.change(e),0));return r.rma(s,t,i)},this.f_3=(e=0,function(t){var i=t.get(0),s=t.get(1);return e=i===s?0:i>s?r.nz(e)<=0?1:r.nz(e)+1:r.nz(e)>=0?-1:r.nz(e)-1,this._context.new_var(e)}),this.main=function(e,t){this._context=e,this._input=t;var i=r.close(this._context),s=this._context.new_var(i),n=this._input(0),o=this._input(1),a=this._input(2);this._context.setMinimumAdditionalDepth(a);var l=r.rsi(this.f_1(s,n,this._context),this.f_2(s,n,this._context)),c=this.f_3(s),h=r.rsi(this.f_1(c,o,this._context),this.f_2(c,o,this._context)),d=this._context.new_var(r.roc(s,1)),u=r.percentrank(d,a);return[r.avg(l,h,u)]}}},{name:"Coppock Curve",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:10,in_1:14,in_2:11}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Coppock Curve",shortDescription:"Coppock Curve",is_price_study:!1,inputs:[{id:"in_0",name:"WMA Length",defval:10,type:"integer",min:-1e12,max:5e3},{id:"in_1",name:"Long RoC Length",defval:14,type:"integer",min:1,max:4999},{id:"in_2",name:"Short RoC Length",defval:11,type:"integer",min:1,max:4999}],id:"Coppock Curve@tv-basicstudies-1",scriptIdPart:"",name:"Coppock Curve",format:{type:"inherit"}},constructor:function(){this.f_0=function(e,t){return e+t},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=this._input(2);this._context.setMinimumAdditionalDepth(i+Math.max(s,n));var o=r.close(this._context),a=this._context.new_var(o),l=r.roc(a,s),c=this._context.new_var(o),h=r.roc(c,n),d=this.f_0(l,h),u=this._context.new_var(d);return[r.wma(u,i,this._context)]}}},{name:"Correlation Coeff",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:4,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:"",in_1:20}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Correlation Coefficient",shortDescription:"CC",is_price_study:!1,inputs:[{id:"in_0",name:"sym",defval:"",type:"symbol"},{id:"in_1",name:"length",defval:20,type:"integer",min:1,max:2e3}],id:"Correlation Coeff@tv-basicstudies-1",scriptIdPart:"", -name:"Correlation Coeff",format:{precision:2,type:"price"}},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,this._context.new_sym(this._input(0),r.period(this._context))},this.main=function(e,t){this._context=e,this._input=t;var i=this._context.new_unlimited_var(this._context.symbol.time),s=(this._input(0),r.period(this._context),r.close(this._context)),n=this._input(1);this._context.select_sym(1);var o=this._context.new_unlimited_var(this._context.symbol.time),a=r.close(this._context),l=this._context.new_unlimited_var(a);this._context.select_sym(0);var c=l.adopt(o,i,0),h=this._context.new_var(s),d=this._context.new_var(c);return[r.correlation(h,d,n,this._context)]}}},{name:"Correlation - Log",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!1,id:"Correlation - Log@tv-basicstudies-1",scriptIdPart:"",name:"Correlation - Log",description:"Correlation - Log",shortDescription:"Correlation - Log",plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:"#2196F3"}},inputs:{instrument:"",instrument2:"",periods:25}},styles:{plot_0:{title:"Plot"}},inputs:[{id:"instrument",name:"Instrument 1",type:"symbol",defval:"",confirm:!0},{id:"instrument2",name:"Instrument 2",type:"symbol",defval:"",confirm:!0},{id:"periods",name:"Periods",type:"integer",defval:25}],format:{precision:2,type:"price"}},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,this._context.new_sym(this._input(0),r.period(this._context)),this._context.new_sym(this._input(1),r.period(this._context)),this.period=this._input(2)},this.correlationLog=function(e,t,i,s){var n=r.sma(e,i,s),o=r.sma(t,i,s),a=s.new_var(e.get()*t.get());return(r.sma(a,i,s)-n*o)/Math.sqrt(r.variance2(e,n,i)*r.variance2(t,o,i))},this.main=function(e,t){this._context=e,this._input=t;var i=this._context.new_var(this._context.symbol.time);this._context.select_sym(2);var s=this._context.new_var(r.close(this._context)),n=this._context.new_var(r.log(s.get()/s.get(1))),o=this._context.new_var(this._context.symbol.time);this._context.select_sym(1);var a=this._context.new_var(this._context.symbol.time),l=this._context.new_var(r.close(this._context)),c=this._context.new_var(r.log(l.get()/l.get(1))),h=this._context.new_var(n.adopt(o,a,0)),d=this._context.new_var(this.correlationLog(c,h,this.period,this._context)),u=this._context.new_var(d.adopt(a,i,0)).get(),p=r.round(1e3*u)/1e3;return this._context.select_sym(0),[p]}}},{name:"Detrended Price Oscillator",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#43A047"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:0}],inputs:{in_0:21,in_1:!1}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"DPO",histogramBase:0,joinPoints:!1,isHidden:!1,zorder:1}},description:"Detrended Price Oscillator",shortDescription:"DPO",is_price_study:!1, -is_hidden_study:!1,id:"detrended_price_oscillator@tv-basicstudies-1",bands:[{id:"hline_0",name:"Zero",isHidden:!1,zorder:-1}],inputs:[{id:"in_0",name:"Period",defval:21,type:"integer",min:1,max:1e12},{id:"in_1",name:"isCentered",defval:!1,type:"bool"}],scriptIdPart:"",name:"Detrended Price Oscillator",format:{type:"price",precision:2},usePlotsZOrder:!0},constructor:function(){this.f_0=function(){var e=this._input(0),t=this._input(1),i=Math.floor(e/2+1);this._context.setMinimumAdditionalDepth(e+i);var s=this._context.new_var(r.close(this._context)),n=this._context.new_var(r.sma(s,e,this._context)),o=this._context.new_var(r.close(this._context)).get(i)-n,a=r.close(this._context)-n.get(i);return[t?o:a,t?-i:0]},this.main=function(e,t){this._context=e,this._input=t;var i=this.f_0();return[{value:i[0],offset:i[1]}]}}},{name:"Directional Movement Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FF6D00"},plot_3:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#F50057"},plot_2:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FFA726"},plot_4:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#ab47bc"}},inputs:{in_0:14,in_1:14}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"},{id:"plot_3",type:"line"},{id:"plot_4",type:"line"}],styles:{plot_0:{title:"+DI",histogramBase:0,joinPoints:!1},plot_1:{title:"-DI",histogramBase:0,joinPoints:!1},plot_2:{title:"DX",histogramBase:0,joinPoints:!1},plot_3:{title:"ADX",histogramBase:0,joinPoints:!1},plot_4:{title:"ADXR",histogramBase:0,joinPoints:!1}},description:"Directional Movement",shortDescription:"DMI",is_price_study:!1,inputs:[{id:"in_0",name:"DI Length",defval:14,type:"integer",min:1,max:2e3},{id:"in_1",name:"ADX Smoothing",defval:14,type:"integer",min:1,max:50}],id:"Directional Movement Index@tv-basicstudies-1",scriptIdPart:"",name:"Directional Movement Index",format:{precision:4,type:"price"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1);return this._context.setMinimumAdditionalDepth(2*i+s),r.dmi(i,s,this._context)}}},{name:"Donchian Channels",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_2:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FF6D00"}},filledAreasStyle:{fill_0:{color:"#2196F3",transparency:95,visible:!0}},inputs:{in_0:20}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"}],styles:{plot_0:{ -title:"Lower",histogramBase:0,joinPoints:!1},plot_1:{title:"Upper",histogramBase:0,joinPoints:!1},plot_2:{title:"Basis",histogramBase:0,joinPoints:!1}},description:"Donchian Channels",shortDescription:"DC",is_price_study:!0,filledAreas:[{id:"fill_0",objAId:"plot_1",objBId:"plot_0",type:"plot_plot",title:"Plots Background"}],inputs:[{id:"in_0",name:"length",defval:20,type:"integer",min:1,max:2e3}],id:"Donchian Channels@tv-basicstudies-1",scriptIdPart:"",name:"Donchian Channels",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=r.low(this._context),n=this._context.new_var(s),o=r.lowest(n,i,this._context),a=r.high(this._context),l=this._context.new_var(a),c=r.highest(l,i,this._context);return[o,c,r.avg(c,o)]}}},{name:"Double Exponential Moving Average",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#43A047"}},inputs:{in_0:9}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Double EMA",shortDescription:"DEMA",is_price_study:!0,inputs:[{id:"in_0",name:"length",defval:9,type:"integer",min:1,max:1e4}],id:"Double Exponential Moving Average@tv-basicstudies-1",scriptIdPart:"",name:"Double Exponential Moving Average",format:{type:"inherit"}},constructor:function(){this.f_0=function(e,t){return 2*e-t},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0);this._context.setMinimumAdditionalDepth(2*i);var s=r.close(this._context),n=this._context.new_var(s),o=r.ema(n,i,this._context),a=this._context.new_var(o),l=r.ema(a,i,this._context);return[this.f_0(o,l)]}}},{name:"Ease of Movement",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#43A047"}},inputs:{in_0:1e4,in_1:14}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Ease Of Movement",shortDescription:"EOM",is_price_study:!1,inputs:[{id:"in_0",name:"Divisor",defval:1e4,type:"integer",min:1,max:1e9},{id:"in_1",name:"length",defval:14,type:"integer",min:1,max:2e3}],id:"Ease of Movement@tv-basicstudies-1",scriptIdPart:"",name:"Ease of Movement",format:{type:"volume"}},constructor:function(){this.f_0=function(e,t,i,s,r){return e*t*(i-s)/r},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=r.hl2(this._context),o=this._context.new_var(n),a=r.change(o),l=this.f_0(i,a,r.high(this._context),r.low(this._context),r.volume(this._context)),c=this._context.new_var(l);return[r.sma(c,s,this._context)]}}},{name:"Elders Force Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:a}},bands:[{color:"#787B86",linestyle:2, -linewidth:1,visible:!0,value:0}],inputs:{in_0:13}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,zorder:1}},description:"Elder's Force Index",shortDescription:"EFI",is_price_study:!1,bands:[{id:"hline_0",name:"Zero",zorder:-1}],inputs:[{id:"in_0",name:"length",defval:13,type:"integer",min:1,max:2e3}],id:"Elders Force Index@tv-basicstudies-1",scriptIdPart:"",name:"Elders Force Index",format:{type:"volume"},usePlotsZOrder:!0},constructor:function(){this.f_0=function(e,t){return e*t},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=r.close(this._context),n=this._context.new_var(s),o=r.change(n),a=this.f_0(o,r.volume(this._context)),l=this._context.new_var(a);return[r.ema(l,i,this._context)]}}},{name:"EMA Cross",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FF6D00"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#43A047"},plot_2:{linestyle:0,linewidth:4,plottype:3,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:9,in_1:26}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"}],styles:{plot_0:{title:"Short",histogramBase:0,joinPoints:!1},plot_1:{title:"Long",histogramBase:0,joinPoints:!1},plot_2:{title:"Crosses",histogramBase:0,joinPoints:!1}},description:"EMA Cross",shortDescription:"EMA Cross",is_price_study:!0,inputs:[{id:"in_0",name:"Short",defval:9,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["plot_0","plot_2"]},{id:"in_1",name:"Long",defval:26,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["plot_1","plot_2"]}],id:"EMA Cross@tv-basicstudies-1",scriptIdPart:"",name:"EMA Cross",format:{type:"inherit"}},constructor:function(){this.f_0=function(e,t){return e?t:r.na()},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=r.close(this._context),o=this._context.new_var(n),a=r.ema(o,i,this._context),l=this._context.new_var(n),c=r.ema(l,s,this._context),h=a,d=c,u=r.cross(a,c,this._context);return[h,d,this.f_0(u,a)]}}},{name:"Envelopes",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FF6D00"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_2:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},filledAreasStyle:{fill_0:{color:"#2196F3",transparency:95,visible:!0}},inputs:{in_0:20,in_1:10,in_2:10,in_3:"Simple",in_4:"close"}},plots:[{id:"plot_1",type:"line"},{id:"plot_0",type:"line"},{id:"plot_2",type:"line"}],styles:{plot_0:{title:"Average",histogramBase:0,joinPoints:!1},plot_1:{title:"Upper",histogramBase:0,joinPoints:!1},plot_2:{title:"Lower",histogramBase:0,joinPoints:!1}},description:"Envelopes",shortDescription:"Envelopes", -is_price_study:!0,filledAreas:[{id:"fill_0",objAId:"plot_1",objBId:"plot_2",type:"plot_plot",title:"Plots Background"}],inputs:[{id:"in_0",name:"Length",defval:20,type:"integer",min:1,max:2e3},{id:"in_1",name:"Upper Percentage",defval:2,type:"float",min:0},{id:"in_2",name:"Lower Percentage",defval:2,type:"float",min:0},{id:"in_3",name:"Method",type:"text",defval:"Simple",options:["Simple","Exponential","Weighted"]},{id:"in_4",name:"Source",defval:"close",type:"source",options:["open","high","low","close","hl2","hlc3","ohlc4"]}],id:"Envelope@tv-basicstudies-1",scriptIdPart:"",name:"Envelopes",format:{type:"inherit"}},constructor:function(){this.f_0=function(e,t){return e*(1+t)},this.f_1=function(e,t){return e*(1-t)},this.main=function(e,t){this._context=e,this._input=t;var i=this._context.new_var(r[this._input(4)](this._context)),s=r.sma(i,this._input(0),this._context);return"Exponential"===this._input(3)?s=r.ema(i,this._input(0),this._context):"Weighted"===this._input(3)&&(s=r.wma(i,this._input(0),this._context)),[this.f_0(s,this._input(1)/100),s,this.f_1(s,this._input(2)/100)]}}},{name:"Standard Error",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!1,id:"Standard Error@tv-basicstudies-1",scriptIdPart:"",name:"Standard Error",description:"Standard Error",shortDescription:"Standard Error",plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:"#FF6D00"}},inputs:{length:14}},styles:{plot_0:{title:"Plot"}},inputs:[{id:"length",type:"integer",name:"Length",min:3}],format:{precision:2,type:"price"}},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,this.period=this._input(0)},this.main=function(e,t){this._context=e,this._input=t;for(var i,s,n=this._context.new_var(r.close(this._context)),o=0,a=0,l=0;l0?1:3,i=r.change(this._context.new_var(e));return t-(r.le(i,0)?0:1)},this.main=function(e,t){this._context=e,this._input=t;var i=r[this._input(2)](this._context),s=this._input(0),n=this._input(1),o=this._input(3);this._context.setMinimumAdditionalDepth(Math.max(s,n)+o) -;var a=this._context.new_var(i),l=r.ema(a,s,this._context),c=this._context.new_var(i),h=r.ema(c,n,this._context),d=this.f_0(l,h),u=this._context.new_var(d),p=r.ema(u,o,this._context),_=this.f_0(d,p);return[_,d,p,this.f_1(_)]}}},{name:"Moving Average Exponential",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},smoothedMA:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!1}},inputs:{length:9,source:"close",offset:0,smoothingLine:"SMA",smoothingLength:9}},plots:[{id:"plot_0",type:"line"},{id:"smoothedMA",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1},smoothedMA:{title:"Smoothed MA",histogramBase:0,joinPoints:!1}},description:"Moving Average Exponential",shortDescription:"EMA",is_price_study:!0,inputs:[{id:"length",name:"Length",defval:9,type:"integer",min:1,max:1e4},{id:"source",name:"Source",defval:"close",type:"source",options:["open","high","low","close","hl2","hlc3","ohlc4"]},{id:"offset",name:"Offset",defval:0,type:"integer",min:-1e4,max:1e4},{id:"smoothingLine",name:"Smoothing Line",defval:"SMA",type:"text",options:["SMA","EMA","WMA"],hideWhenPlotsHidden:["smoothedMA"]},{id:"smoothingLength",name:"Smoothing Length",defval:9,type:"integer",min:1,max:1e4,hideWhenPlotsHidden:["smoothedMA"]}],id:"Moving Average Exponential@tv-basicstudies-1",scriptIdPart:"",name:"Moving Average Exponential",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=r[this._input(1)](this._context),s=this._input(0),n=this._input(2),o=this._input(3),a=this._input(4);this._context.setMinimumAdditionalDepth(s+a);var l,c=this._context.new_var(i),h=r.ema(c,s,this._context),d=this._context.new_var(h);return"EMA"===o?l=r.ema(d,a,this._context):"WMA"===o?l=r.wma(d,a,this._context):"SMA"===o&&(l=r.sma(d,a,this._context)),[{value:h,offset:n},{value:l,offset:n}]}}},{name:"Moving Average Weighted",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:9,in_1:"close",in_2:0}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Moving Average Weighted",shortDescription:"WMA",is_price_study:!0,inputs:[{id:"in_0",name:"Length",defval:9,type:"integer",min:1,max:2e3},{id:"in_1",name:"Source",defval:"close",type:"source",options:["open","high","low","close","hl2","hlc3","ohlc4"]},{id:"in_2",name:"Offset",defval:0,type:"integer",min:-1e4,max:1e4}],id:"Moving Average Weighted@tv-basicstudies-1",scriptIdPart:"",name:"Moving Average Weighted",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=r[this._input(1)](this._context),s=this._input(0),n=this._input(2),o=this._context.new_var(i);return[{value:r.wma(o,s,this._context),offset:n}]}}},{ -name:"Moving Average Double",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,id:"Moving Average Double@tv-basicstudies-1",scriptIdPart:"",name:"Moving Average Double",description:"Moving Average Double",shortDescription:"Moving Average Double",is_price_study:!0,plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:"#FF6D00"},plot_1:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:"#2196F3"}},inputs:{firstPeriods:14,secondPeriods:21,method:"Simple"}},styles:{plot_0:{title:"Plot 1"},plot_1:{title:"Plot 2"}},inputs:[{id:"firstPeriods",name:"1st Period",type:"integer",defval:14,min:1,max:1e4},{id:"secondPeriods",name:"2nd Period",type:"integer",defval:21,min:1,max:1e4},{id:"method",name:"Method",type:"text",defval:"Simple",options:["Simple","Exponential","Weighted"]}],format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i,s,n=this._context.new_var(r.close(this._context));return"Exponential"===this._input(2)?(i=r.ema(n,this._input(0),this._context),s=r.ema(n,this._input(1),this._context)):"Weighted"===this._input(2)?(i=r.wma(n,this._input(0),this._context),s=r.wma(n,this._input(1),this._context)):(i=r.sma(n,this._input(0),this._context),s=r.sma(n,this._input(1),this._context)),[i,s]}}},{name:"Moving Average Triple",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!0,id:"Moving Average Triple@tv-basicstudies-1",scriptIdPart:"",name:"Moving Average Triple",description:"Moving Average Triple",shortDescription:"Moving Average Triple",plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,transparency:0,trackPrice:!1,color:"#FF6D00"},plot_1:{linestyle:0,visible:!0,linewidth:1,transparency:0,plottype:0,trackPrice:!1,color:"#2196F3"},plot_2:{linestyle:0,visible:!0,linewidth:1,transparency:0,plottype:0,trackPrice:!1,color:"#26C6DA"}},inputs:{firstPeriods:14,secondPeriods:21,thirdPeriods:35,method:"Simple"}},styles:{plot_0:{title:"Plot 1"},plot_1:{title:"Plot 2"},plot_2:{title:"Plot 3"}},inputs:[{id:"firstPeriods",name:"1st Period",type:"integer",defval:14,min:1,max:1e4,hideWhenPlotsHidden:["plot_0"]},{id:"secondPeriods",name:"2nd Period",type:"integer",defval:21,min:1,max:1e4,hideWhenPlotsHidden:["plot_1"]},{id:"thirdPeriods",name:"3rd Period",type:"integer",defval:35,min:1,max:1e4,hideWhenPlotsHidden:["plot_2"]},{id:"method",name:"Method",type:"text",defval:"Simple",options:["Simple","Exponential","Weighted"]}],format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i,s,n,o=this._context.new_var(r.close(this._context));return"Exponential"===this._input(3)?(i=r.ema(o,this._input(0),this._context),s=r.ema(o,this._input(1),this._context), -n=r.ema(o,this._input(2),this._context)):"Weighted"===this._input(3)?(i=r.wma(o,this._input(0),this._context),s=r.wma(o,this._input(1),this._context),n=r.wma(o,this._input(2),this._context)):(i=r.sma(o,this._input(0),this._context),s=r.sma(o,this._input(1),this._context),n=r.sma(o,this._input(2),this._context)),[i,s,n]}}},{name:"Moving Average Adaptive",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!0,id:"Moving Average Adaptive@tv-basicstudies-1",scriptIdPart:"",name:"Moving Average Adaptive",description:"Moving Average Adaptive",shortDescription:"Moving Average Adaptive",plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,transparency:0,trackPrice:!1,color:"#AB47BC"}},inputs:{periods:10}},styles:{plot_0:{title:"Plot 1"}},inputs:[{id:"periods",name:"Period",type:"integer",defval:10,min:2,max:1e4}],format:{type:"inherit"}},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,this.periods=this._input(0)},this.ama=function(e,t){var i=this.periods,s=this._context.new_var(),n=e.get(),o=r.stdev(t,i,this._context),a=r.log(n/e.get(i))/(o*Math.sqrt(i)),l=.1*Math.abs(a),c=(n-s.get(1))*l+s.get(1);return s.set(isNaN(c)?n:c),c},this.main=function(e,t){this._context=e,this._input=t;var i=this._context.new_var(r.close(this._context)),s=this._context.new_var(r.log(i.get()/i.get(1)));return[this.ama(i,s)]}}},{name:"Moving Average Hamming",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!0,id:"Moving Average Hamming@tv-basicstudies-1",scriptIdPart:"",name:"Moving Average Hamming",description:"Moving Average Hamming",shortDescription:"Moving Average Hamming",plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,transparency:0,trackPrice:!1,color:"#4CAF50"}},inputs:{periods:10}},styles:{plot_0:{title:"Plot 1"}},inputs:[{id:"periods",name:"Period",type:"integer",defval:10,min:1,max:1e4}],format:{type:"inherit"}},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,this.periods=this._input(0);for(var i=[],s=0,r=1;r<=this.periods;++r){var n=Math.sin((1+r)/this.periods*Math.PI/2);i.unshift(n),s+=n}this.hmaFactors=i,this.hmaFactorsSum=s},this.hma=function(e){for(var t=this.periods,i=0,s=0;sthis._context.new_var(s).get(1)?1:0,[100*r.sma(this._context.new_var(i),this.rollingPeriod,this._context)]}}},{name:"Net Volume",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Net Volume",shortDescription:"Net Volume",is_price_study:!1,inputs:[],id:"Net Volume@tv-basicstudies-1",scriptIdPart:"",name:"Net Volume",format:{type:"volume"}},constructor:function(){this.f_0=function(e,t,i){return r.gt(e,0)?t:r.lt(i,0)?-t:0*t},this.main=function(e,t){this._context=e,this._input=t;var i=r.close(this._context),s=this._context.new_var(i),n=r.change(s);return[this.f_0(n,r.volume(this._context),n)]}}},{name:"On Balance Volume",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},smoothedMA:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!1}},inputs:{smoothingLine:"SMA",smoothingLength:9}},plots:[{id:"plot_0",type:"line"},{id:"smoothedMA",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1},smoothedMA:{title:"Smoothed MA",histogramBase:0,joinPoints:!1}},description:"On Balance Volume",shortDescription:"OBV",is_price_study:!1,inputs:[{id:"smoothingLine",name:"Smoothing Line",defval:"SMA",type:"text",options:["SMA","EMA","WMA"],hideWhenPlotsHidden:["smoothedMA"]},{id:"smoothingLength",name:"Smoothing Length",defval:9,type:"integer",min:1,max:1e4,hideWhenPlotsHidden:["smoothedMA"]}],id:"On Balance Volume@tv-basicstudies-1",scriptIdPart:"",name:"On Balance Volume",format:{type:"volume"}},constructor:function(){this.f_0=function(e,t,i){return r.gt(e,0)?t:r.lt(i,0)?-t:0*t},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=r.close(this._context),o=this._context.new_var(n),a=r.change(o),l=this.f_0(a,r.volume(this._context),a),c=r.cum(l,this._context);this._context.setMinimumAdditionalDepth(s);var h,d=this._context.new_var(c);return"EMA"===i?h=r.ema(d,s,this._context):"WMA"===i?h=r.wma(d,s,this._context):"SMA"===i&&(h=r.sma(d,s,this._context)),[c,h]}}},{name:"Parabolic SAR",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:3,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:.02,in_1:.02,in_2:.2}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Parabolic SAR", -shortDescription:"SAR",is_price_study:!0,inputs:[{id:"in_0",name:"start",defval:.02,type:"float",min:-1e12,max:1e12},{id:"in_1",name:"increment",defval:.02,type:"float",min:-1e12,max:1e12},{id:"in_2",name:"maximum",defval:.2,type:"float",min:-1e12,max:1e12}],id:"Parabolic SAR@tv-basicstudies-1",scriptIdPart:"",name:"Parabolic SAR",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=this._input(2);return[r.sar(i,s,n,this._context)]}}},{name:"Price Channel",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#F50057"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#F50057"},plot_2:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:20,in_1:0}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"}],styles:{plot_0:{title:"Highprice Line",histogramBase:0,joinPoints:!1},plot_1:{title:"Lowprice Line",histogramBase:0,joinPoints:!1},plot_2:{title:"Centerprice Line",histogramBase:0,joinPoints:!1}},description:"Price Channel",shortDescription:"PC",is_price_study:!0,inputs:[{id:"in_0",name:"Length",defval:20,type:"integer",min:1,max:2e3},{id:"in_1",name:"Offset Length",defval:0,type:"integer",min:1,max:2e3}],id:"Price Channel@tv-basicstudies-1",scriptIdPart:"",name:"Price Channel",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=r.high(this._context),s=this._context.new_var(i),n=r.low(this._context),o=this._context.new_var(n),a=this._input(0),l=this._input(1),c=r.highest(s,a,this._context),h=r.lowest(o,a,this._context);return[{value:c,offset:l},{value:h,offset:l},{value:r.avg(c,h),offset:l}]}}},{name:"Price Oscillator",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:u}},inputs:{in_0:10,in_1:21}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Price Oscillator",shortDescription:"PPO",is_price_study:!1,inputs:[{id:"in_0",name:"shortlen",defval:10,type:"integer",min:1,max:2e3},{id:"in_1",name:"longlen",defval:21,type:"integer",min:1,max:2e3}],id:"Price Oscillator@tv-basicstudies-1",scriptIdPart:"",name:"Price Oscillator",format:{type:"price",precision:2}},constructor:function(){this.f_0=function(e,t){return(e-t)/t*100},this.main=function(e,t){this._context=e,this._input=t;var i=r.close(this._context),s=this._input(0),n=this._input(1),o=this._context.new_var(i),a=r.sma(o,s,this._context),l=this._context.new_var(i),c=r.sma(l,n,this._context);return[this.f_0(a,c)]}}},{name:"Price Volume Trend",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1, -transparency:0,visible:!0,color:"#2196F3"}},inputs:{}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"PVT",histogramBase:0,joinPoints:!1,isHidden:!1}},description:"Price Volume Trend",shortDescription:"PVT",is_price_study:!1,is_hidden_study:!1,id:"price_volume_trend@tv-basicstudies-1",inputs:[],scriptIdPart:"",name:"Price Volume Trend",format:{type:"volume"}},constructor:function(){this.f_0=function(){var e=this._context.new_var(r.close(this._context));return[r.cum(r.change(e)/e.get(1)*r.volume(this._context),this._context)]},this.main=function(e,t){return this._context=e,this._input=t,[this.f_0()[0]]}}},{name:"Rate Of Change",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:0}],inputs:{in_0:9}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"ROC",histogramBase:0,joinPoints:!1,isHidden:!1,zorder:1}},description:"Rate Of Change",shortDescription:"ROC",is_price_study:!1,bands:[{id:"hline_0",name:"Zero Line",isHidden:!1,zorder:-1}],inputs:[{id:"in_0",name:"length",defval:9,type:"integer",min:1,max:1e12}],id:"rate_of_change@tv-basicstudies-1",scriptIdPart:"",name:"Rate Of Change",format:{precision:2,type:"price"},usePlotsZOrder:!0},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=this._context.new_var(r.close(this._context)),s=this._input(0);return[100*(i.get(0)-i.get(s))/i.get(s)]}}},{name:"Relative Strength Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#7E57C2"},smoothedMA:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!1}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:70,zorder:-1.1},{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:50,zorder:-1.11},{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:30,zorder:-1.111}],filledAreasStyle:{fill_0:{color:"#7E57C2",transparency:90,visible:!0}},inputs:{length:14,smoothingLine:"SMA",smoothingLength:14}},plots:[{id:"plot_0",type:"line"},{id:"smoothedMA",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,zorder:1},smoothedMA:{title:"Smoothed MA",histogramBase:0,joinPoints:!1,zorder:2}},description:"Relative Strength Index",shortDescription:"RSI",is_price_study:!1,bands:[{id:"hline_0",name:"UpperLimit",zorder:-1.1},{id:"hline_2",name:"MiddleLimit",zorder:-1.11},{id:"hline_1",name:"LowerLimit",zorder:-1.111}],filledAreas:[{id:"fill_0",objAId:"hline_0",objBId:"hline_1",type:"hline_hline",title:"Hlines Background",zorder:-2}],inputs:[{id:"length",name:"Length",defval:14,type:"integer",min:1,max:2e3},{id:"smoothingLine",name:"Smoothing Line",defval:"SMA",type:"text",options:["SMA","EMA","WMA"],hideWhenPlotsHidden:["smoothedMA"]},{id:"smoothingLength",name:"Smoothing Length",defval:14, -type:"integer",min:1,max:1e4,hideWhenPlotsHidden:["smoothedMA"]}],id:"Relative Strength Index@tv-basicstudies-1",scriptIdPart:"",name:"Relative Strength Index",format:{precision:2,type:"price"},usePlotsZOrder:!0},constructor:function(){this.f_0=function(e){return r.max(e,0)},this.f_1=function(e){return-r.min(e,0)},this.f_2=function(e,t){return r.eq(e,0)?100:r.eq(t,0)?0:100-100/(1+t/e)},this.main=function(e,t){this._context=e,this._input=t;var i=r.close(this._context),s=this._input(0),n=this._input(1),o=this._input(2);this._context.setMinimumAdditionalDepth(s+o);var a,l=this._context.new_var(i),c=r.change(l),h=this.f_0(c),d=this._context.new_var(h),u=r.rma(d,s,this._context),p=this.f_1(c),_=this._context.new_var(p),m=r.rma(_,s,this._context),g=this.f_2(m,u),f=this._context.new_var(g);return"EMA"===n?a=r.ema(f,o,this._context):"WMA"===n?a=r.wma(f,o,this._context):"SMA"===n&&(a=r.sma(f,o,this._context)),[{value:g},{value:a}]}}},{name:"Relative Vigor Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:u},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:a}},inputs:{in_0:10}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],styles:{plot_0:{title:"RVGI",histogramBase:0,joinPoints:!1},plot_1:{title:"Signal",histogramBase:0,joinPoints:!1}},description:"Relative Vigor Index",shortDescription:"RVGI",is_price_study:!1,inputs:[{id:"in_0",name:"Length",defval:10,type:"integer",min:1,max:2e3}],id:"Relative Vigor Index@tv-basicstudies-1",scriptIdPart:"",name:"Relative Vigor Index",format:{precision:4,type:"price"}},constructor:function(){this.f_0=function(e,t){return e-t},this.f_1=function(e,t){return e/t},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this.f_0(r.close(this._context),r.open(this._context)),n=this._context.new_var(s),o=r.swma(n,this._context),a=this._context.new_var(o),l=r.sum(a,i,this._context),c=this.f_0(r.high(this._context),r.low(this._context)),h=this._context.new_var(c),d=r.swma(h,this._context),u=this._context.new_var(d),p=r.sum(u,i,this._context),_=this.f_1(l,p),m=this._context.new_var(_);return[_,r.swma(m,this._context)]}}},{name:"Relative Volatility Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#7E57C2"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:80},{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:20}],filledAreasStyle:{fill_0:{color:"#7E57C2",transparency:90,visible:!0}},inputs:{in_0:10}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,zorder:1}},description:"Relative Volatility Index",shortDescription:"RVI",is_price_study:!1,bands:[{id:"hline_0",name:"UpperLimit",zorder:-1.1},{id:"hline_1",name:"LowerLimit",zorder:-1.11}],filledAreas:[{id:"fill_0", -objAId:"hline_0",objBId:"hline_1",type:"hline_hline",title:"Hlines Background",zorder:-2}],inputs:[{id:"in_0",name:"length",defval:10,type:"integer",min:1,max:2e3}],id:"Relative Volatility Index@tv-basicstudies-1",scriptIdPart:"",name:"Relative Volatility Index",format:{precision:2,type:"price"},usePlotsZOrder:!0},constructor:function(){this.f_0=function(e,t){return r.le(e,0)?0:t},this.f_1=function(e,t){return r.gt(e,0)?0:t},this.f_2=function(e,t){return e/(e+t)*100},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0);this._context.setMinimumAdditionalDepth(i+12);var s=r.close(this._context),n=this._context.new_var(s),o=r.stdev(n,i,this._context),a=this._context.new_var(s),l=r.change(a),c=this.f_0(l,o),h=this._context.new_var(c),d=r.ema(h,14,this._context),u=this.f_1(l,o),p=this._context.new_var(u),_=r.ema(p,14,this._context);return[this.f_2(d,_)]}}},{name:"SMI Ergodic Indicator/Oscillator",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FF6D00"},plot_2:{linestyle:0,linewidth:1,plottype:1,trackPrice:!1,transparency:0,visible:!0,color:c}},inputs:{in_0:5,in_1:20,in_2:5}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"}],styles:{plot_0:{title:"Indicator",histogramBase:0,joinPoints:!1},plot_1:{title:"Signal",histogramBase:0,joinPoints:!1},plot_2:{title:"Oscillator",histogramBase:0,joinPoints:!1}},description:"SMI Ergodic Indicator/Oscillator",shortDescription:"SMIIO",is_price_study:!1,inputs:[{id:"in_0",name:"shortlen",defval:5,type:"integer",min:1,max:2e3},{id:"in_1",name:"longlen",defval:20,type:"integer",min:1,max:2e3},{id:"in_2",name:"siglen",defval:5,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["plot_1"]}],id:"SMI Ergodic Indicator/Oscillator@tv-basicstudies-1",scriptIdPart:"",name:"SMI Ergodic Indicator/Oscillator",format:{type:"inherit"}},constructor:function(){this.f_0=function(e,t){return e-t},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=this._input(2);this._context.setMinimumAdditionalDepth(i+s+n);var o=r.close(this._context),a=this._context.new_var(o),l=r.tsi(a,i,s,this._context),c=this._context.new_var(l),h=r.ema(c,n,this._context);return[l,h,this.f_0(l,h)]}}},{name:"Smoothed Moving Average",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#673AB7"}},inputs:{in_0:7,in_1:"close"}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,isHidden:!1}},description:"Smoothed Moving Average",shortDescription:"SMMA",is_price_study:!0,inputs:[{id:"in_0",name:"Length",defval:7,type:"integer",min:1,max:1e12},{id:"in_1",name:"Source",defval:"close",type:"source", -options:["open","high","low","close","hl2","hlc3","ohlc4"]}],id:"smoothed_moving_average@tv-basicstudies-1",scriptIdPart:"",name:"Smoothed Moving Average",format:{type:"inherit"}},constructor:function(){this.f_0=function(){var e=this._input(0),t=r[this._input(1)](this._context);return[r.smma(t,e,this._context)]},this.main=function(e,t){return this._context=e,this._input=t,this.f_0()}}},{name:"Standard Deviation",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,id:"Standard Deviation@tv-basicstudies-1",scriptIdPart:"",name:"Standard Deviation",description:"Standard Deviation",shortDescription:"Standard Deviation",is_price_study:!1,plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:u}},inputs:{periods:5,deviations:1}},styles:{plot_0:{title:"Plot"}},inputs:[{id:"periods",name:"Periods",type:"integer"},{id:"deviations",name:"Deviations",type:"float"}],format:{precision:2,type:"price"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=this._context.new_var(r.close(this._context));return[r.stdev(n,i,this._context)*s]}}},{name:"Stochastic",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FF6D00"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:80},{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:20}],filledAreasStyle:{fill_0:{color:"#2196F3",transparency:90,visible:!0}},inputs:{in_0:14,in_1:1,in_2:3}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],styles:{plot_0:{title:"%K",histogramBase:0,joinPoints:!1,zorder:1.1},plot_1:{title:"%D",histogramBase:0,joinPoints:!1,zorder:1.11}},description:"Stochastic",shortDescription:"Stoch",is_price_study:!1,bands:[{id:"hline_0",name:"UpperLimit",zorder:-1.1},{id:"hline_1",name:"LowerLimit",zorder:-1.11}],filledAreas:[{id:"fill_0",objAId:"hline_0",objBId:"hline_1",type:"hline_hline",title:"Hlines Background",zorder:-2}],inputs:[{id:"in_0",name:"%K Length",defval:14,type:"integer",min:1,max:1e4},{id:"in_1",name:"%K Smoothing",defval:1,type:"integer",min:1,max:1e4},{id:"in_2",name:"%D Smoothing",defval:3,type:"integer",min:1,max:1e4}],id:"Stochastic@tv-basicstudies-1",scriptIdPart:"",name:"Stochastic",format:{precision:2,type:"price"},usePlotsZOrder:!0},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=this._input(2);this._context.setMinimumAdditionalDepth(i+s+n);var o=r.close(this._context),a=r.high(this._context),l=r.low(this._context),c=this._context.new_var(o),h=this._context.new_var(a),d=this._context.new_var(l),u=r.stoch(c,h,d,i,this._context),p=this._context.new_var(u),_=r.sma(p,s,this._context),m=this._context.new_var(_);return[_,r.sma(m,n,this._context)] -}}},{name:"Stochastic RSI",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FF6D00"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:80},{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:20}],filledAreasStyle:{fill_0:{color:"#2196F3",transparency:90,visible:!0}},inputs:{in_0:14,in_1:14,in_2:3,in_3:3}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],styles:{plot_0:{title:"%K",histogramBase:0,joinPoints:!1,zorder:1.1},plot_1:{title:"%D",histogramBase:0,joinPoints:!1,zorder:1.11}},description:"Stochastic RSI",shortDescription:"Stoch RSI",is_price_study:!1,bands:[{id:"hline_0",name:"UpperLimit",zorder:-1.1},{id:"hline_1",name:"LowerLimit",zorder:-1.11}],filledAreas:[{id:"fill_0",objAId:"hline_0",objBId:"hline_1",type:"hline_hline",title:"Hlines Background",zorder:-2}],inputs:[{id:"in_0",name:"lengthRSI",defval:14,type:"integer",min:1,max:1e4},{id:"in_1",name:"lengthStoch",defval:14,type:"integer",min:1,max:1e4},{id:"in_2",name:"smoothK",defval:3,type:"integer",min:1,max:1e4},{id:"in_3",name:"smoothD",defval:3,type:"integer",min:1,max:1e4}],id:"Stochastic RSI@tv-basicstudies-1",scriptIdPart:"",name:"Stochastic RSI",format:{precision:2,type:"price"},usePlotsZOrder:!0},constructor:function(){this.f_1=function(e,t,i){var s=i.new_var(r.max(r.change(e),0));return r.rma(s,t,i)},this.f_2=function(e,t,i){var s=i.new_var(-r.min(r.change(e),0));return r.rma(s,t,i)},this.main=function(e,t){this._context=e,this._input=t;var i=r.close(this._context),s=this._input(0),n=this._input(1),o=this._input(2),a=this._input(3);e.setMinimumAdditionalDepth(s+n+o+a);var l=this._context.new_var(i),c=r.rsi(this.f_1(l,s,this._context),this.f_2(l,s,this._context)),h=this._context.new_var(c),d=this._context.new_var(c),u=this._context.new_var(c),p=r.stoch(h,d,u,n,this._context),_=this._context.new_var(p),m=r.sma(_,o,this._context),g=this._context.new_var(m);return[m,r.sma(g,a,this._context)]}}},{name:"TRIX",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:a}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:0}],inputs:{in_0:18}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"TRIX",histogramBase:0,joinPoints:!1,zorder:1}},description:"TRIX",shortDescription:"TRIX",is_price_study:!1,bands:[{id:"hline_0",name:"Zero",zorder:-1}],inputs:[{id:"in_0",name:"length",defval:18,type:"integer",min:1,max:2e3}],id:"TRIX@tv-basicstudies-1",scriptIdPart:"",name:"TRIX",format:{precision:2,type:"price"},usePlotsZOrder:!0},constructor:function(){this.f_0=function(e){return r.log(e)},this.f_1=function(e){return 1e4*e},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0);e.setMinimumAdditionalDepth(3*i) -;var s=this.f_0(r.close(this._context)),n=this._context.new_var(s),o=r.ema(n,i,this._context),a=this._context.new_var(o),l=r.ema(a,i,this._context),c=this._context.new_var(l),h=r.ema(c,i,this._context),d=this._context.new_var(h),u=r.change(d);return[this.f_1(u)]}}},{name:"Triple EMA",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:9}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Triple EMA",shortDescription:"TEMA",is_price_study:!0,inputs:[{id:"in_0",name:"length",defval:9,type:"integer",min:1,max:1e4}],id:"Triple EMA@tv-basicstudies-1",scriptIdPart:"",name:"Triple EMA",format:{type:"inherit"}},constructor:function(){this.f_0=function(e,t,i){return 3*(e-t)+i},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0);this._context.setMinimumAdditionalDepth(3*i);var s=r.close(this._context),n=this._context.new_var(s),o=r.ema(n,i,this._context),a=this._context.new_var(o),l=r.ema(a,i,this._context),c=this._context.new_var(l),h=r.ema(c,i,this._context);return[this.f_0(o,l,h)]}}},{name:"True Strength Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#E91E63"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:0}],inputs:{in_0:25,in_1:13,in_2:13}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],styles:{plot_0:{title:"True Strength Index",histogramBase:0,joinPoints:!1,zorder:1.1},plot_1:{title:"Signal",histogramBase:0,joinPoints:!1,zorder:1.11}},description:"True Strength Index",shortDescription:"True Strength Index",is_price_study:!1,bands:[{id:"hline_0",name:"Zero",zorder:-1}],inputs:[{id:"in_0",name:"long",defval:25,type:"integer",min:1,max:4999},{id:"in_1",name:"short",defval:13,type:"integer",min:1,max:4999},{id:"in_2",name:"siglen",defval:13,type:"integer",min:1,max:4999,hideWhenPlotsHidden:["plot_1"]}],id:"True Strength Indicator@tv-basicstudies-1",scriptIdPart:"",name:"True Strength Index",format:{precision:4,type:"price"},usePlotsZOrder:!0},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=this._input(2);this._context.setMinimumAdditionalDepth(this._input(0)+this._input(1)+this._input(2));var o=r.close(this._context),a=this._context.new_var(o),l=r.tsi(a,s,i,this._context),c=this._context.new_var(l);return[l,r.ema(c,n,this._context)]}}},{name:"Trend Strength Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!1,id:"Trend Strength Index@tv-basicstudies-1",scriptIdPart:"",name:"Trend Strength Index",description:"Trend Strength Index",shortDescription:"Trend Strength Index",plots:[{id:"plot_0", -type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:c}},inputs:{periods:14}},styles:{plot_0:{title:"Plot",histogramBase:0}},inputs:[{id:"periods",type:"integer",name:"Periods"}],format:{type:"inherit"}},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,this.period=this._input(0),this.invertedPeriod=1/this.period,this.sumX=(this.period-1)*this.period/2,this.sumXX=(this.period-1)*this.period*(2*this.period-1)/6,this.invertedPeriodSumXSumX=this.invertedPeriod*this.sumX*this.sumX},this.trendStrengthIndex=function(){for(var e=this._context.new_var(r.close(this._context)),t=r.sum(e,this.period,this._context),i=0,s=0,n=0;n0?1:-1:a/(l=Math.sqrt(l))},this.main=function(e,t){return this._context=e,this._input=t,[this.trendStrengthIndex()]}}},{name:"Typical Price",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,id:"TypicalPrice@tv-basicstudies-1",scriptIdPart:"",name:"Typical Price",description:"Typical Price",shortDescription:"Typical Price",is_price_study:!0,plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:"#FF6D00"}},inputs:{}},styles:{plot_0:{title:"Plot"}},inputs:[],format:{type:"inherit"}},constructor:function(){this.main=function(e,t){return this._context=e,this._input=t,[r.hlc3(this._context)]}}},{name:"Ultimate Oscillator",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:a}},inputs:{in_0:7,in_1:14,in_2:28}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"UO",histogramBase:0,joinPoints:!1,isHidden:!1}},description:"Ultimate Oscillator",shortDescription:"UO",is_price_study:!1,inputs:[{id:"in_0",name:"length7",defval:7,type:"integer",min:1,max:1e12},{id:"in_1",name:"length14",defval:14,type:"integer",min:1,max:1e12},{id:"in_2",name:"length28",defval:28,type:"integer",min:1,max:1e12}],id:"ultimate_oscillator@tv-basicstudies-1",scriptIdPart:"",name:"Ultimate Oscillator",format:{precision:2,type:"price"}},constructor:function(){this.f_0=function(e,t,i){var s=this._context.new_var(e),n=this._context.new_var(t);return[r.sum(s,i,this._context)/r.sum(n,i,this._context)]},this.f_1=function(){var e=this._input(0),t=this._input(1),i=this._input(2),s=this._context.new_var(r.close(this._context)),n=r.max(r.high(this._context),s.get(1)),o=this._context.new_var(r.close(this._context)),a=r.min(r.low(this._context),o.get(1)),l=r.close(this._context)-a,c=n-a,h=this.f_0(l,c,e),d=this.f_0(l,c,t),u=this.f_0(l,c,i);return[100*(4*h[0]+2*d[0]+u[0])/7]},this.main=function(e,t){return this._context=e,this._input=t,this.f_1()}}},{name:"Volatility Close-to-Close",metainfo:{_metainfoVersion:52, -isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!1,id:"Volatility Close-to-Close@tv-basicstudies-1",scriptIdPart:"",name:"Volatility Close-to-Close",description:"Volatility Close-to-Close",shortDescription:"Volatility Close-to-Close",plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:"#2196F3"}},inputs:{periods:10,daysPerYear:252}},styles:{plot_0:{title:"Plot"}},inputs:[{id:"periods",name:"Periods",type:"integer",defval:10,min:2},{id:"daysPerYear",name:"Days Per Year",type:"integer",defval:252,min:1,max:366}],format:{precision:2,type:"percent"}},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,this.period=this._input(0),this.daysPerYear=this._input(1)},this.stdev=function(e,t,i){var s=this.variance(e,t,i);return r.sqrt(s)},this.variance=function(e,t,i){var s=r.sma(e,t,i);return this.variance2(e,s,t)},this.variance2=function(e,t,i){var s,r,n=0;for(s=0;s0&&(l=.12*this.square(e.get()-s.get(1))/this.marketClosedPercentage+.88*l/(1-this.marketClosedPercentage)),l/=a,l*=this.secondsPerYear;var c=this._context.new_var(l);return 100*Math.sqrt(r.sum(c,this.period,this._context)/this.period)},this.main=function(e,t){return this._context=e,this._input=t,[this.volatilityOHLC()]}}},{name:"Volatility Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!0,id:"Volatility Index@tv-basicstudies-1",scriptIdPart:"",name:"Volatility Index",description:"Volatility Index",shortDescription:"Volatility Index",plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:c}},inputs:{periods:10,atrMult:3,method:"Wilder Smoothing"}},styles:{plot_0:{title:"Plot"}},inputs:[{id:"periods",name:"Periods",type:"integer"},{id:"atrMult",name:"ATR Mult",type:"float"},{id:"method",name:"Method",type:"text",defval:"Exponential",options:["Exponential","Wilder Smoothing"]}],format:{type:"inherit"}},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,this.period=this._input(0),this.atrMult=this._input(1),this.maMethod=this._input(2),this.nextsar=null,this.position=null,this.sic=null,this.bars=[],this.count=0,this.lastSar=null,this._context.setMinimumAdditionalDepth("Exponential"===this.maMethod?2*this.period+2:this.period)},this.computeATR=function(){var e=r.high(this._context)-r.low(this._context),t=r.high(this._context)-this.bars[this.bars.length-2],i=this.bars[this.bars.length-2]-r.low(this._context);return this.tr=Math.max(e,t,i),"Exponential"===this.maMethod?this.atr=r.ema(this._context.new_var(this.tr),this.period,this._context):this.atr=this.tr/this.period+(1-1/this.period)*this.atr,this.atr*this.atrMult},this.calculateVolatility=function(){ -if(r.close(this._context)===this.bars[this.bars.length-1])return this.lastSar;if(this.bars.push(r.close(this._context)),1===this.count)this.atr=r.high(this._context)-r.low(this._context),this.sic=r.close(this._context);else if(this.countthis.sic&&(this.sic=r.close(this._context))}else if(this.count===this.period){e=r.high(this._context)-r.low(this._context),t=r.high(this._context)-this.bars[this.bars.length-2],i=this.bars[this.bars.length-2]-r.low(this._context);this.atr+=Math.max(e,t,i),this.atr*=1/this.period,r.close(this._context)>this.sic&&(this.sic=r.close(this._context)),this.position="LONG",this.nextsar=this.sic-this.atr*this.atrMult}else{var s=this.nextsar;"LONG"===this.position?r.close(this._context)s?(this.position="LONG",this.sic=r.close(this._context),this.nextsar=this.sic-this.computeATR()):(this.position="SHORT",this.sic=Math.min(r.close(this._context),this.sic),this.nextsar=this.sic+this.computeATR())),this.lastSar=s}return this.count++,s},this.main=function(e,t){return this._context=e,this._input=t,this._context.select_sym(0),[this.calculateVolatility()]}}},{name:"VWAP",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{inputs:{in_0:"hlc3",in_anchor:"Session"},styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:0,transparency:0,visible:!0,color:"#2196F3"}}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"VWAP",histogramBase:0,joinPoints:!1,isHidden:!1}},description:"VWAP",shortDescription:"VWAP",is_price_study:!0,inputs:[{id:"in_0",name:"Source",defval:"hlc3",type:"source",options:["open","high","low","close","hl2","hlc3","ohlc4"]},{id:"in_anchor",name:"Anchor Period",defval:"Session",type:"text",options:["Session","Week","Month","Quarter","Year","Decade","Century"]}],id:"VWAP@tv-basicstudies-1",scriptIdPart:"",name:"VWAP",format:{type:"inherit"}},constructor:function(){this.f_1=function(e){e.reset_hist()},this.createAnchorChecker=function(e,t){switch(t){case"Week":return function(t,i){return r.weekofyear(e,t)!==r.weekofyear(e,i)||r.year(e,t)!==r.year(e,i)};case"Month":return function(t,i){return r.month(e,t)!==r.month(e,i)||r.year(e,t)!==r.year(e,i)};case"Quarter":return function(t,i){return Math.floor(r.month(e,t)/3)!==Math.floor(r.month(e,i)/3)||r.year(e,t)!==r.year(e,i)};case"Year":return function(t,i){return r.year(e,t)!==r.year(e,i)};case"Decade":return function(t,i){return Math.floor(r.year(e,t)/10)!==Math.floor(r.year(e,i)/10)};case"Century":return function(t,i){return Math.floor(r.year(e,t)/100)!==Math.floor(r.year(e,i)/100)};default: -return e=>this._isNewSession(e)}},this.init=function(e,t){this._input=t,this._isNewSession=null;const i=this._input(1)||"Session";this._anchorChecker=this.createAnchorChecker(e,i)},this.main=function(e,t){this._context=e,this._input=t;const i=this._input(0);var s=e.new_var(),n=e.new_var();const o=r.time(this._context),a=this._context.new_unlimited_var(o);return o&&(null===this._isNewSession&&(this._isNewSession=r.createNewSessionCheck(e)),this._anchorChecker(a.get(),a.get(1))&&(this.f_1(s),this.f_1(n))),s.set(r.nz(s.get(1))+r[i](this._context)*r.volume(this._context)),n.set(r.nz(n.get(1))+r.volume(this._context)),[s.get(0)/n.get(0)]}}},{name:"VWMA",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:20}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"VWMA",shortDescription:"VWMA",is_price_study:!0,inputs:[{id:"in_0",name:"len",defval:20,type:"integer",min:1,max:1e4}],id:"VWMA@tv-basicstudies-1",scriptIdPart:"",name:"VWMA",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=r.close(this._context),s=this._input(0),n=this._context.new_var(i);return[r.vwma(n,s,this._context)]}}},{name:"Volume Oscillator",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:0}],inputs:{in_0:5,in_1:10}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,zorder:1}},description:"Volume Oscillator",shortDescription:"Volume Osc",is_price_study:!1,bands:[{id:"hline_0",name:"Zero",zorder:-1}],inputs:[{id:"in_0",name:"shortlen",defval:5,type:"integer",min:1,max:4999},{id:"in_1",name:"longlen",defval:10,type:"integer",min:1,max:4999}],id:"Volume Oscillator@tv-basicstudies-1",scriptIdPart:"",name:"Volume Oscillator",format:{precision:2,type:"percent"},usePlotsZOrder:!0},constructor:function(){this.f_0=function(e,t){return 100*(e-t)/t},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=r.volume(this._context),o=this._context.new_var(n),a=r.ema(o,i,this._context),l=this._context.new_var(n),c=r.ema(l,s,this._context);return[this.f_0(a,c)]}}},{name:"Vortex Indicator",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#E91E63"}},inputs:{in_0:14}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],styles:{plot_0:{title:"VI +",histogramBase:0,joinPoints:!1,isHidden:!1},plot_1:{title:"VI -",histogramBase:0,joinPoints:!1,isHidden:!1}},description:"Vortex Indicator", -shortDescription:"VI",is_price_study:!1,is_hidden_study:!1,id:"vortex_indicator@tv-basicstudies-1",inputs:[{id:"in_0",name:"Period",defval:14,type:"integer",min:2,max:1e12}],scriptIdPart:"",name:"Vortex Indicator",format:{precision:4,type:"price"}},constructor:function(){this.f_0=function(){var e=this._input(0),t=this._context.new_var(r.low(this._context)),i=this._context.new_var(r.abs(r.high(this._context)-t.get(1))),s=r.sum(i,e,this._context),n=this._context.new_var(r.high(this._context)),o=this._context.new_var(r.abs(r.low(this._context)-n.get(1))),a=r.sum(o,e,this._context),l=this._context.new_var(r.atr(1,this._context)),c=r.sum(l,e,this._context);return[s/c,a/c]},this.main=function(e,t){return this._context=e,this._input=t,this.f_0()}}},{name:"Willams %R",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#7E57C2"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:-20},{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:-80}],filledAreasStyle:{fill_0:{color:"#7E57C2",transparency:90,visible:!0}},inputs:{in_0:14}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,zorder:1}},description:"Williams %R",shortDescription:"%R",is_price_study:!1,bands:[{id:"hline_0",name:"UpperLimit",zorder:-1.1},{id:"hline_1",name:"LowerLimit",zorder:-1.11}],filledAreas:[{id:"fill_0",objAId:"hline_0",objBId:"hline_1",type:"hline_hline",title:"Hlines Background",zorder:-2}],inputs:[{id:"in_0",name:"length",defval:14,type:"integer",min:1,max:2e3}],id:"Willams %R@tv-basicstudies-1",scriptIdPart:"",name:"Willams %R",format:{precision:2,type:"price"},usePlotsZOrder:!0},constructor:function(){this.f_0=function(e,t,i){return 100*(e-t)/(t-i)},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=r.high(this._context),n=this._context.new_var(s),o=r.highest(n,i,this._context),a=r.low(this._context),l=this._context.new_var(a),c=r.lowest(l,i,this._context);return[this.f_0(r.close(this._context),o,c)]}}},{name:"Williams Alligator",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#E91E63"},plot_2:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#66BB6A"}},inputs:{in_0:21,in_1:13,in_2:8,in_3:8,in_4:5,in_5:3}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"}],styles:{plot_0:{title:"Jaw",histogramBase:0,joinPoints:!1},plot_1:{title:"Teeth",histogramBase:0,joinPoints:!1},plot_2:{title:"Lips",histogramBase:0,joinPoints:!1}},description:"Williams Alligator",shortDescription:"Alligator",is_price_study:!0,inputs:[{id:"in_0",name:"Jaw Length",defval:21,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["plot_0"]},{id:"in_1", -name:"Teeth Length",defval:13,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["plot_1"]},{id:"in_2",name:"Lips Length",defval:8,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["plot_2"]},{id:"in_3",name:"Jaw Offset",defval:8,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["plot_0"]},{id:"in_4",name:"Teeth Offset",defval:5,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["plot_1"]},{id:"in_5",name:"Lips Offset",defval:3,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["plot_2"]}],id:"Williams Alligator@tv-basicstudies-1",scriptIdPart:"",name:"Williams Alligator",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=this._input(2),o=this._input(3),a=this._input(4),l=this._input(5),c=r.hl2(this._context);return[{value:r.smma(c,i,this._context),offset:o},{value:r.smma(c,s,this._context),offset:a},{value:r.smma(c,n,this._context),offset:l}]}}},{name:"Williams Fractals",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,defaults:{styles:{plot_0:{plottype:"shape_triangle_down",visible:!0,location:"BelowBar",transparency:0,color:a},plot_1:{plottype:"shape_triangle_up",visible:!0,location:"AboveBar",transparency:0,color:u}},inputs:{in_0:2}},plots:[{id:"plot_0",type:"shapes"},{id:"plot_1",type:"shapes"}],styles:{plot_0:{title:"Down fractals",isHidden:!1},plot_1:{title:"Up fractals",isHidden:!1}},description:"Williams Fractal",shortDescription:"Fractals",is_price_study:!0,is_hidden_study:!1,id:"Williams Fractals@tv-basicstudies-1",inputs:[{id:"in_0",name:"Periods",defval:2,type:"integer",min:2,max:1e12}],scriptIdPart:"",name:"Williams Fractals",isCustomIndicator:!0,format:{type:"inherit"}},constructor:function(){this.f_0=function(){for(var e=this._input(0),t=this._context.new_var(r.high(this._context)),i=!0,s=!0,n=!0,o=!0,a=!0,l=!0,c=1;c<=e;c++)i=r.and(i,r.lt(t.get(e-c),t.get(e))),s=r.and(s,r.lt(t.get(e+c),t.get(e))),n=r.and(n,r.and(r.le(t.get(e+1),t.get(e)),r.lt(t.get(e+c+1),t.get(e)))),o=r.and(o,r.and(r.le(t.get(e+1),t.get(e)),r.and(r.le(t.get(e+2),t.get(e)),r.lt(t.get(e+c+2),t.get(e))))),a=r.and(a,r.and(r.le(t.get(e+1),t.get(e)),r.and(r.le(t.get(e+2),t.get(e)),r.and(r.le(t.get(e+3),t.get(e)),r.lt(t.get(e+c+3),t.get(e)))))),l=r.and(l,r.and(r.le(t.get(e+1),t.get(e)),r.and(r.le(t.get(e+2),t.get(e)),r.and(r.le(t.get(e+3),t.get(e)),r.and(r.le(t.get(e+4),t.get(e)),r.lt(t.get(e+c+4),t.get(e)))))));var h=r.or(s,r.or(n,r.or(o,r.or(a,l)))),d=r.and(i,h),u=this._context.new_var(r.low(this._context)),p=1,_=1,m=1,g=1,f=1,v=1;for(c=1;c<=e;c++)p=r.and(p,r.gt(u.get(e-c),u.get(e))),_=r.and(_,r.gt(u.get(e+c),u.get(e))),m=r.and(m,r.and(r.ge(u.get(e+1),u.get(e)),r.gt(u.get(e+c+1),u.get(e)))),g=r.and(g,r.and(r.ge(u.get(e+1),u.get(e)),r.and(r.ge(u.get(e+2),u.get(e)),r.gt(u.get(e+c+2),u.get(e))))),f=r.and(f,r.and(r.ge(u.get(e+1),u.get(e)),r.and(r.ge(u.get(e+2),u.get(e)),r.and(r.ge(u.get(e+3),u.get(e)),r.gt(u.get(e+c+3),u.get(e)))))), -v=r.and(v,r.and(r.ge(u.get(e+1),u.get(e)),r.and(r.ge(u.get(e+2),u.get(e)),r.and(r.ge(u.get(e+3),u.get(e)),r.and(r.ge(u.get(e+4),u.get(e)),r.gt(u.get(e+c+4),u.get(e)))))));var y=r.or(_,r.or(m,r.or(g,r.or(f,v))));return[r.and(p,y),d]},this.main=function(e,t){this._context=e,this._input=t;var i=this.f_0();return[{value:i[0],offset:-this._input(0)},{value:i[1],offset:-this._input(0)}]}}},{name:"Guppy Multiple Moving Average",metainfo:{isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,description:"Guppy Multiple Moving Average",shortDescription:"GMMA",is_price_study:!0,id:"Guppy Multiple Moving Average@tv-basicstudies-1",_metainfoVersion:52,format:{type:"inherit"},defaults:{inputs:{traderEMA1Length:3,traderEMA2Length:5,traderEMA3Length:8,traderEMA4Length:10,traderEMA5Length:12,traderEMA6Length:15,investorEMA1Length:30,investorEMA2Length:35,investorEMA3Length:40,investorEMA4Length:45,investorEMA5Length:50,investorEMA6Length:60},styles:{traderEMA1:{color:"#00FFFF",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:15,visible:!0},traderEMA2:{color:"#00FFFF",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:12,visible:!0},traderEMA3:{color:"#00FFFF",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:9,visible:!0},traderEMA4:{color:"#00FFFF",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:6,visible:!0},traderEMA5:{color:"#00FFFF",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:3,visible:!0},traderEMA6:{color:"#00FFFF",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0},investorEMA1:{color:"#FF0000",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:15,visible:!0},investorEMA2:{color:"#FF0000",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:12,visible:!0},investorEMA3:{color:"#FF0000",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:9,visible:!0},investorEMA4:{color:"#FF0000",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:6,visible:!0},investorEMA5:{color:"#FF0000",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:3,visible:!0},investorEMA6:{color:"#FF0000",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0}}},inputs:[{defval:3,id:"traderEMA1Length",max:1e3,min:1,name:"Trader EMA 1 length",type:"integer",hideWhenPlotsHidden:["traderEMA1"]},{defval:5,id:"traderEMA2Length",max:1e3,min:1,name:"Trader EMA 2 length",type:"integer",hideWhenPlotsHidden:["traderEMA2"]},{defval:8,id:"traderEMA3Length",max:1e3,min:1,name:"Trader EMA 3 length",type:"integer",hideWhenPlotsHidden:["traderEMA3"]},{defval:10,id:"traderEMA4Length",max:1e3,min:1,name:"Trader EMA 4 length",type:"integer",hideWhenPlotsHidden:["traderEMA4"]},{defval:12,id:"traderEMA5Length",max:1e3,min:1,name:"Trader EMA 5 length",type:"integer",hideWhenPlotsHidden:["traderEMA5"]},{defval:15,id:"traderEMA6Length",max:1e3,min:1,name:"Trader EMA 6 length",type:"integer",hideWhenPlotsHidden:["traderEMA6"]},{defval:30,id:"investorEMA1Length",max:1e3,min:1,name:"Investor EMA 1 length",type:"integer", -hideWhenPlotsHidden:["investorEMA1"]},{defval:35,id:"investorEMA2Length",max:1e3,min:1,name:"Investor EMA 2 length",type:"integer",hideWhenPlotsHidden:["investorEMA2"]},{defval:40,id:"investorEMA3Length",max:1e3,min:1,name:"Investor EMA 3 length",type:"integer",hideWhenPlotsHidden:["investorEMA3"]},{defval:45,id:"investorEMA4Length",max:1e3,min:1,name:"Investor EMA 4 length",type:"integer",hideWhenPlotsHidden:["investorEMA4"]},{defval:50,id:"investorEMA5Length",max:1e3,min:1,name:"Investor EMA 5 length",type:"integer",hideWhenPlotsHidden:["investorEMA5"]},{defval:60,id:"investorEMA6Length",max:1e3,min:1,name:"Investor EMA 6 length",type:"integer",hideWhenPlotsHidden:["investorEMA6"]}],plots:[{id:"traderEMA1",type:"line"},{id:"traderEMA2",type:"line"},{id:"traderEMA3",type:"line"},{id:"traderEMA4",type:"line"},{id:"traderEMA5",type:"line"},{id:"traderEMA6",type:"line"},{id:"investorEMA1",type:"line"},{id:"investorEMA2",type:"line"},{id:"investorEMA3",type:"line"},{id:"investorEMA4",type:"line"},{id:"investorEMA5",type:"line"},{id:"investorEMA6",type:"line"}],styles:{traderEMA1:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Trader EMA 1"},traderEMA2:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Trader EMA 2"},traderEMA3:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Trader EMA 3"},traderEMA4:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Trader EMA 4"},traderEMA5:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Trader EMA 5"},traderEMA6:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Trader EMA 6"},investorEMA1:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Investor EMA 1"},investorEMA2:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Investor EMA 2"},investorEMA3:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Investor EMA 3"},investorEMA4:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Investor EMA 4"},investorEMA5:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Investor EMA 5"},investorEMA6:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Investor EMA 6"}}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=this._context.new_var(r.close(this._context)),s=this._input(0),n=this._input(1),o=this._input(2),a=this._input(3),l=this._input(4),c=this._input(5),h=r.ema(i,s,this._context),d=r.ema(i,n,this._context),u=r.ema(i,o,this._context),p=r.ema(i,a,this._context),_=r.ema(i,l,this._context),m=r.ema(i,c,this._context),g=this._input(6),f=this._input(7),v=this._input(8),y=this._input(9),S=this._input(10),b=this._input(11);return[h,d,u,p,_,m,r.ema(i,g,this._context),r.ema(i,f,this._context),r.ema(i,v,this._context),r.ema(i,y,this._context),r.ema(i,S,this._context),r.ema(i,b,this._context)]}}},{name:"52 Week High/Low",metainfo:{_metainfoVersion:52,id:"52 Week High/Low@tv-basicstudies-1",description:"52 Week High/Low",shortDescription:"52W H/L",is_price_study:!0,format:{type:"inherit"},plots:[],graphics:{horizlines:{highest:{name:"Highest"},lowest:{name:"Lowest"}}},inputs:[{defval:"close",id:"highestSource",name:"High source",options:["close","high"],type:"text"},{ -defval:"close",id:"lowestSource",name:"Low source",options:["close","low"],type:"text"}],defaults:{graphics:{horizlines:{highest:{color:"rgb(93, 96, 107)",showPrice:!0,style:1,visible:!0,width:2},lowest:{color:"rgb(93, 96, 107)",showPrice:!0,style:1,visible:!0,width:2}}},inputs:{highestSource:"close",lowestSource:"close"}}},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,this._symbolSupports1DResolution=!this._context.symbol.info.supported_resolutions||-1!==this._context.symbol.info.supported_resolutions.indexOf("1D"),this._symbolSupports1DResolution&&"1D"!==r.period(this._context)&&this._context.new_sym(this._context.symbol.ticker,"1D")},this.main=function(e,t){this._symbolSupports1DResolution||r.error(`Daily bars are not available for ${this._context.symbol.info.name}`),this._context=e,this._input=t,"1D"!==r.period(this._context)&&this._context.select_sym(1);const i=this._input(0),s=this._input(1),n=r.time(this._context),o=this._context.new_unlimited_var(n),a=this._context.new_unlimited_var(r[i](this._context)),l=this._context.new_unlimited_var(r[s](this._context));if(o.get(365),!this._context.symbol.isLastBar||!this._context.symbol.isNewBar)return null;const c=r.add_years_considering_dst(this._context.symbol.info.timezone,new Date(n),-1),h=o.indexOf(c.getTime());return{nonseries:!0,type:"study_graphics",data:{graphicsCmds:{create:{horizlines:[{styleId:"highest",data:[{startIndex:n,endIndex:n,level:r.highest(a,h,this._context),extendLeft:!0,extendRight:!0}]},{styleId:"lowest",data:[{startIndex:n,endIndex:n,level:r.lowest(l,h,this._context),extendLeft:!0,extendRight:!0}]}]},erase:[{action:"all"}]}}}}}}]},66846:(e,t,i)=>{"use strict";var s;i.d(t,{SubsessionId:()=>s}),function(e){e.Regular="regular",e.Extended="extended",e.PreMarket="premarket",e.PostMarket="postmarket"}(s||(s={}))},34108:(e,t,i)=>{"use strict";i.d(t,{PointsetsManager:()=>n});var s=i(36274);const r=(0,i(59224).getLogger)("ChartApi.PointsetsManager");class n{constructor(){this._pointsetsDataBySymbol=new Map}destroy(){this._pointsetsDataBySymbol.clear()}createPointset(e,t,i,s,n){let o=this._pointsetsDataBySymbol.get(t);void 0===o&&(o=new Map,this._pointsetsDataBySymbol.set(t,o));const a=[];for(const t of s){const[i,s]=t;"number"!=typeof i||Number.isNaN(i)?r.logWarn(`Pointset time is invalid: id=${e}, ${i} of type ${typeof i}`):a.push({point:t,extrapolation:n.extrapolateTimeWithOffsetToTime(1e3*i,s)})}s.length===a.length&&o.set(e,{resolution:i,points:a})}removePointset(e){const t=[];this._pointsetsDataBySymbol.forEach(((i,s)=>{i.delete(e),0===i.size&&t.push(s)}));for(const e of t)this._pointsetsDataBySymbol.delete(e)}invalidatePointsetsForSymbol(e,t){const i=this._pointsetsDataBySymbol.get(e);void 0!==i&&i.forEach(((e,i)=>{if(s.Interval.isEqual(e.resolution,t))for(const t of e.points)null!==t.extrapolation&&t.extrapolation.exact&&(t.extrapolation.exact=!1)}))}getUpdatesForSymbol(e,t,i,s){const r=new Map,n=this._pointsetsDataBySymbol.get(e);return void 0!==n&&n.forEach(((e,n)=>{const o=this._refreshPointsetData(e,t,i,s) -;null!==o&&r.set(n,o)})),r}_refreshPointsetData(e,t,i,n){if(s.Interval.isEqual(e.resolution,t))for(let t=0;t ${t}`),null;o.push({index:i,value:[a.index,a.timeMs/1e3]})}return o}}},21125:(e,t,i)=>{"use strict";i.d(t,{SessionTimeScale:()=>v});var s=i(50151),r=i(14483),n=i(41249),o=i(78071),a=i(77475),l=i(61401),c=i(13041);function h(e){return 60*e*60*1e3}function d(e){return 60*e*1e3}const u=[{divisor:1,weight:18},{divisor:(p=1,1e3*p),weight:19},{divisor:d(1),weight:20},{divisor:d(5),weight:21},{divisor:d(30),weight:22},{divisor:h(1),weight:30},{divisor:h(3),weight:31},{divisor:h(6),weight:32},{divisor:h(12),weight:33}];var p;function _(e,t){if(null!==t){if(e.getUTCFullYear()!==t.getUTCFullYear())return 70;if(e.getUTCMonth()!==t.getUTCMonth())return 60;if(e.getUTCDate()!==t.getUTCDate())return 50;const i=t.getTime(),s=e.getTime();for(let e=u.length-1;e>=0;--e)if(Math.floor(i/u[e].divisor)!==Math.floor(s/u[e].divisor))return u[e].weight}return 18}function m(e,t,i=0){if(0===e.length)return[];let s=i,r=i;const n=[];for(;s=t.length?(n.push({old:s,new:l.INVALID_TIME_POINT_INDEX}),s++):e[s].timeMs===t[r].timeMs?(s!==r&&n.push({old:s,new:r}),s++,r++):e[s].timeMs{if(e.new===t.new&&e.new===l.INVALID_TIME_POINT_INDEX)return e.old-t.old;if(e.new===l.INVALID_TIME_POINT_INDEX)return-1;if(t.new===l.INVALID_TIME_POINT_INDEX)return 1;const i=e.old-e.new,s=t.old-t.new;return i>0?s>0?e.old-t.old:-1:s<0?t.new-e.new:1}))}function g(e,t){return{span:e.markWeight,time:e.displayTime,index:t}}const f=r.enabled("end_of_period_timescale_marks");class v{constructor(){this._completed=!0,this._mainSymbolExtrapolator=null,this._pointDataByTimePoint=new Map,this._instanceIds=new Set,this._displayTimezone=null,this._minFutureBarsCount=0,this._sortedTimePoints=[]}destroy(){this.clearTimeScale()}setCompleted(e){this._completed=e}isCompleted(){return this._completed}clearTimeScale(){return this._pointDataByTimePoint.clear(),this._instanceIds.clear(),this._sortedTimePoints=[],{baseIndex:null,pointsIndex:0,indexChange:[],marks:[],points:[]}}indexOfTime(e){if(0===this._sortedTimePoints.length)return null===this._mainSymbolExtrapolator?null:this._mainSymbolExtrapolator.indexOfTime(e);if(ethis._sortedTimePoints[this._sortedTimePoints.length-1].timeMs){if(null===this._mainSymbolExtrapolator)return null;const t=this._mainSymbolExtrapolator.indexOfTime(e),i=this._mainSymbolExtrapolator.indexOfTime(this._sortedTimePoints[this._sortedTimePoints.length-1].timeMs);if(null===t||null===i)return null;const s=t.index-i.index-1;return{index:this._sortedTimePoints.length+s,timeMs:t.timeMs}}let t=(0,o.lowerbound)(this._sortedTimePoints,e,((e,t)=>e.timeMs({timeMs:e,markWeight:0,displayTime:NaN})));this._fillPointsData(i,0,0!==this._sortedTimePoints.length?this._sortedTimePoints[this._sortedTimePoints.length-1].displayTime:null);const r=[];for(let t=e;tg(e,i+t)));return r.concat(n)}setTimezone(e){this._displayTimezone="exchange"===e?null:(0,n.get_timezone)(e),this._fillPointsData(this._sortedTimePoints,0)}fillIndexesInRows(e){if(0===e.length)return;let t=-1,i=(0,o.lowerbound)(this._sortedTimePoints,Math.round(1e3*e[0].value[0]),((e,t)=>e.timeMse.timeMs{for(;i=this._sortedTimePoints.length){const t=this.indexOfTime(e);if(null===t)return l.INVALID_TIME_POINT_INDEX;i=t.timeMs!==e?t.index+1:t.index}return(0,s.assert)(i>t,"data must have unique sorted times"),t=i,i}))}firstSeriesBarTime(){return 0===this._sortedTimePoints.length?null:this._sortedTimePoints[0].timeMs}replaceBarsTimesTail(e,t){if(0===t.length)return null;if(!this._instanceIds.has(e))return this.setSeriesBarsTimes(e,t);const i=[],s=(0,o.lowerbound)(this._sortedTimePoints,t[0],((e,t)=>e.timeMs({timeMs:e.timeMs,pointData:e.pointData,markWeight:0,displayTime:NaN})));for(let e=s;ee.timeMs-t.timeMs));const a=this._updateTimeScalePointsTail(n);return this._applyTimeScaleChanges(a,!1)}setSeriesBarsTimes(e,t){return this._setBarsTimes(e,t)}setStudyBarsTimes(e,t){return this._setBarsTimes(e,t)}_setBarsTimes(e,t){const i=0!==this._pointDataByTimePoint.size;if(this._instanceIds.has(e))for(const t of this._sortedTimePoints)t.pointData.instances.delete(e);0===t.length?this._instanceIds.delete(e):this._instanceIds.add(e),this._addBarsTimesToInstance(e,t,!1),i&&this._cleanupPointsData(this._sortedTimePoints);const s=[];this._pointDataByTimePoint.forEach(((e,t)=>{s.push({markWeight:0,timeMs:t,displayTime:NaN,pointData:e})})),s.sort(((e,t)=>e.timeMs-t.timeMs));const r=this._updateTimeScalePoints(s);return this._applyTimeScaleChanges(r,!1)}_updateFutureBars(){if(0===this._minFutureBarsCount||null===this._mainSymbolExtrapolator)return;if(0!==this._sortedTimePoints.length){const e=this._sortedTimePoints[this._sortedTimePoints.length-1].timeMs;this._mainSymbolExtrapolator.ensureExtrapolatedToFutureTime(e)}const e=this._futureBarsFirstPointIndex();this._mainSymbolExtrapolator.setMinFutureBarsCount(e+this._minFutureBarsCount)}_addBarsTimesToInstance(e,t,i){const s=i?[]:null;for(const i of t){const t=this._pointDataByTimePoint.get(i);if(void 0===t){const t=new Set;t.add(e);const r={index:0,instances:t};this._pointDataByTimePoint.set(i,r),null!==s&&s.push({timeMs:i,pointData:r})}else t.instances.add(e)}return s}_futureBarsFirstPointIndex(){if(null===this._mainSymbolExtrapolator||0===this._sortedTimePoints.length)return 0;const e=this._mainSymbolExtrapolator.futureBars();return(0,o.upperbound_int)(e,this._sortedTimePoints[this._sortedTimePoints.length-1].timeMs)}_futureBars(){return null===this._mainSymbolExtrapolator?[]:this._mainSymbolExtrapolator.futureBars().slice(this._futureBarsFirstPointIndex(),this._futureBarsFirstPointIndex()+1e3)}_cleanupPointsData(e){for(const t of e)0===t.pointData.instances.size&&this._pointDataByTimePoint.delete(t.timeMs)}_updateTimeScalePoints(e){let t=-1;for(let i=0;ie.timeMs=this._sortedTimePoints.length)continue;this._sortedTimePoints[n].timeMs!==r.timeMs&&-1===i&&(i=n)}const s=t+e.length;if(i=y(i,this._sortedTimePoints.length,s),-1===i)return null;this._fillPointsData(e,0,0===t||0===this._sortedTimePoints.length?null:this._sortedTimePoints[t-1].displayTime);const r=m(this._sortedTimePoints.slice(t),e).map((e=>({old:e.old+t,new:e.new===l.INVALID_TIME_POINT_INDEX?e.new:e.new+t})));{const i=this._sortedTimePoints;let r=0;for(;t+r1&&null===i){const t=Math.ceil(n/(e.length-1)),i=new Date(1e3*(e[0].displayTime-t));e[0].markWeight=_(new Date(1e3*e[0].displayTime),i)}}(e,t,i)}_applyTimeScaleChanges(e,t){if(null===e)return t?(this._fillPointsData(this._sortedTimePoints,0),{points:[],pointsIndex:0,baseIndex:this._getBaseIndex(),indexChange:[],marks:this.tickMarks(0)}):null;let i=e.pointsIndex;if(0!==i&&t&&(this._fillPointsData(this._sortedTimePoints,0),i=0),0===this._sortedTimePoints.length)return{baseIndex:null,pointsIndex:0,indexChange:[],marks:[],points:[]};const s=[];for(let t=e.pointsIndex;t{"use strict";var s=i(3035),r=i(43910).StudyEngine,n=i(2543).OHLCV,o=i(55137),a=i(76537).SymbolExtrapolator,l=i(21125).SessionTimeScale,c=i(34108).PointsetsManager,h=i(60156),d=i(77475).createDwmAligner,u=i(36274).Interval,p=i(76422),_=i(2663).visitObject,m=i(1722).isObject;i(24172),i(60325) -;var g=i(79850).DatafeedRequestsCachedProcessor,f=i(38618).timezoneIsAvailable,v=i(77475).isAlignmentEnabled,y=i(27856),S=y.isEncodedExtendedSymbol,b=y.decodeExtendedSymbol,w=i(42960).extractSymbolNameFromSymbolInfo,C=i(48739).replaceGraphicsTimesWithTimePointIndexIndex,P=i(14483),x=i(66846).SubsessionId,T=i(60156).getPeriodsBetweenDates,I=i(40367).overwriteVolumeProfileResolutionForPeriodGetter;const M="pre_post_market_sessions",A=P.enabled(M);var L=-5e6;function k(e){var t=e.findIndex((function(e){return e.index!==L}));return-1===t?[]:0===t?e:e.slice(t)}function D(e,t,i){if(e){if("string"==typeof e)return void console.warn("`logo_urls` should be an array of urls, not a string.");const[t,s]=e;s?(i["base-currency-logoid"]=t,i["currency-logoid"]=s):i.logoid=e}t&&(i.provider_id=t)}function E(e,t){return e+"_"+t}function V(e){if(null===e||"number"==typeof e)return e;if("object"==typeof e&&Array.isArray(e)){switch(e[0]){case"bar_count":return e[2];case"from_to":return e.length>=3?e[2]:null}}return null}function B(e){const t=b(e),i="string"==typeof t.symbol?t:t.symbol;return[i.symbol,{currency:i["currency-id"],unit:i["unit-id"],session:i.session===x.Regular?void 0:i.session}]}var R=function(e){var t=this;this._studiesCache={},this._objectsDataCache={},this._studiesNonSeriesTimes={},this._metainfoCache=[],this._barsCoefficientsCache={},this._externalDatafeed=e,e.getVolumeProfileResolutionForPeriod&&I((function(t,i,s,r){return e.getVolumeProfileResolutionForPeriod(t,i,s,r)})),this._datafeedConfiguration=null,this._marketStatusWatchers={},this._resolveRequests={},this._resolvePromisesBySymbolId=new Map,this._symbolIdToSymbolRequestString=new Map,this._callbacks={},this._serverTimeOffset=0,t._logMessage("Datafeed settings received: {0}".format(JSON.stringify(window.configurationData))),t._datafeedConfiguration=t._adoptConfigurationData(window.configurationData),t._fireEvent("configuration_received"),t._externalDatafeed.getServerTime&&t._externalDatafeed.getServerTime((function(e){t._serverTimeOffset=e-(new Date).valueOf()/1e3})),this._invalidatedPointsetSessions=new Set,this._refreshPointsetsTimerId=null,this._pointsetsManagers={},this._quotesInfo=[],this._depthInfo=[],this._endOfData={},this._computeStudyCounter=0,this._symbolExtrapolators={},this._timeScales={},this._cachedDatafeed=new g(e,this.serverTimeOffset.bind(this),this._datafeedConfiguration.reset_cache_timeout),o.setupFeed({resolve:function(e,i,s,r){t._resolveSymbolByName(e,i,s,r)},subscribe:function(e,i,s,r,n){return t._cachedDatafeed.subscribe(e,i,s,function(e,i,s){var r=new h.SessionInfo(e.timezone,e.session,e.session_holidays,e.corrections),n=h.newBarBuilder(i,r,r);return function(e){if(e&&e.count()){var i=1e3*t.getCurrentUTCTime();n.moveTo(i),n.indexOfBar(i)>=0&&e.setLastBarClosed(!1)}s(e)}}(e,i,r),n)},unsubscribe:function(e){return t._cachedDatafeed.unsubscribe(e)}})};function N(e,t){return e+"_"+t}function O(e,t,i,s){return e+(t?"_#_"+t:"")+(i?"_#_"+i:"")+(s?"_#_"+s:"")}R.prototype._getSymbolExtrapolator=function(e,t,i){ -var s=u.normalize(i),r=function(e,t,i){const s=void 0!==t.subsession_id?","+t.subsession_id:"";return e+","+t.full_name+","+i+s}(e,t,s),n=this._symbolExtrapolators[r];return void 0===n&&(n=new a(t,s),this._symbolExtrapolators[r]=n),n},R.prototype._barsCoefficients=function(e,t){if(void 0===b(e).type)return{};var i=e+t;return this._barsCoefficientsCache[i]||(this._barsCoefficientsCache[i]={}),this._barsCoefficientsCache[i]},R.prototype.destroy=function(){this._cachedDatafeed.destroy(),this._externalDatafeed=null,Object.keys(this._pointsetsManagers).forEach((function(e){this._pointsetsManagers[e].destroy()}),this),this._pointsetsManagers={}},R.prototype.purgeCache=function(){this._endOfData={},this._resolveRequests={},this._objectsDataCache={},this._studiesNonSeriesTimes={},this._studiesCache={},this._resolvePromisesBySymbolId.clear(),this._symbolIdToSymbolRequestString.clear(),Object.keys(this._pointsetsManagers).forEach((function(e){this._pointsetsManagers[e].destroy()}),this),this._pointsetsManagers={},Object.keys(this._timeScales).forEach((function(e){this._timeScales[e].destroy()}),this),this._timeScales={},Object.keys(this._symbolExtrapolators).forEach((function(e){this._symbolExtrapolators[e].destroy()}),this),this._symbolExtrapolators={}},R.prototype.purgeDataCache=function(){this._cachedDatafeed.purgeCache()},R.prototype._logMessage=function(e){P.enabled("charting_library_debug_mode")&&console.log(e)},R.prototype.on=function(e,t){return this._callbacks.hasOwnProperty(e)||(this._callbacks[e]=[]),this._callbacks[e].push(t),this},R.prototype._fireEvent=function(e,t,i){if(this._callbacks.hasOwnProperty(e)){for(var s=this._callbacks[e],r=0;r{this._resolveSymbolImpl(e,(e=>{t(e.price_sources)}),(e=>{i(e)}))}))},R.prototype.supportedSymbolsTypes=function(){return this._datafeedConfiguration.symbols_types||[]},R.prototype.symbolsGrouping=function(){return this._datafeedConfiguration.symbols_grouping||{futures:/$a/}},R.prototype._findStudyObject=function(e){e.endsWith("!")&&(e=e.slice(0,-1));var t=e.split("@")[0],i=JSServer.studyLibrary.filter((function(i){return i.metainfo.id===e||i.metainfo.shortDescription===t}));return 0===i.length?null:i[0]},R.prototype.getMarks=function(e,t,i,s,r){var n={red:6,green:5,blue:4,yellow:3} -;if(this._externalDatafeed.getMarks&&this._datafeedConfiguration.supports_marks){this._logMessage("Requesting bars marks: symbol {0}, resolution {1}, range [{2} ... {3}]".format(e.full_name,r,new Date(1e3*t).toUTCString(),new Date(1e3*i).toUTCString()));var o=this;this._externalDatafeed.getMarks(e,t,i,(function(t){var i=t.map((function(e){return e.time=parseInt(e.time),e}));o._logMessage("Received bars marks: symbol {0}, resolution {1}, marks {2}".format(e.full_name,r,JSON.stringify(i)));var a=d(r,e),l=P.enabled("two_character_bar_marks_labels"),c=i.map((function(e){return e.tickmark=null!==a?a.timeToSessionStart(1e3*e.time)/1e3:e.time,e.direction=n[e.color],e.onClicked=function(){p.emit("onMarkClick",e.id)},e.label=!!e.label&&(l?e.label.slice(0,2):e.label[0]),e}));s(c)}),r)}},R.prototype.getTimescaleMarks=function(e,t,i,s,r){if(this._externalDatafeed.getTimescaleMarks&&this._datafeedConfiguration.supports_timescale_marks){this._logMessage("Requesting timescale marks: symbol {0}, resolution {1}, range [{2} ... {3}]".format(e.full_name,r,new Date(1e3*t).toUTCString(),new Date(1e3*i).toUTCString()));var n=this;this._externalDatafeed.getTimescaleMarks(e,t,i,(function(t){n._logMessage("Received timescale marks: symbol {0}, resolution {1}, marks {2}".format(e.full_name,r,JSON.stringify(t)));var i=d(r,e),o=t.map((function(e){return e.tickmark=null!==i?i.timeToSessionStart(1e3*e.time)/1e3:e.time,e}));s(o)}),r)}},R.prototype.getSeriesLastBarTime=function(e,t){var i=this._getSeriesData(e,t);return null===i||0===i.length?null:i[i.length-1].timeMs},R.prototype.getSeriesInterval=function(e,t){var i=this._studiesCache[e][t];return i?i.resolution:null},R.prototype.getSeriesSymbolInfo=function(e,t){var i=this._studiesCache[e][t];return i?i.symbolInfo:null},R.prototype._getSeriesData=function(e,t){return this._objectsDataCache[N(e,t)]||null},R.prototype._computeStudy=async function(e,t,i,s,n,o,a,l,c,h){var p=!0,_=[];null!==l&&(this._objectsDataCache[l]=null),this._timeScales[e].setCompleted(!1);var m=this._computeStudyCounter++;function g(e,t){if(e_[a].timeMs;l?_.push({index:g(s,_.length),value:[s/1e3].concat(r),timeMs:s}):(_[a].index=g(s,a),_[a].value=[s/1e3].concat(r),_[a].timeMs=s),p||h.onRealtimeCallback([_[_.length-1]],l,_.length,f,i)}(e,t,i)},nonseriesOut:function(e,t){h.onNonSeriesDataUpdate(t,i)},setNoMoreData:function(){y=!0},recalc:function(e,s){p=!1,_.endOfData=y,_.emptyBarCount=s.emptyBarCount,t.error&&null!==t.error()||(null!==l&&(S._objectsDataCache[l]=_),h.onDataReadyCallback(_,f,i,s))}});if(!S._studiesCache[e]||!S._studiesCache[e][n])throw Error("This should never happen");S._studiesCache[e][n].engine=w}catch(e){if(!e.studyError)throw e;h.onErrorCallback(e.message)}}else h.onErrorCallback("Unsupported resolution. Did you forget to set has_intraday to true?")}(w,C)},R.prototype._getDataRangeForStudy=function(e,t){var i=this._studiesCache[e][t],s={...this._seriesDataRange(e,i.parentId)};return this._studyCanExtendTimeScale(e,t)?void 0!==i.dataRange?i.dataRange:(i.firstLoadedTimeMs&&(s.to=i.firstLoadedTimeMs),s):s},R.prototype._createStudy=function(e,t,i,s,r,n,o,a){var l=this;function c(e,t,i){const o=l._studiesCache[s][r];if(o.completed=!0,e.length>0&&(o.firstLoadedTimeMs=e[0].timeMs),e=k(e),l._setEndOfData(s,r,n,!l._studyCanExtendTimeScale(s,r)||e.endOfData),l._studyCanExtendTimeScale(s,r)){const t=e.map((function(e){return e.timeMs})),i=l._timeScales[s].setStudyBarsTimes(r,t);l._applyTimeScaleUpdate(s,i)}l._timeScales[s].fillIndexesInRows(e),TradingView.ChartapiMessagerInstances[s].onDataUpdate(r,n,e,t),TradingView.ChartapiMessagerInstances[s].onStudyCompleted(r,n),l._updateTimeScaleState(s)}function h(e){var t={};if(0!==e.size){var i={},n=l._studiesCache[s][r].metainfo;e.forEach((function(e,t){i[n.plots[t].id]=e})),t.data={offsets:i}}return t}this._studiesCache[s][r].completed=!1,a=function(e){if(Array.isArray(e))return e;for(var t=[],i=l._studiesCache[s][r].metainfo.inputs,n=0;n=0},R.prototype.ensureExtendedTo=function(e,t,i){if(!this._studiesCache[t][e])throw Error("This should never happen");var s=this;setTimeout((function(){s._recreateSourcesForDataRange(t,{to:i})}),0)},R.prototype.extendSeriesRange=function(e,t){var i=this._timeScales[e].firstSeriesBarTime();if(null!==i){var s=this._mainSeriesRecord(e);if(u.isDWM(s.resolution)&&null!=s.symbolInfo){var r=d(s.resolution,s.symbolInfo);null!==r&&(i=r.timeToExchangeTradingDay(i))}var n=this._symbolIdToSymbolRequestString.get(E(e,s.symbolId)),o=this._barsCoefficients(n,s.resolution),a=o.barsCoefficient||1;if(!o.barsCoefficient){var l=this._getSeriesData(e,s.guid);null!==l&&(o.expectedBarsCount=l.length+t)}var c=this;setTimeout((function(){c._recreateSourcesForDataRange(e,{to:i,countBack:(t+2)*a})}),0)}else this._logMessage("Nothing to extend - there is no points on time scale")},R.prototype.seriesTurnaround=function(e,t){return this._studiesCache[e]&&this._studiesCache[e][t]&&this._studiesCache[e][t].turnaround},R.prototype._seriesDataRange=function(e,t){var i=this._studiesCache[e][t];return null!==i.firstLoadedTimeMs?{to:i.firstLoadedTimeMs,countBack:0}:i.dataRange},R.prototype._applyTimeScaleUpdate=function(e,t){if(null!==t){var i=[];for(var s in this._studiesCache[e]){var r=this._studiesCache[e][s];if(r&&"study"===r.type){var n=this._studiesNonSeriesTimes[e][s];if(n){var o={indexes:this._timeScales[e].convertTimesToIndexes(n),data:{indexes_replace:!0}};i.push({objId:s,turnaround:r.turnaround,data:[],nonSeriesData:o})}}}TradingView.ChartapiMessagerInstances[e].onTimescaleUpdate(t,i),Promise.resolve().then(function(){var t=this._mainSeriesRecord(e);if(null!==t&&null!=t.symbolInfo){var i=this._getSymbolExtrapolator(e,t.symbolInfo,t.resolution);this._pointsetsManagers[e].getUpdatesForSymbol(t.symbolInfo.full_name,t.resolution,i,this._timeScales[e]).forEach((function(t,i){TradingView.ChartapiMessagerInstances[e].onPointsetDataUpdate(i,null,t)}))}}.bind(this))}},R.prototype._updateMainTsBuilder=function(e){var t=this._mainSeriesRecord(e);if(null!==t&&null!=t.symbolInfo){var i=this._getSymbolExtrapolator(e,t.symbolInfo,t.resolution);this._timeScales[e].setMainSymbolExtrapolator(i)}},R.prototype._updateTimeScaleState=function(e){var t=!0,i=!0;for(var s in this._studiesCache[e]){var r=this._studiesCache[e][s];i=i&&this._isEndOfData(e,s,r.turnaround),t=t&&r.completed}this._timeScales[e].isCompleted()!==t&&(this._timeScales[e].setCompleted(t),t&&TradingView.ChartapiMessagerInstances[e].onTimescaleCompleted(i))},R.prototype._mainSeriesRecord=function(e){var t=null,i=null;for(var s in this._studiesCache[e]){var r=this._studiesCache[e][s];if("series"===r.type&&(null===t&&(t=r),r.isMain)){i=r;break}}return null===i&&(i=t),null!==i&&(i.isMain=!0),i},R.prototype._seriesCount=function(e){var t=0 -;for(var i in this._studiesCache[e]){"series"===this._studiesCache[e][i].type&&(t+=1)}return t},R.prototype._prepareSeriesNonSeriesData=function(e,t,i){var s=i.data[i.data.length-1],r=this._getSeriesData(e,t),n=null===r?[]:i.data;return{data:{data:{reversalAmount:i.reversalAmount,boxSize:i.boxSize,price:s?s[4]:i.price,bars:n.map((function(e,t){return{time:t,open:e[1],high:e[2],low:e[3],close:e[4],volume:e[5],factor:e[6],additionalPrice:e[6]}}))}},indexes:this._timeScales[e].convertTimesToIndexes(n.map((function(e){var t=e[0]||0;return t<0?r[r.length+t].timeMs:i.projectionTime+t})))}},R.prototype.createSeries=function(e,t,i,s,r,o,a){this._setEndOfData(e,t,i,!1);var l=new n;this._studiesCache[e]=this._studiesCache[e]||{};var c=this._getSeriesData(e,t),h=this._studiesCache[e][t],d=this._seriesCount(e),p=this._mainSeriesRecord(e);if(!h||u.isEqual(h.resolution,r)&&h.symbolId===s)void 0!==o.countBack&&null!==c&&0!==c.length&&(o.to=c[0].timeMs),h&&null!=h.firstLoadedTimeMs?o.to=void 0!==o.to?Math.min(h.firstLoadedTimeMs,o.to):h.firstLoadedTimeMs:h||0===d||null!==p&&(null!=p.firstLoadedTimeMs?(o.to=p.firstLoadedTimeMs,o.countBack=0):o=Object.assign({},p.dataRange));else if(1===d)o=Object.assign({},h.initialDatarange);else{var _=this._timeScales[e].firstSeriesBarTime();(void 0===o.to||null!==_&&_{D(e.logo_urls,e.exchange_logo,e)})),s(e)}))},R.prototype.resolveSymbol=function(e,t,i){var s=this;this._symbolIdToSymbolRequestString.set(E(e,t),i),this._resolvePromisesBySymbolId.set(E(e,t),new Promise((function(r,n){s._resolveSymbolImpl(i,(function(s){TradingView.ChartapiMessagerInstances[e].onSymbolResolved(t,s),r({symbolInfo:s,requestedSymbol:i})}),(function(i){TradingView.ChartapiMessagerInstances[e].onSymbolError(t,i),n(i)}))})))},R.prototype._resolveSymbolImpl=function(e,t,i){S(e)||console.error("Expect to get symbol encoded string, but got the following instead: "+e);const[s,r]=B(e);this._resolveSymbolByName(s,r,t,i)},R.prototype._resolveSymbolByName=function(e,t,i,s){var r,n=t&&t.currency,o=t&&t.unit,a=t&&t.session,l=O(e,n,o,a);if(this._resolveRequests[l])r=this._resolveRequests[l];else{r=this._resolveSymbolInternal(e,n||void 0,o||void 0,a||void 0),this._resolveRequests[l]=r;var c=this;r.then((function(t){c._resolveRequests[O(e,t.currency_id,t.unit_id,t.subsession_id)]=r,c._resolveRequests[O(w(t,null),t.currency_id,t.unit_id,t.subsession_id)]=r,c._resolveRequests[O(w(t,null),n,o,a)]=r})).catch((function(){}))} -r.then(i).catch(s)},R.prototype._resolveSymbolInternal=function(e,t,i,s){var r=this;return new Promise(function(n,o){const a=[e,t,i,s].filter((e=>!!e)).join("|");this._logMessage("Symbol resolve requested: `{0}` ".format(a));var l=!0;this._externalDatafeed.resolveSymbol(e,(function(e){l&&console.warn("`resolveSymbol` should return result asynchronously. Use `setTimeout` with 0 interval to execute the callback function."),r._logMessage("Symbol resolved: `{0}`, SymbolInfo in server response {1}".format(a,JSON.stringify(e))),function(e){const t=e.exchange+":"+e.name;if(e.full_name=t,e.pro_name=t,e.base_name||(e.base_name=[e.name]),e.legs||(e.legs=[e.name]),e.exchange||(e.exchange=e["exchange-listed"]),e.ticker||(e.ticker=e.symbol||e.name),e.data_status||(e.data_status="streaming"),!e.session&&e["session-regular"]&&(e.session=e["session-regular"]),!e.minmov&&e.minmovement&&(e.minmov=e.minmovement),e.currency_code&&(e.currency_id=e.currency_code),e.original_currency_code&&(e.original_currency_id=e.original_currency_code),e.holidays&&(e.session_holidays=e.holidays),void 0!==e.has_no_volume&&(e.visible_plots_set=e.has_no_volume?"ohlc":"ohlcv"),void 0===e.visible_plots_set&&(e.visible_plots_set="ohlcv"),e.supported_resolutions)for(var i=0;ithis._resolveSymbolByName(t,i,o,(t=>{this.quoteRemoveSymbols(e,[r]),a(t)}))),e,r)}}},R.prototype._removeMarketStatusWatchers=function(e){var t=this;Object.keys(this._marketStatusWatchers[e]||{}).forEach((function(i){t._marketStatusWatchers[e][i].stop()})),this._marketStatusWatchers[e]={}},R.prototype._stopQuotesSubscription=function(e){this._quotesInfo[e].listenerGUID&&(this._externalDatafeed.unsubscribeQuotes(this._quotesInfo[e].listenerGUID),this._quotesInfo[e].listenerGUID=void 0),this._removeMarketStatusWatchers(e)},R.prototype._startQuotesSubscription=function(e){var t={},i=this;function s(t,s){var r=i._marketStatusWatchers[e][t.n];t.symbolname=t.n,t.status=t.s,t.values=t.v,t.values.change=t.v.ch,t.values.last_price=t.v.lp,t.values.change_percent=t.v.chp,t.values.current_session=t.v.cs||r&&r.marketStatus(),t.values.pricescale=s.pricescale,t.values.minmov=s.minmov,t.values.minmove2=s.minmove2||0,t.values.fractional=s.fractional||!1,D(s.logo_urls,s.exchange_logo,t.values),r&&t.v.cs&&r.stop(),TradingView.ChartapiMessagerInstances[e].onQuotesData([e].concat([t]))}function r(e){e.forEach((function(e){if(void 0!==t[e.n])null!==t[e.n]&&s(e,t[e.n]);else{const[r,n]=B(e.n);i._resolveSymbolByName(r,n,(function(i){t[e.n]=i,s(e,i)}),(function(){t[e.n]=null}))}}))}var n=this._quotesInfo[e].symbols;if(0===n.length)return;const o=n.map((e=>B(e)[0])),a=this._quotesInfo[e].fastSymbols.map((e=>B(e)[0]));this._externalDatafeed.getQuotes&&!P.enabled("charting_library")?this._externalDatafeed.getQuotes(o,(function(t){i._quotesInfo[e]&&0!==i._quotesInfo[e].symbols.length&&(r(t),i._quotesInfo[e].listenerGUID=e,i._externalDatafeed.subscribeQuotes(o,a,r,i._quotesInfo[e].listenerGUID))}),(function(e){})):!this._externalDatafeed.getQuotes&&P.enabled("trading_terminal")&&setTimeout((function(){r(o.map((function(e){return{n:e,s:"ok",v:{}}})))})),this._createMarketStatusWatchers(e,n)},R.prototype._restartQuotesSubscription=function(e){this._stopQuotesSubscription(e),this._startQuotesSubscription(e)},R.prototype.quoteCreateSession=function(e){this._quotesInfo[e]={symbols:[],fastSymbols:[],listenerGUID:void 0}}, -R.prototype.quoteDeleteSession=function(e){this._stopQuotesSubscription(e),this._quotesInfo[e]=null},R.prototype.quoteSetFields=function(e,t){},R.prototype.quoteAddSymbols=function(e,t){this._quotesInfo[e].symbols=this._filteredSymbols(this._quotesInfo[e].symbols.concat(t)),this._restartQuotesSubscription(e)},R.prototype.quoteRemoveSymbols=function(e,t){this._quotesInfo[e].symbols=this._quotesInfo[e].symbols.filter((function(e){return t.indexOf(e)<0})),this._restartQuotesSubscription(e)},R.prototype.quoteFastSymbols=function(e,t){this._quotesInfo[e].fastSymbols=this._filteredSymbols(t),this._restartQuotesSubscription(e)},R.prototype.quoteHibernateAll=function(e){},R.prototype._stopDepthSubscription=function(e){this._depthInfo[e].listenerGUID&&(this._externalDatafeed.unsubscribeDepth(this._depthInfo[e].listenerGUID),this._depthInfo[e].listenerGUID=void 0)},R.prototype._startDepthSubscription=function(e){var t=this,i=this._depthInfo[e].symbol;function s(e){return e.map((function(e){return{p:e.price,v:e.volume}}))}function r(e){var t={};return t.s=i,t.bids=s(e.bids),t.asks=s(e.asks),t}i&&this._externalDatafeed.subscribeDepth&&(t._depthInfo[e].listenerGUID=this._externalDatafeed.subscribeDepth(i,(function(i){var s;t._depthInfo[e]&&((s=i).snapshot?TradingView.ChartapiMessagerInstances[e].onDepthData([e].concat([r(s)])):TradingView.ChartapiMessagerInstances[e].onDepthUpdate([e].concat([r(s)])))})))},R.prototype._restartDepthSubscription=function(e){this._stopDepthSubscription(e),this._startDepthSubscription(e)},R.prototype.depthCreateSession=function(e){this._depthInfo[e]={symbol:null,listenerGUID:void 0}},R.prototype.depthDeleteSession=function(e){this._depthInfo[e].symbol=null,this._stopDepthSubscription(e),delete this._depthInfo[e]},R.prototype.depthSetSymbol=function(e,t){this._depthInfo[e].symbol=t,this._restartDepthSubscription(e)},R.prototype._filteredSymbols=function(e){var t=[];return e.forEach((function(e){e instanceof Object||t.indexOf(e)<0&&t.push(e)})),t},R.prototype._isEndOfData=function(e,t,i){var s=e+"!"+t+"@"+i;return!!this._endOfData[s]},R.prototype._setEndOfData=function(e,t,i,s){var r=e+"!"+t+"@"+i;this._endOfData[r]=!1!==s},R.prototype.serverTimeOffset=function(){return this._serverTimeOffset},R.prototype.serverTime=function(){return 1e3*this.getCurrentUTCTime()},R.prototype.getCurrentUTCTime=function(){return(new Date).valueOf()/1e3+this._serverTimeOffset},R.prototype.switchTimezone=function(e,t){this._timeScales[e].setTimezone(t);var i=this._timeScales[e].tickMarks();null!==i&&TradingView.ChartapiMessagerInstances[e].onTickmarksUpdated(0,i)},R.prototype._studyCanExtendTimeScale=function(e,t){const i=this._studiesCache[e][t]?.metainfo;return void 0!==i&&(P.enabled("studies_extend_time_scale")&&i.canExtendTimeScale||P.enabled("secondary_series_extend_time_scale")&&"Overlay@tv-basicstudies-1"===i.id)},e.exports=R},76537:(e,t,i)=>{"use strict";i.d(t,{SymbolExtrapolator:()=>c});var s=i(50151),r=i(78071),n=i(60156),o=i(94421),a=i(36274);function l(e,t){return e.length>t}class c{constructor(e,t,i=2e5){ -this._firstRealBarTimeMs=null,this._historyBarsCache=[],this._projectionFirstIndex=1/0,this._barsTimes=[],this._minFutureBarsCount=0,this._lastRealBarTimeMs=null,this._futureBarsCache=[],this._symbolInfo=e,this._interval=a.Interval.parse(t),this._extrapolateLimit=i,this._barBuilder=(0,n.newBarBuilder)(t,new n.SessionInfo(e.timezone,e.session,e.session_holidays,e.corrections),null)}destroy(){this.clear()}interval(){return this._interval}barBuilder(){return this._barBuilder}symbolInfo(){return this._symbolInfo}clear(){this._firstRealBarTimeMs=null,this._historyBarsCache=[],this._barsTimes=[],this._lastRealBarTimeMs=null,this._futureBarsCache=[],this._minFutureBarsCount=0,this._projectionFirstIndex=1/0}firstFutureBarIndex(){return this._barsTimes.length}futureBars(){return this._futureBarsCache}replaceBarsTimesTail(e,t=e.length){if(0===e.length)return;if(0===this._barsTimes.length)return void this.setBarsTimes(e,t);const i=e[0],n=this._barsTimes[this._barsTimes.length-1],o=i>n?this._barsTimes.length:(0,r.lowerbound_int)(this._barsTimes,i);0!==o?(this._barsTimes.splice(o,this._barsTimes.length,...e),this._projectionFirstIndex=t===e.length?this._barsTimes.length:this._barsTimes.indexOf(e[t]),(0,s.assert)(-1!==this._projectionFirstIndex,"something went wrong"),n!==e[e.length-1]&&this._setLastRealBarTime(e[e.length-1])):this.setBarsTimes(e,t)}setBarsTimes(e,t=e.length){const i=this._barsTimes;if(this._barsTimes=e.slice(),this._projectionFirstIndex=0===this._barsTimes.length?1/0:t,0===e.length)return this._historyBarsCache=[],this._futureBarsCache=[],this._firstRealBarTimeMs=null,void(this._lastRealBarTimeMs=null);0!==i.length&&i[i.length-1]===e[e.length-1]||this._setLastRealBarTime(e[e.length-1]),0!==i.length&&i[0]===e[0]||(this._historyBarsCache=[],this._firstRealBarTimeMs=e[0])}extrapolateTimeWithOffsetToTime(e,t){if(0===t)return{timeMs:e,exact:!0};0===this._barsTimes.length&&(t<0?null===this._firstRealBarTimeMs?this._firstRealBarTimeMs=e:(this._extendHistoryCacheToTimeFromRight(Math.min(e,null!==this._lastRealBarTimeMs?this._lastRealBarTimeMs:1/0)),this._ensureExtrapolatedToHistoryTime(e)):null===this._lastRealBarTimeMs?this._lastRealBarTimeMs=e:(this._extendFutureCacheToTimeFromLeft(Math.max(e,null!==this._firstRealBarTimeMs?this._firstRealBarTimeMs:1/0)),this._ensureExtrapolatedToFutureTime(e)));const i=this.indexOfTime(e);if(null===i)return null;const s=this._timeOfBarIndex(i.index+t);return null===s?null:((i.index<0||this._projectionFirstIndex<=i.index)&&(s.exact=!1),s)}indexOfTime(e){if(null!==this._firstRealBarTimeMs&&ethis._lastRealBarTimeMs){this._ensureExtrapolatedToFutureTime(e);let t=(0, -r.lowerbound_int)(this._futureBarsCache,e);if(0!==this._futureBarsCache.length&&t===this._futureBarsCache.length&&e>this._futureBarsCache[this._futureBarsCache.length-1])return null;this._futureBarsCache[t]!==e&&(t-=1);const i=Math.max(1,this._barsTimes.length)+t;return{index:i,timeMs:i===this._barsTimes.length-1?(0,s.ensureNotNull)(this._lastRealBarTimeMs):this._futureBarsCache[t]}}if(0===this._barsTimes.length)return null!==this._firstRealBarTimeMs&&this._firstRealBarTimeMs<=e||null!==this._lastRealBarTimeMs&&e<=this._lastRealBarTimeMs?{index:0,timeMs:(0,s.ensureNotNull)(this._timeOfBarIndex(0)).timeMs}:null;let t=(0,r.lowerbound_int)(this._barsTimes,e);return this._barsTimes[t]!==e&&(t-=1),{index:t,timeMs:this._barsTimes[t]}}setMinFutureBarsCount(e){this._minFutureBarsCount=e,0!==this._barsTimes.length&&this._ensureExtrapolatedToFutureBar(e)}ensureExtrapolatedToFutureTime(e){this._ensureExtrapolatedToFutureTime(e)}_setLastRealBarTime(e){const t=this._futureBarsCache.length,i=(0,r.upperbound_int)(this._futureBarsCache,e);0===i?this._extendFutureCacheToTimeFromLeft(e):(this._lastRealBarTimeMs=e,this._futureBarsCache=this._futureBarsCache.slice(i)),this._ensureExtrapolatedToFutureBar(Math.max(t,this._minFutureBarsCount))}_timeOfBarIndex(e){var t;if(e<0){const t=Math.abs(e);this._ensureExtrapolatedToHistoryBar(t);const i=this._historyBarsCache.length-t;return i<0?null:{timeMs:this._historyBarsCache[i],exact:!1}}if(0===e&&0===this._barsTimes.length)return{timeMs:(0,s.ensureNotNull)(null!==(t=this._firstRealBarTimeMs)&&void 0!==t?t:this._lastRealBarTimeMs),exact:!1};if(e>=this._barsTimes.length){const t=e-Math.max(1,this._barsTimes.length);return this._ensureExtrapolatedToFutureBar(t+1),t>=this._futureBarsCache.length?null:{timeMs:this._futureBarsCache[t],exact:!1}}return{timeMs:this._barsTimes[e],exact:e=e)return;if((0,s.assert)(0===this._barsTimes.length,"bars should be empty"),this._firstRealBarTimeMs=e, -0===this._historyBarsCache.length)return;const t=(0,o.extrapolateBarsFrontToTime)(this._barBuilder,this._historyBarsCache[this._historyBarsCache.length-1],e-1,this._extrapolateLimit,!0).times;this._historyBarsCache=this._historyBarsCache.concat(t)}_ensureExtrapolatedToFutureBar(e){return!(this._futureBarsCache.length>=e||l(this._futureBarsCache,this._extrapolateLimit))&&this._extendFutureCacheFromRight(((t,i)=>(0,o.extrapolateBarsFrontByCount)(this._barBuilder,t,e-i,!0).times))}_ensureExtrapolatedToFutureTime(e){null!==this._lastRealBarTimeMs&&this._lastRealBarTimeMs>=e||l(this._futureBarsCache,this._extrapolateLimit)||0!==this._futureBarsCache.length&&this._futureBarsCache[this._futureBarsCache.length-1]>=e||(this._extendFutureCacheFromRight(((t,i)=>(0,o.extrapolateBarsFrontToTime)(this._barBuilder,t,e,this._extrapolateLimit,!0).times)),this._futureBarsCache[this._futureBarsCache.length-1]=e||l(this._historyBarsCache,this._extrapolateLimit)||this._extendHistoryCacheFromLeft(((t,i)=>(0,o.extrapolateBarsFrontByCount)(this._barBuilder,t,-(e-i),!0).times.reverse()))}_ensureExtrapolatedToHistoryTime(e){null!==this._firstRealBarTimeMs&&this._firstRealBarTimeMs<=e||l(this._historyBarsCache,this._extrapolateLimit)||0!==this._historyBarsCache.length&&this._historyBarsCache[0]<=e||(this._extendHistoryCacheFromLeft(((t,i)=>{const s=(0,o.extrapolateBarsFrontToTime)(this._barBuilder,t-1,e-1,this._extrapolateLimit,!0).times;return s[s.length-1]===t?s.slice(0,-1):s})),(0===this._historyBarsCache.length||this._historyBarsCache[0]>e)&&this._ensureExtrapolatedToHistoryBar(this._historyBarsCache.length+1))}}},61595:(e,t,i)=>{"use strict";i.d(t,{backend:()=>s});const s=i(58844)},47327:(e,t,i)=>{"use strict";i.d(t,{HandlerInfo:()=>s});class s{constructor(e,t){this.handler=e,this.customId=t}}},17133:(e,t,i)=>{"use strict";var s,r;function n(e,t){return"period-back"===e.type&&"period-back"===t.type?e.value===t.value:"time-range"===e.type&&"time-range"===t.type&&(e.from===t.from&&e.to===t.to)}i.d(t,{TIMEFRAMETYPE:()=>r,areEqualTimeFrames:()=>n}),function(e){e.extractErrorReason=function(e){return e.params[1]}}(s||(s={})),function(e){e.PeriodBack="period-back",e.TimeRange="time-range"}(r||(r={}))},89173:()=>{"use strict";TradingView.Pro=function(){this.hasPackage=function(){return!1}},window.user={is_pro:!1,settings:{}},TradingView.Pro.prototype.isPaidPro=function(){return!1},TradingView.Pro.prototype.isSupportAvailable=function(){return!1},TradingView.Pro.prototype.getProduct=function(){return{}},TradingView.Pro.prototype.getStudiesOrder=function(){return[]}},67545:(e,t,i)=>{"use strict";i.r(t),i.d(t,{QUOTE_FIELDS:()=>n,QUOTE_FIELDS_CACHE:()=>o,QuoteCache:()=>r});var s=i(50151);class r{constructor(e){this._cache=new Map,this._fields=[...e.fields]}update(e,t,i){const r=(0,s.ensureDefined)(e.symbolname);if(this._cache.has(r)||this._cache.set(r,{symbolname:r,status:e.status,values:{}}), -"error"===e.status)return;const n=(0,s.ensureDefined)(this._cache.get(r));n.status=e.status;for(const s of this._fields)t.has(s)&&(i||void 0!==e.values[s])&&(n.values[s]=e.values[s])}get(e){var t;return null!==(t=this._cache.get(e))&&void 0!==t?t:null}fields(){return this._fields}} +;return e=>t.indexOfBar(e)===o.SessionStage.POST_SESSION&&(t.moveTo(e),!0)},h.createNthBarInSessionCheck=e=>{if(void 0===e.symbol.session.timezone)return()=>!1;const t=(0,s.newBarBuilder)(e.symbol.period,e.symbol.session,null);return(e,i)=>(t.indexOfBar(e)===o.SessionStage.POST_SESSION&&t.moveTo(e),t.indexOfBar(e)===i)},h.error=e=>{throw new a.StudyError(e)},h.dmi=(e,t,i)=>{const s=i.new_var(h.high(i)),r=i.new_var(h.low(i)),n=h.change(s),o=-h.change(r),a=i.new_var(h.na(n)||h.na(o)?h.na():h.and(h.gt(n,o),h.gt(n,0))?n:0),l=i.new_var(h.na(o)?h.na():h.and(h.gt(o,n),h.gt(o,0))?o:0),c=h.atr(e,i),d=h.fixnan(100*h.rma(a,e,i)/c,i),u=h.fixnan(100*h.rma(l,e,i)/c,i);let p=d+u;h.isZero(p)&&(p+=1);const _=Math.abs(d-u)/p*100,m=i.new_var(_),g=h.rma(m,t,i),f=i.new_var(g);return[d,u,_,g,(f.get(0)+f.get(e-1))/2]},h.zigzag=(e,t,i)=>new m(e,t,i).lastPrice(),h.zigzagbars=(e,t,i)=>{const s=new m(e,t,i);return-1===s.lastIndex()?NaN:s.lastIndex()-h.n(i)};const u=0,p=1;class _{constructor(e,t,i,s,r){this._areaRight=e,this._areaLeft=t,this._pivotType=i,this._series=s,this._currentIndex=r.new_var(0),this._currentValue=r.new_var(NaN),this._pivotIndex=r.new_var(-1),this._index=h.n(r),this._isNewBar=r.symbol.isNewBar;const n=this._currentIndex.get(1),o=this._currentValue.get(1),a=this._pivotIndex.get(1);this._index>1&&(this._currentIndex.set(n),this._currentValue.set(o),this._pivotIndex.set(a))}isPivotFound(){return-1!==this._pivotIndex.get()}pivotIndex(){return this._pivotIndex.get()}currentValue(){return this._currentValue.get()}pivotType(){return this._pivotType}reset(){this._currentValue.set(NaN),this._currentIndex.set(0),this._pivotIndex.set(-1)}isRightSideOk(e){return e-this._currentIndex.get()===this._areaRight}isViolate(e,t){if(e<1||isNaN(this._currentValue.get()))return!0;const i=this._series.get(this._index-e);return!!isNaN(i)||(i===this._currentValue.get()?t:this._pivotType===p?i>this._currentValue.get():ithis._areaRight}update(){if(this._isNewBar&&this.isPivotFound()&&this.reset(),this.processPoint(this._index),this.isRightSideOk(this._index)){if(-1===this._pivotIndex.get()){let e=!0;for(let t=0;t1&&this.addPivot(n,o,a),this.processPivot(this._pivotHigh),this.processPivot(this._pivotLow)}addPivot(e,t,i){this._lastIndex.set(e),this._lastVal.set(t),this._lastType.set(i)}updatePivot(e,t){this._lastIndex.set(e),this._lastVal.set(t)}lastPrice(){return this._lastVal.get()}lastIndex(){return this._lastIndex.get()}addPoint(e,t,i){if(isNaN(this._lastVal.get()))return void this.addPivot(e,t,i);const s=this._lastVal.get();if(this._lastType.get()===i){return void((i===p?t>s:tthis._deviation&&this.addPivot(e,t,i)}processPivot(e){e.update(),this._isBarClosed&&e.isPivotFound()&&this.addPoint(e.pivotIndex(),e.currentValue(),e.pivotType())}}},53130:(e,t,i)=>{"use strict";i.d(t,{anchoredVWAPStudyItem:()=>n});var s=i(50151),r=i(49581);const n={name:"Anchored VWAP",metainfo:{_metainfoVersion:51,description:"Anchored VWAP",shortDescription:"Anchored VWAP",format:{type:"inherit"},id:"AnchoredVWAP@tv-basicstudies-1",is_hidden_study:!0,is_price_study:!0,defaults:{inputs:{start_time:0,source:"hlc3"},styles:{VWAP:{color:"#1e88e5",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,display:15}}},inputs:[{defval:0,id:"start_time",isHidden:!0,max:253370764800,min:-253370764800,name:"Start time",type:"time"},{defval:"hlc3",id:"source",name:"Source",options:["open","high","low","close","hl2","hlc3","ohlc4"],type:"source"}],plots:[{id:"VWAP",type:"line"}],styles:{VWAP:{histogramBase:0,title:"VWAP"}}},constructor:class{constructor(){this._isNewSession=null,this._firstBarTime=0}init(e,t){this._firstBarTime=t(0),this._isNewSession=null}main(e,t,i){if(void 0===i)return[NaN];(0,s.assert)(e.symbol.time===i.time);const n=i.time;if(n&&n{"use strict";i.d(t,{OHLCV:()=>r});var s=i(49581);class r{main(e){return[s.Std.open(e),s.Std.high(e),s.Std.low(e),s.Std.close(e),s.Std.volume(e),s.Std.updatetime(e),void 0,void 0,void 0,void 0]}}},82808:(e,t,i)=>{"use strict";i.d(t,{pivotPointsStandardStudyItem:()=>d});var s=i(36274),r=i(47609),n=i(49581);class o{constructor(){this.p=NaN,this.r1=NaN,this.s1=NaN,this.r2=NaN,this.s2=NaN,this.r3=NaN,this.s3=NaN,this.r4=NaN,this.s4=NaN,this.r5=NaN,this.s5=NaN,this.startIndex__t=NaN,this.endIndex__t=NaN}}class a{constructor(){this.pivots=[]}}function l(e,t){e.setUTCMonth(e.getUTCMonth()+t)}function c(e,t){if(n.Std.ismonthly(e)){let i=new Date(t);return i.getUTCDay()=1&&t.multiplier()<=15?"1D":"1W";case s.ResolutionKind.Seconds:case s.ResolutionKind.Ticks:return"1D"}throw new Error("Unexpected resolution type: "+e.symbol.resolution)}(e);case"Daily":return"1D";case"Weekly":return"1W";case"Monthly":return"1M";case"Yearly":return"12M";default:throw new Error("No such pivTimeFrame: "+t)}}const d={name:"Pivot Points Standard",metainfo:{_metainfoVersion:44,defaults:{inputs:{kind:"Traditional",lookBack:15,pivTimeFrame:"Auto",showHistoricalPivots:!0},precision:"4"},description:"Pivot Points Standard",id:"PivotPointsStandard@tv-basicstudies-80",inputs:[{defval:"Traditional",id:"kind",name:"Type",options:["Traditional","Fibonacci","Woodie","Classic","DeMark","Camarilla","Floor"],type:"text"},{defval:!0,id:"showHistoricalPivots",name:"Show historical pivots",type:"bool"},{defval:"Auto",id:"pivTimeFrame",name:"Pivots Timeframe",options:["Auto","Daily","Weekly","Monthly","Yearly"],type:"text"},{defval:15,id:"lookBack",max:5e3,min:1,name:"Number of Pivots Back",type:"integer"}],is_price_study:!0,linkedToSeries:!0,shortDescription:"Pivots",format:{type:"price",precision:4}},constructor:class{constructor(){this._secondaryRes="1D",this._firstMainSeriesBarTime=NaN}init(e,t){const i=t(0),s=t(1),o=t(2),l=t(3);this._data=new a,this._firstMainSeriesBarTime=NaN,this._kindPP=function(e){switch(e){case"Traditional":return 0;case"Fibonacci":return 1;case"Woodie":return 2;case"Classic":return 3;case"DeMark":return 4;case"Camarilla":return 5;case"Floor":return 6;default:throw new Error("Unknown kind "+e)}}(i),this._showHistoricalPivots=s,this._historicalPivotsToKeep=l,this._pivTimeFrame=o,this._isValidResolution=function(e,t){return!(n.Std.isdaily(e)&&"Daily"===t||n.Std.isweekly(e)&&("Daily"===t||"Weekly"===t)||n.Std.ismonthly(e)&&("Daily"===t||"Weekly"===t||"Monthly"===t))}(e,this._pivTimeFrame),this._isValidResolution||n.Std.error("You cannot see this pivot timeframe on this resolution"),this._isValidResolution&&(this._secondaryRes=h(e,this._pivTimeFrame),void 0!==e.symbol.info&&(0,r.findSuitableResolutionToBuildFrom)(this._secondaryRes,e.symbol.info).error&&(this._isValidResolution=!1,n.Std.error(`Resolution ${this._secondaryRes} is not supported for this symbol`))),e.new_sym(e.symbol.tickerid,this._secondaryRes)}main(e,t,i){if(!this._isValidResolution)return null;if(e.is_main_symbol(i))return isNaN(this._firstMainSeriesBarTime)&&(this._firstMainSeriesBarTime=e.symbol.time,this._removeUnusedPivots()),e.symbol.isLastBar&&e.symbol.isNewBar?this._createResponse():null;e.select_sym(1) +;const s=e.new_var(n.Std.open(e)),r=e.new_var(n.Std.high(e)),a=e.new_var(n.Std.low(e)),l=e.new_var(n.Std.close(e)),h=e.new_var(n.Std.time(e)),d=this._data,u=s.get(0),p=h.get(0),_=s.get(1),m=r.get(1),g=a.get(1),f=l.get(1),v=e.symbol.isLastBar;if(0!==d.pivots.length&&e.symbol.isNewBar){const e=d.pivots[d.pivots.length-1];e.endIndex__t!==p&&(e.endIndex__t=p)}if(0===e.symbol.index||!e.symbol.isNewBar)return e.select_sym(0),null;const y=function(e,t,i,s,r,a,l,c){const h=new o;let d=NaN;const u=i-s;switch(c){case 0:d=(i+s+r)/3,h.p=d,h.r1=2*d-s,h.s1=2*d-i,h.r2=d+(i-s),h.s2=d-(i-s),h.r3=2*d+(i-2*s),h.s3=2*d-(2*i-s),h.r4=3*d+(i-3*s),h.s4=3*d-(3*i-s),h.r5=4*d+(i-4*s),h.s5=4*d-(4*i-s);break;case 1:d=(i+s+r)/3,h.p=d,h.r1=d+.382*u,h.s1=d-.382*u,h.r2=d+.618*u,h.s2=d-.618*u,h.r3=d+u,h.s3=d-u;break;case 2:d=(i+s+2*e)/4,h.p=d,h.r1=2*d-s,h.s1=2*d-i,h.r2=d+u,h.s2=d-u,h.r3=i+2*(d-s),h.s3=s-2*(i-d),h.r4=h.r3+u,h.s4=h.s3-u;break;case 3:d=(i+s+r)/3,h.p=d,h.r1=2*d-s,h.s1=2*d-i,h.r2=d+u,h.s2=d-u,h.r3=d+2*u,h.s3=d-2*u,h.r4=d+3*u,h.s4=d-3*u;break;case 4:let o=NaN;o=n.Std.equal(t,r)?i+s+2*r:n.Std.greater(r,t)?2*i+s+r:2*s+i+r,d=o/4,h.p=d,h.r1=o/2-s,h.s1=o/2-i;break;case 5:d=(i+s+r)/3,h.p=d,h.r1=r+1.1*u/12,h.s1=r-1.1*u/12,h.r2=r+1.1*u/6,h.s2=r-1.1*u/6,h.r3=r+1.1*u/4,h.s3=r-1.1*u/4,h.r4=r+1.1*u/2,h.s4=r-1.1*u/2;break;case 6:d=(i+s+r)/3,h.p=d,h.r1=2*d-s,h.s1=2*d-i,h.r2=d+(i-s),h.s2=d-(i-s),h.r3=d-h.s1+h.r2,h.s3=2*d-(2*i-s);break;default:throw new Error("Unknown kind")}return h.startIndex__t=a,h.endIndex__t=l,h}(u,_,m,g,f,p,c(e,p),this._kindPP);return e.select_sym(0),this._showHistoricalPivots||(d.pivots=[]),d.pivots.push(y),d.pivots.length>this._historicalPivotsToKeep&&d.pivots.shift(),v?this._createResponse():null}_createResponse(){return 0===this._data.pivots.length?null:{nonseries:!0,type:"non_series_data",data:{data:this._data}}}_removeUnusedPivots(){const e=Math.max(this._data.pivots.findIndex((e=>e.startIndex__t>this._firstMainSeriesBarTime))-1,0);e>0&&this._data.pivots.splice(0,e)}}}},81821:(e,t,i)=>{"use strict";i.d(t,{ratioStudyItem:()=>n});var s=i(87302);class r extends s.SpreadRatioBase{_doCalculation(e,t,i,s){return e*t/(i*s)}}const n={name:"Ratio",metainfo:{_metainfoVersion:15,defaults:s.spreadRatioDefaults,plots:s.spreadRatioPlots,styles:s.spreadRatioStyles,description:"Ratio",shortDescription:"Ratio",is_price_study:!1,inputs:s.spreadRatioInputs,id:"Ratio@tv-basicstudies-1",format:{type:"price",precision:2}},constructor:r}},65097:(e,t,i)=>{"use strict";i.d(t,{regressionTrendStudyItem:()=>n});var s=i(49581);function r(e,t,i){const r={slope:NaN,average:NaN,intercept:NaN,stdDev:NaN,upDev:NaN,downDev:NaN,pearsons:NaN};return 0===e.length||(function(e,t){let i=0,s=0,r=0,n=0;for(let t=0;tn&&(n=u),u=d-i[s],u>o&&(o=u),u=e[s] +;const _=u-r.average,m=d-p;u-=d,a+=u*u,l+=_*_,c+=m*m,h+=_*m,d+=r.slope}r.stdDev=Math.sqrt(a/(0===u?1:u)),r.pearsons=s.Std.isZero(l)||s.Std.isZero(c)?0:h/Math.sqrt(l*c),r.upDev=n,r.downDev=o}(e,t,i,r)),r}const n={name:"Regression Trend",metainfo:{_metainfoVersion:51,description:"Regression Trend",format:{type:"inherit"},id:"RegressionTrend@tv-basicstudies-144",is_hidden_study:!0,is_price_study:!0,shortDescription:"Reg Trend",defaults:{inputs:{"first bar time":0,"last bar time":0,"lower diviation":-2,source:"close","upper diviation":2,"use lower diviation":!0,"use upper diviation":!0},styles:{}},inputs:[{defval:2,id:"upper diviation",max:500,min:-500,name:"Upper Deviation",type:"float"},{defval:-2,id:"lower diviation",max:500,min:-500,name:"Lower Deviation",type:"float"},{defval:!0,id:"use upper diviation",name:"Use Upper Deviation",type:"bool"},{defval:!0,id:"use lower diviation",name:"Use Lower Deviation",type:"bool"},{defval:0,id:"first bar time",isHidden:!0,max:253370764800,min:-253370764800,name:"First bar time",type:"time"},{defval:0,id:"last bar time",isHidden:!0,max:253370764800,min:-253370764800,name:"Last bar time",type:"time"},{defval:"close",id:"source",name:"Source",options:["open","high","low","close","hl2","hlc3","ohlc4"],type:"source"}],plots:[]},constructor:class{constructor(){this._resultSent=!1}init(e,t){this._resultSent=!1,this._data={baseLine:{startPrice:NaN,endPrice:NaN},upLine:{startPrice:NaN,endPrice:NaN},downLine:{startPrice:NaN,endPrice:NaN},pearsons:NaN,startIndex__t:NaN,endIndex__t:NaN}}main(e,t){const i=t(6),n=e.new_unlimited_var(s.Std.time(e)),o=e.new_unlimited_var(s.Std.high(e)),a=e.new_unlimited_var(s.Std.low(e)),l=e.new_unlimited_var(s.Std[i](e));if(!e.symbol.isLastBar)return null;if(this._resultSent)return null;const c=t(0),h=t(1),d=t(2),u=t(3),p=t(4),_=t(5),m=n.indexOf(p),g=n.indexOf(_),f=[],v=[],y=[],S=[];for(let e=m;e>=g;--e)f.push(n.get(e)),v.push(o.get(e)),y.push(a.get(e)),S.push(l.get(e));return this._updateData(f,d,c,u,h,p,_,r(S,v,y)),this._resultSent=!0,{type:"non_series_data",nonseries:!0,data:{data:this._data}}}_updateData(e,t,i,s,r,n,o,a){const l=e.length-1;this._data.baseLine.startPrice=a.intercept,this._data.baseLine.endPrice=a.intercept+a.slope*l;const c=a.intercept+(t?a.stdDev*i:a.upDev);this._data.upLine.startPrice=c,this._data.upLine.endPrice=c+a.slope*l;const h=a.intercept+(s?a.stdDev*r:-a.downDev);this._data.downLine.startPrice=h,this._data.downLine.endPrice=h+a.slope*l,this._data.pearsons=a.pearsons,this._data.startIndex__t=n,this._data.endIndex__t=o}}}},87302:(e,t,i)=>{"use strict";i.d(t,{SpreadRatioBase:()=>l,spreadRatioDefaults:()=>c,spreadRatioFilledAreas:()=>_,spreadRatioInputs:()=>h,spreadRatioPalettes:()=>p,spreadRatioPlots:()=>d,spreadRatioStyles:()=>u});var s=i(33013),r=i(72877),n=i(49581),o=i(87095);const a="rgba(0, 0, 0, 0)";class l{init(e,t){e.new_sym(t(1),n.Std.period(e)),this._source=t(0),this._scaleFactor1=1,this._scaleFactor2=1}main(e,t){const i=e.symbol.time,s=n.Std[this._source](e);e.select_sym(1) +;const r=n.Std[this._source](e),o=e.new_unlimited_var(r),a=e.new_unlimited_var(e.symbol.time);if(e.select_sym(0),isNaN(i))return null;let l=a.indexOf(i);-1!==l&&a.get(l)!==i&&(l=-1);const c=l<0?NaN:o.get(l),h=this._doCalculation(this._scaleFactor1,s,this._scaleFactor2,c);return[h,0,n.Std.ge(h,0),n.Std.lt(h,0)]}}const c={styles:{plot1:{linestyle:0,linewidth:2,plottype:r.LineStudyPlotStyle.Line,trackPrice:!1,transparency:35,color:"#800080",display:15},plotBaseline:{linestyle:0,linewidth:2,plottype:r.LineStudyPlotStyle.Line,trackPrice:!1,transparency:0,color:a,display:0}},palettes:{negativePalette:{colors:[{color:(0,o.applyAlpha)((0,s.getHexColorByName)("color-ripe-red-500"),.5),style:0,width:0},{color:a,style:0,width:0}]},positivePalette:{colors:[{color:(0,o.applyAlpha)((0,s.getHexColorByName)("color-minty-green-500"),.5),style:0,width:0},{color:a,style:0,width:0}]}},filledAreasStyle:{negativeFill:{color:"",transparency:0,visible:!0,fillType:void 0},positiveFill:{color:"",transparency:0,visible:!0,fillType:void 0}},precision:2,inputs:{source:"close",symbol2:""}},h=[{defval:"close",id:"source",name:"Source",options:["open","high","low","close","hl2","hlc3","ohlc4"],type:"text"},{id:"symbol2",name:"Symbol",type:"symbol",confirm:!0}],d=[{id:"plot1",type:"line"},{id:"plotBaseline",type:"line"},{id:"plotNegativeFill",type:"colorer",target:"negativeFill",palette:"negativePalette"},{id:"plotPositiveFill",type:"colorer",target:"positiveFill",palette:"positivePalette"}],u={plot1:{title:"Plot",histogramBase:0},plotBaseline:{title:"Baseline",isHidden:!0}},p={negativePalette:{valToIndex:{0:0,1:1},colors:[{name:"Color"}]},positivePalette:{valToIndex:{0:0,1:1},colors:[{name:"Color"}]}},_=[{id:"negativeFill",objAId:"plot1",objBId:"plotBaseline",type:"plot_plot",title:"Negative fill",palette:"negativePalette",fillToIntersection:!0},{id:"positiveFill",objAId:"plot1",objBId:"plotBaseline",type:"plot_plot",title:"Positive fill",palette:"positivePalette",fillToIntersection:!0}]},39944:(e,t,i)=>{"use strict";i.d(t,{spreadStudyItem:()=>n});var s=i(87302);class r extends s.SpreadRatioBase{_doCalculation(e,t,i,s){return e*t-i*s}}const n={name:"Spread",metainfo:{_metainfoVersion:15,defaults:s.spreadRatioDefaults,plots:s.spreadRatioPlots,styles:s.spreadRatioStyles,palettes:s.spreadRatioPalettes,filledAreas:s.spreadRatioFilledAreas,description:"Spread",shortDescription:"Spread",is_price_study:!1,inputs:s.spreadRatioInputs,id:"Spread@tv-basicstudies-1",format:{type:"price",precision:2}},constructor:r}},56437:(e,t,i)=>{"use strict";i.d(t,{VbPCheckHaveVolumeExpr:()=>r});var s=i(49581);class r{constructor(e){this._haveAnyVolume=!1,this._isDisabled=!1,this._seriesGetter=e}update(e,t){if(this._haveAnyVolume||this._isDisabled)return;const i=this._seriesGetter.volume().get(e);0!==i&&Number.isFinite(i)&&(this._haveAnyVolume=!0),t&&(this._haveAnyVolume||s.Std.error("The data vendor doesn't provide volume data for this symbol."),this._isDisabled=!0)}}},89529:(e,t,i)=>{"use strict";i.d(t,{VolumeByPriceExpr:()=>_}) +;var s=i(50151),r=i(37160),n=i(36274),o=i(29779);class a extends o.GraphicsObj{constructor(e,t,i,r,n,o){super(e),(0,s.assert)(t({index:e.index,offset:e.offset,level:e.level})))}}}class u extends o.GraphicsObj{constructor(e,t,i,s,r=!1,n=!1){super(e),this._endIndex=this._mixinJSONObject.createTimeField(i,"endIndex"),this._extendLeft=this._mixinJSONObject.createField(r,"extendLeft"),this._extendRight=this._mixinJSONObject.createField(n,"extendRight"), +this._level=this._mixinJSONObject.createDoubleField(s,"level"),this._startIndex=this._mixinJSONObject.createTimeField(t,"startIndex")}isNaN(){return super.isNaN()||Number.isNaN(this._level.get())||this._startIndex.get()<0||this._endIndex.get()<0||this._startIndex.get()===this._endIndex.get()&&!this._extendLeft.get()&&!this._extendRight.get()}jsonName(){return"horizlines"}primitiveData(){return{id:this.id(),startIndex:this._startIndex.get(),endIndex:this._endIndex.get(),extendLeft:this._extendLeft.get(),extendRight:this._extendRight.get(),level:this._level.get()}}startIndex(){return this._startIndex.get()}setStartIndex(e){this._startIndex.set(e)&&this._processObjUpdate()}endIndex(){return this._endIndex.get()}setEndIndex(e){this._endIndex.set(e)&&this._processObjUpdate()}level(){return this._level.get()}setLevel(e){this._level.set(e)&&this._processObjUpdate()}isExtendLeft(){return this._extendLeft.get()}setExtendLeft(e){this._extendLeft.set(e)&&this._processObjUpdate()}extendLeft(){return this.isExtendLeft()}isExtendRight(){return this._extendRight.get()}setExtendRight(e){this._extendRight.set(e)&&this._processObjUpdate()}extendRight(){return this.isExtendRight()}}class p{constructor(){this._map=new Map}get(e){const t=this._innerMap(e.start);return t&&t.get(e.end)}set(e,t){this._innerMap(e.start,!0).set(e.end,t)}clear(){this._map.clear()}size(){let e=0;return this._map.forEach((t=>e+=t.size)),e}_innerMap(e,t){let i=this._map.get(e);return void 0===i&&t&&(i=new Map,this._map.set(e,i)),i}}class _{constructor(e,t,i,r,n,o,a,c,h,d,u,_,m,g,f){this._freezedBoxes=new l.GraphicsList,this._freezedHists=new l.GraphicsList,this._freezedPocs=new l.GraphicsList,this._freezedVAHists=new l.GraphicsList,this._currentHistsGr=new l.GraphicsList,this._currentVAHistsGr=new l.GraphicsList,this._currentHists=[],this._currentHistsMap=new p,this._currentBox=null,this._currentPoc=null,this._historyBarSet=[],this._prevRtBar=null,this._minPrice=Number.POSITIVE_INFINITY,this._maxPrice=Number.NEGATIVE_INFINITY,this._leftBoxTime=null,this._rightBoxTime=null,this._actualRightBoxTime=null,this._needRecalc=!1,this._largestHistItem=null,this._rowsLayout=null,this._currentVAStart=0,this._currentVAEnd=0,this._previousVAStart=0,this._previousVAEnd=0,this._idsGenerator=null,(0,s.assert)(1===e||2===e),this._numOfSubHists=e,this._outHists=r,this._outBoxLines=n,this._outPocLines=o,this._extendPocLeftRight=a,this._outVAHists=c,this._vaVolumePercent=h,this._rowsLayoutSupplier=d,this._outHists.addStable(this._freezedHists),this._outVAHists.addStable(this._freezedVAHists),this._maxHHistItems=u,this._layoutIsAutoselected=g,this._leftBoxTimeMutable=_,this._rightBoxTimeMutable=m,this._actualRightBoxTime=null!=f?f:m,this._ctx=t,this._seriesGetter=i}update(e){this._supplyRowsLayout(this._ctx),null===this._currentBox&&this._initCurrentBox(),null===this._currentPoc&&this._initCurrentPoc();const t=this._timeScale().get(e);this._leftBoxTime=this._leftBoxTimeMutable,this._rightBoxTime=this._rightBoxTimeMutable, +this._ctx.symbol.isLastBar&&!Number.isNaN(this._rightBoxTime)&&(this._rightBoxTime=Math.min(t+n.Interval.parse(this._ctx.symbol.interval+this._ctx.symbol.resolution).inMilliseconds(t)-1,this._rightBoxTime));const i=c.Std.greaterOrEqual(this._seriesClose().get(e),this._seriesOpen().get(e)),s={high:this._seriesHigh().get(e),low:this._seriesLow().get(e),volume:this._seriesVol().get(e),isUp:i,time:t};this._updateCurrentHistogram(s),this._currentHists.length>0&&(this._largestHistItem=this._getLargestHistItem(),this._updateCurrentPoc(),this._seriesGetter.developingPoc().set(this._currentPoc.level()),this._updateValueArea(),this._vaVolumePercent>0&&(this._seriesGetter.developingVAHigh().set(this._currentHists[this._currentVAEnd].priceHigh()),this._seriesGetter.developingVALow().set(this._currentHists[this._currentVAStart].priceLow()))),this._updateCurrentBox(),this._rebuildOutData()}setIdsGeneratorProxy(e){this._idsGenerator=e}nextGraphicsObjId(){return(0,s.ensureNotNull)(this._idsGenerator).nextGraphicsObjId()}pushEraseObjCmd(e,t){(0,s.ensureNotNull)(this._idsGenerator).pushEraseObjCmd(e,t)}popEraseCmds(){return(0,s.ensureNotNull)(this._idsGenerator).popEraseCmds()}_timeScale(){return this._seriesGetter.time()}_seriesLow(){return this._seriesGetter.low()}_seriesHigh(){return this._seriesGetter.high()}_seriesVol(){return this._seriesGetter.volume()}_seriesOpen(){return this._seriesGetter.open()}_seriesClose(){return this._seriesGetter.close()}_freezeCurrentHistogramAndCleanup(){null!==this._currentBox&&this._freezedBoxes.add(this._currentBox),c.Std.greater(this._getVolume(this._currentHists),0)&&(this._freezedHists.addAll(this._currentHistsGr),this._freezedVAHists.addAll(this._currentVAHistsGr),null!==this._currentPoc&&this._freezedPocs.add(this._currentPoc)),this._currentHists=[],this._currentHistsGr.clear(),this._currentHistsMap.clear(),this._initCurrentBox(),this._initCurrentPoc(),this._currentVAHistsGr.clear(),this._historyBarSet=[],this._minPrice=Number.POSITIVE_INFINITY,this._maxPrice=Number.NEGATIVE_INFINITY,this._prevRtBar=null,this._leftBoxTime=null,this._rightBoxTime=null}_supplyRowsLayout(e){null===this._rowsLayout&&e.symbol.isFirstBar&&e.symbol.isNewBar&&(this._rowsLayout=this._rowsLayoutSupplier())}_updateCurrentHistogram(e){if(this._needRecalc=!1,c.Std.greater(this._minPrice,e.low)&&(this._minPrice=e.low,this._needRecalc=!0),c.Std.less(this._maxPrice,e.high)&&(this._maxPrice=e.high,this._needRecalc=!0),this._ctx.symbol.isBarClosed&&this._historyBarSet.length>0){const t=this._historyBarSet[this._historyBarSet.length-1];t.time===e.time&&(this._prevRtBar=t,this._historyBarSet.pop())}this._needRecalc&&0===(0,s.ensureNotNull)(this._rowsLayout).type()?(this._recalculateCurrentResultsOnHistoryBarSet(),this._applyUpdateToCurrentResults(e,!1)):this._applyUpdateToCurrentResults(e,!0),this._ctx.symbol.isBarClosed?((0,s.assert)(null===this._prevRtBar||e.time===this._prevRtBar.time),this._historyBarSet.push(e),this._prevRtBar=null):this._prevRtBar=e}_getMidLevel(e){return(e.priceHigh()+e.priceLow())/2} +_getMidLevelFromList(e){return e.length%2==0?e[e.length/2].priceLow():this._getMidLevel(e[Math.floor(e.length/2)])}_getLargestHistItem(){let e=[],t=this._currentHists[0];for(const i of this._currentHists)c.Std.greater(i.ratesSum(),t.ratesSum())?(t=i,e=[t]):c.Std.equal(i.ratesSum(),t.ratesSum())&&e.push(i);if(e.length>1){const i=this._getMidLevelFromList(this._currentHists);t=e[e.length-1];for(let s=e.length-2;s>=0;s--){const r=e[s];c.Std.lessOrEqual(Math.abs(this._getMidLevel(r)-i),Math.abs(this._getMidLevel(t)-i))&&(t=r)}}return t}_initCurrentPoc(){this._currentPoc=new u(this,0,0,0)}_updateCurrentPoc(){const e=(0,s.ensureNotNull)(this._currentPoc);e.setStartIndex((0,s.ensureNotNull)(this._leftBoxTime)),e.setEndIndex((0,s.ensureNotNull)(this._actualRightBoxTime)),e.setExtendLeft(this._extendPocLeftRight),e.setExtendRight(this._extendPocLeftRight);const t=this._getMidLevel((0,s.ensureNotNull)(this._largestHistItem));e.setLevel(t)}_getVolume(e){let t=0;for(const i of e)t+=i.ratesSum();return t}_getPocHistItemIndex(){for(let e=0;e=0,`ERROR - PocHistItemIndex == ${e}`),this._currentVAStart=e-1,this._currentVAEnd=e+1;const t=this._getVolume(this._currentHists)*this._vaVolumePercent*.01;let i=this._currentHists[e].ratesSum(),r=0,n=null;for(;c.Std.lessOrEqual(i+r,t)&&(i+=r,0===n?--this._currentVAStart:1===n&&++this._currentVAEnd,-1!==this._currentVAStart||this._currentVAEnd!==this._currentHists.length);){let t,i;if(this._currentVAStart>-1)if(t=this._currentHists[this._currentVAStart].ratesSum(),this._currentVAEndthis._getMidLevel(this._currentHists[this._currentVAStart])&&e.priceLow()0&&(e=this._currentHists[0].priceLow(),t=this._currentHists[this._currentHists.length-1].priceHigh());const i=[],r=(0,s.ensureNotNull)(this._leftBoxTime),n=(0,s.ensureNotNull)(this._actualRightBoxTime);i.push(new h(r,e)),i.push(new h(r,t)),i.push(new h(n,t)),i.push(new h(n,e)),(0,s.ensureNotNull)(this._currentBox).setPoints(i)}_recalculateCurrentResultsOnHistoryBarSet(){for(let e=0;e0&&(this._largestHistItem=this._getLargestHistItem(),this._updateCurrentPoc()),this._updateCurrentBox()}_applyUpdateToCurrentResults(e,t){t&&null!==this._prevRtBar&&this._addHistoryBarToHistogram(this._prevRtBar,this._historyBarSet.length-1,this._currentHists,this._currentHistsMap,-1),this._addHistoryBarToHistogram(e,this._historyBarSet.length-1,this._currentHists,this._currentHistsMap,1),this._updateLastBarTimeInHistogram(this._currentHists)}_addHistoryBarToHistogram(e,t,i,r,n){(0,s.assert)(-1===n||1===n,"Please set sign argument either +1 or -1");const o=e.low,a=e.high,l=isNaN(e.volume)?0:e.volume,h=e.isUp,d=(0,s.ensureNotNull)(this._rowsLayout);d.init(this._ctx.symbol.minTick,this._minPrice,this._maxPrice,o,a);const u=d.rowWidth();if(!c.Std.greater(u,0))return;d.calculate();const p=d.getIndexLowVbP(),_=d.getIndexHighVbP(),m=d.getStartPrice();if(p===_){const e=p*u+m,t=(p+1)*u+m;this._updateResult({start:e,end:t},n*l,h,i,r)}else{let e=0;for(let t=p;t<=_;t++){const s=t*u+m,c=(t+1)*u+m,d=this._rowCoeff(s,c,o,a),p=d*l;e+=d,this._updateResult({start:s,end:c},n*p,h,i,r)}(0,s.assert)(c.Std.equal(e,1,.05),`totalCoeff not equal 1! totalConf = ${e}`)}}_updateResult(e,t,i,r,n){const o=this._createRates(i,t);(0,s.assert)(null!==this._leftBoxTime,"leftBoxTime is not set (equals null)"),(0,s.assert)(null!==this._rightBoxTime,"rightBoxTime is not set (equals null)");const l=(0,s.ensureNotNull)(this._leftBoxTime),h=(0,s.ensureNotNull)(this._actualRightBoxTime);let d=n.get(e);if(void 0===d)d=new a(this,e.start,e.end,o,l,h),n.set(e,d),this._verifyHistogramSizeIsNotTooLarge(n.size()),this._currentHistsGr.add(d),_._addInOrder(d,r,0,r.length,((e,t)=>{let i=c.Std.compare(e.firstBarTime(),t.firstBarTime());return 0!==i?i:(i=c.Std.compare(e.priceLow(),t.priceLow()),0!==i?i:c.Std.compare(e.priceHigh(),t.priceHigh()))}));else{const e=[];for(let t=0;t0?_._addInOrder(e,t,o+1,s,n):t.splice(o,0,e)}}},19762:(e,t,i)=>{"use strict";i.d(t,{VolumeProfileBase:()=>u,maxHHistItems:()=>h,numOfSubHists:()=>d});var s=i(14483),r=i(36274);class n{constructor(e,t){this._minTick=NaN,this._minPrice=NaN,this._maxPrice=NaN,this._low=NaN,this._high=NaN,this._startPrice=NaN,this._indexLowVbP=NaN,this._indexHighVbP=NaN,this._rowSize=e,this._type=t}init(e,t,i,s,r){this._minTick=e,this._minPrice=t,this._maxPrice=i,this._low=s,this._high=r}getStartPrice(){return this._startPrice}setStartPrice(e){this._startPrice=e}getIndexLowVbP(){return this._indexLowVbP}setIndexLowVbP(e){this._indexLowVbP=e}getIndexHighVbP(){return this._indexHighVbP}setIndexHighVbP(e){this._indexHighVbP=e}type(){return this._type}}class o extends n{constructor(e){super(e,0)}calculate(){this.setStartPrice(this._minPrice);const e=this.rowWidth();let t=Math.floor((this._low-this._minPrice)/e),i=Math.ceil((this._high-this._minPrice)/e)-1;t=Math.max(t,0),i=Math.max(i,0),i=Math.min(i,this._rowSize-1),t=Math.min(t,i),this.setIndexLowVbP(t),this.setIndexHighVbP(i)}rowWidth(){return Math.max((this._maxPrice-this._minPrice)/this._rowSize,this._minTick)}}class a extends n{constructor(e){super(e,1)}calculate(){this.setStartPrice(0);const e=this.rowWidth();let t=Math.floor(this._low/e);const i=Math.ceil(this._high/e)-1;t=Math.min(t,i),this.setIndexLowVbP(t),this.setIndexHighVbP(i)}rowWidth(){return this._minTick*this._rowSize} +}var l=i(49581),c=i(40367);function h(){return 6e3}function d(e){switch(e){case"Delta":case"Up/Down":return 2;case"Total":return 1;default:l.Std.error(`Invalid study argument value: ${e}`)}}class u{findBasicResolutionForFromTo(e,t,i,n){const o=(0,c.getVolumeProfileResolutionForPeriod)(e.value(),t,i,n),a=r.Interval.parse(o);return s.enabled("charting_library_debug_mode")&&console.log(`Selected resolution ${a.value()} for (${e.value()}, ${t}, ${i})`),a}verifyRowSizeInput(e,t){"Number Of Rows"===t&&e>6e3&&l.Std.error('Histogram is too large, please reduce "Row Size" input.')}_getRowsLayout(e,t){return"Number Of Rows"===e?new o(t):new a(t)}}},82597:(e,t,i)=>{"use strict";i.d(t,{volumeProfileFixedRangeBSStudyItem:()=>w,volumeProfileFixedRangeVbPStudyItem:()=>b});var s=i(50151),r=i(19762),n=i(72877),o=i(90164),a=i(36274),l=i(79999),c=i(748),h=i(43945),d=i(31584),u=i(1386),p=i(56437),_=i(95586),m=i(89529);class g extends m.VolumeByPriceExpr{constructor(e,t,i,s,r,n,o,a,l,c,h,d,u){super(e,t,i,n,o,a,!1,l,c,(()=>h),d,s,r,!1,u),this._firstBarTime=s,this._lastBarTime=r}update(e){this._supplyRowsLayout(this._ctx),this.timeInRequestedRange(e)&&super.update(e)}timeInRequestedRange(e){const t=this._timeScale().get(e);return this._firstBarTime<=t&&t=this._firstBarTime){const e=this._developingPocSeries.getLeftOrEqual(n),t=this._developingVAHighSeries.getLeftOrEqual(n),i=this._developingVALowSeries.getLeftOrEqual(n);r.data.push([e,t,i])}else r.data.push([NaN,NaN,NaN])}return r}time(){return this._timeSeries}open(){return this._openSeries}high(){return this._highSeries}low(){return this._lowSeries}close(){return this._closeSeries}volume(){return this._volumeSeries}developingPoc(){return this._developingPocSeries}developingVAHigh(){return this._developingVAHighSeries}developingVALow(){return this._developingVALowSeries}}function S(e){return{constructor:y,name:e.description,metainfo:{_metainfoVersion:51,shortDescription:"VPFR",format:{type:"volume"},is_price_study:!0,defaults:{graphics:{hhists:{histBars2:{colors:["#1592e6","#fbc123"],direction:o.HHistDirection.LeftToRight,percentWidth:30,showValues:!1,transparencies:[76,76],valuesColor:"#424242",visible:!0},histBarsVA:{colors:["#1592e6","#fbc123"],direction:o.HHistDirection.LeftToRight, +percentWidth:30,showValues:!1,transparencies:[30,30],valuesColor:"#424242",visible:!0}},horizlines:{pocLines:{color:"#ff0000",style:_.LineStyle.Solid,visible:!0,width:2}},polygons:{histBoxBg:{color:"#37a6ef",transparency:94}}},inputs:{first_bar_time:0,last_bar_time:0,rows:24,rowsLayout:"Number Of Rows",subscribeRealtime:!0,vaVolume:70,volume:"Up/Down"},styles:{developingPoc:{color:"#ff0000",linestyle:_.LineStyle.Solid,linewidth:1,plottype:n.LineStudyPlotStyle.StepLine,trackPrice:!1,transparency:0,display:0},developingVAHigh:{color:"#0000ff",linestyle:_.LineStyle.Solid,linewidth:1,plottype:n.LineStudyPlotStyle.StepLine,trackPrice:!1,transparency:0,display:0},developingVALow:{color:"#0000ff",linestyle:_.LineStyle.Solid,linewidth:1,plottype:n.LineStudyPlotStyle.StepLine,trackPrice:!1,transparency:0,display:0}}},graphics:{hhists:{histBars2:{location:o.HHistLocation.Absolute,title:"Volume Profile",titles:["Up Volume","Down Volume"]},histBarsVA:{location:o.HHistLocation.Absolute,title:"Value Area",titles:["Value Area Up","Value Area Down"]}},horizlines:{pocLines:{name:"POC",showPrice:!0}},polygons:{histBoxBg:{mouseTouchable:!1,name:"Histogram Box",showBorder:!1}}},inputs:[{defval:"Number Of Rows",id:"rowsLayout",name:"Rows Layout",options:["Number Of Rows","Ticks Per Row"],type:"text"},{defval:24,id:"rows",max:1e6,min:1,name:"Row Size",type:"integer"},{defval:"Up/Down",id:"volume",name:"Volume",options:["Up/Down","Total","Delta"],type:"text"},{defval:0,id:"first_bar_time",isHidden:!0,max:253370764800,min:-253370764800,name:"First Bar Time",type:"time"},{defval:0,id:"last_bar_time",isHidden:!0,max:253370764800,min:-253370764800,name:"Last Bar Time",type:"time"},{defval:70,id:"vaVolume",max:100,min:0,name:"Value Area Volume",type:"integer"},{defval:!0,id:"subscribeRealtime",isHidden:!0,name:"SubscribeRealtime",type:"bool"}],plots:[{id:"developingPoc",type:"line"},{id:"developingVAHigh",type:"line"},{id:"developingVALow",type:"line"}],styles:{developingPoc:{histogramBase:0,title:"Developing Poc"},developingVAHigh:{histogramBase:0,title:"Developing VA High"},developingVALow:{histogramBase:0,title:"Developing VA Low"}},...e}}}const b=S({id:"VbPFixed@tv-volumebyprice-57",description:"Volume Profile Fixed Range"}),w=S({id:"VbPFixed@tv-basicstudies-152",description:"Fixed Range",is_hidden_study:!0})},19999:(e,t,i)=>{"use strict";i.d(t,{VolumeProfileOutputSeries:()=>n});var s=i(50151),r=i(78071);class n{constructor(){this._histPos=-1,this._hist=new Float64Array(2e3),this._times=new Float64Array(2e3)}addHist(e){if(this._histPos>=0){const t=this._times[this._histPos];(0,s.assert)(t<=e,"History order violation"),this._histPos+=t===e?0:1}else this._histPos+=1;if(this._histPos===this._hist.length){const e=new Float64Array(2*this._hist.length);e.set(this._hist),this._hist=e;const t=new Float64Array(this._hist.length);t.set(this._times),this._times=t}this._hist[this._histPos]=NaN,this._times[this._histPos]=e}removeLastIfNaN(){Number.isNaN(this.get(0))&&(this._histPos-=1)}get(e){(0,s.assert)(0===e);const t=this._histPos-e +;return this._hist[t]}getLeftOrEqual(e){const t=(0,r.upperbound)(this._times,e,((e,t)=>e{"use strict";i.d(t,{volumeProfileVisibleRangeStudyItem:()=>v});var s=i(50151),r=i(19762),n=i(90164),o=i(36274),a=i(79999),l=i(89529),c=i(31584);class h extends l.VolumeByPriceExpr{constructor(e,t,i,s,r,n,o,a,l,h,d){super(e,t,i,n,new c.GraphicsList,o,!0,a,l,(()=>h),d,s,r,!1),this._firstBarTime=s,this._lastBarTime=r}update(e){this._supplyRowsLayout(this._ctx),this.timeInRequestedRange(e)&&super.update(e)}timeInRequestedRange(e){const t=this._timeScale().get(e);return this._firstBarTime<=t&&t=this._firstBarTime){const e=this._developingPocSeries.getLeftOrEqual(n),t=this._developingVAHighSeries.getLeftOrEqual(n),i=this._developingVALowSeries.getLeftOrEqual(n);r.data.push([e,t,i])}else r.data.push([NaN,NaN,NaN])}return r}time(){return this._timeSeries}open(){return this._openSeries}high(){return this._highSeries}low(){return this._lowSeries}close(){return this._closeSeries}volume(){return this._volumeSeries}developingPoc(){return this._developingPocSeries}developingVAHigh(){return this._developingVAHighSeries}developingVALow(){return this._developingVALowSeries}}const v={constructor:f,name:"Volume Profile Visible Range",metainfo:{_metainfoVersion:51,id:"VbPVisible@tv-basicstudies-49",description:"Volume Profile Visible Range",shortDescription:"VPVR",format:{type:"volume"},is_price_study:!0,linkedToSeries:!0,palettes:{},inputs:[{id:"rowsLayout",name:"Rows Layout",defval:"Number Of Rows",options:["Number Of Rows","Ticks Per Row"],type:"text"},{id:"rows",name:"Row Size",defval:24,max:1e6,min:1,type:"integer"},{id:"volume",name:"Volume",defval:"Up/Down",options:["Up/Down","Total","Delta"],type:"text"},{id:"first_visible_bar_time",name:"First Visible Bar Time",defval:0,isHidden:!0,max:253370764800,min:-253370764800,type:"time"},{id:"last_visible_bar_time",name:"Last Visible Bar Time",defval:0,isHidden:!0,max:253370764800,min:-253370764800,type:"time"},{id:"vaVolume",name:"Value Area Volume",defval:70,max:100,min:0,type:"integer"}],plots:[{id:"developingPoc",type:"line"},{id:"developingVAHigh",type:"line"},{ +id:"developingVALow",type:"line"}],graphics:{hhists:{histBars2:{location:n.HHistLocation.Relative,title:"Volume Profile",titles:["Up Volume","Down Volume"]},histBarsVA:{location:n.HHistLocation.Relative,title:"Value Area",titles:["Value Area Up","Value Area Down"]}},horizlines:{pocLines:{name:"POC",showPrice:!0}}},defaults:{graphics:{hhists:{histBars2:{colors:["#1592e6","#fbc123"],direction:n.HHistDirection.RightToLeft,percentWidth:30,showValues:!1,transparencies:[76,76],valuesColor:"#424242",visible:!0},histBarsVA:{colors:["#1592e6","#fbc123"],direction:n.HHistDirection.RightToLeft,percentWidth:30,showValues:!1,transparencies:[30,30],valuesColor:"#424242",visible:!0}},horizlines:{pocLines:{color:"#ff0000",style:0,visible:!0,width:2}}},inputs:{first_visible_bar_time:0,last_visible_bar_time:0,rows:24,rowsLayout:"Number Of Rows",vaVolume:70,volume:"Up/Down"},styles:{developingPoc:{color:"#ff0000",linestyle:0,linewidth:1,plottype:9,trackPrice:!1,transparency:0,display:0},developingVAHigh:{color:"#0000ff",linestyle:0,linewidth:1,plottype:9,trackPrice:!1,transparency:0,display:0},developingVALow:{color:"#0000ff",linestyle:0,linewidth:1,plottype:9,trackPrice:!1,transparency:0,display:0}}},styles:{developingPoc:{histogramBase:0,title:"Developing Poc"},developingVAHigh:{histogramBase:0,title:"Developing VA High"},developingVALow:{histogramBase:0,title:"Developing VA Low"}}}}},43910:(e,t,i)=>{"use strict";i.d(t,{StudyEngine:()=>r});var s=i(65507);class r{constructor(e){this.runner=new s.ScriptRunner(e)}stop(){this.runner.stop()}isStarted(){return this.runner.isStarted}}},85898:(e,t,i)=>{"use strict";i.d(t,{StudyError:()=>s});class s extends Error{constructor(e){super(e),this.studyError=!0}}},43945:(e,t,i)=>{"use strict";i.d(t,{EraseAll:()=>r,EraseObj:()=>s,GraphicsCmds:()=>n});class s{constructor(e,t){this.id=e,this.type=t}primitiveData(){return{action:"one",id:this.id,type:this.type}}}class r{primitiveData(){return{action:"all"}}}class n{constructor(){this.erase=[],this.create=null,this._modified=!1}primitiveData(e){if(this.isNaN())return null;const t={},i=this.create&&this.create.primitiveData(e);return null!==i&&(t.create=i),null!==this.erase&&this.erase.length>0&&(t.erase=this.erase.map((e=>e.primitiveData()))),void 0===t.create&&void 0===t.erase?null:t}setCreate(e){this.create=e,this.create.forEachList((e=>e.setOwner(this)))}isNaN(){return(null===this.erase||0===this.erase.length)&&null===this.create}isModified(){return this._modified}setModified(e){this._modified=e}dirty(){this._modified=!0}setOwner(e){throw new Error("Unsupported")}}},79999:(e,t,i)=>{"use strict";i.d(t,{GraphicsListColl:()=>s});class s{constructor(){this._stable=[],this._variable=null,this._owner=null}addStable(e){e.setOwner(this),this._stable.push(e)}setVariable(e){this._variable=e,null!==this._variable&&this._variable.setOwner(this)}primitivesData(e){const t=[];return this._forEach((i=>t.push(...i.primitivesData(e)))),t}deleteErasedItems(){this._forEach((e=>e.deleteErasedItems()))}markPostedItems(){this._forEach((e=>e.markPostedItems()))}isNaN(){ +return this._all((e=>e.isNaN()))}dirty(){null!==this._owner&&this._owner.dirty()}setOwner(e){this._owner=e}_forEach(e){for(const t of this._stable)e(t);null!==this._variable&&e(this._variable)}_all(e){for(const t of this._stable)if(!e(t))return!1;return null===this._variable||e(this._variable)}}},31584:(e,t,i)=>{"use strict";i.d(t,{GraphicsList:()=>n});var s=i(29779),r=i(76958);class n{constructor(){this._items=[],this._owner=null}primitivesData(e){const t=[];for(const i of this._items)e.isIgnoredObj(i)||t.push(i.primitiveData());return t}get(e){return this._items[e]}set(e,t){return this.dirty(),t.setOwner(this),this._items[e]=t,t}addAtIndex(e,t){this.dirty(),t.setOwner(this),this._items[e]=t}clear(){this._unsetOwner(this._items),this._items=[],this.dirty()}addAllFromNumber(e,t){this.setOwner(t),this._items.splice(e,0,...t._items);return this._setCachedDataValid(!1),true}addAll(e){this.setOwner(e),this._items.push(...e._items);return this._setCachedDataValid(!1),true}remove(e){const t=this._items[e];return this._items.splice(e,1),t.unsetOwner(this),this.dirty(),t}getItems(){return this._items}size(){return this._items.length}add(e){e.setOwner(this),this._items.push(e);return this._setCachedDataValid(!1),true}deleteErasedItems(){this._items=this._items.filter((e=>!e.isErased()))}markPostedItems(){for(const e of this._items)e.markAsPosted()}isNaN(){if(0===this._items.length)return!0;for(const e of this._items){if(!(0,r.isNaNable)(e))return!1;if(!e.isNaN())return!1}return!0}setOwner(e){this._owner=e}dirty(){null!==this._owner&&this._owner.dirty()}_unsetOwner(e){for(const t of e)t instanceof s.GraphicsObj&&t.unsetOwner(this)}_setCachedDataValid(e){e||this.dirty()}}},29779:(e,t,i)=>{"use strict";i.d(t,{GraphicsObj:()=>l});var s=i(49581);class r{constructor(e,t,i,s){this._value=e,this._name=t,this._owner=i,this._comparer=void 0!==s?s:(e,t)=>null==e?null!=t:e===t}getName(){return this._name}set(e){const t=this._comparer(this._value,e);return t&&this._owner.dirty(),this._value=e,t}get(){return this._value}}class n{constructor(e,t,i){this._owner=null,this._value=e,this._name=t,this._owner=i}getName(){return this._name}set(e){return this._value!==e&&(this._value=e,null!==this._owner&&this._owner.dirty(),!0)}get(){return this._value}}class o extends r{constructor(e,t,i,s){super(e,t,i,s)}}class a{constructor(e){this._owner=e}createField(e,t){return new r(e,t,this)}createDoubleField(e,t){return new r(e,t,this,((e,t)=>!s.Std.equal(e,t)))}createDoubleArrayField(e,t){return new o(e,t,this,((e,t)=>{if(e===t)return!1;const i=e.length;if(t.length!==i)return!0;for(let r=0;r{"use strict";function s(e){return Boolean(e.isNaN)}i.d(t,{isNaNable:()=>s})},1386:(e,t,i)=>{"use strict";i.d(t,{JStudyDataUpdate:()=>d});var s=i(43945);class r{constructor(){this.isUpdate=!1,this.graphicsCmds=new s.GraphicsCmds,this._offsetsChanged=!1,this._disableGraphicsAndData=!1}isNaN(){return this.graphicsCmds.isNaN()}primitiveData(e){const t={};if(!this._disableGraphicsAndData){const i=this.graphicsCmds.primitiveData(e);null!==i&&(t.graphicsCmds=i)}return this.isUpdate&&(t.isUpdate=!0),void 0===t.graphicsCmds?void 0:t}disable(){this._disableGraphicsAndData=!0}checkForChangeAndResetChangedState(e){const t=this._offsetsChanged,i=this.graphicsCmds.isModified();this.graphicsCmds.setModified(!1),this._offsetsChanged=!1;return i||t||0!==e.length}}var n=i(1722),o=i(76958);function a(e){return Boolean(e.isPosted)}class l{isIgnoredObj(e,t){return l.isIgnoredObjDefault(e,t)}static isIgnoredObjDefault(e,t){if(void 0===t)return l.isIgnoredObjNaNable(e);const i=e[t];return l.isIgnoredByGeneralRules(e,t)||l.isIgnoredObjNaNable(i)||l.isIgnoredObjListOfNaNables(i)}static isIgnoredObjNaNable(e){return(0,o.isNaNable)(e)&&e.isNaN()}static isIgnoredObjListOfNaNables(e){if(!(0,n.isArray)(e))return!1;let t=!0;for(const i of e)if(!(0,o.isNaNable)(i)||!i.isNaN()){t=!1;break}return t}static isIgnoredObjPosted(e){return a(e)&&e.isPosted()}static isIgnoredObjErased(e){return a(e)&&e.isErased()}static isIgnoredByGeneralRules(e,t){const i=e[t];return(0,n.isArray)(i)&&0===i.length}}class c{isIgnoredObj(e,t){if(void 0===t)return l.isIgnoredObjDefault(e)||l.isIgnoredObjErased(e);const i=e[t];return l.isIgnoredObjDefault(e,t)||l.isIgnoredObjErased(i)}}class h{isIgnoredObj(e,t){if(void 0===t)return l.isIgnoredObjDefault(e)||l.isIgnoredObjErased(e)||l.isIgnoredObjPosted(e);const i=e[t];return l.isIgnoredObjDefault(e,t)||l.isIgnoredObjErased(i)||l.isIgnoredObjPosted(i)}}class d extends class extends class{constructor(e){this._dataObj=new r,this._isDirty=!1,this._eraseCmds=[],this._enableCmdDataStudy=e}init(e){this._dataObj.graphicsCmds.setCreate(e),this.update(!0)}dataObj(){return this._dataObj}setEraseCmds(e){this._eraseCmds=e}resetDirtyState(){this._isDirty=!1}disable(){this._dataObj.disable()}}{constructor(e){super(e),this._snapshotPredicate=new c,this._dataSnapShot={}}getData(){return this._dataSnapShot}getUpdate(){return this._isDirty?this._dataSnapShot:{}}update(e){ +(this._dataObj.checkForChangeAndResetChangedState(this._eraseCmds)||e)&&(null!==this._dataObj.graphicsCmds.create&&(this._dataObj.graphicsCmds.create.deleteErasedObjs(),this._dataObj.graphicsCmds.erase=[new s.EraseAll]),this._makeSnapshot(),this._isDirty=!0)}_makeSnapshot(){this._json=this._dataObj.primitiveData(this._snapshotPredicate),this._dataSnapShot={json:this._json}}}{constructor(e){super(e),this._updatePredicate=new h,this._sendShapshotOnly=!0,this._isFirstNotForcedUpdate=!0}update(e){(this._dataObj.checkForChangeAndResetChangedState(this._eraseCmds)||e)&&(null!==this._dataObj.graphicsCmds.create&&(this._dataObj.graphicsCmds.erase=[new s.EraseAll]),this._dataObj.isUpdate=!0,this._makeSnapshot(),null!==this._dataObj.graphicsCmds.create&&(this._dataObj.graphicsCmds.erase=this._eraseCmds),this._dataObj.isUpdate=!0,this._jsonUpdate=this._dataObj.primitiveData(this._updatePredicate),null!==this._dataObj.graphicsCmds.create&&this._dataObj.graphicsCmds.create.deleteErasedAndMarkPostedObjs(),this._sendShapshotOnly=e||this._isFirstNotForcedUpdate,this._isFirstNotForcedUpdate=Boolean(e),this._isDirty=!0)}getUpdate(){return this._isDirty?this._enableCmdDataStudy?{json:this._sendShapshotOnly?this._json:void 0,jsonUpdate:this._sendShapshotOnly?void 0:this._jsonUpdate}:{json:this._json,jsonUpdate:this._sendShapshotOnly?void 0:this._jsonUpdate}:{}}}},748:(e,t,i)=>{"use strict";i.d(t,{Container:()=>n,StudyGraphicsData:()=>r});var s=i(50151);class r{constructor(){this._horizlines=[],this._hhists=[],this._polygons=[],this._vertlines=[],this._containersCache=[],this._containerNamesCache=[],this._containersMapCache=new Map,this._addToCache("horizlines",this._horizlines),this._addToCache("hhists",this._hhists),this._addToCache("polygons",this._polygons),this._addToCache("vertlines",this._vertlines)}primitiveData(e){const t={};let i=!1;for(const s of this._containerNamesCache){const r=[],n=this.getObjsContainer(s);for(const t of n){if(t.isNaN())continue;const i=t.primitiveData(e);i.data.length>0&&r.push(i)}r.length>0&&(t[s]=r,i=!0)}return i?t:null}deleteErasedAndMarkPostedObjs(){this.forEachList((e=>{e.deleteErasedItems(),e.markPostedItems()}))}deleteErasedObjs(){this.forEachList((e=>e.deleteErasedItems()))}getObjsContainer(e){return(0,s.ensureDefined)(this._containersMapCache.get(e))}forEachList(e){for(const t of this._containersCache)for(const i of t)e(i.data)}_addToCache(e,t){this._containersCache.push(t),this._containerNamesCache.push(e),this._containersMapCache.set(e,t)}}class n{constructor(e,t){this.styleId=e,this.data=t}isNaN(){return this.data.isNaN()}primitiveData(e){return{styleId:this.styleId,data:this.data.primitivesData(e)}}}},24172:(e,t,i)=>{"use strict";const s=i(33013).getHexColorByName,r=i(49581).Std,n=s("color-ripe-red-100"),o=s("color-ripe-red-200"),a=s("color-ripe-red-500"),l=s("color-ripe-red-900"),c=s("color-ripe-red-a200"),h=s("color-minty-green-100"),d=s("color-minty-green-400"),u=s("color-minty-green-500");JSServer.studyLibrary=[{name:"Accumulation/Distribution",metainfo:{_metainfoVersion:52,isTVScript:!1, +isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Accumulation/Distribution",shortDescription:"Accum/Dist",is_price_study:!1,inputs:[],id:"Accumulation/Distribution@tv-basicstudies-1",scriptIdPart:"",name:"Accumulation/Distribution",format:{type:"volume"}},constructor:function(){this.f_0=function(e,t,i,s){return r.or(r.and(r.eq(e,t),r.eq(e,i)),r.eq(t,i))?0:(2*e-i-t)/(t-i)*s},this.main=function(e,t){this._context=e,this._input=t;var i=this.f_0(r.close(this._context),r.high(this._context),r.low(this._context),r.volume(this._context));return[r.cum(i,this._context)]}}},{name:"Accumulative Swing Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:10}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"ASI",histogramBase:0,joinPoints:!1}},description:"Accumulative Swing Index",shortDescription:"ASI",is_price_study:!1,inputs:[{id:"in_0",name:"Limit Move Value",defval:10,type:"float",min:.1,max:1e5}],id:"Accumulative Swing Index@tv-basicstudies-1",scriptIdPart:"",name:"Accumulative Swing Index",format:{type:"volume"}},constructor:function(){this.f_0=function(e,t){var i=t.new_var(r.open(t)),s=t.new_var(r.high(t)),n=t.new_var(r.low(t)),o=t.new_var(r.close(t)),a=r.abs(s-o.get(1)),l=r.abs(n-o.get(1)),c=r.abs(s-n),h=r.abs(o.get(1)-i.get(1)),d=r.max(a,l),u=r.iff(a>=r.max(l,c),a-.5*l+.25*h,r.iff(l>=r.max(a,c),l-.5*a+.25*h,c+.25*h));return r.iff(0===u,0,(o-o.get(1)+.5*(o-i)+.25*(o.get(1)-i.get(1)))/u*d/e*50)},this.f_1=function(e,t){var i=this.f_0(e,t);return r.cum(i,t)},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0);return[this.f_1(i,this._context)]}}},{name:"Advance/Decline",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:10}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Advance/Decline",shortDescription:"AD",is_price_study:!1,inputs:[{id:"in_0",name:"length",defval:10,type:"integer",min:1,max:2e3}],id:"Advance/Decline@tv-basicstudies-1",scriptIdPart:"",name:"Advance/Decline",format:{precision:2,type:"price"}},constructor:function(){this.f_0=function(e,t){return r.gt(e,t)},this.f_1=function(e,t){return r.lt(e,t)},this.f_2=function(e,t){return 0===t?e:e/t},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this.f_0(r.close(this._context),r.open(this._context)),n=this._context.new_var(s),o=r.sum(n,i,this._context),a=this.f_1(r.close(this._context),r.open(this._context)),l=this._context.new_var(a),c=r.sum(l,i,this._context);return[this.f_2(o,c)]}}},{ +name:"Arnaud Legoux Moving Average",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:9,in_1:.85,in_2:6}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Arnaud Legoux Moving Average",shortDescription:"ALMA",is_price_study:!0,inputs:[{id:"in_0",name:"Window Size",defval:9,type:"integer",min:0,max:5e3},{id:"in_1",name:"Offset",defval:.85,type:"float",min:-1e12,max:1e12},{id:"in_2",name:"Sigma",defval:6,type:"float",min:-1e12,max:1e12}],id:"Arnaud Legoux Moving Average@tv-basicstudies-1",scriptIdPart:"",name:"Arnaud Legoux Moving Average",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=r.close(this._context),s=this._input(0),n=this._input(1),o=this._input(2),a=this._context.new_var(i);return[r.alma(a,s,n,o)]}}},{name:"Aroon",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FB8C00"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:14}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],styles:{plot_0:{title:"Upper",histogramBase:0,joinPoints:!1},plot_1:{title:"Lower",histogramBase:0,joinPoints:!1}},description:"Aroon",shortDescription:"Aroon",is_price_study:!1,inputs:[{id:"in_0",name:"length",defval:14,type:"integer",min:1,max:2e3}],id:"Aroon@tv-basicstudies-1",scriptIdPart:"",name:"Aroon",format:{precision:2,type:"percent"}},constructor:function(){this.f_0=function(e,t){return 100*(e+t)/t},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=r.high(this._context),n=i+1,o=this._context.new_var(s),a=r.highestbars(o,n,this._context),l=this.f_0(a,i),c=r.low(this._context),h=this._context.new_var(c),d=r.lowestbars(h,n,this._context);return[l,this.f_0(d,i)]}}},{name:"Average Price",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,id:"AveragePrice@tv-basicstudies-1",scriptIdPart:"",name:"Average Price",description:"Average Price",shortDescription:"Average Price",is_price_study:!0,plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:"#2196F3"}},inputs:{}},styles:{plot_0:{title:"Plot"}},inputs:[],format:{type:"inherit"}},constructor:function(){this.main=function(e,t){return this._context=e,this._input=t,[r.ohlc4(this._context)]}}},{name:"Average Directional Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:c}},inputs:{in_0:14,in_1:14}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"ADX",histogramBase:0,joinPoints:!1,isHidden:!1}}, +description:"Average Directional Index",shortDescription:"ADX",is_price_study:!1,inputs:[{id:"in_0",name:"ADX Smoothing",defval:14,type:"integer",min:-1e12,max:1e12},{id:"in_1",name:"DI Length",defval:14,type:"integer",min:-1e12,max:1e12}],id:"average_directional_Index@tv-basicstudies-1",scriptIdPart:"",name:"Average Directional Index",format:{precision:2,type:"price"}},constructor:function(){this.f_0=function(e){var t=this._context.new_var(r.high(this._context)),i=r.change(t),s=this._context.new_var(r.low(this._context)),n=-r.change(s),o=this._context.new_var(r.tr(void 0,this._context)),a=r.rma(o,e,this._context),l=this._context.new_var(r.and(r.gt(i,n),r.gt(i,0))?i:0),c=r.fixnan(100*r.rma(l,e,this._context)/a,this._context),h=this._context.new_var(r.and(r.gt(n,i),r.gt(n,0))?n:0);return[c,r.fixnan(100*r.rma(h,e,this._context)/a,this._context)]},this.f_1=function(e,t){var i=this.f_0(e),s=i[0],n=i[1],o=s+n,a=this._context.new_var(r.abs(s-n)/(r.eq(o,0)?1:o));return[100*r.rma(a,t,this._context)]},this.main=function(e,t){return this._context=e,this._input=t,this._context.setMinimumAdditionalDepth(this._input(0)+this._input(1)),this.f_1(this._input(1),this._input(0))}}},{name:"Average True Range",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:l}},inputs:{in_0:14}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Average True Range",shortDescription:"ATR",is_price_study:!1,inputs:[{id:"in_0",name:"length",defval:14,type:"integer",min:1,max:2e3}],id:"Average True Range@tv-basicstudies-1",scriptIdPart:"",name:"Average True Range",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){var i=t(0);return[r.atr(i,e)]}}},{name:"Awesome Oscillator",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:1,trackPrice:!1,transparency:0,visible:!0,color:"#000080"}},palettes:{palette_0:{colors:{0:{color:a,width:1,style:0},1:{color:u,width:1,style:0}}}},inputs:{}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",palette:"palette_0",target:"plot_0",type:"colorer"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Awesome Oscillator",shortDescription:"AO",is_price_study:!1,palettes:{palette_0:{colors:{0:{name:"Color 0"},1:{name:"Color 1"}}}},inputs:[],id:"Awesome Oscillator@tv-basicstudies-1",scriptIdPart:"",name:"Awesome Oscillator",format:{type:"inherit"}},constructor:function(){this.f_0=function(e,t){return e-t},this.f_1=function(e){return r.le(e,0)?0:1},this.main=function(e,t){this._context=e,this._input=t;var i=r.hl2(this._context),s=this._context.new_var(i),n=r.sma(s,5,this._context),o=this._context.new_var(i),a=r.sma(o,34,this._context),l=this.f_0(n,a),c=l,h=this._context.new_var(l),d=r.change(h);return[c,this.f_1(d)]}}},{name:"Accelerator Oscillator",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1, +is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:1,trackPrice:!1,transparency:0,visible:!0,color:"#000080"}},palettes:{palette_0:{colors:{0:{color:a,width:1,style:0},1:{color:u,width:1,style:0}}}},inputs:{}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",palette:"palette_0",target:"plot_0",type:"colorer"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Accelerator Oscillator",shortDescription:"AO",is_price_study:!1,palettes:{palette_0:{colors:{0:{name:"Color 0"},1:{name:"Color 1"}}}},inputs:[],id:"Accelerator Oscillator@tv-basicstudies-1",scriptIdPart:"",name:"Accelerator Oscillator",format:{type:"inherit"}},constructor:function(){this.f_0=function(e,t){return e-t},this.f_1=function(e){return r.le(e,0)?0:1},this.main=function(e,t){this._context=e,this._input=t;var i=r.hl2(this._context),s=this._context.new_var(i),n=r.sma(s,5,this._context),o=this._context.new_var(i),a=r.sma(o,34,this._context),l=this.f_0(n,a),c=this._context.new_var(l),h=r.sma(c,5,this._context),d=this.f_0(l,h),u=this._context.new_var(d),p=r.change(u);return[d,this.f_1(p)]}}},{name:"Balance of Power",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:c}},inputs:{}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Balance of Power",shortDescription:"Balance of Power",is_price_study:!1,inputs:[],id:"Balance of Power@tv-basicstudies-1",scriptIdPart:"",name:"Balance of Power",format:{precision:2,type:"price"}},constructor:function(){this.f_0=function(e,t,i,s){return(e-t)/(i-s)},this.main=function(e,t){return this._context=e,this._input=t,[this.f_0(r.close(this._context),r.open(this._context),r.high(this._context),r.low(this._context))]}}},{name:"Bollinger Bands",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FF6D00"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_2:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},filledAreasStyle:{fill_0:{color:"#2196F3",transparency:95,visible:!0}},inputs:{in_0:20,in_1:2}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"}],styles:{plot_0:{title:"Median",histogramBase:0,joinPoints:!1},plot_1:{title:"Upper",histogramBase:0,joinPoints:!1},plot_2:{title:"Lower",histogramBase:0,joinPoints:!1}},description:"Bollinger Bands",shortDescription:"BB",is_price_study:!0,filledAreas:[{id:"fill_0",objAId:"plot_1",objBId:"plot_2",type:"plot_plot",title:"Plots Background"}],inputs:[{id:"in_0",name:"length",defval:20,type:"integer",min:1,max:1e4},{id:"in_1",name:"mult",defval:2,type:"float",min:.001,max:50}],id:"Bollinger Bands@tv-basicstudies-1",scriptIdPart:"",name:"Bollinger Bands",format:{type:"inherit"}}, +constructor:function(){this.f_0=function(e,t){return e*t},this.f_1=function(e,t){return e+t},this.f_2=function(e,t){return e-t},this.main=function(e,t){this._context=e,this._input=t;var i=r.close(this._context),s=this._input(0),n=this._input(1),o=this._context.new_var(i),a=r.sma(o,s,this._context),l=this._context.new_var(i),c=r.stdev(l,s,this._context),h=this.f_0(n,c);return[a,this.f_1(a,h),this.f_2(a,h)]}}},{name:"Bollinger Bands %B",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:d}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:1},{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:0}],filledAreasStyle:{fill_0:{color:"#26A69A",transparency:90,visible:!0}},inputs:{in_0:20,in_1:2}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,zorder:1}},description:"Bollinger Bands %B",shortDescription:"BB %B",is_price_study:!1,bands:[{id:"hline_0",name:"UpperLimit",zorder:-1.1},{id:"hline_1",name:"LowerLimit",zorder:-1.11}],filledAreas:[{id:"fill_0",objAId:"hline_0",objBId:"hline_1",type:"hline_hline",title:"Hlines Background",zorder:-2}],inputs:[{id:"in_0",name:"length",defval:20,type:"integer",min:1,max:1e4},{id:"in_1",name:"mult",defval:2,type:"float",min:.001,max:50}],id:"Bollinger Bands %B@tv-basicstudies-1",scriptIdPart:"",name:"Bollinger Bands %B",format:{precision:2,type:"price"},usePlotsZOrder:!0},constructor:function(){this.f_0=function(e,t){return e*t},this.f_1=function(e,t){return e+t},this.f_2=function(e,t){return e-t},this.f_3=function(e,t,i){return(e-t)/(i-t)},this.main=function(e,t){this._context=e,this._input=t;var i=r.close(this._context),s=this._input(0),n=this._input(1),o=this._context.new_var(i),a=r.sma(o,s,this._context),l=this._context.new_var(i),c=r.stdev(l,s,this._context),h=this.f_0(n,c),d=this.f_1(a,h),u=this.f_2(a,h);return[this.f_3(i,u,d)]}}},{name:"Bollinger Bands Width",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FF6D00"}},inputs:{in_0:20,in_1:2}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Bollinger Bands Width",shortDescription:"BBW",is_price_study:!1,inputs:[{id:"in_0",name:"length",defval:20,type:"integer",min:1,max:1e4},{id:"in_1",name:"mult",defval:2,type:"float",min:.001,max:50}],id:"Bollinger Bands Width@tv-basicstudies-1",scriptIdPart:"",name:"Bollinger Bands Width",format:{precision:2,type:"price"}},constructor:function(){this.f_0=function(e,t){return e*t},this.f_1=function(e,t){return e+t},this.f_2=function(e,t){return e-t},this.f_3=function(e,t,i){return(e-t)/i},this.main=function(e,t){this._context=e,this._input=t +;var i=r.close(this._context),s=this._input(0),n=this._input(1),o=this._context.new_var(i),a=r.sma(o,s,this._context),l=this._context.new_var(i),c=r.stdev(l,s,this._context),h=this.f_0(n,c),d=this.f_1(a,h),u=this.f_2(a,h);return[this.f_3(d,u,a)]}}},{name:"Chaikin Money Flow",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#43A047"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:0}],inputs:{in_0:20}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,zorder:1}},description:"Chaikin Money Flow",shortDescription:"CMF",is_price_study:!1,bands:[{id:"hline_0",name:"Zero",zorder:-1}],inputs:[{id:"in_0",name:"length",defval:20,type:"integer",min:1,max:2e3}],id:"Chaikin Money Flow@tv-basicstudies-1",scriptIdPart:"",name:"Chaikin Money Flow",format:{precision:2,type:"price"},usePlotsZOrder:!0},constructor:function(){this.f_0=function(e,t,i,s){return r.or(r.and(r.eq(e,t),r.eq(e,i)),r.eq(t,i))?0:(2*e-i-t)/(t-i)*s},this.f_1=function(e,t){return e/t},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this.f_0(r.close(this._context),r.high(this._context),r.low(this._context),r.volume(this._context)),n=this._context.new_var(s),o=r.sum(n,i,this._context),a=r.volume(this._context),l=this._context.new_var(a),c=r.sum(l,i,this._context);return[this.f_1(o,c)]}}},{name:"Chaikin Oscillator",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#EC407A"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:0}],inputs:{in_0:3,in_1:10}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,zorder:1}},description:"Chaikin Oscillator",shortDescription:"Chaikin Osc",is_price_study:!1,bands:[{id:"hline_0",name:"Zero",zorder:-1}],inputs:[{id:"in_0",name:"short",defval:3,type:"integer",min:1,max:2e3},{id:"in_1",name:"long",defval:10,type:"integer",min:1,max:2e3}],id:"Chaikin Oscillator@tv-basicstudies-1",scriptIdPart:"",name:"Chaikin Oscillator",format:{type:"volume"},usePlotsZOrder:!0},constructor:function(){this.f_0=function(e,t){return e-t},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=r.accdist(this._context),o=this._context.new_var(n),a=r.ema(o,i,this._context),l=this._context.new_var(n),c=r.ema(l,s,this._context);return[this.f_0(a,c)]}}},{name:"Chaikin Volatility",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!1,id:"Chaikin Volatility@tv-basicstudies-1",scriptIdPart:"",name:"Chaikin Volatility",description:"Chaikin Volatility",shortDescription:"Chaikin Volatility",plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:"#AB47BC"}},bands:[{color:"#787B86", +linestyle:2,linewidth:1,visible:!0,value:0}],inputs:{periods:10,rocLookback:10}},styles:{plot_0:{title:"Plot",zorder:1}},bands:[{id:"hline_0",name:"Zero",zorder:-1}],inputs:[{id:"periods",type:"integer",name:"Periods"},{id:"rocLookback",type:"integer",name:"Rate of Change Lookback"}],format:{type:"volume"},usePlotsZOrder:!0},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,this.period=this._input(0),this.rocLookback=this._input(1)},this.main=function(e,t){this._context=e,this._input=t,this._context.setMinimumAdditionalDepth(this.period+this.rocLookback);var i=this._context.new_var(r.high(this._context)-r.low(this._context)),s=this._context.new_var(r.ema(i,this.period,this._context));return[r.roc(s,this.rocLookback)]}}},{name:"Chande Kroll Stop",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FF6D00"}},inputs:{in_0:10,in_1:1,in_2:9}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],styles:{plot_0:{title:"Long",histogramBase:0,joinPoints:!1},plot_1:{title:"Short",histogramBase:0,joinPoints:!1}},description:"Chande Kroll Stop",shortDescription:"Chande Kroll Stop",is_price_study:!0,inputs:[{id:"in_0",name:"p",defval:10,type:"integer",min:1,max:4999},{id:"in_1",name:"x",defval:1,type:"integer",min:1,max:1e12},{id:"in_2",name:"q",defval:9,type:"integer",min:1,max:1e12}],id:"Chande Kroll Stop@tv-basicstudies-1",scriptIdPart:"",name:"Chande Kroll Stop",format:{type:"inherit"}},constructor:function(){this.f_0=function(e,t,i){return e-t*i},this.f_1=function(e,t,i){return e+t*i},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=this._input(2),o=r.high(this._context),a=this._context.new_var(o),l=r.highest(a,i,this._context),c=r.atr(i,this._context),h=this.f_0(l,s,c),d=this._context.new_var(o),u=r.lowest(d,i,this._context),p=this.f_1(u,s,c),_=this._context.new_var(h),m=r.highest(_,n,this._context),g=this._context.new_var(p);return[r.lowest(g,n,this._context),m]}}},{name:"Chande Momentum Oscillator",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:9}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Chande Momentum Oscillator",shortDescription:"ChandeMO",is_price_study:!1,inputs:[{id:"in_0",name:"length",defval:9,type:"integer",min:1,max:2e3}],id:"Chande Momentum Oscillator@tv-basicstudies-1",scriptIdPart:"",name:"Chande Momentum Oscillator",format:{type:"price",precision:2}},constructor:function(){this.f_0=function(e){return r.ge(e,0)?e:0},this.f_1=function(e){return r.ge(e,0)?0:-e},this.f_2=function(e,t){return 100*e/t},this.f_3=function(e,t){return this.f_2(e-t,e+t)}, +this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=r.close(this._context),n=this._context.new_var(s),o=r.change(n),a=this.f_0(o),l=this.f_1(o),c=this._context.new_var(a),h=r.sum(c,i,this._context),d=this._context.new_var(l),u=r.sum(d,i,this._context);return[this.f_3(h,u)]}}},{name:"Chop Zone",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:5,trackPrice:!1,transparency:0,visible:!0,color:"#000080"}},palettes:{palette_0:{colors:{0:{color:"#26C6DA",width:1,style:0},1:{color:"#43A047",width:1,style:0},2:{color:"#A5D6A7",width:1,style:0},3:{color:u,width:1,style:0},4:{color:"#D50000",width:1,style:0},5:{color:"#E91E63",width:1,style:0},6:{color:"#FF6D00",width:1,style:0},7:{color:"#FFB74D",width:1,style:0},8:{color:"#FDD835",width:1,style:0}}}},inputs:{}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",palette:"palette_0",target:"plot_0",type:"colorer"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,isHidden:!1}},description:"Chop Zone",shortDescription:"Chop Zone",is_price_study:!1,palettes:{palette_0:{colors:{0:{name:"Color 0"},1:{name:"Color 1"},2:{name:"Color 2"},3:{name:"Color 3"},4:{name:"Color 4"},5:{name:"Color 5"},6:{name:"Color 6"},7:{name:"Color 7"},8:{name:"Color 8"}},valToIndex:{0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8}}},inputs:[],id:"chop_zone@tv-basicstudies-1",scriptIdPart:"",name:"Chop Zone",format:{precision:0,type:"price"}},constructor:function(){this.f_0=function(){var e=r.close(this._context),t=r.hlc3(this._context),i=this._context.new_var(r.high(this._context)),s=r.highest(i,30,this._context),n=r.lowest(i,30,this._context),o=25/(s-n)*n,a=this._context.new_var(e),l=this._context.new_var(r.ema(a,34,this._context)),c=(l.get(1)-l.get(0))/t*o,h=r.sqrt(1+c*c),d=r.round(180*r.acos(1/h)/3.141592653589793),u=r.iff(r.gt(c,0),-d,d),p=r.and(r.gt(u,-2.14),r.le(u,-.71))?7:8,_=r.and(r.gt(u,-3.57),r.le(u,-2.14))?6:p,m=r.and(r.gt(u,-5),r.le(u,-3.57))?5:_,g=r.le(u,-5)?4:m,f=r.and(r.lt(u,2.14),r.ge(u,.71))?3:g,v=r.and(r.lt(u,3.57),r.ge(u,2.14))?2:f,y=r.and(r.lt(u,5),r.ge(u,3.57))?1:v;return[1,r.ge(u,5)?0:y]},this.main=function(e,t){return this._context=e,this._input=t,this.f_0()}}},{name:"Choppiness Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:61.8},{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:38.2}],filledAreasStyle:{fill_0:{color:"#2196F3",transparency:90,visible:!0}},inputs:{in_0:14}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,zorder:1}},description:"Choppiness Index",shortDescription:"CHOP",is_price_study:!1,bands:[{id:"hline_0",name:"UpperLimit",zorder:-1.1},{id:"hline_1",name:"LowerLimit",zorder:-1.11}],filledAreas:[{id:"fill_0",objAId:"hline_0",objBId:"hline_1",type:"hline_hline", +title:"Hlines Background",zorder:-2}],inputs:[{id:"in_0",name:"length",defval:14,type:"integer",min:1,max:2e3}],id:"Choppiness Index@tv-basicstudies-1",scriptIdPart:"",name:"Choppiness Index",format:{type:"price",precision:2},usePlotsZOrder:!0},constructor:function(){this.f_0=function(e,t,i,s){return 100*r.log10(e/(t-i))/s},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=r.atr(1,this._context),n=this._context.new_var(s),o=r.sum(n,i,this._context),a=r.high(this._context),l=this._context.new_var(a),c=r.highest(l,i,this._context),h=r.low(this._context),d=this._context.new_var(h),u=r.lowest(d,i,this._context),p=r.log10(i);return[this.f_0(o,c,u,p)]}}},{name:"Commodity Channel Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},smoothedMA:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!1}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:100},{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:-100}],filledAreasStyle:{fill_0:{color:"#2196F3",transparency:90,visible:!0}},inputs:{in_0:20,smoothingLine:"SMA",smoothingLength:20}},plots:[{id:"plot_0",type:"line"},{id:"smoothedMA",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,zorder:2},smoothedMA:{title:"Smoothed MA",histogramBase:0,joinPoints:!1,zorder:1}},description:"Commodity Channel Index",shortDescription:"CCI",is_price_study:!1,bands:[{id:"hline_0",name:"UpperLimit",zorder:-1.1},{id:"hline_1",name:"LowerLimit",zorder:-1.11}],filledAreas:[{id:"fill_0",objAId:"hline_0",objBId:"hline_1",type:"hline_hline",title:"Hlines Background",zorder:-2}],inputs:[{id:"in_0",name:"length",defval:20,type:"integer",min:1,max:2e3},{id:"smoothingLine",name:"Smoothing Line",defval:"SMA",type:"text",options:["SMA","EMA","WMA"],hideWhenPlotsHidden:["smoothedMA"]},{id:"smoothingLength",name:"Smoothing Length",defval:20,type:"integer",min:1,max:1e4,hideWhenPlotsHidden:["smoothedMA"]}],id:"Commodity Channel Index@tv-basicstudies-1",scriptIdPart:"",name:"Commodity Channel Index",format:{precision:2,type:"price"},usePlotsZOrder:!0},constructor:function(){this.f_0=function(e,t,i){return(e-t)/(.015*i)},this.main=function(e,t){this._context=e,this._input=t;var i=r.hlc3(this._context),s=this._input(0),n=this._input(1),o=this._input(2);this._context.setMinimumAdditionalDepth(s+o);var a,l=this._context.new_var(i),c=r.sma(l,s,this._context),h=this._context.new_var(i),d=r.dev(h,s,this._context),u=this.f_0(i,c,d),p=this._context.new_var(u);return"EMA"===n?a=r.ema(p,o,this._context):"WMA"===n?a=r.wma(p,o,this._context):"SMA"===n&&(a=r.sma(p,o,this._context)),[u,a]}}},{name:"Connors RSI",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:70},{ +color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:30}],filledAreasStyle:{fill_0:{color:"#2196F3",transparency:90,visible:!0}},inputs:{in_0:3,in_1:2,in_2:100}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"CRSI",histogramBase:0,joinPoints:!1,zorder:1}},description:"Connors RSI",shortDescription:"CRSI",is_price_study:!1,bands:[{id:"hline_0",name:"UpperLimit",zorder:-1.1},{id:"hline_1",name:"LowerLimit",zorder:-1.11}],filledAreas:[{id:"fill_0",objAId:"hline_0",objBId:"hline_1",type:"hline_hline",title:"Hlines Background",zorder:-2}],inputs:[{id:"in_0",name:"RSI Length",defval:3,type:"integer",min:1},{id:"in_1",name:"UpDown Length",defval:2,type:"integer",min:1},{id:"in_2",name:"ROC Length",defval:100,type:"integer",min:1}],id:"Connors RSI@tv-basicstudies-1",scriptIdPart:"",name:"Connors RSI",format:{precision:2,type:"price"},usePlotsZOrder:!0},constructor:function(){var e;this.f_1=function(e,t,i){var s=i.new_var(r.max(r.change(e),0));return r.rma(s,t,i)},this.f_2=function(e,t,i){var s=i.new_var(-r.min(r.change(e),0));return r.rma(s,t,i)},this.f_3=(e=0,function(t){var i=t.get(0),s=t.get(1);return e=i===s?0:i>s?r.nz(e)<=0?1:r.nz(e)+1:r.nz(e)>=0?-1:r.nz(e)-1,this._context.new_var(e)}),this.main=function(e,t){this._context=e,this._input=t;var i=r.close(this._context),s=this._context.new_var(i),n=this._input(0),o=this._input(1),a=this._input(2);this._context.setMinimumAdditionalDepth(a);var l=r.rsi(this.f_1(s,n,this._context),this.f_2(s,n,this._context)),c=this.f_3(s),h=r.rsi(this.f_1(c,o,this._context),this.f_2(c,o,this._context)),d=this._context.new_var(r.roc(s,1)),u=r.percentrank(d,a);return[r.avg(l,h,u)]}}},{name:"Coppock Curve",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:10,in_1:14,in_2:11}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Coppock Curve",shortDescription:"Coppock Curve",is_price_study:!1,inputs:[{id:"in_0",name:"WMA Length",defval:10,type:"integer",min:-1e12,max:5e3},{id:"in_1",name:"Long RoC Length",defval:14,type:"integer",min:1,max:4999},{id:"in_2",name:"Short RoC Length",defval:11,type:"integer",min:1,max:4999}],id:"Coppock Curve@tv-basicstudies-1",scriptIdPart:"",name:"Coppock Curve",format:{type:"inherit"}},constructor:function(){this.f_0=function(e,t){return e+t},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=this._input(2);this._context.setMinimumAdditionalDepth(i+Math.max(s,n));var o=r.close(this._context),a=this._context.new_var(o),l=r.roc(a,s),c=this._context.new_var(o),h=r.roc(c,n),d=this.f_0(l,h),u=this._context.new_var(d);return[r.wma(u,i,this._context)]}}},{name:"Correlation Coeff",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:4,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:"",in_1:20 +}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Correlation Coefficient",shortDescription:"CC",is_price_study:!1,inputs:[{id:"in_0",name:"sym",defval:"",type:"symbol"},{id:"in_1",name:"length",defval:20,type:"integer",min:1,max:2e3}],id:"Correlation Coeff@tv-basicstudies-1",scriptIdPart:"",name:"Correlation Coeff",format:{precision:2,type:"price"}},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,this._context.new_sym(this._input(0),r.period(this._context))},this.main=function(e,t){this._context=e,this._input=t;var i=this._context.new_unlimited_var(this._context.symbol.time),s=(this._input(0),r.period(this._context),r.close(this._context)),n=this._input(1);this._context.select_sym(1);var o=this._context.new_unlimited_var(this._context.symbol.time),a=r.close(this._context),l=this._context.new_unlimited_var(a);this._context.select_sym(0);var c=l.adopt(o,i,0),h=this._context.new_var(s),d=this._context.new_var(c);return[r.correlation(h,d,n,this._context)]}}},{name:"Correlation - Log",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!1,id:"Correlation - Log@tv-basicstudies-1",scriptIdPart:"",name:"Correlation - Log",description:"Correlation - Log",shortDescription:"Correlation - Log",plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:"#2196F3"}},inputs:{instrument:"",instrument2:"",periods:25}},styles:{plot_0:{title:"Plot"}},inputs:[{id:"instrument",name:"Instrument 1",type:"symbol",defval:"",confirm:!0},{id:"instrument2",name:"Instrument 2",type:"symbol",defval:"",confirm:!0},{id:"periods",name:"Periods",type:"integer",defval:25}],format:{precision:2,type:"price"}},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,this._context.new_sym(this._input(0),r.period(this._context)),this._context.new_sym(this._input(1),r.period(this._context)),this.period=this._input(2)},this.correlationLog=function(e,t,i,s){var n=r.sma(e,i,s),o=r.sma(t,i,s),a=s.new_var(e.get()*t.get());return(r.sma(a,i,s)-n*o)/Math.sqrt(r.variance2(e,n,i)*r.variance2(t,o,i))},this.main=function(e,t){this._context=e,this._input=t;var i=this._context.new_var(this._context.symbol.time);this._context.select_sym(2);var s=this._context.new_var(r.close(this._context)),n=this._context.new_var(r.log(s.get()/s.get(1))),o=this._context.new_var(this._context.symbol.time);this._context.select_sym(1);var a=this._context.new_var(this._context.symbol.time),l=this._context.new_var(r.close(this._context)),c=this._context.new_var(r.log(l.get()/l.get(1))),h=this._context.new_var(n.adopt(o,a,0)),d=this._context.new_var(this.correlationLog(c,h,this.period,this._context)),u=this._context.new_var(d.adopt(a,i,0)).get(),p=r.round(1e3*u)/1e3;return this._context.select_sym(0),[p]}}},{name:"Detrended Price Oscillator",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1, +plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#43A047"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:0}],inputs:{in_0:21,in_1:!1}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"DPO",histogramBase:0,joinPoints:!1,isHidden:!1,zorder:1}},description:"Detrended Price Oscillator",shortDescription:"DPO",is_price_study:!1,is_hidden_study:!1,id:"detrended_price_oscillator@tv-basicstudies-1",bands:[{id:"hline_0",name:"Zero",isHidden:!1,zorder:-1}],inputs:[{id:"in_0",name:"Period",defval:21,type:"integer",min:1,max:1e12},{id:"in_1",name:"isCentered",defval:!1,type:"bool"}],scriptIdPart:"",name:"Detrended Price Oscillator",format:{type:"price",precision:2},usePlotsZOrder:!0},constructor:function(){this.f_0=function(){var e=this._input(0),t=this._input(1),i=Math.floor(e/2+1);this._context.setMinimumAdditionalDepth(e+i);var s=this._context.new_var(r.close(this._context)),n=this._context.new_var(r.sma(s,e,this._context)),o=this._context.new_var(r.close(this._context)).get(i)-n,a=r.close(this._context)-n.get(i);return[t?o:a,t?-i:0]},this.main=function(e,t){this._context=e,this._input=t;var i=this.f_0();return[{value:i[0],offset:i[1]}]}}},{name:"Directional Movement Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FF6D00"},plot_3:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#F50057"},plot_2:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FFA726"},plot_4:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#ab47bc"}},inputs:{in_0:14,in_1:14}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"},{id:"plot_3",type:"line"},{id:"plot_4",type:"line"}],styles:{plot_0:{title:"+DI",histogramBase:0,joinPoints:!1},plot_1:{title:"-DI",histogramBase:0,joinPoints:!1},plot_2:{title:"DX",histogramBase:0,joinPoints:!1},plot_3:{title:"ADX",histogramBase:0,joinPoints:!1},plot_4:{title:"ADXR",histogramBase:0,joinPoints:!1}},description:"Directional Movement",shortDescription:"DMI",is_price_study:!1,inputs:[{id:"in_0",name:"DI Length",defval:14,type:"integer",min:1,max:2e3},{id:"in_1",name:"ADX Smoothing",defval:14,type:"integer",min:1,max:50}],id:"Directional Movement Index@tv-basicstudies-1",scriptIdPart:"",name:"Directional Movement Index",format:{precision:4,type:"price"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1);return this._context.setMinimumAdditionalDepth(2*i+s),r.dmi(i,s,this._context)}}},{name:"Donchian Channels",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_1:{linestyle:0,linewidth:1,plottype:0, +trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_2:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FF6D00"}},filledAreasStyle:{fill_0:{color:"#2196F3",transparency:95,visible:!0}},inputs:{in_0:20,offset:0}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"}],styles:{plot_0:{title:"Lower",histogramBase:0,joinPoints:!1},plot_1:{title:"Upper",histogramBase:0,joinPoints:!1},plot_2:{title:"Basis",histogramBase:0,joinPoints:!1}},description:"Donchian Channels",shortDescription:"DC",is_price_study:!0,filledAreas:[{id:"fill_0",objAId:"plot_1",objBId:"plot_0",type:"plot_plot",title:"Plots Background"}],inputs:[{id:"in_0",name:"length",defval:20,type:"integer",min:1,max:2e3},{id:"offset",name:"Offset",defval:0,type:"integer",min:-1e3,max:1e3}],id:"Donchian Channels@tv-basicstudies-1",scriptIdPart:"",name:"Donchian Channels",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=r.low(this._context),o=this._context.new_var(n);this._context.setMinimumAdditionalDepth(i+Math.max(s,0));var a=r.lowest(o,i,this._context),l=r.high(this._context),c=this._context.new_var(l),h=r.highest(c,i,this._context);return[{value:a,offset:s},{value:h,offset:s},{value:r.avg(h,a),offset:s}]}}},{name:"Double Exponential Moving Average",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#43A047"}},inputs:{in_0:9}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Double EMA",shortDescription:"DEMA",is_price_study:!0,inputs:[{id:"in_0",name:"length",defval:9,type:"integer",min:1,max:1e4}],id:"Double Exponential Moving Average@tv-basicstudies-1",scriptIdPart:"",name:"Double Exponential Moving Average",format:{type:"inherit"}},constructor:function(){this.f_0=function(e,t){return 2*e-t},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0);this._context.setMinimumAdditionalDepth(2*i);var s=r.close(this._context),n=this._context.new_var(s),o=r.ema(n,i,this._context),a=this._context.new_var(o),l=r.ema(a,i,this._context);return[this.f_0(o,l)]}}},{name:"Ease of Movement",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#43A047"}},inputs:{in_0:1e4,in_1:14}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Ease Of Movement",shortDescription:"EOM",is_price_study:!1,inputs:[{id:"in_0",name:"Divisor",defval:1e4,type:"integer",min:1,max:1e9},{id:"in_1",name:"length",defval:14,type:"integer",min:1,max:2e3}],id:"Ease of Movement@tv-basicstudies-1",scriptIdPart:"",name:"Ease of Movement",format:{type:"volume"}},constructor:function(){this.f_0=function(e,t,i,s,r){return e*t*(i-s)/r}, +this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=r.hl2(this._context),o=this._context.new_var(n),a=r.change(o),l=this.f_0(i,a,r.high(this._context),r.low(this._context),r.volume(this._context)),c=this._context.new_var(l);return[r.sma(c,s,this._context)]}}},{name:"Elders Force Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:a}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:0}],inputs:{in_0:13}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,zorder:1}},description:"Elder's Force Index",shortDescription:"EFI",is_price_study:!1,bands:[{id:"hline_0",name:"Zero",zorder:-1}],inputs:[{id:"in_0",name:"length",defval:13,type:"integer",min:1,max:2e3}],id:"Elders Force Index@tv-basicstudies-1",scriptIdPart:"",name:"Elders Force Index",format:{type:"volume"},usePlotsZOrder:!0},constructor:function(){this.f_0=function(e,t){return e*t},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=r.close(this._context),n=this._context.new_var(s),o=r.change(n),a=this.f_0(o,r.volume(this._context)),l=this._context.new_var(a);return[r.ema(l,i,this._context)]}}},{name:"EMA Cross",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FF6D00"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#43A047"},plot_2:{linestyle:0,linewidth:4,plottype:3,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:9,in_1:26}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"}],styles:{plot_0:{title:"Short",histogramBase:0,joinPoints:!1},plot_1:{title:"Long",histogramBase:0,joinPoints:!1},plot_2:{title:"Crosses",histogramBase:0,joinPoints:!1}},description:"EMA Cross",shortDescription:"EMA Cross",is_price_study:!0,inputs:[{id:"in_0",name:"Short",defval:9,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["plot_0","plot_2"]},{id:"in_1",name:"Long",defval:26,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["plot_1","plot_2"]}],id:"EMA Cross@tv-basicstudies-1",scriptIdPart:"",name:"EMA Cross",format:{type:"inherit"}},constructor:function(){this.f_0=function(e,t){return e?t:r.na()},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=r.close(this._context),o=this._context.new_var(n),a=r.ema(o,i,this._context),l=this._context.new_var(n),c=r.ema(l,s,this._context),h=a,d=c,u=r.cross(a,c,this._context);return[h,d,this.f_0(u,a)]}}},{name:"Envelopes",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FF6D00"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0, +color:"#2196F3"},plot_2:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},filledAreasStyle:{fill_0:{color:"#2196F3",transparency:95,visible:!0}},inputs:{in_0:20,in_1:10,in_2:10,in_3:"Simple",in_4:"close"}},plots:[{id:"plot_1",type:"line"},{id:"plot_0",type:"line"},{id:"plot_2",type:"line"}],styles:{plot_0:{title:"Average",histogramBase:0,joinPoints:!1},plot_1:{title:"Upper",histogramBase:0,joinPoints:!1},plot_2:{title:"Lower",histogramBase:0,joinPoints:!1}},description:"Envelopes",shortDescription:"Envelopes",is_price_study:!0,filledAreas:[{id:"fill_0",objAId:"plot_1",objBId:"plot_2",type:"plot_plot",title:"Plots Background"}],inputs:[{id:"in_0",name:"Length",defval:20,type:"integer",min:1,max:2e3},{id:"in_1",name:"Upper Percentage",defval:2,type:"float",min:0},{id:"in_2",name:"Lower Percentage",defval:2,type:"float",min:0},{id:"in_3",name:"Method",type:"text",defval:"Simple",options:["Simple","Exponential","Weighted"]},{id:"in_4",name:"Source",defval:"close",type:"source",options:["open","high","low","close","hl2","hlc3","ohlc4"]}],id:"Envelope@tv-basicstudies-1",scriptIdPart:"",name:"Envelopes",format:{type:"inherit"}},constructor:function(){this.f_0=function(e,t){return e*(1+t)},this.f_1=function(e,t){return e*(1-t)},this.main=function(e,t){this._context=e,this._input=t;var i=this._context.new_var(r[this._input(4)](this._context)),s=r.sma(i,this._input(0),this._context);return"Exponential"===this._input(3)?s=r.ema(i,this._input(0),this._context):"Weighted"===this._input(3)&&(s=r.wma(i,this._input(0),this._context)),[this.f_0(s,this._input(1)/100),s,this.f_1(s,this._input(2)/100)]}}},{name:"Standard Error",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!1,id:"Standard Error@tv-basicstudies-1",scriptIdPart:"",name:"Standard Error",description:"Standard Error",shortDescription:"Standard Error",plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:"#FF6D00"}},inputs:{length:14}},styles:{plot_0:{title:"Plot"}},inputs:[{id:"length",type:"integer",name:"Length",min:3}],format:{precision:2,type:"price"}},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,this.period=this._input(0)},this.main=function(e,t){this._context=e,this._input=t;for(var i,s,n=this._context.new_var(r.close(this._context)),o=0,a=0,l=0;l0?1:3,i=r.change(this._context.new_var(e));return t-(r.le(i,0)?0:1)},this.main=function(e,t){this._context=e,this._input=t;var i=r[this._input(2)](this._context),s=this._input(0),n=this._input(1),o=this._input(3);this._context.setMinimumAdditionalDepth(Math.max(s,n)+o);var a=this._context.new_var(i),l=r.ema(a,s,this._context),c=this._context.new_var(i),h=r.ema(c,n,this._context),d=this.f_0(l,h),u=this._context.new_var(d),p=r.ema(u,o,this._context),_=this.f_0(d,p);return[_,d,p,this.f_1(_)]}}},{name:"Moving Average Exponential",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},smoothedMA:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!1}},inputs:{length:9,source:"close",offset:0,smoothingLine:"SMA",smoothingLength:9}},plots:[{id:"plot_0",type:"line"},{id:"smoothedMA",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1},smoothedMA:{title:"Smoothed MA",histogramBase:0,joinPoints:!1}},description:"Moving Average Exponential",shortDescription:"EMA",is_price_study:!0,inputs:[{id:"length",name:"Length",defval:9,type:"integer",min:1,max:1e4},{id:"source",name:"Source",defval:"close",type:"source",options:["open","high","low","close","hl2","hlc3","ohlc4"]},{id:"offset",name:"Offset",defval:0,type:"integer",min:-1e4,max:1e4},{id:"smoothingLine",name:"Smoothing Line",defval:"SMA",type:"text",options:["SMA","EMA","WMA"],hideWhenPlotsHidden:["smoothedMA"]},{id:"smoothingLength",name:"Smoothing Length",defval:9,type:"integer",min:1,max:1e4,hideWhenPlotsHidden:["smoothedMA"]}],id:"Moving Average Exponential@tv-basicstudies-1",scriptIdPart:"",name:"Moving Average Exponential",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=r[this._input(1)](this._context),s=this._input(0),n=this._input(2),o=this._input(3),a=this._input(4);this._context.setMinimumAdditionalDepth(s+a);var l,c=this._context.new_var(i),h=r.ema(c,s,this._context),d=this._context.new_var(h);return"EMA"===o?l=r.ema(d,a,this._context):"WMA"===o?l=r.wma(d,a,this._context):"SMA"===o&&(l=r.sma(d,a,this._context)),[{value:h,offset:n},{value:l,offset:n}]}}},{name:"Moving Average Weighted",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:9,in_1:"close",in_2:0}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Moving Average Weighted",shortDescription:"WMA",is_price_study:!0,inputs:[{id:"in_0",name:"Length",defval:9,type:"integer",min:1,max:2e3},{id:"in_1",name:"Source",defval:"close",type:"source",options:["open","high","low","close","hl2","hlc3","ohlc4"]},{id:"in_2",name:"Offset",defval:0,type:"integer", +min:-1e4,max:1e4}],id:"Moving Average Weighted@tv-basicstudies-1",scriptIdPart:"",name:"Moving Average Weighted",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=r[this._input(1)](this._context),s=this._input(0),n=this._input(2),o=this._context.new_var(i);return[{value:r.wma(o,s,this._context),offset:n}]}}},{name:"Moving Average Double",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,id:"Moving Average Double@tv-basicstudies-1",scriptIdPart:"",name:"Moving Average Double",description:"Moving Average Double",shortDescription:"Moving Average Double",is_price_study:!0,plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:"#FF6D00"},plot_1:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:"#2196F3"}},inputs:{firstPeriods:14,secondPeriods:21,method:"Simple"}},styles:{plot_0:{title:"Plot 1"},plot_1:{title:"Plot 2"}},inputs:[{id:"firstPeriods",name:"1st Period",type:"integer",defval:14,min:1,max:1e4},{id:"secondPeriods",name:"2nd Period",type:"integer",defval:21,min:1,max:1e4},{id:"method",name:"Method",type:"text",defval:"Simple",options:["Simple","Exponential","Weighted"]}],format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i,s,n=this._context.new_var(r.close(this._context));return"Exponential"===this._input(2)?(i=r.ema(n,this._input(0),this._context),s=r.ema(n,this._input(1),this._context)):"Weighted"===this._input(2)?(i=r.wma(n,this._input(0),this._context),s=r.wma(n,this._input(1),this._context)):(i=r.sma(n,this._input(0),this._context),s=r.sma(n,this._input(1),this._context)),[i,s]}}},{name:"Moving Average Triple",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!0,id:"Moving Average Triple@tv-basicstudies-1",scriptIdPart:"",name:"Moving Average Triple",description:"Moving Average Triple",shortDescription:"Moving Average Triple",plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,transparency:0,trackPrice:!1,color:"#FF6D00"},plot_1:{linestyle:0,visible:!0,linewidth:1,transparency:0,plottype:0,trackPrice:!1,color:"#2196F3"},plot_2:{linestyle:0,visible:!0,linewidth:1,transparency:0,plottype:0,trackPrice:!1,color:"#26C6DA"}},inputs:{firstPeriods:14,secondPeriods:21,thirdPeriods:35,method:"Simple"}},styles:{plot_0:{title:"Plot 1"},plot_1:{title:"Plot 2"},plot_2:{title:"Plot 3"}},inputs:[{id:"firstPeriods",name:"1st Period",type:"integer",defval:14,min:1,max:1e4,hideWhenPlotsHidden:["plot_0"]},{id:"secondPeriods",name:"2nd Period",type:"integer",defval:21,min:1,max:1e4,hideWhenPlotsHidden:["plot_1"]},{id:"thirdPeriods",name:"3rd Period",type:"integer",defval:35,min:1,max:1e4,hideWhenPlotsHidden:["plot_2"]},{id:"method",name:"Method",type:"text",defval:"Simple", +options:["Simple","Exponential","Weighted"]}],format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i,s,n,o=this._context.new_var(r.close(this._context));return"Exponential"===this._input(3)?(i=r.ema(o,this._input(0),this._context),s=r.ema(o,this._input(1),this._context),n=r.ema(o,this._input(2),this._context)):"Weighted"===this._input(3)?(i=r.wma(o,this._input(0),this._context),s=r.wma(o,this._input(1),this._context),n=r.wma(o,this._input(2),this._context)):(i=r.sma(o,this._input(0),this._context),s=r.sma(o,this._input(1),this._context),n=r.sma(o,this._input(2),this._context)),[i,s,n]}}},{name:"Moving Average Adaptive",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!0,id:"Moving Average Adaptive@tv-basicstudies-1",scriptIdPart:"",name:"Moving Average Adaptive",description:"Moving Average Adaptive",shortDescription:"Moving Average Adaptive",plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,transparency:0,trackPrice:!1,color:"#AB47BC"}},inputs:{periods:10}},styles:{plot_0:{title:"Plot 1"}},inputs:[{id:"periods",name:"Period",type:"integer",defval:10,min:2,max:1e4}],format:{type:"inherit"}},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,this.periods=this._input(0)},this.ama=function(e,t){var i=this.periods,s=this._context.new_var(),n=e.get(),o=r.stdev(t,i,this._context),a=r.log(n/e.get(i))/(o*Math.sqrt(i)),l=.1*Math.abs(a),c=(n-s.get(1))*l+s.get(1);return s.set(isNaN(c)?n:c),c},this.main=function(e,t){this._context=e,this._input=t;var i=this._context.new_var(r.close(this._context)),s=this._context.new_var(r.log(i.get()/i.get(1)));return[this.ama(i,s)]}}},{name:"Moving Average Hamming",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!0,id:"Moving Average Hamming@tv-basicstudies-1",scriptIdPart:"",name:"Moving Average Hamming",description:"Moving Average Hamming",shortDescription:"Moving Average Hamming",plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,transparency:0,trackPrice:!1,color:"#4CAF50"}},inputs:{periods:10}},styles:{plot_0:{title:"Plot 1"}},inputs:[{id:"periods",name:"Period",type:"integer",defval:10,min:1,max:1e4}],format:{type:"inherit"}},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,this.periods=this._input(0);for(var i=[],s=0,r=1;r<=this.periods;++r){var n=Math.sin((1+r)/this.periods*Math.PI/2);i.unshift(n),s+=n}this.hmaFactors=i,this.hmaFactorsSum=s},this.hma=function(e){for(var t=this.periods,i=0,s=0;sthis._context.new_var(s).get(1)?1:0,[100*r.sma(this._context.new_var(i),this.rollingPeriod,this._context)]}}},{name:"Net Volume",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Net Volume",shortDescription:"Net Volume",is_price_study:!1,inputs:[],id:"Net Volume@tv-basicstudies-1",scriptIdPart:"",name:"Net Volume",format:{type:"volume"}},constructor:function(){this.f_0=function(e,t,i){return r.gt(e,0)?t:r.lt(i,0)?-t:0*t},this.main=function(e,t){this._context=e,this._input=t;var i=r.close(this._context),s=this._context.new_var(i),n=r.change(s);return[this.f_0(n,r.volume(this._context),n)]}}},{name:"On Balance Volume",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},smoothedMA:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!1}},inputs:{smoothingLine:"SMA",smoothingLength:9}},plots:[{id:"plot_0",type:"line"},{id:"smoothedMA",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1},smoothedMA:{title:"Smoothed MA",histogramBase:0,joinPoints:!1}},description:"On Balance Volume",shortDescription:"OBV",is_price_study:!1,inputs:[{id:"smoothingLine",name:"Smoothing Line",defval:"SMA",type:"text",options:["SMA","EMA","WMA"],hideWhenPlotsHidden:["smoothedMA"]},{id:"smoothingLength",name:"Smoothing Length",defval:9,type:"integer",min:1,max:1e4,hideWhenPlotsHidden:["smoothedMA"]}],id:"On Balance Volume@tv-basicstudies-1",scriptIdPart:"",name:"On Balance Volume",format:{type:"volume"}},constructor:function(){this.f_0=function(e,t,i){return r.gt(e,0)?t:r.lt(i,0)?-t:0*t},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=r.close(this._context),o=this._context.new_var(n),a=r.change(o),l=this.f_0(a,r.volume(this._context),a),c=r.cum(l,this._context);this._context.setMinimumAdditionalDepth(s);var h,d=this._context.new_var(c);return"EMA"===i?h=r.ema(d,s,this._context):"WMA"===i?h=r.wma(d,s,this._context):"SMA"===i&&(h=r.sma(d,s,this._context)),[c,h]}}},{name:"Parabolic SAR",metainfo:{ +_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:3,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:.02,in_1:.02,in_2:.2}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Parabolic SAR",shortDescription:"SAR",is_price_study:!0,inputs:[{id:"in_0",name:"start",defval:.02,type:"float",min:-1e12,max:1e12},{id:"in_1",name:"increment",defval:.02,type:"float",min:-1e12,max:1e12},{id:"in_2",name:"maximum",defval:.2,type:"float",min:-1e12,max:1e12}],id:"Parabolic SAR@tv-basicstudies-1",scriptIdPart:"",name:"Parabolic SAR",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=this._input(2);return[r.sar(i,s,n,this._context)]}}},{name:"Price Channel",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#F50057"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#F50057"},plot_2:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:20,in_1:0}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"}],styles:{plot_0:{title:"Highprice Line",histogramBase:0,joinPoints:!1},plot_1:{title:"Lowprice Line",histogramBase:0,joinPoints:!1},plot_2:{title:"Centerprice Line",histogramBase:0,joinPoints:!1}},description:"Price Channel",shortDescription:"PC",is_price_study:!0,inputs:[{id:"in_0",name:"Length",defval:20,type:"integer",min:1,max:2e3},{id:"in_1",name:"Offset Length",defval:0,type:"integer",min:1,max:2e3}],id:"Price Channel@tv-basicstudies-1",scriptIdPart:"",name:"Price Channel",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=r.high(this._context),s=this._context.new_var(i),n=r.low(this._context),o=this._context.new_var(n),a=this._input(0),l=this._input(1),c=r.highest(s,a,this._context),h=r.lowest(o,a,this._context);return[{value:c,offset:l},{value:h,offset:l},{value:r.avg(c,h),offset:l}]}}},{name:"Price Oscillator",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:u}},inputs:{in_0:10,in_1:21}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Price Oscillator",shortDescription:"PPO",is_price_study:!1,inputs:[{id:"in_0",name:"shortlen",defval:10,type:"integer",min:1,max:2e3},{id:"in_1",name:"longlen",defval:21,type:"integer",min:1,max:2e3}],id:"Price Oscillator@tv-basicstudies-1",scriptIdPart:"",name:"Price Oscillator",format:{type:"price",precision:2}},constructor:function(){this.f_0=function(e,t){return(e-t)/t*100},this.main=function(e,t){this._context=e,this._input=t +;var i=r.close(this._context),s=this._input(0),n=this._input(1),o=this._context.new_var(i),a=r.sma(o,s,this._context),l=this._context.new_var(i),c=r.sma(l,n,this._context);return[this.f_0(a,c)]}}},{name:"Price Volume Trend",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"PVT",histogramBase:0,joinPoints:!1,isHidden:!1}},description:"Price Volume Trend",shortDescription:"PVT",is_price_study:!1,is_hidden_study:!1,id:"price_volume_trend@tv-basicstudies-1",inputs:[],scriptIdPart:"",name:"Price Volume Trend",format:{type:"volume"}},constructor:function(){this.f_0=function(){var e=this._context.new_var(r.close(this._context));return[r.cum(r.change(e)/e.get(1)*r.volume(this._context),this._context)]},this.main=function(e,t){return this._context=e,this._input=t,[this.f_0()[0]]}}},{name:"Rate Of Change",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:0}],inputs:{in_0:9}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"ROC",histogramBase:0,joinPoints:!1,isHidden:!1,zorder:1}},description:"Rate Of Change",shortDescription:"ROC",is_price_study:!1,bands:[{id:"hline_0",name:"Zero Line",isHidden:!1,zorder:-1}],inputs:[{id:"in_0",name:"length",defval:9,type:"integer",min:1,max:1e12}],id:"rate_of_change@tv-basicstudies-1",scriptIdPart:"",name:"Rate Of Change",format:{precision:2,type:"price"},usePlotsZOrder:!0},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=this._context.new_var(r.close(this._context)),s=this._input(0);return[100*(i.get(0)-i.get(s))/i.get(s)]}}},{name:"Relative Strength Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#7E57C2"},smoothedMA:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!1}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:70,zorder:-1.1},{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:50,zorder:-1.11},{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:30,zorder:-1.111}],filledAreasStyle:{fill_0:{color:"#7E57C2",transparency:90,visible:!0}},inputs:{length:14,smoothingLine:"SMA",smoothingLength:14}},plots:[{id:"plot_0",type:"line"},{id:"smoothedMA",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,zorder:1},smoothedMA:{title:"Smoothed MA",histogramBase:0,joinPoints:!1,zorder:2}},description:"Relative Strength Index",shortDescription:"RSI",is_price_study:!1,bands:[{id:"hline_0",name:"UpperLimit",zorder:-1.1},{id:"hline_2",name:"MiddleLimit",zorder:-1.11},{id:"hline_1",name:"LowerLimit",zorder:-1.111}],filledAreas:[{ +id:"fill_0",objAId:"hline_0",objBId:"hline_1",type:"hline_hline",title:"Hlines Background",zorder:-2}],inputs:[{id:"length",name:"Length",defval:14,type:"integer",min:1,max:2e3},{id:"smoothingLine",name:"Smoothing Line",defval:"SMA",type:"text",options:["SMA","EMA","WMA"],hideWhenPlotsHidden:["smoothedMA"]},{id:"smoothingLength",name:"Smoothing Length",defval:14,type:"integer",min:1,max:1e4,hideWhenPlotsHidden:["smoothedMA"]}],id:"Relative Strength Index@tv-basicstudies-1",scriptIdPart:"",name:"Relative Strength Index",format:{precision:2,type:"price"},usePlotsZOrder:!0},constructor:function(){this.f_0=function(e){return r.max(e,0)},this.f_1=function(e){return-r.min(e,0)},this.f_2=function(e,t){return r.eq(e,0)?100:r.eq(t,0)?0:100-100/(1+t/e)},this.main=function(e,t){this._context=e,this._input=t;var i=r.close(this._context),s=this._input(0),n=this._input(1),o=this._input(2);this._context.setMinimumAdditionalDepth(s+o);var a,l=this._context.new_var(i),c=r.change(l),h=this.f_0(c),d=this._context.new_var(h),u=r.rma(d,s,this._context),p=this.f_1(c),_=this._context.new_var(p),m=r.rma(_,s,this._context),g=this.f_2(m,u),f=this._context.new_var(g);return"EMA"===n?a=r.ema(f,o,this._context):"WMA"===n?a=r.wma(f,o,this._context):"SMA"===n&&(a=r.sma(f,o,this._context)),[{value:g},{value:a}]}}},{name:"Relative Vigor Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:u},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:a}},inputs:{in_0:10}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],styles:{plot_0:{title:"RVGI",histogramBase:0,joinPoints:!1},plot_1:{title:"Signal",histogramBase:0,joinPoints:!1}},description:"Relative Vigor Index",shortDescription:"RVGI",is_price_study:!1,inputs:[{id:"in_0",name:"Length",defval:10,type:"integer",min:1,max:2e3}],id:"Relative Vigor Index@tv-basicstudies-1",scriptIdPart:"",name:"Relative Vigor Index",format:{precision:4,type:"price"}},constructor:function(){this.f_0=function(e,t){return e-t},this.f_1=function(e,t){return e/t},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this.f_0(r.close(this._context),r.open(this._context)),n=this._context.new_var(s),o=r.swma(n,this._context),a=this._context.new_var(o),l=r.sum(a,i,this._context),c=this.f_0(r.high(this._context),r.low(this._context)),h=this._context.new_var(c),d=r.swma(h,this._context),u=this._context.new_var(d),p=r.sum(u,i,this._context),_=this.f_1(l,p),m=this._context.new_var(_);return[_,r.swma(m,this._context)]}}},{name:"Relative Volatility Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#7E57C2"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:80},{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:20}],filledAreasStyle:{fill_0:{color:"#7E57C2", +transparency:90,visible:!0}},inputs:{in_0:10}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,zorder:1}},description:"Relative Volatility Index",shortDescription:"RVI",is_price_study:!1,bands:[{id:"hline_0",name:"UpperLimit",zorder:-1.1},{id:"hline_1",name:"LowerLimit",zorder:-1.11}],filledAreas:[{id:"fill_0",objAId:"hline_0",objBId:"hline_1",type:"hline_hline",title:"Hlines Background",zorder:-2}],inputs:[{id:"in_0",name:"length",defval:10,type:"integer",min:1,max:2e3}],id:"Relative Volatility Index@tv-basicstudies-1",scriptIdPart:"",name:"Relative Volatility Index",format:{precision:2,type:"price"},usePlotsZOrder:!0},constructor:function(){this.f_0=function(e,t){return r.le(e,0)?0:t},this.f_1=function(e,t){return r.gt(e,0)?0:t},this.f_2=function(e,t){return e/(e+t)*100},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0);this._context.setMinimumAdditionalDepth(i+12);var s=r.close(this._context),n=this._context.new_var(s),o=r.stdev(n,i,this._context),a=this._context.new_var(s),l=r.change(a),c=this.f_0(l,o),h=this._context.new_var(c),d=r.ema(h,14,this._context),u=this.f_1(l,o),p=this._context.new_var(u),_=r.ema(p,14,this._context);return[this.f_2(d,_)]}}},{name:"SMI Ergodic Indicator/Oscillator",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FF6D00"},plot_2:{linestyle:0,linewidth:1,plottype:1,trackPrice:!1,transparency:0,visible:!0,color:c}},inputs:{in_0:5,in_1:20,in_2:5}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"}],styles:{plot_0:{title:"Indicator",histogramBase:0,joinPoints:!1},plot_1:{title:"Signal",histogramBase:0,joinPoints:!1},plot_2:{title:"Oscillator",histogramBase:0,joinPoints:!1}},description:"SMI Ergodic Indicator/Oscillator",shortDescription:"SMIIO",is_price_study:!1,inputs:[{id:"in_0",name:"shortlen",defval:5,type:"integer",min:1,max:2e3},{id:"in_1",name:"longlen",defval:20,type:"integer",min:1,max:2e3},{id:"in_2",name:"siglen",defval:5,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["plot_1"]}],id:"SMI Ergodic Indicator/Oscillator@tv-basicstudies-1",scriptIdPart:"",name:"SMI Ergodic Indicator/Oscillator",format:{type:"inherit"}},constructor:function(){this.f_0=function(e,t){return e-t},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=this._input(2);this._context.setMinimumAdditionalDepth(i+s+n);var o=r.close(this._context),a=this._context.new_var(o),l=r.tsi(a,i,s,this._context),c=this._context.new_var(l),h=r.ema(c,n,this._context);return[l,h,this.f_0(l,h)]}}},{name:"Smoothed Moving Average",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#673AB7"}},inputs:{in_0:7, +in_1:"close"}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,isHidden:!1}},description:"Smoothed Moving Average",shortDescription:"SMMA",is_price_study:!0,inputs:[{id:"in_0",name:"Length",defval:7,type:"integer",min:1,max:1e12},{id:"in_1",name:"Source",defval:"close",type:"source",options:["open","high","low","close","hl2","hlc3","ohlc4"]}],id:"smoothed_moving_average@tv-basicstudies-1",scriptIdPart:"",name:"Smoothed Moving Average",format:{type:"inherit"}},constructor:function(){this.f_0=function(){var e=this._input(0),t=r[this._input(1)](this._context);return[r.smma(t,e,this._context)]},this.main=function(e,t){return this._context=e,this._input=t,this.f_0()}}},{name:"Standard Deviation",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,id:"Standard Deviation@tv-basicstudies-1",scriptIdPart:"",name:"Standard Deviation",description:"Standard Deviation",shortDescription:"Standard Deviation",is_price_study:!1,plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:u}},inputs:{periods:5,deviations:1}},styles:{plot_0:{title:"Plot"}},inputs:[{id:"periods",name:"Periods",type:"integer"},{id:"deviations",name:"Deviations",type:"float"}],format:{precision:2,type:"price"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=this._context.new_var(r.close(this._context));return[r.stdev(n,i,this._context)*s]}}},{name:"Stochastic",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FF6D00"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:80},{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:20}],filledAreasStyle:{fill_0:{color:"#2196F3",transparency:90,visible:!0}},inputs:{in_0:14,in_1:1,in_2:3}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],styles:{plot_0:{title:"%K",histogramBase:0,joinPoints:!1,zorder:1.1},plot_1:{title:"%D",histogramBase:0,joinPoints:!1,zorder:1.11}},description:"Stochastic",shortDescription:"Stoch",is_price_study:!1,bands:[{id:"hline_0",name:"UpperLimit",zorder:-1.1},{id:"hline_1",name:"LowerLimit",zorder:-1.11}],filledAreas:[{id:"fill_0",objAId:"hline_0",objBId:"hline_1",type:"hline_hline",title:"Hlines Background",zorder:-2}],inputs:[{id:"in_0",name:"%K Length",defval:14,type:"integer",min:1,max:1e4},{id:"in_1",name:"%K Smoothing",defval:1,type:"integer",min:1,max:1e4},{id:"in_2",name:"%D Smoothing",defval:3,type:"integer",min:1,max:1e4}],id:"Stochastic@tv-basicstudies-1",scriptIdPart:"",name:"Stochastic",format:{precision:2,type:"price"},usePlotsZOrder:!0},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=this._input(2) +;this._context.setMinimumAdditionalDepth(i+s+n);var o=r.close(this._context),a=r.high(this._context),l=r.low(this._context),c=this._context.new_var(o),h=this._context.new_var(a),d=this._context.new_var(l),u=r.stoch(c,h,d,i,this._context),p=this._context.new_var(u),_=r.sma(p,s,this._context),m=this._context.new_var(_);return[_,r.sma(m,n,this._context)]}}},{name:"Stochastic RSI",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FF6D00"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:80},{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:20}],filledAreasStyle:{fill_0:{color:"#2196F3",transparency:90,visible:!0}},inputs:{in_0:14,in_1:14,in_2:3,in_3:3}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],styles:{plot_0:{title:"%K",histogramBase:0,joinPoints:!1,zorder:1.1},plot_1:{title:"%D",histogramBase:0,joinPoints:!1,zorder:1.11}},description:"Stochastic RSI",shortDescription:"Stoch RSI",is_price_study:!1,bands:[{id:"hline_0",name:"UpperLimit",zorder:-1.1},{id:"hline_1",name:"LowerLimit",zorder:-1.11}],filledAreas:[{id:"fill_0",objAId:"hline_0",objBId:"hline_1",type:"hline_hline",title:"Hlines Background",zorder:-2}],inputs:[{id:"in_0",name:"lengthRSI",defval:14,type:"integer",min:1,max:1e4},{id:"in_1",name:"lengthStoch",defval:14,type:"integer",min:1,max:1e4},{id:"in_2",name:"smoothK",defval:3,type:"integer",min:1,max:1e4},{id:"in_3",name:"smoothD",defval:3,type:"integer",min:1,max:1e4}],id:"Stochastic RSI@tv-basicstudies-1",scriptIdPart:"",name:"Stochastic RSI",format:{precision:2,type:"price"},usePlotsZOrder:!0},constructor:function(){this.f_1=function(e,t,i){var s=i.new_var(r.max(r.change(e),0));return r.rma(s,t,i)},this.f_2=function(e,t,i){var s=i.new_var(-r.min(r.change(e),0));return r.rma(s,t,i)},this.main=function(e,t){this._context=e,this._input=t;var i=r.close(this._context),s=this._input(0),n=this._input(1),o=this._input(2),a=this._input(3);e.setMinimumAdditionalDepth(s+n+o+a);var l=this._context.new_var(i),c=r.rsi(this.f_1(l,s,this._context),this.f_2(l,s,this._context)),h=this._context.new_var(c),d=this._context.new_var(c),u=this._context.new_var(c),p=r.stoch(h,d,u,n,this._context),_=this._context.new_var(p),m=r.sma(_,o,this._context),g=this._context.new_var(m);return[m,r.sma(g,a,this._context)]}}},{name:"TRIX",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:a}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:0}],inputs:{in_0:18}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"TRIX",histogramBase:0,joinPoints:!1,zorder:1}},description:"TRIX",shortDescription:"TRIX",is_price_study:!1,bands:[{id:"hline_0",name:"Zero",zorder:-1}],inputs:[{id:"in_0",name:"length",defval:18, +type:"integer",min:1,max:2e3}],id:"TRIX@tv-basicstudies-1",scriptIdPart:"",name:"TRIX",format:{precision:2,type:"price"},usePlotsZOrder:!0},constructor:function(){this.f_0=function(e){return r.log(e)},this.f_1=function(e){return 1e4*e},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0);e.setMinimumAdditionalDepth(3*i);var s=this.f_0(r.close(this._context)),n=this._context.new_var(s),o=r.ema(n,i,this._context),a=this._context.new_var(o),l=r.ema(a,i,this._context),c=this._context.new_var(l),h=r.ema(c,i,this._context),d=this._context.new_var(h),u=r.change(d);return[this.f_1(u)]}}},{name:"Triple EMA",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:9}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Triple EMA",shortDescription:"TEMA",is_price_study:!0,inputs:[{id:"in_0",name:"length",defval:9,type:"integer",min:1,max:1e4}],id:"Triple EMA@tv-basicstudies-1",scriptIdPart:"",name:"Triple EMA",format:{type:"inherit"}},constructor:function(){this.f_0=function(e,t,i){return 3*(e-t)+i},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0);this._context.setMinimumAdditionalDepth(3*i);var s=r.close(this._context),n=this._context.new_var(s),o=r.ema(n,i,this._context),a=this._context.new_var(o),l=r.ema(a,i,this._context),c=this._context.new_var(l),h=r.ema(c,i,this._context);return[this.f_0(o,l,h)]}}},{name:"True Strength Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#E91E63"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:0}],inputs:{in_0:25,in_1:13,in_2:13}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],styles:{plot_0:{title:"True Strength Index",histogramBase:0,joinPoints:!1,zorder:1.1},plot_1:{title:"Signal",histogramBase:0,joinPoints:!1,zorder:1.11}},description:"True Strength Index",shortDescription:"True Strength Index",is_price_study:!1,bands:[{id:"hline_0",name:"Zero",zorder:-1}],inputs:[{id:"in_0",name:"long",defval:25,type:"integer",min:1,max:4999},{id:"in_1",name:"short",defval:13,type:"integer",min:1,max:4999},{id:"in_2",name:"siglen",defval:13,type:"integer",min:1,max:4999,hideWhenPlotsHidden:["plot_1"]}],id:"True Strength Indicator@tv-basicstudies-1",scriptIdPart:"",name:"True Strength Index",format:{precision:4,type:"price"},usePlotsZOrder:!0},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=this._input(2);this._context.setMinimumAdditionalDepth(this._input(0)+this._input(1)+this._input(2));var o=r.close(this._context),a=this._context.new_var(o),l=r.tsi(a,s,i,this._context),c=this._context.new_var(l) +;return[l,r.ema(c,n,this._context)]}}},{name:"Trend Strength Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!1,id:"Trend Strength Index@tv-basicstudies-1",scriptIdPart:"",name:"Trend Strength Index",description:"Trend Strength Index",shortDescription:"Trend Strength Index",plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:c}},inputs:{periods:14}},styles:{plot_0:{title:"Plot",histogramBase:0}},inputs:[{id:"periods",type:"integer",name:"Periods"}],format:{type:"inherit"}},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,this.period=this._input(0),this.invertedPeriod=1/this.period,this.sumX=(this.period-1)*this.period/2,this.sumXX=(this.period-1)*this.period*(2*this.period-1)/6,this.invertedPeriodSumXSumX=this.invertedPeriod*this.sumX*this.sumX},this.trendStrengthIndex=function(){for(var e=this._context.new_var(r.close(this._context)),t=r.sum(e,this.period,this._context),i=0,s=0,n=0;n0?1:-1:a/(l=Math.sqrt(l))},this.main=function(e,t){return this._context=e,this._input=t,[this.trendStrengthIndex()]}}},{name:"Typical Price",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,id:"TypicalPrice@tv-basicstudies-1",scriptIdPart:"",name:"Typical Price",description:"Typical Price",shortDescription:"Typical Price",is_price_study:!0,plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:"#FF6D00"}},inputs:{}},styles:{plot_0:{title:"Plot"}},inputs:[],format:{type:"inherit"}},constructor:function(){this.main=function(e,t){return this._context=e,this._input=t,[r.hlc3(this._context)]}}},{name:"Ultimate Oscillator",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:a}},inputs:{in_0:7,in_1:14,in_2:28}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"UO",histogramBase:0,joinPoints:!1,isHidden:!1}},description:"Ultimate Oscillator",shortDescription:"UO",is_price_study:!1,inputs:[{id:"in_0",name:"length7",defval:7,type:"integer",min:1,max:1e12},{id:"in_1",name:"length14",defval:14,type:"integer",min:1,max:1e12},{id:"in_2",name:"length28",defval:28,type:"integer",min:1,max:1e12}],id:"ultimate_oscillator@tv-basicstudies-1",scriptIdPart:"",name:"Ultimate Oscillator",format:{precision:2,type:"price"}},constructor:function(){this.f_0=function(e,t,i){var s=this._context.new_var(e),n=this._context.new_var(t);return[r.sum(s,i,this._context)/r.sum(n,i,this._context)]},this.f_1=function(){ +var e=this._input(0),t=this._input(1),i=this._input(2),s=this._context.new_var(r.close(this._context)),n=r.max(r.high(this._context),s.get(1)),o=this._context.new_var(r.close(this._context)),a=r.min(r.low(this._context),o.get(1)),l=r.close(this._context)-a,c=n-a,h=this.f_0(l,c,e),d=this.f_0(l,c,t),u=this.f_0(l,c,i);return[100*(4*h[0]+2*d[0]+u[0])/7]},this.main=function(e,t){return this._context=e,this._input=t,this.f_1()}}},{name:"Volatility Close-to-Close",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!1,id:"Volatility Close-to-Close@tv-basicstudies-1",scriptIdPart:"",name:"Volatility Close-to-Close",description:"Volatility Close-to-Close",shortDescription:"Volatility Close-to-Close",plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:"#2196F3"}},inputs:{periods:10,daysPerYear:252}},styles:{plot_0:{title:"Plot"}},inputs:[{id:"periods",name:"Periods",type:"integer",defval:10,min:2},{id:"daysPerYear",name:"Days Per Year",type:"integer",defval:252,min:1,max:366}],format:{precision:2,type:"percent"}},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,this.period=this._input(0),this.daysPerYear=this._input(1)},this.stdev=function(e,t,i){var s=this.variance(e,t,i);return r.sqrt(s)},this.variance=function(e,t,i){var s=r.sma(e,t,i);return this.variance2(e,s,t)},this.variance2=function(e,t,i){var s,r,n=0;for(s=0;s0&&(l=.12*this.square(e.get()-s.get(1))/this.marketClosedPercentage+.88*l/(1-this.marketClosedPercentage)),l/=a,l*=this.secondsPerYear;var c=this._context.new_var(l);return 100*Math.sqrt(r.sum(c,this.period,this._context)/this.period)},this.main=function(e,t){return this._context=e,this._input=t,[this.volatilityOHLC()]}}},{name:"Volatility Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!0,id:"Volatility Index@tv-basicstudies-1",scriptIdPart:"",name:"Volatility Index",description:"Volatility Index",shortDescription:"Volatility Index",plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:c}},inputs:{periods:10,atrMult:3,method:"Wilder Smoothing"}},styles:{plot_0:{title:"Plot"}},inputs:[{id:"periods",name:"Periods",type:"integer"},{id:"atrMult",name:"ATR Mult",type:"float"},{id:"method",name:"Method",type:"text",defval:"Exponential",options:["Exponential","Wilder Smoothing"]}],format:{type:"inherit"}},constructor:function(){this.init=function(e,t){this._context=e,this._input=t, +this.period=this._input(0),this.atrMult=this._input(1),this.maMethod=this._input(2),this.nextsar=null,this.position=null,this.sic=null,this.bars=[],this.count=0,this.lastSar=null,this._context.setMinimumAdditionalDepth("Exponential"===this.maMethod?2*this.period+2:this.period)},this.computeATR=function(){var e=r.high(this._context)-r.low(this._context),t=r.high(this._context)-this.bars[this.bars.length-2],i=this.bars[this.bars.length-2]-r.low(this._context);return this.tr=Math.max(e,t,i),"Exponential"===this.maMethod?this.atr=r.ema(this._context.new_var(this.tr),this.period,this._context):this.atr=this.tr/this.period+(1-1/this.period)*this.atr,this.atr*this.atrMult},this.calculateVolatility=function(){if(r.close(this._context)===this.bars[this.bars.length-1])return this.lastSar;if(this.bars.push(r.close(this._context)),1===this.count)this.atr=r.high(this._context)-r.low(this._context),this.sic=r.close(this._context);else if(this.countthis.sic&&(this.sic=r.close(this._context))}else if(this.count===this.period){e=r.high(this._context)-r.low(this._context),t=r.high(this._context)-this.bars[this.bars.length-2],i=this.bars[this.bars.length-2]-r.low(this._context);this.atr+=Math.max(e,t,i),this.atr*=1/this.period,r.close(this._context)>this.sic&&(this.sic=r.close(this._context)),this.position="LONG",this.nextsar=this.sic-this.atr*this.atrMult}else{var s=this.nextsar;"LONG"===this.position?r.close(this._context)s?(this.position="LONG",this.sic=r.close(this._context),this.nextsar=this.sic-this.computeATR()):(this.position="SHORT",this.sic=Math.min(r.close(this._context),this.sic),this.nextsar=this.sic+this.computeATR())),this.lastSar=s}return this.count++,s},this.main=function(e,t){return this._context=e,this._input=t,this._context.select_sym(0),[this.calculateVolatility()]}}},{name:"VWAP",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{inputs:{in_0:"hlc3",in_anchor:"Session"},styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:0,transparency:0,visible:!0,color:"#2196F3"}}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"VWAP",histogramBase:0,joinPoints:!1,isHidden:!1}},description:"VWAP",shortDescription:"VWAP",is_price_study:!0,inputs:[{id:"in_0",name:"Source",defval:"hlc3",type:"source",options:["open","high","low","close","hl2","hlc3","ohlc4"]},{id:"in_anchor",name:"Anchor Period",defval:"Session",type:"text",options:["Session","Week","Month","Quarter","Year","Decade","Century"]}],id:"VWAP@tv-basicstudies-1",scriptIdPart:"",name:"VWAP",format:{type:"inherit"}},constructor:function(){ +this.f_1=function(e){e.reset_hist()},this.createAnchorChecker=function(e,t){switch(t){case"Week":return function(t,i){return r.weekofyear(e,t)!==r.weekofyear(e,i)||r.year(e,t)!==r.year(e,i)};case"Month":return function(t,i){return r.month(e,t)!==r.month(e,i)||r.year(e,t)!==r.year(e,i)};case"Quarter":return function(t,i){return Math.floor(r.month(e,t)/3)!==Math.floor(r.month(e,i)/3)||r.year(e,t)!==r.year(e,i)};case"Year":return function(t,i){return r.year(e,t)!==r.year(e,i)};case"Decade":return function(t,i){return Math.floor(r.year(e,t)/10)!==Math.floor(r.year(e,i)/10)};case"Century":return function(t,i){return Math.floor(r.year(e,t)/100)!==Math.floor(r.year(e,i)/100)};default:return e=>this._isFirstBarInSession(e)}},this.init=function(e,t){this._input=t,this._isFirstBarInSession=null;const i=this._input(1)||"Session";this._anchorChecker=this.createAnchorChecker(e,i)},this.main=function(e,t){this._context=e,this._input=t;const i=this._input(0);var s=e.new_var(),n=e.new_var(),o=e.new_var();const a=r.time(this._context),l=this._context.new_unlimited_var(a).get(1);if(a){if(null===this._isFirstBarInSession){const t=r.createNthBarInSessionCheck(e);this._isFirstBarInSession=e=>t(e,0)}this._anchorChecker(a,l)&&(this.f_1(s),this.f_1(n),o.set(a))}return s.set(r.nz(s.get(1))+r[i](this._context)*r.volume(this._context)),n.set(r.nz(n.get(1))+r.volume(this._context)),r.na(o.get(0))?[NaN]:[s.get(0)/n.get(0)]}}},{name:"VWMA",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:20}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"VWMA",shortDescription:"VWMA",is_price_study:!0,inputs:[{id:"in_0",name:"len",defval:20,type:"integer",min:1,max:1e4}],id:"VWMA@tv-basicstudies-1",scriptIdPart:"",name:"VWMA",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=r.close(this._context),s=this._input(0),n=this._context.new_var(i);return[r.vwma(n,s,this._context)]}}},{name:"Volume Oscillator",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:0}],inputs:{in_0:5,in_1:10}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,zorder:1}},description:"Volume Oscillator",shortDescription:"Volume Osc",is_price_study:!1,bands:[{id:"hline_0",name:"Zero",zorder:-1}],inputs:[{id:"in_0",name:"shortlen",defval:5,type:"integer",min:1,max:4999},{id:"in_1",name:"longlen",defval:10,type:"integer",min:1,max:4999}],id:"Volume Oscillator@tv-basicstudies-1",scriptIdPart:"",name:"Volume Oscillator",format:{precision:2,type:"percent"},usePlotsZOrder:!0},constructor:function(){this.f_0=function(e,t){return 100*(e-t)/t},this.main=function(e,t){ +this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=r.volume(this._context),o=this._context.new_var(n),a=r.ema(o,i,this._context),l=this._context.new_var(n),c=r.ema(l,s,this._context);return[this.f_0(a,c)]}}},{name:"Vortex Indicator",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#E91E63"}},inputs:{in_0:14}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],styles:{plot_0:{title:"VI +",histogramBase:0,joinPoints:!1,isHidden:!1},plot_1:{title:"VI -",histogramBase:0,joinPoints:!1,isHidden:!1}},description:"Vortex Indicator",shortDescription:"VI",is_price_study:!1,is_hidden_study:!1,id:"vortex_indicator@tv-basicstudies-1",inputs:[{id:"in_0",name:"Period",defval:14,type:"integer",min:2,max:1e12}],scriptIdPart:"",name:"Vortex Indicator",format:{precision:4,type:"price"}},constructor:function(){this.f_0=function(){var e=this._input(0),t=this._context.new_var(r.low(this._context)),i=this._context.new_var(r.abs(r.high(this._context)-t.get(1))),s=r.sum(i,e,this._context),n=this._context.new_var(r.high(this._context)),o=this._context.new_var(r.abs(r.low(this._context)-n.get(1))),a=r.sum(o,e,this._context),l=this._context.new_var(r.atr(1,this._context)),c=r.sum(l,e,this._context);return[s/c,a/c]},this.main=function(e,t){return this._context=e,this._input=t,this.f_0()}}},{name:"Willams %R",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#7E57C2"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:-20},{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:-80}],filledAreasStyle:{fill_0:{color:"#7E57C2",transparency:90,visible:!0}},inputs:{in_0:14}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,zorder:1}},description:"Williams %R",shortDescription:"%R",is_price_study:!1,bands:[{id:"hline_0",name:"UpperLimit",zorder:-1.1},{id:"hline_1",name:"LowerLimit",zorder:-1.11}],filledAreas:[{id:"fill_0",objAId:"hline_0",objBId:"hline_1",type:"hline_hline",title:"Hlines Background",zorder:-2}],inputs:[{id:"in_0",name:"length",defval:14,type:"integer",min:1,max:2e3}],id:"Willams %R@tv-basicstudies-1",scriptIdPart:"",name:"Willams %R",format:{precision:2,type:"price"},usePlotsZOrder:!0},constructor:function(){this.f_0=function(e,t,i){return 100*(e-t)/(t-i)},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=r.high(this._context),n=this._context.new_var(s),o=r.highest(n,i,this._context),a=r.low(this._context),l=this._context.new_var(a),c=r.lowest(l,i,this._context);return[this.f_0(r.close(this._context),o,c)]}}},{name:"Williams Alligator",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1, +plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#E91E63"},plot_2:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#66BB6A"}},inputs:{in_0:21,in_1:13,in_2:8,in_3:8,in_4:5,in_5:3}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"}],styles:{plot_0:{title:"Jaw",histogramBase:0,joinPoints:!1},plot_1:{title:"Teeth",histogramBase:0,joinPoints:!1},plot_2:{title:"Lips",histogramBase:0,joinPoints:!1}},description:"Williams Alligator",shortDescription:"Alligator",is_price_study:!0,inputs:[{id:"in_0",name:"Jaw Length",defval:21,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["plot_0"]},{id:"in_1",name:"Teeth Length",defval:13,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["plot_1"]},{id:"in_2",name:"Lips Length",defval:8,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["plot_2"]},{id:"in_3",name:"Jaw Offset",defval:8,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["plot_0"]},{id:"in_4",name:"Teeth Offset",defval:5,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["plot_1"]},{id:"in_5",name:"Lips Offset",defval:3,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["plot_2"]}],id:"Williams Alligator@tv-basicstudies-1",scriptIdPart:"",name:"Williams Alligator",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=this._input(2),o=this._input(3),a=this._input(4),l=this._input(5),c=r.hl2(this._context);return[{value:r.smma(c,i,this._context),offset:o},{value:r.smma(c,s,this._context),offset:a},{value:r.smma(c,n,this._context),offset:l}]}}},{name:"Williams Fractals",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,defaults:{styles:{plot_0:{plottype:"shape_triangle_down",visible:!0,location:"BelowBar",transparency:0,color:a},plot_1:{plottype:"shape_triangle_up",visible:!0,location:"AboveBar",transparency:0,color:u}},inputs:{in_0:2}},plots:[{id:"plot_0",type:"shapes"},{id:"plot_1",type:"shapes"}],styles:{plot_0:{title:"Down fractals",isHidden:!1},plot_1:{title:"Up fractals",isHidden:!1}},description:"Williams Fractal",shortDescription:"Fractals",is_price_study:!0,is_hidden_study:!1,id:"Williams Fractals@tv-basicstudies-1",inputs:[{id:"in_0",name:"Periods",defval:2,type:"integer",min:2,max:1e12}],scriptIdPart:"",name:"Williams Fractals",isCustomIndicator:!0,format:{type:"inherit"}},constructor:function(){this.f_0=function(){for(var e=this._input(0),t=this._context.new_var(r.high(this._context)),i=!0,s=!0,n=!0,o=!0,a=!0,l=!0,c=1;c<=e;c++)i=r.and(i,r.lt(t.get(e-c),t.get(e))),s=r.and(s,r.lt(t.get(e+c),t.get(e))),n=r.and(n,r.and(r.le(t.get(e+1),t.get(e)),r.lt(t.get(e+c+1),t.get(e)))),o=r.and(o,r.and(r.le(t.get(e+1),t.get(e)),r.and(r.le(t.get(e+2),t.get(e)),r.lt(t.get(e+c+2),t.get(e))))),a=r.and(a,r.and(r.le(t.get(e+1),t.get(e)),r.and(r.le(t.get(e+2),t.get(e)),r.and(r.le(t.get(e+3),t.get(e)),r.lt(t.get(e+c+3),t.get(e)))))), +l=r.and(l,r.and(r.le(t.get(e+1),t.get(e)),r.and(r.le(t.get(e+2),t.get(e)),r.and(r.le(t.get(e+3),t.get(e)),r.and(r.le(t.get(e+4),t.get(e)),r.lt(t.get(e+c+4),t.get(e)))))));var h=r.or(s,r.or(n,r.or(o,r.or(a,l)))),d=r.and(i,h),u=this._context.new_var(r.low(this._context)),p=1,_=1,m=1,g=1,f=1,v=1;for(c=1;c<=e;c++)p=r.and(p,r.gt(u.get(e-c),u.get(e))),_=r.and(_,r.gt(u.get(e+c),u.get(e))),m=r.and(m,r.and(r.ge(u.get(e+1),u.get(e)),r.gt(u.get(e+c+1),u.get(e)))),g=r.and(g,r.and(r.ge(u.get(e+1),u.get(e)),r.and(r.ge(u.get(e+2),u.get(e)),r.gt(u.get(e+c+2),u.get(e))))),f=r.and(f,r.and(r.ge(u.get(e+1),u.get(e)),r.and(r.ge(u.get(e+2),u.get(e)),r.and(r.ge(u.get(e+3),u.get(e)),r.gt(u.get(e+c+3),u.get(e)))))),v=r.and(v,r.and(r.ge(u.get(e+1),u.get(e)),r.and(r.ge(u.get(e+2),u.get(e)),r.and(r.ge(u.get(e+3),u.get(e)),r.and(r.ge(u.get(e+4),u.get(e)),r.gt(u.get(e+c+4),u.get(e)))))));var y=r.or(_,r.or(m,r.or(g,r.or(f,v))));return[r.and(p,y),d]},this.main=function(e,t){this._context=e,this._input=t;var i=this.f_0();return[{value:i[0],offset:-this._input(0)},{value:i[1],offset:-this._input(0)}]}}},{name:"Guppy Multiple Moving Average",metainfo:{isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,description:"Guppy Multiple Moving Average",shortDescription:"GMMA",is_price_study:!0,id:"Guppy Multiple Moving Average@tv-basicstudies-1",_metainfoVersion:52,format:{type:"inherit"},defaults:{inputs:{traderEMA1Length:3,traderEMA2Length:5,traderEMA3Length:8,traderEMA4Length:10,traderEMA5Length:12,traderEMA6Length:15,investorEMA1Length:30,investorEMA2Length:35,investorEMA3Length:40,investorEMA4Length:45,investorEMA5Length:50,investorEMA6Length:60},styles:{traderEMA1:{color:"#00FFFF",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:15,visible:!0},traderEMA2:{color:"#00FFFF",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:12,visible:!0},traderEMA3:{color:"#00FFFF",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:9,visible:!0},traderEMA4:{color:"#00FFFF",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:6,visible:!0},traderEMA5:{color:"#00FFFF",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:3,visible:!0},traderEMA6:{color:"#00FFFF",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0},investorEMA1:{color:"#FF0000",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:15,visible:!0},investorEMA2:{color:"#FF0000",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:12,visible:!0},investorEMA3:{color:"#FF0000",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:9,visible:!0},investorEMA4:{color:"#FF0000",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:6,visible:!0},investorEMA5:{color:"#FF0000",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:3,visible:!0},investorEMA6:{color:"#FF0000",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0}}},inputs:[{defval:3,id:"traderEMA1Length",max:1e3,min:1,name:"Trader EMA 1 length",type:"integer",hideWhenPlotsHidden:["traderEMA1"]},{defval:5, +id:"traderEMA2Length",max:1e3,min:1,name:"Trader EMA 2 length",type:"integer",hideWhenPlotsHidden:["traderEMA2"]},{defval:8,id:"traderEMA3Length",max:1e3,min:1,name:"Trader EMA 3 length",type:"integer",hideWhenPlotsHidden:["traderEMA3"]},{defval:10,id:"traderEMA4Length",max:1e3,min:1,name:"Trader EMA 4 length",type:"integer",hideWhenPlotsHidden:["traderEMA4"]},{defval:12,id:"traderEMA5Length",max:1e3,min:1,name:"Trader EMA 5 length",type:"integer",hideWhenPlotsHidden:["traderEMA5"]},{defval:15,id:"traderEMA6Length",max:1e3,min:1,name:"Trader EMA 6 length",type:"integer",hideWhenPlotsHidden:["traderEMA6"]},{defval:30,id:"investorEMA1Length",max:1e3,min:1,name:"Investor EMA 1 length",type:"integer",hideWhenPlotsHidden:["investorEMA1"]},{defval:35,id:"investorEMA2Length",max:1e3,min:1,name:"Investor EMA 2 length",type:"integer",hideWhenPlotsHidden:["investorEMA2"]},{defval:40,id:"investorEMA3Length",max:1e3,min:1,name:"Investor EMA 3 length",type:"integer",hideWhenPlotsHidden:["investorEMA3"]},{defval:45,id:"investorEMA4Length",max:1e3,min:1,name:"Investor EMA 4 length",type:"integer",hideWhenPlotsHidden:["investorEMA4"]},{defval:50,id:"investorEMA5Length",max:1e3,min:1,name:"Investor EMA 5 length",type:"integer",hideWhenPlotsHidden:["investorEMA5"]},{defval:60,id:"investorEMA6Length",max:1e3,min:1,name:"Investor EMA 6 length",type:"integer",hideWhenPlotsHidden:["investorEMA6"]}],plots:[{id:"traderEMA1",type:"line"},{id:"traderEMA2",type:"line"},{id:"traderEMA3",type:"line"},{id:"traderEMA4",type:"line"},{id:"traderEMA5",type:"line"},{id:"traderEMA6",type:"line"},{id:"investorEMA1",type:"line"},{id:"investorEMA2",type:"line"},{id:"investorEMA3",type:"line"},{id:"investorEMA4",type:"line"},{id:"investorEMA5",type:"line"},{id:"investorEMA6",type:"line"}],styles:{traderEMA1:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Trader EMA 1"},traderEMA2:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Trader EMA 2"},traderEMA3:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Trader EMA 3"},traderEMA4:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Trader EMA 4"},traderEMA5:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Trader EMA 5"},traderEMA6:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Trader EMA 6"},investorEMA1:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Investor EMA 1"},investorEMA2:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Investor EMA 2"},investorEMA3:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Investor EMA 3"},investorEMA4:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Investor EMA 4"},investorEMA5:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Investor EMA 5"},investorEMA6:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Investor EMA 6"}}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t +;var i=this._context.new_var(r.close(this._context)),s=this._input(0),n=this._input(1),o=this._input(2),a=this._input(3),l=this._input(4),c=this._input(5),h=r.ema(i,s,this._context),d=r.ema(i,n,this._context),u=r.ema(i,o,this._context),p=r.ema(i,a,this._context),_=r.ema(i,l,this._context),m=r.ema(i,c,this._context),g=this._input(6),f=this._input(7),v=this._input(8),y=this._input(9),S=this._input(10),b=this._input(11);return[h,d,u,p,_,m,r.ema(i,g,this._context),r.ema(i,f,this._context),r.ema(i,v,this._context),r.ema(i,y,this._context),r.ema(i,S,this._context),r.ema(i,b,this._context)]}}},{name:"52 Week High/Low",metainfo:{_metainfoVersion:52,id:"52 Week High/Low@tv-basicstudies-1",description:"52 Week High/Low",shortDescription:"52W H/L",is_price_study:!0,format:{type:"inherit"},plots:[],graphics:{horizlines:{highest:{name:"Highest"},lowest:{name:"Lowest"}}},inputs:[{defval:"close",id:"highestSource",name:"High source",options:["close","high"],type:"text"},{defval:"close",id:"lowestSource",name:"Low source",options:["close","low"],type:"text"}],defaults:{graphics:{horizlines:{highest:{color:"rgb(93, 96, 107)",showPrice:!0,style:1,visible:!0,width:2},lowest:{color:"rgb(93, 96, 107)",showPrice:!0,style:1,visible:!0,width:2}}},inputs:{highestSource:"close",lowestSource:"close"}}},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,this._symbolSupports1DResolution=!this._context.symbol.info.supported_resolutions||-1!==this._context.symbol.info.supported_resolutions.indexOf("1D"),this._symbolSupports1DResolution&&"1D"!==r.period(this._context)&&this._context.new_sym(this._context.symbol.ticker,"1D")},this.main=function(e,t){this._symbolSupports1DResolution||r.error(`Daily bars are not available for ${this._context.symbol.info.name}`),this._context=e,this._input=t,"1D"!==r.period(this._context)&&this._context.select_sym(1);const i=this._input(0),s=this._input(1),n=r.time(this._context),o=this._context.new_unlimited_var(n),a=this._context.new_unlimited_var(r[i](this._context)),l=this._context.new_unlimited_var(r[s](this._context));if(o.get(365),!this._context.symbol.isLastBar||!this._context.symbol.isNewBar)return null;const c=r.add_years_considering_dst(this._context.symbol.info.timezone,new Date(n),-1),h=o.indexOf(c.getTime()),d=-1===h?NaN:r.highest(a,h,this._context),u=-1===h?NaN:r.lowest(l,h,this._context);if(isNaN(d)||isNaN(u))return{nonseries:!0,type:"study_graphics",data:{graphicsCmds:{erase:[{action:"all"}]}}};return{nonseries:!0,type:"study_graphics",data:{graphicsCmds:{create:{horizlines:[{styleId:"highest",data:[{startIndex:n,endIndex:n,level:d,extendLeft:!0,extendRight:!0}]},{styleId:"lowest",data:[{startIndex:n,endIndex:n,level:u,extendLeft:!0,extendRight:!0}]}]},erase:[{action:"all"}]}}}}}}]},66846:(e,t,i)=>{"use strict";var s;i.d(t,{SubsessionId:()=>s}),function(e){e.Regular="regular",e.Extended="extended",e.PreMarket="premarket",e.PostMarket="postmarket"}(s||(s={}))},34108:(e,t,i)=>{"use strict";i.d(t,{PointsetsManager:()=>n});var s=i(36274);const r=(0, +i(59224).getLogger)("ChartApi.PointsetsManager");class n{constructor(){this._pointsetsDataBySymbol=new Map}destroy(){this._pointsetsDataBySymbol.clear()}createPointset(e,t,i,s,n){let o=this._pointsetsDataBySymbol.get(t);void 0===o&&(o=new Map,this._pointsetsDataBySymbol.set(t,o));const a=[];for(const t of s){const[i,s]=t;"number"!=typeof i||Number.isNaN(i)?r.logWarn(`Pointset time is invalid: id=${e}, ${i} of type ${typeof i}`):a.push({point:t,extrapolation:n.extrapolateTimeWithOffsetToTime(1e3*i,s)})}s.length===a.length&&o.set(e,{resolution:i,points:a})}removePointset(e){const t=[];this._pointsetsDataBySymbol.forEach(((i,s)=>{i.delete(e),0===i.size&&t.push(s)}));for(const e of t)this._pointsetsDataBySymbol.delete(e)}invalidatePointsetsForSymbol(e,t){const i=this._pointsetsDataBySymbol.get(e);void 0!==i&&i.forEach(((e,i)=>{if(s.Interval.isEqual(e.resolution,t))for(const t of e.points)null!==t.extrapolation&&t.extrapolation.exact&&(t.extrapolation.exact=!1)}))}getUpdatesForSymbol(e,t,i,s){const r=new Map,n=this._pointsetsDataBySymbol.get(e);return void 0!==n&&n.forEach(((e,n)=>{const o=this._refreshPointsetData(e,t,i,s);null!==o&&r.set(n,o)})),r}_refreshPointsetData(e,t,i,n){if(s.Interval.isEqual(e.resolution,t))for(let t=0;t ${t}`),null;o.push({index:i,value:[a.index,a.timeMs/1e3]})}return o}}},21125:(e,t,i)=>{"use strict";i.d(t,{SessionTimeScale:()=>v});var s=i(50151),r=i(14483),n=i(41249),o=i(78071),a=i(77475),l=i(61401),c=i(13041);function h(e){return 60*e*60*1e3}function d(e){return 60*e*1e3}const u=[{divisor:1,weight:18},{divisor:(p=1,1e3*p),weight:19},{divisor:d(1),weight:20},{divisor:d(5),weight:21},{divisor:d(30),weight:22},{divisor:h(1),weight:30},{divisor:h(3),weight:31},{divisor:h(6),weight:32},{divisor:h(12),weight:33}];var p;function _(e,t){if(null!==t){if(e.getUTCFullYear()!==t.getUTCFullYear())return 70;if(e.getUTCMonth()!==t.getUTCMonth())return 60;if(e.getUTCDate()!==t.getUTCDate())return 50;const i=t.getTime(),s=e.getTime();for(let e=u.length-1;e>=0;--e)if(Math.floor(i/u[e].divisor)!==Math.floor(s/u[e].divisor))return u[e].weight}return 18}function m(e,t,i=0){if(0===e.length)return[];let s=i,r=i;const n=[];for(;s=t.length?(n.push({old:s,new:l.INVALID_TIME_POINT_INDEX}),s++):e[s].timeMs===t[r].timeMs?(s!==r&&n.push({old:s,new:r}),s++,r++):e[s].timeMs{if(e.new===t.new&&e.new===l.INVALID_TIME_POINT_INDEX)return e.old-t.old;if(e.new===l.INVALID_TIME_POINT_INDEX)return-1;if(t.new===l.INVALID_TIME_POINT_INDEX)return 1;const i=e.old-e.new,s=t.old-t.new +;return i>0?s>0?e.old-t.old:-1:s<0?t.new-e.new:1}))}function g(e,t){return{span:e.markWeight,time:e.displayTime,index:t}}const f=r.enabled("end_of_period_timescale_marks");class v{constructor(){this._completed=!0,this._mainSymbolExtrapolator=null,this._pointDataByTimePoint=new Map,this._instanceIds=new Set,this._displayTimezone=null,this._minFutureBarsCount=0,this._sortedTimePoints=[]}destroy(){this.clearTimeScale()}setCompleted(e){this._completed=e}isCompleted(){return this._completed}clearTimeScale(){return this._pointDataByTimePoint.clear(),this._instanceIds.clear(),this._sortedTimePoints=[],{baseIndex:null,pointsIndex:0,indexChange:[],marks:[],points:[]}}indexOfTime(e){if(0===this._sortedTimePoints.length)return null===this._mainSymbolExtrapolator?null:this._mainSymbolExtrapolator.indexOfTime(e);if(ethis._sortedTimePoints[this._sortedTimePoints.length-1].timeMs){if(null===this._mainSymbolExtrapolator)return null;const t=this._mainSymbolExtrapolator.indexOfTime(e),i=this._mainSymbolExtrapolator.indexOfTime(this._sortedTimePoints[this._sortedTimePoints.length-1].timeMs);if(null===t||null===i)return null;const s=t.index-i.index-1;return{index:this._sortedTimePoints.length+s,timeMs:t.timeMs}}let t=(0,o.lowerbound)(this._sortedTimePoints,e,((e,t)=>e.timeMs({timeMs:e,markWeight:0,displayTime:NaN})));this._fillPointsData(i,0,0!==this._sortedTimePoints.length?this._sortedTimePoints[this._sortedTimePoints.length-1].displayTime:null);const r=[];for(let t=e;tg(e,i+t)));return r.concat(n)}setTimezone(e){this._displayTimezone="exchange"===e?null:(0,n.get_timezone)(e),this._fillPointsData(this._sortedTimePoints,0)}fillIndexesInRows(e){if(0===e.length)return;let t=-1,i=(0,o.lowerbound)(this._sortedTimePoints,Math.round(1e3*e[0].value[0]),((e,t)=>e.timeMse.timeMs{for(;i=this._sortedTimePoints.length){const t=this.indexOfTime(e);if(null===t)return l.INVALID_TIME_POINT_INDEX;i=t.timeMs!==e?t.index+1:t.index}return(0,s.assert)(i>t,"data must have unique sorted times"),t=i,i}))}firstSeriesBarTime(){return 0===this._sortedTimePoints.length?null:this._sortedTimePoints[0].timeMs}replaceBarsTimesTail(e,t){if(0===t.length)return null;if(!this._instanceIds.has(e))return this.setSeriesBarsTimes(e,t);const i=[],s=(0,o.lowerbound)(this._sortedTimePoints,t[0],((e,t)=>e.timeMs({timeMs:e.timeMs,pointData:e.pointData,markWeight:0,displayTime:NaN})));for(let e=s;ee.timeMs-t.timeMs));const a=this._updateTimeScalePointsTail(n);return this._applyTimeScaleChanges(a,!1)}setSeriesBarsTimes(e,t){return this._setBarsTimes(e,t)}setStudyBarsTimes(e,t){return this._setBarsTimes(e,t)}_setBarsTimes(e,t){const i=0!==this._pointDataByTimePoint.size;if(this._instanceIds.has(e))for(const t of this._sortedTimePoints)t.pointData.instances.delete(e);0===t.length?this._instanceIds.delete(e):this._instanceIds.add(e),this._addBarsTimesToInstance(e,t,!1),i&&this._cleanupPointsData(this._sortedTimePoints);const s=[];this._pointDataByTimePoint.forEach(((e,t)=>{s.push({markWeight:0,timeMs:t,displayTime:NaN,pointData:e})})),s.sort(((e,t)=>e.timeMs-t.timeMs));const r=this._updateTimeScalePoints(s);return this._applyTimeScaleChanges(r,!1)}_updateFutureBars(){if(0===this._minFutureBarsCount||null===this._mainSymbolExtrapolator)return;if(0!==this._sortedTimePoints.length){const e=this._sortedTimePoints[this._sortedTimePoints.length-1].timeMs;this._mainSymbolExtrapolator.ensureExtrapolatedToFutureTime(e)}const e=this._futureBarsFirstPointIndex();this._mainSymbolExtrapolator.setMinFutureBarsCount(e+this._minFutureBarsCount)}_addBarsTimesToInstance(e,t,i){const s=i?[]:null;for(const i of t){const t=this._pointDataByTimePoint.get(i);if(void 0===t){const t=new Set;t.add(e);const r={index:0,instances:t};this._pointDataByTimePoint.set(i,r),null!==s&&s.push({timeMs:i,pointData:r})}else t.instances.add(e)}return s}_futureBarsFirstPointIndex(){ +if(null===this._mainSymbolExtrapolator||0===this._sortedTimePoints.length)return 0;const e=this._mainSymbolExtrapolator.futureBars();return(0,o.upperbound_int)(e,this._sortedTimePoints[this._sortedTimePoints.length-1].timeMs)}_futureBars(){return null===this._mainSymbolExtrapolator?[]:this._mainSymbolExtrapolator.futureBars().slice(this._futureBarsFirstPointIndex(),this._futureBarsFirstPointIndex()+1e3)}_cleanupPointsData(e){for(const t of e)0===t.pointData.instances.size&&this._pointDataByTimePoint.delete(t.timeMs)}_updateTimeScalePoints(e){let t=-1;for(let i=0;ie.timeMs=this._sortedTimePoints.length)continue;this._sortedTimePoints[n].timeMs!==r.timeMs&&-1===i&&(i=n)}const s=t+e.length;if(i=y(i,this._sortedTimePoints.length,s),-1===i)return null;this._fillPointsData(e,0,0===t||0===this._sortedTimePoints.length?null:this._sortedTimePoints[t-1].displayTime);const r=m(this._sortedTimePoints.slice(t),e).map((e=>({old:e.old+t,new:e.new===l.INVALID_TIME_POINT_INDEX?e.new:e.new+t})));{const i=this._sortedTimePoints;let r=0;for(;t+r1&&null===i){const t=Math.ceil(n/(e.length-1)),i=new Date(1e3*(e[0].displayTime-t));e[0].markWeight=_(new Date(1e3*e[0].displayTime),i)}}(e,t,i)}_applyTimeScaleChanges(e,t){if(null===e)return t?(this._fillPointsData(this._sortedTimePoints,0),{points:[],pointsIndex:0,baseIndex:this._getBaseIndex(),indexChange:[],marks:this.tickMarks(0)}):null;let i=e.pointsIndex;if(0!==i&&t&&(this._fillPointsData(this._sortedTimePoints,0),i=0),0===this._sortedTimePoints.length)return{baseIndex:null,pointsIndex:0,indexChange:[],marks:[],points:[]};const s=[];for(let t=e.pointsIndex;t{"use strict";var s=i(3035),r=i(43910).StudyEngine,n=i(2543).OHLCV,o=i(55137),a=i(76537).SymbolExtrapolator,l=i(21125).SessionTimeScale,c=i(34108).PointsetsManager,h=i(60156),d=i(77475).createDwmAligner,u=i(36274).Interval,p=i(76422),_=i(2663).visitObject,m=i(1722).isObject;i(24172),i(60325);var g=i(79850).DatafeedRequestsCachedProcessor,f=i(38618).timezoneIsAvailable,v=i(77475).isAlignmentEnabled,y=i(27856),S=y.isEncodedExtendedSymbol,b=y.decodeExtendedSymbol,w=i(42960).extractSymbolNameFromSymbolInfo,C=i(48739).replaceGraphicsTimesWithTimePointIndexIndex,P=i(14483),x=i(66846).SubsessionId,T=i(60156).getPeriodsBetweenDates,I=i(40367).overwriteVolumeProfileResolutionForPeriodGetter;const M="pre_post_market_sessions",A=P.enabled(M);function L(e,t,i,s){return[e,t,i,s].filter((e=>!!e)).join("|")}var k=-5e6;function D(e){var t=e.findIndex((function(e){return e.index!==k}));return-1===t?[]:0===t?e:e.slice(t)}function E(e,t,i){if(e){if("string"==typeof e)return void console.warn("`logo_urls` should be an array of urls, not a string.");const[t,s]=e;s?(i["base-currency-logoid"]=t,i["currency-logoid"]=s):i.logoid=e}t&&(i.provider_id=t)}function V(e,t){return e+"_"+t}function B(e){if(null===e||"number"==typeof e)return e;if("object"==typeof e&&Array.isArray(e)){switch(e[0]){case"bar_count":return e[2];case"from_to":return e.length>=3?e[2]:null}}return null}function R(e){const t=b(e),i="string"==typeof t.symbol?t:t.symbol;return[i.symbol,{currency:i["currency-id"],unit:i["unit-id"],session:i.session===x.Regular?void 0:i.session}]}var N=function(e){var t=this;this._studiesCache={},this._objectsDataCache={},this._studiesNonSeriesTimes={},this._metainfoCache=[],this._barsCoefficientsCache={},this._externalDatafeed=e,e.getVolumeProfileResolutionForPeriod&&I((function(t,i,s,r){return e.getVolumeProfileResolutionForPeriod(t,i,s,r)})),this._datafeedConfiguration=null,this._marketStatusWatchers={},this._resolveRequests={},this._resolvePromisesBySymbolId=new Map,this._symbolIdToSymbolRequestString=new Map,this._callbacks={},this._serverTimeOffset=0,t._logMessage("Datafeed settings received: {0}".format(JSON.stringify(window.configurationData))),t._datafeedConfiguration=t._adoptConfigurationData(window.configurationData), +t._fireEvent("configuration_received"),t._externalDatafeed.getServerTime&&t._externalDatafeed.getServerTime((function(e){t._serverTimeOffset=e-(new Date).valueOf()/1e3})),this._invalidatedPointsetSessions=new Set,this._refreshPointsetsTimerId=null,this._pointsetsManagers={},this._quotesInfo=[],this._depthInfo=[],this._endOfData={},this._computeStudyCounter=0,this._symbolExtrapolators={},this._timeScales={},this._cachedDatafeed=new g(e,this.serverTimeOffset.bind(this),this._datafeedConfiguration.reset_cache_timeout),o.setupFeed({resolve:function(e,i,s,r){t._resolveSymbolByName(e,i,s,r)},subscribe:function(e,i,s,r,n){return t._cachedDatafeed.subscribe(e,i,s,function(e,i,s){var r=new h.SessionInfo(e.timezone,e.session,e.session_holidays,e.corrections),n=h.newBarBuilder(i,r,r);return function(e){if(e&&e.count()){var i=1e3*t.getCurrentUTCTime();n.moveTo(i),n.indexOfBar(i)>=0&&e.setLastBarClosed(!1)}s(e)}}(e,i,r),n)},unsubscribe:function(e){return t._cachedDatafeed.unsubscribe(e)}})};function O(e,t){return e+"_"+t}function F(e,t,i,s){return e+(t?"_#_"+t:"")+(i?"_#_"+i:"")+(s?"_#_"+s:"")}N.prototype._getSymbolExtrapolator=function(e,t,i){var s=u.normalize(i),r=function(e,t,i){const s=void 0!==t.subsession_id?","+t.subsession_id:"";return e+","+t.full_name+","+i+s}(e,t,s),n=this._symbolExtrapolators[r];return void 0===n&&(n=new a(t,s),this._symbolExtrapolators[r]=n),n},N.prototype._barsCoefficients=function(e,t){if(void 0===b(e).type)return{};var i=e+t;return this._barsCoefficientsCache[i]||(this._barsCoefficientsCache[i]={}),this._barsCoefficientsCache[i]},N.prototype.destroy=function(){this._cachedDatafeed.destroy(),this._externalDatafeed=null,Object.keys(this._pointsetsManagers).forEach((function(e){this._pointsetsManagers[e].destroy()}),this),this._pointsetsManagers={}},N.prototype.purgeCache=function(){this._endOfData={},this._resolveRequests={},this._objectsDataCache={},this._studiesNonSeriesTimes={},this._studiesCache={},this._resolvePromisesBySymbolId.clear(),this._symbolIdToSymbolRequestString.clear(),Object.keys(this._pointsetsManagers).forEach((function(e){this._pointsetsManagers[e].destroy()}),this),this._pointsetsManagers={},Object.keys(this._timeScales).forEach((function(e){this._timeScales[e].destroy()}),this),this._timeScales={},Object.keys(this._symbolExtrapolators).forEach((function(e){this._symbolExtrapolators[e].destroy()}),this),this._symbolExtrapolators={}},N.prototype.purgeDataCache=function(){this._cachedDatafeed.purgeCache()},N.prototype._logMessage=function(e){P.enabled("charting_library_debug_mode")&&console.log(e)},N.prototype.on=function(e,t){return this._callbacks.hasOwnProperty(e)||(this._callbacks[e]=[]),this._callbacks[e].push(t),this},N.prototype._fireEvent=function(e,t,i){if(this._callbacks.hasOwnProperty(e)){for(var s=this._callbacks[e],r=0;r{this._resolveSymbolImpl(e,(e=>{t(e.price_sources)}),(e=>{i(e)}))}))},N.prototype.supportedSymbolsTypes=function(){return this._datafeedConfiguration.symbols_types||[]},N.prototype.symbolsGrouping=function(){return this._datafeedConfiguration.symbols_grouping||{futures:/$a/}},N.prototype._findStudyObject=function(e){e.endsWith("!")&&(e=e.slice(0,-1));var t=e.split("@")[0],i=JSServer.studyLibrary.filter((function(i){return i.metainfo.id===e||i.metainfo.shortDescription===t}));return 0===i.length?null:i[0]},N.prototype.getMarks=function(e,t,i,s,r){var n={red:6,green:5,blue:4,yellow:3};if(this._externalDatafeed.getMarks&&this._datafeedConfiguration.supports_marks){this._logMessage("Requesting bars marks: symbol {0}, resolution {1}, range [{2} ... {3}]".format(e.full_name,r,new Date(1e3*t).toUTCString(),new Date(1e3*i).toUTCString()));var o=this;this._externalDatafeed.getMarks(e,t,i,(function(t){var i=t.map((function(e){return e.time=parseInt(e.time),e}));o._logMessage("Received bars marks: symbol {0}, resolution {1}, marks {2}".format(e.full_name,r,JSON.stringify(i)));var a=d(r,e),l=P.enabled("two_character_bar_marks_labels"),c=i.map((function(e){return e.tickmark=null!==a?a.timeToSessionStart(1e3*e.time)/1e3:e.time,e.direction=n[e.color],e.onClicked=function(){p.emit("onMarkClick",e.id)},e.label=!!e.label&&(l?e.label.slice(0,2):e.label[0]),e}));s(c)}),r)}},N.prototype.getTimescaleMarks=function(e,t,i,s,r){if(this._externalDatafeed.getTimescaleMarks&&this._datafeedConfiguration.supports_timescale_marks){this._logMessage("Requesting timescale marks: symbol {0}, resolution {1}, range [{2} ... {3}]".format(e.full_name,r,new Date(1e3*t).toUTCString(),new Date(1e3*i).toUTCString()));var n=this;this._externalDatafeed.getTimescaleMarks(e,t,i,(function(t){n._logMessage("Received timescale marks: symbol {0}, resolution {1}, marks {2}".format(e.full_name,r,JSON.stringify(t)));var i=d(r,e),o=t.map((function(e){return e.tickmark=null!==i?i.timeToSessionStart(1e3*e.time)/1e3:e.time,e}));s(o)}),r)}},N.prototype.getSeriesLastBarTime=function(e,t){var i=this._getSeriesData(e,t);return null===i||0===i.length?null:i[i.length-1].timeMs},N.prototype.getSeriesInterval=function(e,t){var i=this._studiesCache[e][t];return i?i.resolution:null},N.prototype.getSeriesSymbolInfo=function(e,t){var i=this._studiesCache[e][t];return i?i.symbolInfo:null},N.prototype._getSeriesData=function(e,t){return this._objectsDataCache[O(e,t)]||null},N.prototype._computeStudy=async function(e,t,i,s,n,o,a,l,c,h){var p=!0,_=[];null!==l&&(this._objectsDataCache[l]=null), +this._timeScales[e].setCompleted(!1);var m=this._computeStudyCounter++;function g(e,t){if(e_[a].timeMs;l?_.push({index:g(s,_.length),value:[s/1e3].concat(r),timeMs:s}):(_[a].index=g(s,a),_[a].value=[s/1e3].concat(r),_[a].timeMs=s),p||h.onRealtimeCallback([_[_.length-1]],l,_.length,f,i)}(e,t,i)},nonseriesOut:function(e,t){h.onNonSeriesDataUpdate(t,i)},setNoMoreData:function(){y=!0},recalc:function(e,s){p=!1,_.endOfData=y,_.emptyBarCount=s.emptyBarCount,t.error&&null!==t.error()||(null!==l&&(S._objectsDataCache[l]=_),h.onDataReadyCallback(_,f,i,s))}});if(!S._studiesCache[e]||!S._studiesCache[e][n])throw Error("This should never happen");S._studiesCache[e][n].engine=w}catch(e){if(!e.studyError)throw e;h.onErrorCallback(e.message)}}else h.onErrorCallback("Unsupported resolution. Did you forget to set has_intraday to true?")}(w,C)},N.prototype._getDataRangeForStudy=function(e,t){var i=this._studiesCache[e][t],s={...this._seriesDataRange(e,i.parentId)};return this._studyCanExtendTimeScale(e,t)?void 0!==i.dataRange?i.dataRange:(i.firstLoadedTimeMs&&(s.to=i.firstLoadedTimeMs),s):s},N.prototype._createStudy=function(e,t,i,s,r,n,o,a){var l=this;function c(e,t,i){const o=l._studiesCache[s][r];if(o.completed=!0,e.length>0&&(o.firstLoadedTimeMs=e[0].timeMs),e=D(e),l._setEndOfData(s,r,n,!l._studyCanExtendTimeScale(s,r)||e.endOfData),l._studyCanExtendTimeScale(s,r)){const t=e.map((function(e){return e.timeMs})),i=l._timeScales[s].setStudyBarsTimes(r,t);l._applyTimeScaleUpdate(s,i)}l._timeScales[s].fillIndexesInRows(e),TradingView.ChartapiMessagerInstances[s].onDataUpdate(r,n,e,t),TradingView.ChartapiMessagerInstances[s].onStudyCompleted(r,n),l._updateTimeScaleState(s)}function h(e){var t={};if(0!==e.size){var i={},n=l._studiesCache[s][r].metainfo +;e.forEach((function(e,t){i[n.plots[t].id]=e})),t.data={offsets:i}}return t}this._studiesCache[s][r].completed=!1,a=function(e){if(Array.isArray(e))return e;for(var t=[],i=l._studiesCache[s][r].metainfo.inputs,n=0;n=0},N.prototype.ensureExtendedTo=function(e,t,i){if(!this._studiesCache[t][e])throw Error("This should never happen");var s=this;setTimeout((function(){s._recreateSourcesForDataRange(t,{to:i})}),0)},N.prototype.extendSeriesRange=function(e,t){var i=this._timeScales[e].firstSeriesBarTime();if(null!==i){var s=this._mainSeriesRecord(e);if(u.isDWM(s.resolution)&&null!=s.symbolInfo){var r=d(s.resolution,s.symbolInfo);null!==r&&(i=r.timeToExchangeTradingDay(i))}var n=this._symbolIdToSymbolRequestString.get(V(e,s.symbolId)),o=this._barsCoefficients(n,s.resolution),a=o.barsCoefficient||1;if(!o.barsCoefficient){var l=this._getSeriesData(e,s.guid);null!==l&&(o.expectedBarsCount=l.length+t)}var c=this;setTimeout((function(){c._recreateSourcesForDataRange(e,{to:i,countBack:(t+2)*a})}),0)}else this._logMessage("Nothing to extend - there is no points on time scale")},N.prototype.seriesTurnaround=function(e,t){return this._studiesCache[e]&&this._studiesCache[e][t]&&this._studiesCache[e][t].turnaround},N.prototype._seriesDataRange=function(e,t){var i=this._studiesCache[e][t];return null!==i.firstLoadedTimeMs?{to:i.firstLoadedTimeMs,countBack:0}:i.dataRange},N.prototype._applyTimeScaleUpdate=function(e,t){if(null!==t){var i=[];for(var s in this._studiesCache[e]){var r=this._studiesCache[e][s];if(r&&"study"===r.type){var n=this._studiesNonSeriesTimes[e][s];if(n){var o={indexes:this._timeScales[e].convertTimesToIndexes(n),data:{indexes_replace:!0}};i.push({objId:s,turnaround:r.turnaround,data:[],nonSeriesData:o})}}}TradingView.ChartapiMessagerInstances[e].onTimescaleUpdate(t,i),Promise.resolve().then(function(){var t=this._mainSeriesRecord(e);if(null!==t&&null!=t.symbolInfo){var i=this._getSymbolExtrapolator(e,t.symbolInfo,t.resolution) +;this._pointsetsManagers[e].getUpdatesForSymbol(t.symbolInfo.full_name,t.resolution,i,this._timeScales[e]).forEach((function(t,i){TradingView.ChartapiMessagerInstances[e].onPointsetDataUpdate(i,null,t)}))}}.bind(this))}},N.prototype._updateMainTsBuilder=function(e){var t=this._mainSeriesRecord(e);if(null!==t&&null!=t.symbolInfo){var i=this._getSymbolExtrapolator(e,t.symbolInfo,t.resolution);this._timeScales[e].setMainSymbolExtrapolator(i)}},N.prototype._updateTimeScaleState=function(e){var t=!0,i=!0;for(var s in this._studiesCache[e]){var r=this._studiesCache[e][s];i=i&&this._isEndOfData(e,s,r.turnaround),t=t&&r.completed}this._timeScales[e].isCompleted()!==t&&(this._timeScales[e].setCompleted(t),t&&TradingView.ChartapiMessagerInstances[e].onTimescaleCompleted(i))},N.prototype._mainSeriesRecord=function(e){var t=null,i=null;for(var s in this._studiesCache[e]){var r=this._studiesCache[e][s];if("series"===r.type&&(null===t&&(t=r),r.isMain)){i=r;break}}return null===i&&(i=t),null!==i&&(i.isMain=!0),i},N.prototype._seriesCount=function(e){var t=0;for(var i in this._studiesCache[e]){"series"===this._studiesCache[e][i].type&&(t+=1)}return t},N.prototype._prepareSeriesNonSeriesData=function(e,t,i){var s=i.data[i.data.length-1],r=this._getSeriesData(e,t),n=null===r?[]:i.data;return{data:{data:{reversalAmount:i.reversalAmount,boxSize:i.boxSize,price:s?s[4]:i.price,bars:n.map((function(e,t){return{time:t,open:e[1],high:e[2],low:e[3],close:e[4],volume:e[5],factor:e[6],additionalPrice:e[6]}}))}},indexes:this._timeScales[e].convertTimesToIndexes(n.map((function(e){var t=e[0]||0;return t<0?r[r.length+t].timeMs:i.projectionTime+t})))}},N.prototype.createSeries=function(e,t,i,s,r,o,a){this._setEndOfData(e,t,i,!1);var l=new n;this._studiesCache[e]=this._studiesCache[e]||{};var c=this._getSeriesData(e,t),h=this._studiesCache[e][t],d=this._seriesCount(e),p=this._mainSeriesRecord(e);if(!h||u.isEqual(h.resolution,r)&&h.symbolId===s)void 0!==o.countBack&&null!==c&&0!==c.length&&(o.to=c[0].timeMs),h&&null!=h.firstLoadedTimeMs?o.to=void 0!==o.to?Math.min(h.firstLoadedTimeMs,o.to):h.firstLoadedTimeMs:h||0===d||null!==p&&(null!=p.firstLoadedTimeMs?(o.to=p.firstLoadedTimeMs,o.countBack=0):o=Object.assign({},p.dataRange));else if(1===d)o=Object.assign({},h.initialDatarange);else{var _=this._timeScales[e].firstSeriesBarTime();(void 0===o.to||null!==_&&_{E(e.logo_urls,e.exchange_logo,e)})),s(e)}))}, +N.prototype.resolveSymbol=function(e,t,i){var s=this;this._symbolIdToSymbolRequestString.set(V(e,t),i),this._resolvePromisesBySymbolId.set(V(e,t),new Promise((function(r,n){s._resolveSymbolImpl(i,(function(s){TradingView.ChartapiMessagerInstances[e].onSymbolResolved(t,s),r({symbolInfo:s,requestedSymbol:i})}),(function(i){TradingView.ChartapiMessagerInstances[e].onSymbolError(t,i),n(i)}))})))},N.prototype._resolveSymbolImpl=function(e,t,i){S(e)||console.error("Expect to get symbol encoded string, but got the following instead: "+e);const[s,r]=R(e);this._resolveSymbolByName(s,r,t,i)},N.prototype._resolveSymbolByName=function(e,t,i,s){var r,n=t&&t.currency,o=t&&t.unit,a=t&&t.session,l=F(e,n,o,a);if(this._resolveRequests[l])r=this._resolveRequests[l];else{r=this._resolveSymbolInternal(e,n||void 0,o||void 0,a||void 0),this._resolveRequests[l]=r;var c=this;r.then((function(t){c._resolveRequests[F(e,t.currency_id,t.unit_id,t.subsession_id)]=r,c._resolveRequests[F(w(t,null),t.currency_id,t.unit_id,t.subsession_id)]=r,c._resolveRequests[F(w(t,null),n,o,a)]=r})).catch((function(){}))}r.then(i).catch(s)},N.prototype._resolveSymbolInternal=function(e,t,i,s){var r=this;return new Promise(function(n,o){const a=L(e,t,i,s);this._logMessage("Symbol resolve requested: `{0}` ".format(a));var l=!0;this._externalDatafeed.resolveSymbol(e,(function(e){l&&console.warn("`resolveSymbol` should return result asynchronously. Use `setTimeout` with 0 interval to execute the callback function."),r._logMessage("Symbol resolved: `{0}`, SymbolInfo in server response {1}".format(a,JSON.stringify(e))),function(e){const t=e.exchange+":"+e.name;if(e.full_name=t,e.pro_name=t,e.base_name||(e.base_name=[e.name]),e.legs||(e.legs=[e.name]),e.exchange||(e.exchange=e["exchange-listed"]),e.ticker||(e.ticker=e.symbol||e.name),e.data_status||(e.data_status="streaming"),!e.session&&e["session-regular"]&&(e.session=e["session-regular"]),!e.minmov&&e.minmovement&&(e.minmov=e.minmovement),e.currency_code&&(e.currency_id=e.currency_code),e.original_currency_code&&(e.original_currency_id=e.original_currency_code),e.holidays&&(e.session_holidays=e.holidays),void 0!==e.has_no_volume&&(e.visible_plots_set=e.has_no_volume?"ohlc":"ohlcv"),void 0===e.visible_plots_set&&(e.visible_plots_set="ohlcv"),e.supported_resolutions)for(var i=0;ithis._resolveSymbolByName(t,i,o,(s=>{console.warn(`Error resolving for market status watcher ${L(t,i.currency,i.unit,i.session)}:\n${s}`),this.quoteRemoveSymbols(e,[r]),a(s)}))),e,r)}}},N.prototype._removeMarketStatusWatchers=function(e){var t=this;Object.keys(this._marketStatusWatchers[e]||{}).forEach((function(i){t._marketStatusWatchers[e][i].stop()})),this._marketStatusWatchers[e]={}},N.prototype._stopQuotesSubscription=function(e){this._quotesInfo[e].listenerGUID&&(this._externalDatafeed.unsubscribeQuotes(this._quotesInfo[e].listenerGUID),this._quotesInfo[e].listenerGUID=void 0),this._removeMarketStatusWatchers(e)},N.prototype._startQuotesSubscription=function(e){var t={},i=this;function s(t,s){var r=i._marketStatusWatchers[e][t.n];t.symbolname=t.n,t.status=t.s,t.values=t.v,t.values.change=t.v.ch,t.values.last_price=t.v.lp,t.values.change_percent=t.v.chp,t.values.current_session=t.v.cs||r&&r.marketStatus(),t.values.pricescale=s.pricescale, +t.values.minmov=s.minmov,t.values.minmove2=s.minmove2||0,t.values.fractional=s.fractional||!1,E(s.logo_urls,s.exchange_logo,t.values),r&&t.v.cs&&r.stop(),TradingView.ChartapiMessagerInstances[e].onQuotesData([e].concat([t]))}function r(e){e.forEach((function(e){if(void 0!==t[e.n])null!==t[e.n]&&s(e,t[e.n]);else{const[r,n]=R(e.n);i._resolveSymbolByName(r,n,(function(i){t[e.n]=i,s(e,i)}),(function(){t[e.n]=null}))}}))}var n=this._quotesInfo[e].symbols;if(0===n.length)return;const o=n.map((e=>R(e)[0])),a=this._quotesInfo[e].fastSymbols.map((e=>R(e)[0]));this._externalDatafeed.getQuotes&&!P.enabled("charting_library")?this._externalDatafeed.getQuotes(o,(function(t){i._quotesInfo[e]&&0!==i._quotesInfo[e].symbols.length&&(r(t),i._quotesInfo[e].listenerGUID=e,i._externalDatafeed.subscribeQuotes(o,a,r,i._quotesInfo[e].listenerGUID))}),(function(e){})):!this._externalDatafeed.getQuotes&&P.enabled("trading_terminal")&&setTimeout((function(){r(o.map((function(e){return{n:e,s:"ok",v:{}}})))})),this._createMarketStatusWatchers(e,n)},N.prototype._restartQuotesSubscription=function(e){this._stopQuotesSubscription(e),this._startQuotesSubscription(e)},N.prototype.quoteCreateSession=function(e){this._quotesInfo[e]={symbols:[],fastSymbols:[],listenerGUID:void 0}},N.prototype.quoteDeleteSession=function(e){this._stopQuotesSubscription(e),this._quotesInfo[e]=null},N.prototype.quoteSetFields=function(e,t){},N.prototype.quoteAddSymbols=function(e,t){this._quotesInfo[e].symbols=this._filteredSymbols(this._quotesInfo[e].symbols.concat(t)),this._restartQuotesSubscription(e)},N.prototype.quoteRemoveSymbols=function(e,t){this._quotesInfo[e].symbols=this._quotesInfo[e].symbols.filter((function(e){return t.indexOf(e)<0})),this._restartQuotesSubscription(e)},N.prototype.quoteFastSymbols=function(e,t){this._quotesInfo[e].fastSymbols=this._filteredSymbols(t),this._restartQuotesSubscription(e)},N.prototype.quoteHibernateAll=function(e){},N.prototype._stopDepthSubscription=function(e){this._depthInfo[e].listenerGUID&&(this._externalDatafeed.unsubscribeDepth(this._depthInfo[e].listenerGUID),this._depthInfo[e].listenerGUID=void 0)},N.prototype._startDepthSubscription=function(e){var t=this,i=this._depthInfo[e].symbol;function s(e){return e.map((function(e){return{p:e.price,v:e.volume}}))}function r(e){var t={};return t.s=i,t.bids=s(e.bids),t.asks=s(e.asks),t}i&&this._externalDatafeed.subscribeDepth&&(t._depthInfo[e].listenerGUID=this._externalDatafeed.subscribeDepth(i,(function(i){var s;t._depthInfo[e]&&((s=i).snapshot?TradingView.ChartapiMessagerInstances[e].onDepthData([e].concat([r(s)])):TradingView.ChartapiMessagerInstances[e].onDepthUpdate([e].concat([r(s)])))})))},N.prototype._restartDepthSubscription=function(e){this._stopDepthSubscription(e),this._startDepthSubscription(e)},N.prototype.depthCreateSession=function(e){this._depthInfo[e]={symbol:null,listenerGUID:void 0}},N.prototype.depthDeleteSession=function(e){this._depthInfo[e].symbol=null,this._stopDepthSubscription(e),delete this._depthInfo[e]},N.prototype.depthSetSymbol=function(e,t){ +this._depthInfo[e].symbol=t,this._restartDepthSubscription(e)},N.prototype._filteredSymbols=function(e){var t=[];return e.forEach((function(e){e instanceof Object||t.indexOf(e)<0&&t.push(e)})),t},N.prototype._isEndOfData=function(e,t,i){var s=e+"!"+t+"@"+i;return!!this._endOfData[s]},N.prototype._setEndOfData=function(e,t,i,s){var r=e+"!"+t+"@"+i;this._endOfData[r]=!1!==s},N.prototype.serverTimeOffset=function(){return this._serverTimeOffset},N.prototype.serverTime=function(){return 1e3*this.getCurrentUTCTime()},N.prototype.getCurrentUTCTime=function(){return(new Date).valueOf()/1e3+this._serverTimeOffset},N.prototype.switchTimezone=function(e,t){this._timeScales[e].setTimezone(t);var i=this._timeScales[e].tickMarks();null!==i&&TradingView.ChartapiMessagerInstances[e].onTickmarksUpdated(0,i)},N.prototype._studyCanExtendTimeScale=function(e,t){const i=this._studiesCache[e][t]?.metainfo;return void 0!==i&&(P.enabled("studies_extend_time_scale")&&i.canExtendTimeScale||P.enabled("secondary_series_extend_time_scale")&&"Overlay@tv-basicstudies-1"===i.id)},e.exports=N},76537:(e,t,i)=>{"use strict";i.d(t,{SymbolExtrapolator:()=>c});var s=i(50151),r=i(78071),n=i(60156),o=i(94421),a=i(36274);function l(e,t){return e.length>t}class c{constructor(e,t,i=2e5){this._firstRealBarTimeMs=null,this._historyBarsCache=[],this._projectionFirstIndex=1/0,this._barsTimes=[],this._minFutureBarsCount=0,this._lastRealBarTimeMs=null,this._futureBarsCache=[],this._symbolInfo=e,this._interval=a.Interval.parse(t),this._extrapolateLimit=i,this._barBuilder=(0,n.newBarBuilder)(t,new n.SessionInfo(e.timezone,e.session,e.session_holidays,e.corrections),null)}destroy(){this.clear()}interval(){return this._interval}barBuilder(){return this._barBuilder}symbolInfo(){return this._symbolInfo}clear(){this._firstRealBarTimeMs=null,this._historyBarsCache=[],this._barsTimes=[],this._lastRealBarTimeMs=null,this._futureBarsCache=[],this._minFutureBarsCount=0,this._projectionFirstIndex=1/0}firstFutureBarIndex(){return this._barsTimes.length}futureBars(){return this._futureBarsCache}replaceBarsTimesTail(e,t=e.length){if(0===e.length)return;if(0===this._barsTimes.length)return void this.setBarsTimes(e,t);const i=e[0],n=this._barsTimes[this._barsTimes.length-1],o=i>n?this._barsTimes.length:(0,r.lowerbound_int)(this._barsTimes,i);0!==o?(this._barsTimes.splice(o,this._barsTimes.length,...e),this._projectionFirstIndex=t===e.length?this._barsTimes.length:this._barsTimes.indexOf(e[t]),(0,s.assert)(-1!==this._projectionFirstIndex,"something went wrong"),n!==e[e.length-1]&&this._setLastRealBarTime(e[e.length-1])):this.setBarsTimes(e,t)}setBarsTimes(e,t=e.length){const i=this._barsTimes;if(this._barsTimes=e.slice(),this._projectionFirstIndex=0===this._barsTimes.length?1/0:t,0===e.length)return this._historyBarsCache=[],this._futureBarsCache=[],this._firstRealBarTimeMs=null,void(this._lastRealBarTimeMs=null);0!==i.length&&i[i.length-1]===e[e.length-1]||this._setLastRealBarTime(e[e.length-1]),0!==i.length&&i[0]===e[0]||(this._historyBarsCache=[],this._firstRealBarTimeMs=e[0])} +extrapolateTimeWithOffsetToTime(e,t){if(0===t)return{timeMs:e,exact:!0};0===this._barsTimes.length&&(t<0?null===this._firstRealBarTimeMs?this._firstRealBarTimeMs=e:(this._extendHistoryCacheToTimeFromRight(Math.min(e,null!==this._lastRealBarTimeMs?this._lastRealBarTimeMs:1/0)),this._ensureExtrapolatedToHistoryTime(e)):null===this._lastRealBarTimeMs?this._lastRealBarTimeMs=e:(this._extendFutureCacheToTimeFromLeft(Math.max(e,null!==this._firstRealBarTimeMs?this._firstRealBarTimeMs:1/0)),this._ensureExtrapolatedToFutureTime(e)));const i=this.indexOfTime(e);if(null===i)return null;const s=this._timeOfBarIndex(i.index+t);return null===s?null:((i.index<0||this._projectionFirstIndex<=i.index)&&(s.exact=!1),s)}indexOfTime(e){if(null!==this._firstRealBarTimeMs&&ethis._lastRealBarTimeMs){this._ensureExtrapolatedToFutureTime(e);let t=(0,r.lowerbound_int)(this._futureBarsCache,e);if(0!==this._futureBarsCache.length&&t===this._futureBarsCache.length&&e>this._futureBarsCache[this._futureBarsCache.length-1])return null;this._futureBarsCache[t]!==e&&(t-=1);const i=Math.max(1,this._barsTimes.length)+t;return{index:i,timeMs:i===this._barsTimes.length-1?(0,s.ensureNotNull)(this._lastRealBarTimeMs):this._futureBarsCache[t]}}if(0===this._barsTimes.length)return null!==this._firstRealBarTimeMs&&this._firstRealBarTimeMs<=e||null!==this._lastRealBarTimeMs&&e<=this._lastRealBarTimeMs?{index:0,timeMs:(0,s.ensureNotNull)(this._timeOfBarIndex(0)).timeMs}:null;let t=(0,r.lowerbound_int)(this._barsTimes,e);return this._barsTimes[t]!==e&&(t-=1),{index:t,timeMs:this._barsTimes[t]}}setMinFutureBarsCount(e){this._minFutureBarsCount=e,0!==this._barsTimes.length&&this._ensureExtrapolatedToFutureBar(e)}ensureExtrapolatedToFutureTime(e){this._ensureExtrapolatedToFutureTime(e)}_setLastRealBarTime(e){const t=this._futureBarsCache.length,i=(0,r.upperbound_int)(this._futureBarsCache,e);0===i?this._extendFutureCacheToTimeFromLeft(e):(this._lastRealBarTimeMs=e,this._futureBarsCache=this._futureBarsCache.slice(i)),this._ensureExtrapolatedToFutureBar(Math.max(t,this._minFutureBarsCount))}_timeOfBarIndex(e){var t;if(e<0){const t=Math.abs(e);this._ensureExtrapolatedToHistoryBar(t);const i=this._historyBarsCache.length-t;return i<0?null:{timeMs:this._historyBarsCache[i],exact:!1}}if(0===e&&0===this._barsTimes.length)return{timeMs:(0,s.ensureNotNull)(null!==(t=this._firstRealBarTimeMs)&&void 0!==t?t:this._lastRealBarTimeMs),exact:!1};if(e>=this._barsTimes.length){const t=e-Math.max(1,this._barsTimes.length);return this._ensureExtrapolatedToFutureBar(t+1),t>=this._futureBarsCache.length?null:{timeMs:this._futureBarsCache[t],exact:!1}}return{timeMs:this._barsTimes[e], +exact:e=e)return;if((0,s.assert)(0===this._barsTimes.length,"bars should be empty"),this._firstRealBarTimeMs=e,0===this._historyBarsCache.length)return;const t=(0,o.extrapolateBarsFrontToTime)(this._barBuilder,this._historyBarsCache[this._historyBarsCache.length-1],e-1,this._extrapolateLimit,!0).times;this._historyBarsCache=this._historyBarsCache.concat(t)}_ensureExtrapolatedToFutureBar(e){return!(this._futureBarsCache.length>=e||l(this._futureBarsCache,this._extrapolateLimit))&&this._extendFutureCacheFromRight(((t,i)=>(0,o.extrapolateBarsFrontByCount)(this._barBuilder,t,e-i,!0).times))}_ensureExtrapolatedToFutureTime(e){null!==this._lastRealBarTimeMs&&this._lastRealBarTimeMs>=e||l(this._futureBarsCache,this._extrapolateLimit)||0!==this._futureBarsCache.length&&this._futureBarsCache[this._futureBarsCache.length-1]>=e||(this._extendFutureCacheFromRight(((t,i)=>(0,o.extrapolateBarsFrontToTime)(this._barBuilder,t,e,this._extrapolateLimit,!0).times)),this._futureBarsCache[this._futureBarsCache.length-1]=e||l(this._historyBarsCache,this._extrapolateLimit)||this._extendHistoryCacheFromLeft(((t,i)=>(0,o.extrapolateBarsFrontByCount)(this._barBuilder,t,-(e-i),!0).times.reverse()))}_ensureExtrapolatedToHistoryTime(e){null!==this._firstRealBarTimeMs&&this._firstRealBarTimeMs<=e||l(this._historyBarsCache,this._extrapolateLimit)||0!==this._historyBarsCache.length&&this._historyBarsCache[0]<=e||(this._extendHistoryCacheFromLeft(((t,i)=>{const s=(0,o.extrapolateBarsFrontToTime)(this._barBuilder,t-1,e-1,this._extrapolateLimit,!0).times;return s[s.length-1]===t?s.slice(0,-1):s})),(0===this._historyBarsCache.length||this._historyBarsCache[0]>e)&&this._ensureExtrapolatedToHistoryBar(this._historyBarsCache.length+1))}}},61595:(e,t,i)=>{"use strict";i.d(t,{backend:()=>s});const s=i(58844)},47327:(e,t,i)=>{ +"use strict";i.d(t,{HandlerInfo:()=>s});class s{constructor(e,t){this.handler=e,this.customId=t}}},17133:(e,t,i)=>{"use strict";var s,r;function n(e,t){return"period-back"===e.type&&"period-back"===t.type?e.value===t.value:"time-range"===e.type&&"time-range"===t.type&&(e.from===t.from&&e.to===t.to)}i.d(t,{TIMEFRAMETYPE:()=>r,areEqualTimeFrames:()=>n}),function(e){e.extractErrorReason=function(e){return e.params[1]}}(s||(s={})),function(e){e.PeriodBack="period-back",e.TimeRange="time-range"}(r||(r={}))},89173:()=>{"use strict";TradingView.Pro=function(){this.hasPackage=function(){return!1}},window.user={is_pro:!1,settings:{}},TradingView.Pro.prototype.isPaidPro=function(){return!1},TradingView.Pro.prototype.isSupportAvailable=function(){return!1},TradingView.Pro.prototype.getProduct=function(){return{}},TradingView.Pro.prototype.getStudiesOrder=function(){return[]}},67545:(e,t,i)=>{"use strict";i.r(t),i.d(t,{QUOTE_FIELDS:()=>n,QUOTE_FIELDS_CACHE:()=>o,QuoteCache:()=>r});var s=i(50151);class r{constructor(e){this._cache=new Map,this._fields=[...e.fields]}update(e,t,i){const r=(0,s.ensureDefined)(e.symbolname);if(this._cache.has(r)||this._cache.set(r,{symbolname:r,status:e.status,values:{}}),"error"===e.status)return;const n=(0,s.ensureDefined)(this._cache.get(r));n.status=e.status;for(const s of this._fields)t.has(s)&&(i||void 0!==e.values[s])&&(n.values[s]=e.values[s])}get(e){var t;return null!==(t=this._cache.get(e))&&void 0!==t?t:null}fields(){return this._fields}} const n=new Set(["pro_name","base_name","logoid","currency-logoid","base-currency-logoid","source-logoid","short_name","timezone","current_session","last_price","lp_time","prev_close_price","open_price","high_price","low_price","price_52_week_high","price_52_week_low","ask","ask_size","bid","bid_size","rch","rchp","rtc","data_frequency","reference-last-period-start","business_description","web_site_url","number_of_employees","float_shares_outstanding","earnings_release_next_calendar_date","root","description","exchange","listed_exchange","type","country_code","provider_id","sector","typespecs","visible-plots-set","industry","currency_id","last_price","fractional","minmov","minmove2","pricescale","variable_tick_size","change","change_percent","volume","average_volume","market_cap_basic","total_revenue","earnings_per_share_basic_ttm","price_earnings_ttm","beta_1_year","dps_common_stock_prim_issue_fy","dividends_yield","earnings_release_next_date","earnings_per_share_forecast_next_fq","earnings_release_date","earnings_per_share_fq","fundamental_currency_code","number_of_employees","web_site_url","business_description","founded","ceo","float_shares_outstanding","total_shares_outstanding","dividend_payout_ratio_ttm","dividends_yield_current","dividend_ex_date_upcoming","dividend_amount_upcoming","dividend_amount_recent","dividend_ex_date_recent","total_revenue_fq_h","total_revenue_fy_h","net_income_fy_h","net_income_fq_h","total_assets_fy_h","total_assets_fq_h","total_liabilities_fy_h","total_liabilities_fq_h","cash_f_operating_activities_fy_h","cash_f_operating_activities_fq_h","cash_f_investing_activities_fy_h","cash_f_investing_activities_fq_h","cash_f_financing_activities_fy_h","cash_f_financing_activities_fq_h","fiscal_period_fy_h","fiscal_period_fq_h","fiscal_period_fh_h","earnings_release_date_fq_h","earnings_release_next_date_fq","earnings_per_share_forecast_next_fq","earnings_per_share_forecast_fq_h","earnings_per_share_fq_h","earnings_fiscal_period_fq_h","next_earnings_fiscal_period_fq","earnings_release_next_time","is_next_earnings_release_date_estimated","symbol-primaryname","currency_code","rates_mc","rates_fy","rates_ttm","measure","value_unit_id","value-unit-id","update_mode","language","local_description","short_description","source","source2","format","recommendation_mark","last_report_frequency","price_target_estimates_num","price_target_average","update_mode_seconds","recommendation_total","recommendation_buy","recommendation_over","recommendation_hold","recommendation_under","recommendation_sell","recommendation_total","price_target_high","price_target_low","rates_pt","rates_pt","total_revenue_fy_h","total_revenue_fq_h","total_revenue_fh_h","net_income_fy_h","net_income_fq_h","net_income_fh_h","total_assets_fy_h","total_assets_fq_h","total_assets_fh_h","total_liabilities_fy_h","total_liabilities_fq_h","total_liabilities_fh_h","cash_f_operating_activities_fy_h","cash_f_operating_activities_fq_h","cash_f_operating_activities_fh_h","cash_f_investing_activities_fy_h","cash_f_investing_activities_fq_h","cash_f_investing_activities_fh_h","cash_f_financing_activities_fy_h","cash_f_financing_activities_fq_h","cash_f_financing_activities_fh_h","fiscal_period_fy","fiscal_period_fq","fiscal_period_fh","earnings_release_date_fq_h","earnings_release_date_fy_h","earnings_release_date_fh_h","earnings_release_next_date_fq","earnings_release_next_date_fy","earnings_release_next_date_fh","earnings_release_next_time","is_next_earnings_release_date_estimated","earnings_per_share_forecast_next_fq","earnings_per_share_forecast_next_fy","earnings_per_share_forecast_next_fh","earnings_per_share_forecast_fq_h","earnings_per_share_forecast_fy_h","earnings_per_share_forecast_fh_h","earnings_per_share_fq_h","earnings_per_share_fy_h","earnings_per_share_fh_h","earnings_fiscal_period_fq_h","earnings_fiscal_period_fy_h","earnings_fiscal_period_fh_h","next_earnings_fiscal_period_fq","next_earnings_fiscal_period_fy","next_earnings_fiscal_period_fh","revenue_fq_h","revenue_fy_h","revenue_fh_h","revenue_forecast_fq_h","revenue_forecast_fy_h","revenue_forecast_fh_h","revenue_forecast_next_fq","revenue_forecast_next_fy","revenue_forecast_next_fh","revenue_seg_by_business_h","revenue_seg_by_region_h","dividend_payout_ratio_ttm","dividends_yield_current","dividend_ex_date_upcoming","dividend_amount_upcoming","dividend_amount_recent","dividend_ex_date_recent","dividend_amount_h","total_revenue_fy","total_revenue_fq","total_revenue_fh","gross_profit_fy","gross_profit_fq","gross_profit_fh","ebitda_fy","ebit_fy","net_income_fy","net_income_fq","net_income_fh","total_debt_fy_h","total_debt_fq_h","total_debt_fh_h","free_cash_flow_fy_h","free_cash_flow_fq_h","free_cash_flow_fh_h","cash_n_equivalents_fy_h","cash_n_equivalents_fq_h","cash_n_equivalents_fh_h","total_current_assets_fy","total_current_assets_fq","total_current_assets_fh","total_current_liabilities_fy","total_current_liabilities_fq","total_current_liabilities_fh","total_non_current_assets_fy","total_non_current_assets_fq","total_non_current_assets_fh","total_non_current_liabilities_fy","total_non_current_liabilities_fq","total_non_current_liabilities_fh","loans_net_fy","total_deposits_fy","loan_loss_allowances_fy","price_earnings_fq_h","price_earnings_fy_h","price_earnings_fh_h","price_sales_fq_h","price_sales_fy_h","price_sales_fh_h","diluted_net_income_ttm","total_revenue_ttm","price_earnings_current","price_sales_current","isin","interest_income_fy_h","interest_income_fq_h","interest_income_fh_h","non_interest_income_fy_h","non_interest_income_fq_h","non_interest_income_fh_h","website","doc","explorer","sources","contracts","crypto_common_categories","crypto_asset","community","dividends_availability","earnings_availability","financials_availability","etf_asset_type_exposure","etf_region_exposure","top_holdings","unit-id","options-info","interest_income_fy","interest_income_fq","interest_income_fh","non_interest_income_fy","non_interest_income_fq","non_interest_income_fh","interest_expense_fy","interest_expense_fq","interest_expense_fh","loan_loss_provision_fy","loan_loss_provision_fq","loan_loss_provision_fh","non_interest_expense_fy","non_interest_expense_fq","non_interest_expense_fh","non_oper_income_fy","non_oper_income_fq","non_oper_income_fh","unusual_expense_inc_fy","unusual_expense_inc_fq","unusual_expense_inc_fh","pretax_income_fy","pretax_income_fq","pretax_income_fh","income_tax_fy","income_tax_fq","income_tax_fh","after_tax_other_income_fy","after_tax_other_income_fq","after_tax_other_income_fh","total_non_oper_income_fy","total_non_oper_income_fq","total_non_oper_income_fh","oper_income_fy","oper_income_fq","oper_income_fh","operating_expenses_fy","operating_expenses_fq","operating_expenses_fh","cost_of_goods_fy","cost_of_goods_fq","cost_of_goods_fh","equity_in_earnings_fy","equity_in_earnings_fq","equity_in_earnings_fh","minority_interest_exp_fy","minority_interest_exp_fq","minority_interest_exp_fh","discontinued_operations_fy","discontinued_operations_fq","discontinued_operations_fh","front_contract","pointvalue","unit_id","expiration","aum","asset_class","focus","expense_ratio","launch_date","issuer","brand","homepage","index_tracked","fund_view_mode","common_equity_tier1_ratio_fy_h","common_equity_tier1_ratio_fq_h","common_equity_tier1_ratio_fh_h","tier1_capital_ratio_fy_h","tier1_capital_ratio_fq_h","tier1_capital_ratio_fh_h","total_capital_ratio_fy_h","total_capital_ratio_fq_h","total_capital_ratio_fh_h","etf_holdings_count","contract-description"]),o=new r({ fields:n})},2438:(e,t,i)=>{"use strict";i.d(t,{destroyQuoteSessions:()=>a,getQuoteSessionInstance:()=>o});var s=i(49326),r=i.n(s);const n={};function o(e="full"){return n[e]||function(e="full",t){n[e]=t}(e,new(r())(e)),n[e]}function a(){for(const e in n)if(n.hasOwnProperty(e)){const t=n[e];void 0!==t&&t.destroy(),delete n[e]}}},47562:(e,t,i)=>{"use strict";i.d(t,{QuoteSession:()=>r});var s=i(36174);class r{constructor(e,t=(0,s.randomHash)()){this._sessionstarted=!1,this._globalHandler=null,this._chartApi=e,this._sessionid="qs_"+t}destroy(){this._sessionstarted&&(this._chartApi.quoteDeleteSession(this._sessionid),this._sessionstarted=!1)}connected(){return this._chartApi.connected()}connect(e){this._globalHandler=e,this._chartApi.createSession(this._sessionid,this),this._chartApi.connect()}disconnect(){this._chartApi.disconnect()}quoteAddSymbols(e){this._chartApi.quoteAddSymbols(this._sessionid,e)}quoteRemoveSymbols(e){this._chartApi.quoteRemoveSymbols(this._sessionid,e)}quoteFastSymbols(e){this._chartApi.quoteFastSymbols(this._sessionid,e)}quoteSetFields(e){this._chartApi.quoteSetFields(this._sessionid,e)}onMessage(e){var t;switch(e.method){case"connected":this._sessionstarted||(this._chartApi.quoteCreateSession(this._sessionid),this._sessionstarted=!0);break;case"disconnected":this._sessionstarted=!1}null===(t=this._globalHandler)||void 0===t||t.call(this,e)}quoteHibernateAll(){this._chartApi.quoteHibernateAll(this._sessionid)}}window.TradingView.QuoteSession=r},49326:(e,t,i)=>{"use strict";e=i.nmd(e);var s=i(43370).default,r=i(12481).default,n=i(71766).PriceFormatter;const{uniq:o}=i(15051);var a=i(36174);const{normalizeUpdateMode:l}=i(5370);var c=i(30888).deepExtend;const{QUOTE_FIELDS_CACHE:h,QUOTE_FIELDS:d}=i(67545);var u,p=i(57898).Delegate;function _(e,t){this.options=Object.assign({throttleTimeout:125},t),this._connected=!1,this._symbol_data={},this._subscriptions={},this.onConnect=new p,this.onDisconnect=new p,this._quoteApi=new u(window.ChartApiInstance),this._type=e||"full",this._delayUpdateFastSymbols=r(this._updateFastSymbols,250),this._throttledSymbolData={},this._formatterValuesCache={},this._waitingForFormatters={},this._snapshotValuesCache={},this._waitingForSnapshot={},this.connect()}u=i(47562).QuoteSession,_.prototype.destroy=function(){this._quoteApi.destroy(),this._quoteApi=null,this._connected=!1,this.onDisconnect.fire()},_.prototype.typeFields={},_.prototype.typeFields.simple=["base-currency-logoid","ch","chp","currency-logoid","currency_code","currency_id","base_currency_id","current_session","description","exchange","format","fractional","is_tradable","language","local_description","listed_exchange","logoid","lp","lp_time","minmov","minmove2","original_name","pricescale","pro_name","short_name","type","typespecs","update_mode","volume","variable_tick_size","value_unit_id"], _.prototype.typeFields.simpleDetailed=[].concat(_.prototype.typeFields.simple,["ask","bid","fundamentals","high_price","is_tradable","low_price","open_price","prev_close_price","rch","rchp","rtc","rtc_time","status","basic_eps_net_income","beta_1_year","earnings_per_share_basic_ttm","industry","market_cap_basic","price_earnings_ttm","sector","volume","dividends_yield","timezone"]),_.prototype.typeFields.full=[],_.prototype.typeFields.watchlist=[].concat(_.prototype.typeFields.simple,["rchp","rtc","country_code","provider_id"]),_.prototype.typeFields.portfolio=["pro_name","short_name","exchange","listed_exchange","description","sector","type","typespecs","industry","currency_code","currency_id","ch","chp","logoid","currency-logoid","base-currency-logoid","earnings_per_share_forecast_next_fq","earnings_release_next_date","earnings_release_date","earnings_per_share_fq","lp","fractional","minmov","minmove2","pricescale","volume","average_volume","market_cap_basic","total_revenue","earnings_per_share_basic_ttm","price_earnings_ttm","beta_1_year","dps_common_stock_prim_issue_fy","dividends_yield","fundamental_currency_code","rates_mc","rates_fy","rates_ttm","format","value_unit_id"],_.prototype.typeFields.notes=["short_name","pro_name","logoid","currency-logoid","base-currency-logoid","symbol-primaryname","type","typespecs"],_.prototype.typeFields.estimates=["fundamental_data","type","typespecs","earnings_per_share_forecast_next_symbol_currency_fq","earnings_release_next_aligned_date","earnings_release_next_calendar_date","earnings_release_next_date"],_.prototype.connect=function(e){this._quoteApi.connect(this.quoteHandler.bind(this))},_.prototype.quoteHandler=function(e){var t=e.method,i=e.params;switch(t){case"connected":this._connected||(this._connected=!0,this.onConnected());break;case"quote_list_fields":break;case"quote_symbol_data":this._connected&&this.onSymbolData(i[0]);break;case"quote_completed":this._connected&&this.onSymbolData({symbolname:i[0],complete:performance.now(),values:{}});break;case"disconnected":this._connected&&(this._connected=!1,this.onDisconnect.fire())}},_.prototype.onConnected=function(){this.setFields();var e=Object.keys(this._symbol_data);e.length&&(this._quoteApi.quoteAddSymbols(e),this._delayUpdateFastSymbols()),this.onConnect.fire()},_.prototype.setFields=function(){var e=_.prototype.typeFields[this._type];e&&e.length&&this._quoteApi.quoteSetFields(e)},_.prototype.onSymbolData=function(e){try{e.status&&h.update(e,d,!1)}catch(e){}var t=e.symbolname,i=this._throttledSymbolData[t];i||(i=this._throttledSymbolData[t]={fnDispatch:s(this.dipatchSymbolData.bind(this),this.options.throttleTimeout)}),i.cache?c(i.cache,e):i.cache=e,i.fnDispatch(t)},_.prototype._parseUpdateMode=function(e){l(e)},_.prototype.dipatchSymbolData=function(e){var t=this._symbol_data[e],i=this._throttledSymbolData[e].cache;if(delete this._throttledSymbolData[e].cache,this._symbol_data[e])for(var s in c(t,i),t.values&&this._parseUpdateMode(t.values),this._subscriptions){var r=this._subscriptions[s] @@ -240,22 +240,22 @@ this._lineDataSources=new WeakMap,this._selectionApi=null,this._prevVisibleRange v.isFunction)(t)&&(t={dataReady:t});const{dataReady:i,doNotActivateChart:s}=t||{};e===this.symbol()||this._chartWidget.hasModel()&&this._chartWidget.model().mainSeries().symbolSameAsResolved(e)?null==i||i():(s||this._activateChart(),this._chartWidget.setSymbol(e),j(this._chartWidget.model().mainSeries(),(e=>{!e&&i&&i()})))}async setResolution(e,t){(0,v.isFunction)(t)&&(t={dataReady:t});const{dataReady:i,doNotActivateChart:s}=t||{};let r=a.Interval.normalize(e);if(null!==r&&(r=this._chartWidget.model().mainSeries().getSupportedResolution(r)),null===r||r===this.resolution())return null==i||i(),!0;s||this._activateChart();const n=this._chartWidget.chartWidgetCollection().setResolution(r,void 0,this._chartWidget);return j(this._chartWidget.model().mainSeries(),(e=>{!e&&i&&i()})),n}async setChartType(e,t){if(this._chartWidget.model().mainSeries().properties().childs().style.value()===e)return null==t||t(),!0;const i=this._chartWidget.chartWidgetCollection().setChartStyleToWidget(e,this._chartWidget);return j(this._chartWidget.model().mainSeries(),(e=>{!e&&t&&t()})),i}resetData(){this._chartWidget.model().mainSeries().rerequestData()}getBarsMarksSources(){return this._chartWidget.model().barsMarksSources()}getAllStudies(){return this._chartWidget.model().model().allStudies(!0).map(f.studyEntityInfo)}getAllPanesHeight(){const e=this._chartWidget.model().model().panes();if(this._chartWidget.isMaximizedPane()){let t=0,i=0;e.forEach((e=>{t+=e.height(),i+=e.stretchFactor()}));const s=i/t;return e.map((e=>Math.round(e.stretchFactor()/s*100)/100))}return e.map((e=>e.height()))}setAllPanesHeight(e){const t=this._chartWidget.model().model(),i=t.panes();(0,s.assert)(i.length===e.length,"There`s a mismatch between the number of heights you provided and the number of panes.");const r=i.reduce(((e,t)=>e+t.stretchFactor()),0)/e.reduce(((e,t)=>e+t));e.forEach(((e,t)=>{const s=e*r;i[t].setStretchFactor(s)})),t.fullUpdate()}maximizeChart(){this._chartWidget.requestFullscreen()}isMaximized(){return this._chartWidget.inFullscreen()}restoreChart(){this._chartWidget.exitFullscreen()}sessions(){return this._chartWidget.model().model().sessions()}chartModel(){return this._chartWidget.model().model()}getTimeScaleLogicalRange(){return this._chartWidget.model().timeScale().logicalRange()}createStudy(e,t,i,s,r,n){if("function"==typeof r)return console.warn('"createStudy" does not take "callback" parameter anymore'),Promise.resolve(null);if(n=n||{},"string"!=typeof e)return this._createStudy(e);if(n.checkLimit&&!this._chartWidget.model().canCreateStudy())return(0,G.showTooManyStudiesNotice)(),Promise.resolve(null);e=e.toLowerCase();const o=n.disableUndo?this._chartWidget.model().model():this._chartWidget.model(),a=q.StudyMetaInfo.findStudyMetaInfoByDescription(o.studiesMetaData(),e),c=o.createStudyInserter({type:"java",studyId:a.id},[]);if(c.setForceOverlay(!!t),n.priceScale&&c.setPreferredPriceScale(function(e){switch(e){case"no-scale":return"overlay";case"as-series":return"as-series";case"new-left":return"left";case"new-right":return"right" ;default:throw new Error('The pricescale "'+e+'" is invalid, the only valid options are "no-scale", "as-series", "new-left" and "new-right".')}}(n.priceScale)),n.allowChangeCurrency&&c.setAllowChangeCurrency(!0),n.allowChangeUnit&&c.setAllowChangeUnit(!0),Array.isArray(s)){console.warn("Passing study inputs as an ordered array is now deprecated. Please use an object where keys correspond to the inputs of your study instead.");const e={};for(let t=0;tPromise.resolve({inputs:s||{},parentSources:[]}))).then((e=>(r&&(0,l.applyOverridesToStudy)(e,r),i&&e.setUserEditEnabled(!1),e.id())))}getStudyById(e){const t=this._chartWidget.model().model().getStudyById(e);if(null===t)throw new Error("There is no such study");return this._getStudyApi(t)}getSeries(){const e=this._chartWidget.model(),t=e.mainSeries();return new O(t,e)}getShapeById(e){const t=this._chartWidget.model().model().getLineToolById(e);if(null===t)throw new Error("There is no such shape");return this._getLineDataSourceApi(t)}removeAllShapes(){this._chartWidget.removeAllDrawingTools()}removeAllStudies(){this._chartWidget.removeAllStudies()}selection(){return null===this._selectionApi&&(this._selectionApi=new W.SelectionApi(this._chartWidget.model().model())),this._selectionApi}createStudyTemplate(e){return this._chartWidget.model().model().studyTemplate(e.saveSymbol,e.saveInterval)}applyStudyTemplate(e){this._chartWidget.model().applyStudyTemplate(e,""+1e3*Math.random())}symbol(){return this._chartWidget.symbolWV().value()}symbolExt(){const e=this._chartWidget.model().mainSeries().symbolInfo();return null===e?null:{symbol:e.name,full_name:e.full_name,exchange:e.exchange,description:e.description,type:e.type,pro_name:e.pro_name,typespecs:e.typespecs,delay:e.delay}}resolution(){return this._chartWidget.model().mainSeries().interval()}marketStatus(){return this._chartWidget.model().mainSeries().marketStatusModel().status().spawn()}getVisibleRange(){const e={from:0,to:0},t=this._chartWidget.model().timeScale(),i=t.visibleBarsStrictRange();if(null===i)return e;const r=i.firstBar(),n=i.lastBar(),o=this._convertIndexToPublicTime(n);if(null===o)return e;const a=Math.max((0,s.ensureNotNull)(t.points().range().value()).firstIndex,r);return e.from=(0,s.ensureNotNull)(this._convertIndexToPublicTime(a)),e.to=o,e}getTimezoneApi(){return this._timezoneApi}getPanes(){return this._chartWidget.model().model().panes().map((e=>this._getPaneApi(e)))}exportData(e){if(!o.enabled("charting_library_export_chart_data"))return Promise.reject("Data export is not supported");const t={...e};return void 0!==t.from&&(t.from=this._convertTimeFromPublic(t.from)),void 0!==t.to&&(t.to=this._convertTimeFromPublic(t.to)),i.e(9498).then(i.bind(i,50210)).then((e=>e.exportData(this._chartWidget.model().model(),t)))}isSelectBarRequested(){return this._chartWidget.selectPointMode().value()!==$.SelectPointMode.None}barTimeToEndOfPeriod(e){const t=this._prepareEndOfPeriodArgs();return(0,h.barTimeToEndOfPeriod)(t.barBuilder,e,t.intervalObj)} endOfPeriodToBarTime(e){const t=this._prepareEndOfPeriodArgs();return(0,h.endOfPeriodToBarTime)(t.barBuilder,e,t.intervalObj)}createAnchoredShape(e,t){const i=t.shape;if((0,Y.isSupportedLineTool)(i)&&!0!==Y.supportedLineTools[i].isAnchored)return console.warn(`${i} is not an anchored shape. It can be created using createShape or createMultipointShape`),null;const s=this._chartWidget.model().model(),r=s.mainSeries();if(s.timeScale().isEmpty())return null;const n=void 0!==t.ownerStudyId?s.dataSourceForId(t.ownerStudyId):r,o=this._convertPositionPercentToPricedPoint(e,n);return null===o?null:this.createMultipointShape([o],t)}properties(){return this._chartWidget.properties()}setBarSpacing(e){this._chartWidget.model().timeScale().setBarSpacing(e)}scrollChartByBar(e){this._chartWidget.model().scrollChartByBar(e)}mergeAllScales(e){this._chartWidget.model().mergeAllScales(e)}chartPainted(){return this._chartWidget.chartPainted()}applyOverrides(e){this._chartWidget.applyOverrides(e)}addOverlayStudy(e,t,i){return this._chartWidget.addOverlayStudy(e,t,i)}lineToolsSynchronizer(){return this._chartWidget.lineToolsSynchronizer()}cloneLineTool(e){const t=this._chartWidget.model(),i=t.model().dataSourceForId(e);t.cloneLineTools([i],!1)}shareLineTools(e,t){const i=this._chartWidget.model(),s=e.map((e=>i.model().dataSourceForId(e)));i.shareLineTools(s,t)}linkingGroupIndex(){return this._apiLinkingGroupIndex.spawn()}loadingScreenActive(){return this._chartWidget.screen.isShown()}symbolResolvingActive(){for(const e of this._chartWidget.model().model().symbolSources())if(e.symbolResolvingActive().value())return!0;return!1}hasModel(){return this._chartWidget.hasModel()}disableAllUtilitySources(){0}ranges(){throw new Error("not implemented")}getTimeScale(){return new d(this._chartWidget.model().timeScale())}async loadChartTemplate(e){await(0,J.loadTheme)(this._chartWidget.chartWidgetCollection(),{themeName:e,standardTheme:!1,noUndo:!1,onlyActiveChart:!0})}setTimeFrame(e){this.setActive(),this._chartWidget.loadRange(e)}syncTime(e){if(this._chartWidget.hasModel()){const t=this._chartWidget.model().model(),i=t.mainSeries().syncModel();i&&t.syncTimeWithModel(i.syncSourceTarget(),e)}}syncDateRange(e,t){this._chartWidget.hasModel()&&this._chartWidget.model().model().gotoTimeRange(e,t)}getLineToolsState(e,t,i){this._canUseLineToolsSynchronizer("getLineToolsState");const r=null==i||i,n=(0,s.ensureNotNull)(this.lineToolsSynchronizer()).getDTO(e,t,r);return delete n.clientId,n}async applyLineToolsState(e){this._canUseLineToolsSynchronizer("applyLineToolsState"),await(0,s.ensureNotNull)(this.lineToolsSynchronizer()).applyDTO(e)}reloadLineToolsFromServer(){this._canUseLineToolsSynchronizer("reloadLineToolsFromServer"),(0,s.ensureNotNull)(this.lineToolsSynchronizer()).reloadAllLineTools()}_destroy(){this._chartWidget.hasModel()&&(this._chartWidget.model().crossHairSource().moved().unsubscribeAll(this),this._chartWidget.model().timeScale().logicalRangeChanged().unsubscribe(this,this._onLogicalRangeChanged)),this._widgetLinkingGroupIndex.destroy()} -_createStudy(e){return Promise.reject("Pine Script™ and java studies are not supported")}_convertTimeToPublic(e){return this._getTimeConverter().convertInternalTimeToPublicTime(e)}_convertIndexToPublicTime(e){return null===this._chartWidget.model().mainSeries().symbolInfo()?null:this._getTimeConverter().convertTimePointIndexToPublicTime(e)}_getDefaultCreateMultipointShapeOptions(){return{filled:!0}}_convertPositionPercentToPricedPoint(e,t){const i=this._chartWidget.model().timeScale(),s=t.priceScale(),r=t.firstValue();if(null==r||!isFinite(r)||null===s)return null;const n=i.coordinateToIndex(e.x*i.width()),o=i.indexToTimePoint(n);if(null===o)return null;return{price:s.coordinateToPrice(e.y*s.height(),r),time:o}}_convertUserPointsToDataSource(e){const t=this._chartWidget.model().model(),i=t.mainSeries(),r=t.timeScale().points(),n=i.data();if(t.timeScale().isEmpty())return null;const o=e.map((e=>e.time||0)),a=this._alignPoints(o),l=(e,t,o)=>{const a=r.closestIndexLeft(e)||0,l={index:a,price:NaN},c=(0,s.ensureNotNull)(r.valueAt(a)),h=(0,s.ensureNotNull)(r.range().value());if(e>c&&a===h.lastIndex){const t=(0,s.ensureNotNull)(i.syncModel()).distance(c,e);t.success&&(l.index=l.index+t.result)}else if(ee.visible()&&0!==e.title().length)).map((e=>({title:e.title(),value:e.value()})));h.entityValues[t.id()]={isHovered:s,values:r,title:i.header()}}this._crosshairMoved.fire(h)}_makeSubscriptionFromDelegate(e){return{ -subscribe:e.subscribe.bind(e),unsubscribe:e.unsubscribe.bind(e),unsubscribeAll:e.unsubscribeAll.bind(e)}}_prepareEndOfPeriodArgs(){const e=this._chartWidget.model().model(),t=e.timezone(),i=(0,s.ensureNotNull)(e.mainSeries().symbolInfo()),r=e.mainSeries().interval(),n=new c.SessionInfo(t,i.session,i.session_holidays,i.corrections);return{barBuilder:(0,c.newBarBuilder)(r,n,n),intervalObj:a.Interval.parse(r)}}_getPaneApi(e){let t=this._panes.get(e);return void 0===t&&(t=new w(e,this._chartWidget),this._panes.set(e,t)),t}_getStudyApi(e){let t=this._studies.get(e);return void 0===t&&(t=new R(e,this._chartWidget),this._studies.set(e,t)),t}_getLineDataSourceApi(e){let t=this._lineDataSources.get(e);return void 0===t&&(t=new N.LineDataSourceApi(e,this._chartWidget.model(),{apiPointsToDataSource:this._convertUserPointsToDataSource.bind(this),dataSourcePointsToPriced:e=>{const t=(0,s.ensureNotNull)(this._chartWidget.model().mainSeries().syncModel()),i=this._chartWidget.model().timeScale();return e.map((e=>{const s=i.normalizeBarIndex(e.index);return{price:e.price,time:this._convertTimeToPublic(t.projectTime(s.time_t,s.offset))}}))}}),this._lineDataSources.set(e,t)),t}_alignPoints(e){const t=this._chartWidget.model().model(),i=t.mainSeries(),s=i.interval(),r=i.symbolInfo();if(t.timeScale().isEmpty()||!a.Interval.isDWM(s)||null===r)return e;const n=(0,X.createDwmAligner)(s,r);return null===n?e:e.map((e=>n.timeToSessionStart(1e3*e)/1e3))}_onLogicalRangeChanged(){const e=this._chartWidget.model().mainSeries(),t=e.data().isEmpty();if(null!==this._chartWidget.model().timeScale().visibleBarsStrictRange()&&t)return void e.dataEvents().completed().subscribe(this,this._onLogicalRangeChanged,!0);const i=this.getVisibleRange();null!==this._prevVisibleRange&&(0,v.deepEquals)(this._prevVisibleRange,i)[0]||(this._prevVisibleRange=i,this._visibleBarsChanged.fire(i))}_canUseLineToolsSynchronizer(e){if(!o.enabled("saveload_separate_drawings_storage"))throw new Error(`${e} can only be used when 'saveload_separate_drawings_storage' featureset is enabled`)}}},66764:(e,t,i)=>{"use strict";i.d(t,{getChartWidgetApiTimeConverter:()=>n});var s=i(50151),r=i(77475);function n(e,t,i){return new a(function(e,t){const i=function(e,t){return e+t.session+t.timezone+(t.corrections||"")+(t.session_holidays||"")}(e,t);let s=o.get(i);void 0===s&&(s=(0,r.createDwmAligner)(e,t),o.set(i,s));return s}(e,t),i)}const o=new Map;class a{constructor(e,t){this._dwmAligner=e,this._chartModel=t}convertPublicTimeToInternalTime(e){return null!==this._dwmAligner?this._dwmAligner.timeToSessionStart(1e3*e)/1e3:e}convertInternalTimeToPublicTime(e){return null!==this._dwmAligner?this._dwmAligner.timeToExchangeTradingDay(1e3*e)/1e3:e}convertTimePointIndexToPublicTime(e){let t=this.convertTimePointIndexToInternalTime(e);return null!==t&&(t=this.convertInternalTimeToPublicTime(t)),t}convertTimePointIndexToInternalTime(e){const t=this._chartModel.timeScale();if(t.isEmpty())return null;const i=t.points(),{firstIndex:r,lastIndex:n}=(0,s.ensureNotNull)(i.range().value());let o=null -;if(r<=e&&e<=n)o=i.valueAt(e);else if(e>n){const i=this._chartModel.mainSeries().syncModel();if(null!==i){const r=(0,s.ensureNotNull)(t.indexToTimePoint(n));o=i.projectTime(r,e-n)}}return o}}},58487:(e,t,i)=>{"use strict";i.d(t,{ChartWidgetBase:()=>qi});var s=i(27714),r=i(50151),n=i(3343),o=i(11542),a=i(76422),l=(i(82992),i(49483)),c=i(56840),h=i(11014),d=i(51768),u=i(87095),p=i(59224),_=i(5894),m=i(53180),g=i(51608);function f(e,t){const i=Object.create(Object.getPrototypeOf(e));for(const s of t)Object.prototype.hasOwnProperty.call(e,s)&&(i[s]=e[s]);return i}var v=i(82723),y=i(90995),S=i(85067);let b;class w extends S.DialogRenderer{constructor(){super(),this._dialog=null,this._subscribe=e=>{this._setVisibility(e)}}show(){this._load().then((e=>e.show()))}hide(){var e;null===(e=this._dialog)||void 0===e||e.hide()}static getInstance(){return b||(b=new w),b}_load(){return Promise.all([i.e(2666),i.e(956),i.e(2109),i.e(4015),i.e(3842),i.e(5145),i.e(855),i.e(6),i.e(5649),i.e(8056),i.e(5993),i.e(6221),i.e(6752),i.e(8149),i.e(6106),i.e(4781),i.e(9465),i.e(6747),i.e(3780),i.e(962),i.e(1740),i.e(4062),i.e(6408),i.e(2544),i.e(5057),i.e(2052),i.e(3263),i.e(5164),i.e(4862)]).then(i.bind(i,56396)).then((e=>{var t,i;return null===(t=this._dialog)||void 0===t||t.hide(),null===(i=this._dialog)||void 0===i||i.visible().unsubscribe(this._subscribe),this._dialog=new e.ObjectTreeDialogRenderer,this._dialog.visible().subscribe(this._subscribe),this._dialog}))}}var C=i(1722),P=i(33703),x=i(88640);async function T(e,t,s,r,n,a="default"){let l,c=[];const h=e.model().model(),d=(0,C.clone)(t),u=new x.default({inputs:d}),p=function(e,t){return"symbol"===t?e.inputs.filter((t=>t.id===e.symbolInputId())):e.inputs.filter((e=>e.confirm))}(s,a),_=()=>{l&&h.removeCustomSource(l)},m=()=>{_(),n()},g=e=>{r({inputs:e,parentSources:c}),_()},f=p.filter(P.isTimeOrPriceNotHiddenInput);if(f.length>0)try{const t=await Promise.all([i.e(5362),i.e(2666),i.e(956),i.e(2109),i.e(4015),i.e(3842),i.e(5145),i.e(855),i.e(6),i.e(8056),i.e(5993),i.e(2191),i.e(6221),i.e(2587),i.e(2639),i.e(3502),i.e(9842),i.e(7807),i.e(3353),i.e(4215),i.e(9327),i.e(6625),i.e(7194),i.e(6884),i.e(5940),i.e(1762),i.e(962),i.e(1740),i.e(6408),i.e(750),i.e(4403),i.e(4713),i.e(7051),i.e(3030)]).then(i.bind(i,73339)),r=await t.selectInputValuesOnChart(e,f,u,s.shortDescription,s.inputs);if(l=r.customSourceId,r.destPane){const e=r.destPane.mainDataSource();c=e===h.mainSeries()?[]:[e]}else c=[]}catch(e){return void m()}f.length!==p.length?Promise.all([i.e(5362),i.e(2666),i.e(956),i.e(2109),i.e(4015),i.e(3842),i.e(5145),i.e(855),i.e(6),i.e(8056),i.e(5993),i.e(2191),i.e(6221),i.e(2587),i.e(2639),i.e(3502),i.e(9842),i.e(7807),i.e(3353),i.e(4215),i.e(9327),i.e(6625),i.e(7194),i.e(6884),i.e(5940),i.e(1762),i.e(962),i.e(1740),i.e(6408),i.e(750),i.e(4403),i.e(4713),i.e(7051),i.e(3030)]).then(i.bind(i,29638)).then((t=>{const r=new t.ConfirmInputsDialogRenderer(function(e){if("symbol"===e)return o.t(null,void 0,i(45743));return o.t(null,void 0,i(46689))}(a),p,u,a,s,e.model(),g,m);return r.show(),r -})):g(u.state().inputs||{})}let I=null;i(83135);var M=i(70027),A=i(58096);const L=(0,M.parseHtmlElement)(function(e=""){return`
`}());class k{constructor(e){this._shown=!1,this._el=L.cloneNode(!0),this.setSize(A.spinnerSizeMap[e||A.DEFAULT_SIZE])}spin(e){return this._el.classList.add("tv-spinner--shown"),void 0===this._container&&(this._container=e,void 0!==e&&e.appendChild(this._el)),this._shown=!0,this}stop(e){return e&&void 0!==this._container&&this._container.removeChild(this._el),this._el&&this._el.classList.remove("tv-spinner--shown"),this._shown=!1,this}setStyle(e){return Object.keys(e).forEach((t=>{const i=e[t];void 0!==i&&this._el.style.setProperty(t,i)})),this}style(){return this._el.style}setSize(e){const t=void 0!==e?`tv-spinner--size_${e}`:"";return this._el.className=`tv-spinner ${t} ${this._shown?"tv-spinner--shown":""}`,this}getEl(){return this._el}destroy(){this.stop(),delete this._el,delete this._container}}var D=i(78071),E=i(97906),V=i(38618),B=i(57898),R=i(14483);function N(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function O(e){return e.reduce(((e,t)=>{for(const i in t)if(N(t,i)){const s=t[i],r=e[i];r?r.push(s):e[i]=[s]}return e}),{})}var F=i(36298),W=i(97145),H=i(39347),z=i(86909),U=(i(3994),i(74359)),j=i(28571);const G=new F.TranslatedString("move left",o.t(null,void 0,i(15086))),q=new F.TranslatedString("move right",o.t(null,void 0,i(61711)));class ${constructor(e){this._chartModel=null,this._animation=null,this._chart=e,this._chart.withModel(this,(()=>{this._chartModel=this._chart.model()}))}destroy(){var e;null===(e=this._animation)||void 0===e||e.stop()}move(e){if(null!==this._chartModel){const t=this._chartModel.timeScale();if(t.isEmpty())return;const i=t.barSpacing(),s=.003/i,r=1.1/i,n=Math.round(r/s);this._moveImpl(e,((t,i,o)=>{const a=Math.min(i,n),l=e*s*Math.pow(a,2)/2;if(i<=n)return t-l;const c=Number.isFinite(o)?Math.max(0,n-o):0;return t-l-e*(i-a-c)*r-e*(r*c-s*Math.pow(c,2)/2)}),(e=>Math.max(0,n-e)+n))}}moveByBar(e){if(null!==this._chartModel){if(this._chartModel.timeScale().isEmpty())return;const t=300;this._moveImpl(e,((i,s)=>i-e*(Math.floor(Math.max(0,s-t)/100)+1)),(()=>0),!0)}}stopMove(){var e;null===(e=this._animation)||void 0===e||e.stop(),this._animation=null}scrollToRealtime(e){null!==this._chartModel&&this._chartModel.timeScale().scrollToRealtime(e)}_moveImpl(e,t,i,s){if(null===this._chartModel)return;const r=this._chartModel.timeScale();if(r.isEmpty())return;if(this._chartModel.changeTimeScale(1===e?G:q),s&&null!==r.visibleBarsStrictRange()){const e=r.indexToCoordinate(r.visibleBarsStrictRange().lastBar())+r.barSpacing()/2;Math.abs(r.width()-e)>r.barSpacing()/6&&r.setRightOffset(Math.round(r.rightOffset()))}const n=performance.now();let o=1/0;const a=r.rightOffset();this._animation={getPosition:e=>(e=Math.min(o,e),t(a,e-n,o-e)),finished:e=>e>=o,stop:()=>{const e=performance.now()-n;o=performance.now()+i(e)}},this._chartModel.model().setTimeScaleAnimation(this._animation)}}var Y=i(14787);function K(e,t,s,r,n){ -return Promise.all([i.e(5362),i.e(2285),i.e(6306),i.e(2666),i.e(956),i.e(2109),i.e(4015),i.e(3842),i.e(5145),i.e(855),i.e(6),i.e(5649),i.e(8056),i.e(5993),i.e(2191),i.e(6221),i.e(2587),i.e(2639),i.e(3502),i.e(8149),i.e(9842),i.e(7807),i.e(3353),i.e(4215),i.e(6036),i.e(9327),i.e(6625),i.e(7194),i.e(6884),i.e(5940),i.e(3980),i.e(826),i.e(2486),i.e(4894),i.e(7391),i.e(7555),i.e(962),i.e(1740),i.e(750),i.e(4403),i.e(4713),i.e(7051),i.e(5664),i.e(4648),i.e(5983),i.e(6265)]).then(i.bind(i,63374)).then((i=>{const o=new(0,i.EditObjectDialogRenderer)(e,t,r,n);return o.show(s),o}))}var Z=i(28853);let X=null;var J=i(58229),Q=i(92249);const ee={[Y.TabNames.symbol]:"symbol",[Y.TabNames.legend]:"legend",[Y.TabNames.scales]:"scales",[Y.TabNames.trading]:"trading",[Y.TabNames.events]:"events",[Y.TabNames.eventsAndAlerts]:"events",[Y.TabNames.timezoneSessions]:"canvas",[Y.TabNames.text]:"text",[Y.TabNames.style]:"style",[Y.TabNames.visibility]:"visibility"},te={[Y.TabNames.style]:"style",[Y.TabNames.visibility]:"visibilities"};async function ie(e,t,s={},r,n){const o=r.activeChartWidget.value(),{initialTab:a,tabName:l}=s;if(l&&!a&&(s.initialTab=te[l]),(0,Q.isStudyLineTool)(e)&&function(e){return[J.LineToolVbPFixed,null].filter(C.notNull).some((t=>e instanceof t))}(e))return o.propertiesDefinitionsForSource(e).then((i=>null!==i?K(e,t,s,n,i):null));if((0,Z.isStudy)(e)&&function(e){const{shortId:t}=e.metaInfo();return"Overlay"===t}(e)||(0,Q.isLineTool)(e))return o.propertiesDefinitionsForSource(e).then((r=>{if(null!==r){return function(e){return Promise.all([i.e(5362),i.e(2666),i.e(956),i.e(2109),i.e(4015),i.e(3842),i.e(5145),i.e(855),i.e(6),i.e(5649),i.e(8056),i.e(5993),i.e(2191),i.e(6221),i.e(2587),i.e(2639),i.e(3502),i.e(8149),i.e(9842),i.e(7807),i.e(3353),i.e(4215),i.e(9327),i.e(6625),i.e(7194),i.e(6884),i.e(5940),i.e(3980),i.e(826),i.e(2486),i.e(7391),i.e(8904),i.e(962),i.e(1740),i.e(750),i.e(4403),i.e(4713),i.e(7051),i.e(5664),i.e(4648),i.e(5983),i.e(6780)]).then(i.bind(i,75892)).then((t=>{const i=new(0,t.SourcePropertiesEditorRenderer)(e);return null!==X&&X.hide(),i.show({shouldReturnFocus:e.shouldReturnFocus}),X=i,i}))}({propertyPages:r,model:t,source:e,activePageId:l&&ee[l],shouldReturnFocus:s.shouldReturnFocus})}return null}));if((0,Z.isStudy)(e))return K(e,t,s,n);{const e=l&&ee[l],t=r.getChartPropertiesDialogRenderer();return t.setActivePage(e),t.show(s)}}var se=i(33013),re=i(45345),ne=i(24633);async function oe(){return(await Promise.all([i.e(5866),i.e(962),i.e(139)]).then(i.bind(i,81200))).ErrorCardRenderer}var ae=i(42960);const le=(0,se.getHexColorByName)("color-cold-gray-700"),ce=(0,se.getHexColorByName)("color-cold-gray-400");class he{constructor(e){this._container=null,this._errorCardRenderer=null,this._mainSeriesErrorMessage=null,this._banErrorMessage=new W.WatchedValue(null).spawn(),this._errorMessageHandler=e=>{this._chartWidget.hasModel()?this._updatePaneWidgets(e):this._renderErrorWithoutModel(e)},this._chartWidget=e,this._subscribeToMainSeriesErrors()}destroy(){var e,t -;null===(e=this._mainSeriesErrorMessage)||void 0===e||e.destroy(),this._banErrorMessage.destroy(),null===(t=this._errorCardRenderer)||void 0===t||t.then((e=>{e.container.remove(),e.destroy()}))}updatePaneWidgets(){this._updatePaneWidgets()}setContainer(e){var t;if(this._container!==e){this._container=e,null===(t=this._errorCardRenderer)||void 0===t||t.then((e=>e.container.remove()));const i=this._getErrorMessage();i&&this._errorMessageHandler(i)}}_updatePaneWidgets(e=this._getErrorMessage()){this._chartWidget.paneWidgets().forEach((t=>t.setErrorMessage(e)))}async _renderErrorWithoutModel(e){if(null===this._container||null===e&&null===this._errorCardRenderer)return;const t=await this._getErrorCardRenderer();this._container.contains(t.container)||this._container.appendChild(t.container),t.update(this._createErrorCardRendererState(e))}async _getErrorCardRenderer(){return this._errorCardRenderer||(this._errorCardRenderer=this._createErrorCardRenderer())}async _createErrorCardRenderer(){return new(await oe())}_createErrorCardRendererState(e){return e?{message:e.message,icon:e.icon,textColor:re.watchedTheme.value()===ne.StdTheme.Dark?ce:le,backgroundColor:re.watchedTheme.value()===ne.StdTheme.Dark?"#131722":"#FFF",solutionId:e.solutionId}:{message:null}}_subscribeToMainSeriesErrors(){const e=this._chartWidget;e.withModel(this,(()=>{const t=e.model().model().mainSeries();this._mainSeriesErrorMessage=(0,E.combine)(((e,t)=>{if(e)return e;switch(t){case"invalid_symbol":return{message:o.t(null,void 0,i(32619)),icon:"ghost"};case"no_data":return{message:o.t(null,void 0,i(95222)),icon:"ghost"};case null:return null}}),this._banErrorMessage.weakReference(),(0,ae.getSeriesDisplayErrorWV)(t).ownership()),this._mainSeriesErrorMessage.subscribe(this._errorMessageHandler,{callWithLast:!0})}))}_getErrorMessage(){var e;return this._banErrorMessage.value()||(null===(e=this._mainSeriesErrorMessage)||void 0===e?void 0:e.value())||null}}var de=i(31964),ue=i(91280),pe=i(38325),_e=i(75531),me=i(93613),ge=i(1803),fe=i(54355);class ve{constructor(e,t){this._showed=!1,this._cw=e,this._element=document.createElement("div"),this._element.classList.add(fe.screen),t.appendChild(this._element),this._cw.withModel(this,this._connectToModel)}show(e){if(e){const e=this._cw.model().mainSeries().status();if(1!==e&&2!==e)return}this._cw.setInLoadingState(!0),this._showed||(this._showed=!0,this._show())}hide(){this._cw.setInLoadingState(!1),this._showed&&this._hide()}isShown(){return this._showed}_connectToModel(){const e=this._cw.model().mainSeries().dataEvents();e.symbolError().subscribe(this,(e=>{e!==ge.permissionDenied&&this.hide()})),e.seriesError().subscribe(this,(()=>{(0,R.enabled)("hide_loading_screen_on_series_error")&&this.hide()})),e.completed().subscribe(this,this.hide)}_show(){const e=this._cw.properties().childs().paneProperties.childs();let t;if(e.backgroundType.value()===me.ColorType.Solid)t=e.background.value();else{t=`linear-gradient(${e.backgroundGradientStartColor.value()},${e.backgroundGradientEndColor.value()})`} -this._element.style.background=t,this._element.classList.add(fe.fade)}_hide(){this._showed=!1,this._element.classList.remove(fe.fade)}}function ye(e,t){let{deltaX:i,deltaY:s}=e;switch(i/=100,s/=100,t.deltaMode){case t.DOM_DELTA_PAGE:i*=120,s*=120;break;case t.DOM_DELTA_LINE:i*=32,s*=32}return{deltaX:i,deltaY:s}}class Se{constructor(){this._totalDeltaX=0,this._totalDeltaY=0,this._prevWheelTime=0}processWheel(e){e.timeStamp-this._prevWheelTime>100&&this._reset(),this._totalDeltaX+=e.deltaX,this._totalDeltaY+=e.deltaY,this._prevWheelTime=e.timeStamp;const t={deltaX:e.deltaX,deltaY:e.deltaY};return 0===this._totalDeltaX||0===this._totalDeltaY||(Math.abs(this._totalDeltaX)>=Math.abs(3*this._totalDeltaY)&&(t.deltaY=0),Math.abs(this._totalDeltaY)>=Math.abs(3*this._totalDeltaX)&&(t.deltaX=0)),ye(t,e)}_reset(){this._totalDeltaX=0,this._totalDeltaY=0}}var be=i(24377),we=i(37160),Ce=i(42184),Pe=i(16838),xe=i(30383);class Te{constructor(e,t,i){this._handleEl=null,this._resizeInfo=null,this._colorCache={lineColor:"",backgroundColor:"",color:""},this._chart=e,this._topPaneIndex=t,this._bottomPaneIndex=i,this._element=document.createElement("div"),this._element.classList.add(xe.paneSeparator),this._element.style.background=this._color(),this.adjustSize(),this._element.addEventListener("click",(()=>{}));const s=document.createElement("div");s.classList.add(xe.handle),this._element.appendChild(s),this._mouseEventHandler=new Ce.MouseEventHandler(s,this,{treatVertTouchDragAsPageScroll:!1,treatHorzTouchDragAsPageScroll:!0}),this._handleEl=s,Pe.PLATFORM_ACCESSIBILITY_ENABLED&&this._element.setAttribute("aria-hidden","true")}destroy(){this._mouseEventHandler.destroy(),this._element.parentElement&&this._element.parentElement.removeChild(this._element)}getElement(){return this._element}hide(){this._element.classList.add("js-hidden")}show(){this._element.classList.remove("js-hidden")}adjustSize(){this._element.style.height=Te.height()+"px"}mouseEnterEvent(e){const{topPane:t,bottomPane:i}=this._topBottomPane(!0);null!==t&&null!==i&&(0,r.ensureNotNull)(this._handleEl).classList.add(xe.hovered)}mouseLeaveEvent(e){(0,r.ensureNotNull)(this._handleEl).classList.remove(xe.hovered)}mouseDownEvent(e){this._mouseDownOrTouchStartEvent(e)}touchStartEvent(e){this._mouseDownOrTouchStartEvent(e)}pressedMouseMoveEvent(e){this._pressedMouseOrTouchMoveEvent(e)}touchMoveEvent(e){this._pressedMouseOrTouchMoveEvent(e)}mouseUpEvent(e){this._mouseUpOrTouchEndEvent(e)}touchEndEvent(e){this._mouseUpOrTouchEndEvent(e)}update(){this._element.style.background=this._color().toString()}paint(){}image(){const{topPane:e}=this._topBottomPane(!1),t=e.leftPriceAxisesContainer().getWidth(),i=e.width(),r=e.rightPriceAxisesContainer().getWidth(),n=this._color(),o=(0,U.createDisconnectedCanvas)(document,(0,s.size)({width:t,height:1})),a=(0,U.getPrescaledContext2D)(o);a.fillStyle=n,a.fillRect(0,0,t,1);const l=(0,U.createDisconnectedCanvas)(document,(0,s.size)({width:i,height:1})),c=(0,U.getPrescaledContext2D)(l);c.fillStyle=n,c.fillRect(0,0,i,1);const h=(0, -U.createDisconnectedCanvas)(document,(0,s.size)({width:r,height:1})),d=(0,U.getPrescaledContext2D)(h);return d.fillStyle=n,d.fillRect(0,0,r,1),{type:"separator",leftAxis:{content:o.toDataURL(),canvas:o,contentWidth:t,contentHeight:1},rightAxis:{content:h.toDataURL(),canvas:h,contentWidth:r,contentHeight:1},content:l.toDataURL(),canvas:l,contentWidth:i,contentHeight:1}}static height(){const e=window.devicePixelRatio||1;return e>=1?1:1/e}_mouseDownOrTouchStartEvent(e){const{topPane:t,bottomPane:i}=this._topBottomPane(!0);if(null===t||null===i)return;const s=t.state().stretchFactor()+i.state().stretchFactor(),n=s/(t.height()+i.height()),o=30*n;s<=2*o||(this._resizeInfo={startY:e.pageY,prevStretchTopPane:t.state().stretchFactor(),maxPaneStretch:s-o,totalStretch:s,pixelStretchFactor:n,minPaneStretch:o},(0,r.ensureNotNull)(this._handleEl).classList.add(xe.active))}_pressedMouseOrTouchMoveEvent(e){const{topPane:t,bottomPane:i}=this._topBottomPane(!0),s=this._resizeInfo;if(null===s||null===t||null===i)return;const r=(e.pageY-s.startY)*s.pixelStretchFactor,n=(0,we.clamp)(s.prevStretchTopPane+r,s.minPaneStretch,s.maxPaneStretch);t.state().setStretchFactor(n),i.state().setStretchFactor(s.totalStretch-n),this._chart.model().model().fullUpdate()}_mouseUpOrTouchEndEvent(e){const{topPane:t,bottomPane:i}=this._topBottomPane(!0),s=this._resizeInfo;null!==s&&null!==t&&null!==i&&(this._chart.model().addPaneStretchFactorUndoCommand(t.state(),i.state(),s.prevStretchTopPane,t.state().stretchFactor()),this._resizeInfo=null,(0,r.ensureNotNull)(this._handleEl).classList.remove(xe.active))}_color(){const e=this._chart.properties().childs().paneProperties.childs().separatorColor.value(),t=this._chart.model().model().backgroundColor().value();if(this._colorCache.lineColor!==e||this._colorCache.backgroundColor!==t){const i=(0,be.parseRgba)(t),s=(0,be.parseRgba)(e),r=0===i[3]&&0===s[3]?"rgba(0,0,0,0)":(0,be.rgbaToString)((0,be.blendRgba)(i,s));this._colorCache={lineColor:e,backgroundColor:t,color:r}}return this._colorCache.color}_topBottomPane(e){const t=this._chart.paneWidgets();let i=null,s=null;for(let s=this._topPaneIndex;s>=0;--s){const r=t[s];if(!e||!r.state().collapsed().value()){i=r;break}}for(let i=this._bottomPaneIndex;i.1&&(this._currentScale=i,Math.abs(this._currentScale-1)>.1?this._element.style.transform=`scale(${this._currentScale})`:(this._currentScale=1,this._element.style.transform=""))}drawLabelForScreenshot(e,t){if(null===this._info||"gear"===this._mode)return;const i=(0,Oe.makeFont)(t.fontSize,He.CHART_FONT_FAMILY);e.fillStyle=h.themes[t.theme].getThemedColor("color-price-axis-label-back"),e.globalAlpha=.5,e.beginPath();const s=je(t.fontSize)*ze/2,r=(0,Ae.point)(t.offset+t.width/2,t.height/2);e.arc(r.x,r.y,s,0,2*Math.PI,!0),e.fill(),e.globalAlpha=1,e.fillStyle=h.themes[t.theme].getThemedColor("color-price-axis-label-text"),e.textAlign="center",e.font=i,e.textBaseline="middle",e.fillText(this._info.label,r.x,r.y)}setAxisNameInfo(e){this._info=e,null!==e&&(this._labelElement.textContent=e.label)}static height(e){return(ze+Ue)*e}}var qe=i(10643),$e=i(94194);const Ye={enableTooltip:!0,showLabels:!0,enableMenu:!0,enableHighlight:!0};class Ke{constructor(e,t,i,r,n,o=null){this._invalidated=!0,this._size=(0,s.size)({width:0,height:0}),this._offset=0,this._axisInfo=null,this._onLabelHovered=new B.Delegate,this._highlighted=!1,this._labelMode="auto",this._fixedLabelMode=null,this._canvasConfiguredHandler=()=>this.update(),this._timeAxisWidget=o,this._isLeft="left"===e,this._rendererOptionsProvider=r.rendererOptionsProvider,this._sourcesTitlesProvider=r.sourcesTitlesProvider,this._contextMenuItemsProvider=r.contextMenuItemsProvider,this._backgroundBasedTheme=r.backgroundBasedTheme,this._getBackgroundTopColor=r.getBackgroundTopColor,this._getBackgroundBottomColor=r.getBackgroundBottomColor,this._showHorizontalBorder=Boolean(r.showHorizontalBorder),this._properties=t,this._axisInfo=i,this._labelOptions={...Ye,...n},this._properties.lineColor.subscribe(this,this._onPropertyChanged),this._cell=document.createElement("div"),this._cell.classList.add(We["price-axis-stub"]),this._labelOptions.enableTooltip&&this._cell.classList.add("apply-common-tooltip"),this._cell.style.width="25px",this._cell.style.height="100%",this._cell.style.position="absolute",this._cell.style.left="0",this._cell.style.overflow="hidden",this._labelOptions.showLabels?(this._label=new Ge,this._label.setAxisNameInfo(this._axisInfo),this._cell.appendChild(this._label.getElement()),this._labelOptions.enableTooltip&&(0,$e.setTooltipData)(this._cell,"text",(e=>this._tooltipContent()))):this._label=null,this._mouseEventHandler=new Ce.MouseEventHandler(this._cell,this,{treatHorzTouchDragAsPageScroll:!0,treatVertTouchDragAsPageScroll:!0}),this._canvasBinding=(0,U.createBoundCanvas)(this._cell,(0,s.size)({width:16,height:16})),this._canvasBinding.subscribeSuggestedBitmapSizeChanged(this._canvasConfiguredHandler) -;const a=this._canvasBinding.canvasElement;a.style.position="absolute",a.style.left="0",a.style.top="0",Pe.PLATFORM_ACCESSIBILITY_ENABLED&&this._cell.setAttribute("aria-hidden","true")}destroy(){this._canvasBinding.unsubscribeSuggestedBitmapSizeChanged(this._canvasConfiguredHandler),this._canvasBinding.dispose(),this._properties.lineColor.unsubscribe(this,this._onPropertyChanged),this._mouseEventHandler.destroy()}mouseEnterEvent(e){this._mouseOrTouchEnterEvent(e)}touchStartEvent(e){this._mouseOrTouchEnterEvent(e)}mouseLeaveEvent(e){this._mouseOrTouchLeaveEvent(e)}touchEndEvent(e){this._mouseOrTouchLeaveEvent(e)}mouseClickEvent(e){this._mouseClickOrTapEvent(e)}tapEvent(e){this._mouseClickOrTapEvent(e)}update(){}getElement(){return this._cell}onLabelHovered(){return this._onLabelHovered}setSizeAndOffset(e,t){(0,s.equalSizes)(this._size,e)||(this._size=e,this._canvasBinding.resizeCanvasElement(e),this._cell.style.width=`${e.width}px`,this._cell.style.minWidth=`${e.width}px`,this._cell.style.height=`${e.height}px`,this._invalidated=!0),this._offset!==t&&(this._offset=t,this._cell.style.left=`${t}px`)}paint(e){if(e{this.setLabelMode((0,r.ensureNotNull)(this._fixedLabelMode)),this._fixedLabelMode=null}))}}var Ze=i(10688);class Xe{constructor(e,t,i,r,n,o=null){this._axises=[],this._stubs=[],this._size=(0,s.size)({width:0,height:0}),this._onLabelHovered=new B.Delegate,this._scalesProperties=e,this._priceAxisWidgetFactory=i,this._timeAxisWidget=o,this._rendererOptionsProvider=r.rendererOptionsProvider,this._titlesProvider=r.titlesProvider,this._stubContextMenuProvider=r.stubContextMenuProvider,this._backgroundBasedTheme=r.backgroundBasedTheme,this._getBackgroundTopColor=r.getBackgroundTopColor,this._getBackgroundBottomColor=r.getBackgroundBottomColor,this._showHorisontalBorder=Boolean(r.showHorizontalBorder),this._labelsOptions={...Ye,...n};const a=this._scalesProperties.childs();this._stubProperties={lineColor:a.lineColor,fontSize:a.fontSize},this._side=t,this._cell=document.createElement("div"),this._cell.classList.add("chart-markup-table","price-axis-container"),this._cell.style.width="25px",this._cell.style.position="relative"}destroy(){this.setScales([],0,0,0)}onLabelHovered(){return this._onLabelHovered}setScales(e,t,i,s){for(;e.length>this._axises.length&&this._axises.lengtho;){const e=(0,r.ensureDefined)(this._stubs.pop());e.onLabelHovered().unsubscribeAll(this),this._cell.removeChild(e.getElement()),e.destroy()}for(;this._stubs.length{this._labelsOptions.showLabels&&this._labelsOptions.enableHighlight&&this._onLabelHovered.fire({owner:t,axis:(0,r.ensureNotNull)(e)},i)})),this._stubs.push(t),this._cell.appendChild(t.getElement())}const a=this._labelsOptions.enableMenu;1===s?this._stubs.forEach(((e,t)=>e.setLabelMode(a?"gear":"symbol"))):this._stubs.forEach(((e,t)=>e.setLabelMode(te.updateCurrencyLabel()))}optimalWidths(){return this._axises.map((e=>e.optimalWidth()))}setSizes(e,t){this._size=(0,s.size)({width:t.reduce(((e,t)=>e+t),0),height:e}),this._cell.style.width=this._size.width+"px",this._cell.style.minWidth=this._size.width+"px",this._cell.style.height=this._size.height+"px",t.length!==this._axises.length+this._stubs.length&&(0,r.assert)(t.length===this._axises.length+this._stubs.length,"Widgets count should be the same as widths one");let i=0;this._forEachWidgetFromLeft(((r,n)=>{const o=t[n];r.setSizeAndOffset((0,s.size)({width:o,height:e}),i),i+=o}))}update(){this._axises.forEach((e=>e.update())),this._stubs.forEach((e=>e.update()))}paint(e){this._axises.forEach(((t,i)=>t.paint(e(i)))),this._stubs.forEach(((t,i)=>t.paint(e(i))))}paintStubs(e){this._stubs.forEach((t=>t.paint(e)))}restoreDefaultCursor(){this._axises.forEach((e=>e.restoreDefaultCursor()))}getWidth(){return this._size.width}findAxisWidgetForScale(e){const t=this._axises.find((t=>t.priceScale()===e));return void 0===t?null:t}getScreenshotData(){const e=this._getImage();return{canvas:e,content:e.toDataURL(),contentHeight:this._size.height,contentWidth:this._size.width}}getImage(){return this._getImage()}slotsCount(){return this._axises.length+this._stubs.length}highlightPriceAxisByLabel(e){this._axises.forEach((t=>{const i=t.axisInfo();t.setHighlighted(null!==i&&i.equals(e))}))}axes(){return this._axises}_stubParams(e){return{rendererOptionsProvider:this._rendererOptionsProvider,backgroundBasedTheme:this._backgroundBasedTheme,sourcesTitlesProvider:()=>this._titlesProvider(this._side,e),contextMenuItemsProvider:()=>this._stubContextMenuProvider(this._side,e),getBackgroundTopColor:this._getBackgroundTopColor,getBackgroundBottomColor:this._getBackgroundBottomColor,showHorizontalBorder:this._showHorisontalBorder}}_getImage(){const e=(0, -U.createDisconnectedCanvas)(document,this._size),t=(0,U.getPrescaledContext2D)(e);let i=0;return this._forEachWidgetFromLeft(((e,s)=>{const r=e.getWidth();0!==r&&0!==this._size.height&&(t.drawImage(e.getImage(),i,0,r,this._size.height),i+=r)})),e}_forEachWidgetFromLeft(e){const t=[...this._axises,...this._stubs],i="left"===this._side,s=i?-1:t.length,r=i?-1:1;for(let n=i?t.length-1:0;n!==s;n+=r)e(t[n],n,t)}}var Je=i(34565),Qe=i(55824),et=i(60682);class tt{constructor(){this._width=null,this._labelBottom=null,this._currencyInfo=null,this._unitInfo=null,this._measureUnitIdInfo=null,this._fontSize=0,this._currencyAndUnitLabelsWrapper=document.createElement("div"),this._currencyAndUnitLabelsWrapper.className=et["price-axis-currency-label-wrapper"],this._currencyAndUnitLabelsWrapper.setAttribute("data-name","currency-unit-label-wrapper"),this._controlsContainer=document.createElement("div"),this._controlsContainer.className=et["price-axis-currency-label"],this._currencyAndUnitLabelsWrapper.appendChild(this._controlsContainer),this._currencyLabelDiv=document.createElement("div"),this._currencyLabelDiv.className=et.row,this._currencyLabelDiv.classList.add("apply-common-tooltip"),(0,$e.setTooltipData)(this._currencyLabelDiv,"text",(e=>this._currencyTooltipContent())),this._currencyText=document.createElement("div"),this._currencyText.className=et["price-axis-currency-label-text"],this._currencyLabelDiv.appendChild(this._currencyText),this._currencyArrowDown=document.createElement("div"),this._currencyArrowDown.className=et["price-axis-currency-label-arrow-down"],this._currencyArrowDown.innerHTML=Qe,this._currencyLabelDiv.appendChild(this._currencyArrowDown),this._measureUnitIdLabelDiv=document.createElement("div"),this._measureUnitIdLabelDiv.className=et.row,this._measureUnitIdLabelDiv.classList.add("apply-common-tooltip"),this._measureUnitIdLabelDiv.classList.add("readonly"),(0,$e.setTooltipData)(this._measureUnitIdLabelDiv,"text",(e=>this._measureUnitIdTooltipContent())),this._measureUnitIdText=document.createElement("div"),this._measureUnitIdText.className=et["price-axis-currency-label-text"],this._measureUnitIdLabelDiv.appendChild(this._measureUnitIdText),this._unitLabelDiv=document.createElement("div"),this._unitLabelDiv.className=et.row,this._unitLabelDiv.classList.add("apply-common-tooltip"),(0,$e.setTooltipData)(this._unitLabelDiv,"text",(e=>this._unitTooltipContent())),this._unitText=document.createElement("div"),this._unitText.className=et["price-axis-currency-label-text"],this._unitLabelDiv.appendChild(this._unitText),this._unitArrowDown=document.createElement("div"),this._unitArrowDown.className=et["price-axis-currency-label-arrow-down"],this._unitArrowDown.innerHTML=Qe,this._unitLabelDiv.appendChild(this._unitArrowDown),this._controlsContainer.appendChild(this._currencyLabelDiv),this._controlsContainer.appendChild(this._measureUnitIdLabelDiv),this._controlsContainer.appendChild(this._unitLabelDiv),this.disableCurrency(),this.disableUnit()}element(){return this._currencyAndUnitLabelsWrapper}currencyLabelElement(){ -return this._currencyLabelDiv}unitLabelElement(){return this._unitLabelDiv}isEnabled(){return this.currencyLabelEnabled()||this.unitLabelEnabled()||this.measureUnitIdLableEnabled()}isHidden(){return this._currencyAndUnitLabelsWrapper.classList.contains(et.hidden)}setCurrencyExpanded(e){this._currencyLabelDiv.classList.toggle(et.expanded,e)}setUnitExpanded(e){this._unitLabelDiv.classList.toggle(et.expanded,e)}width(){if(null!==this._width)return this._width;let e=0;if(this.currencyLabelEnabled()){const t=this._currencyText.getBoundingClientRect(),i=this._currencyArrowDown.getBoundingClientRect();e=Math.max(e,t.width+i.width+2*this._textMarginAndPadding())}if(this.measureUnitIdLableEnabled()){const t=this._measureUnitIdText.getBoundingClientRect();e=Math.max(e,t.width+2*this._textMarginAndPadding())}if(this.unitLabelEnabled()){const t=this._unitText.getBoundingClientRect(),i=this._unitArrowDown.getBoundingClientRect();e=Math.max(e,t.width+i.width+2*this._textMarginAndPadding())}return this._width=e}drawLabel(e,t,i){var s,r,n;if(!this.isEnabled())return;const o=Math.round(Number(et.css_wrapper_margin)*i),a=(0,we.ceiledEven)(t*i)-2*o,l=Math.round(this.labelBottom()*i),c=l-2*o,h=Math.round(Number(et.css_value_currency_label_radius)*i);e.fillStyle=getComputedStyle(this._currencyAndUnitLabelsWrapper).backgroundColor,e.fillRect(0,0,Math.ceil(t*i),l);const d=[];d.push(this.currencyLabelEnabled()&&null!==(s=this._currencyText.textContent)&&void 0!==s?s:""),d.push(this.measureUnitIdLableEnabled()&&null!==(r=this._measureUnitIdText.textContent)&&void 0!==r?r:""),d.push(this.unitLabelEnabled()&&null!==(n=this._unitText.textContent)&&void 0!==n?n:""),e.font=(0,Oe.makeFont)(this._fontSize,He.CHART_FONT_FAMILY);const u=new Je.TextWidthCache;let p=0;const _=[];d.forEach((t=>{let i=0;""!==t&&(i=u.yMidCorrection(e,t),p++),_.push(i)}));const m=c/p;e.beginPath();const g=getComputedStyle(this._controlsContainer);e.fillStyle=g.backgroundColor,e.strokeStyle=g.borderColor,(0,Ne.drawRoundRect)(e,o,o,a,c,h),e.fill(),e.stroke(),e.fillStyle=getComputedStyle(this._currencyLabelDiv).color,e.textBaseline="middle",e.textAlign="left";const f=Math.round(this._textMarginAndPadding()*i)+o,v=m/2;let y=o+v;d.forEach(((t,s)=>{""!==t&&((0,U.drawScaled)(e,i,i,(()=>{e.fillText(t,f/i,(y+_[s])/i)})),y=Math.ceil(y+2*v))}))}setHidden(e){this._currencyAndUnitLabelsWrapper.classList.toggle(et.hidden,e)}enableCurrency(){this._currencyLabelDiv.classList.remove("js-hidden"),this._resetSizesAndVisibility()}disableCurrency(){this._currencyLabelDiv.classList.add("js-hidden"),this._resetSizesAndVisibility()}enableUnit(){this._unitLabelDiv.classList.remove("js-hidden"),this._resetSizesAndVisibility()}disableUnit(){this._unitLabelDiv.classList.add("js-hidden"),this._resetSizesAndVisibility()}enableMeasureUnitId(){this._measureUnitIdLabelDiv.classList.remove("js-hidden"),this._resetSizesAndVisibility()}disableMeasureUnitId(){this._measureUnitIdLabelDiv.classList.add("js-hidden"),this._resetSizesAndVisibility()}currencyLabelEnabled(){ -return!this._currencyLabelDiv.classList.contains("js-hidden")}unitLabelEnabled(){return!this._unitLabelDiv.classList.contains("js-hidden")}measureUnitIdLableEnabled(){return!this._measureUnitIdLabelDiv.classList.contains("js-hidden")}currencyConversionAvailable(){return!this._currencyLabelDiv.classList.contains("readonly")}unitConversionAvailable(){return!this._unitLabelDiv.classList.contains("readonly")}setCurrencyInfo(e){if(this._currencyInfo===e)return!1;this._currencyInfo=e;const t=null===e.selectedCurrency?o.t(null,void 0,i(95093)):(0,r.ensureDefined)(e.displayedValues.get(e.selectedCurrency));return this._currencyText.textContent!==t&&(this._currencyText.textContent=t,this._width=null),this._currencyArrowDown.classList.contains("js-hidden")!==e.readOnly&&(this._currencyArrowDown.classList.toggle("js-hidden",e.readOnly),this._currencyLabelDiv.classList.toggle("readonly",e.readOnly),this._width=null),!0}setUnitInfo(e){if(null!==this._unitInfo&&this._unitInfo.selectedUnit===e.selectedUnit&&0===this._unitInfo.availableGroups.size==(0===e.availableGroups.size)&&this._unitInfo.originalUnits.size===e.originalUnits.size)return this._unitInfo=e,!1;this._unitInfo=e;const t=null===e.selectedUnit?o.t(null,void 0,i(95093)):(0,r.ensureDefined)(e.names.get(e.selectedUnit));return this._unitText.textContent!==t&&(this._unitText.textContent=t,this._width=null),this._unitArrowDown.classList.contains("js-hidden")!==(0===e.availableGroups.size)&&(this._unitArrowDown.classList.toggle("js-hidden",0===e.availableGroups.size),this._unitLabelDiv.classList.toggle("readonly",0===e.availableGroups.size),this._width=null),!0}setMeasureUnitIdInfo(e){if(this._measureUnitIdInfo===e)return!1;this._measureUnitIdInfo=e;const t=null===e.selectedMeasureUnitId?o.t(null,void 0,i(95093)):(0,r.ensureDefined)(e.names.get(e.selectedMeasureUnitId));return this._measureUnitIdText.textContent!==t&&(this._measureUnitIdText.textContent=t,this._width=null),this._measureUnitIdLabelDiv.classList.contains("js-hidden")!==(0===e.names.size)&&(this._measureUnitIdLabelDiv.classList.toggle("js-hidden",0===e.names.size),this._width=null),!0}currencyInfo(){return this._currencyInfo}unitInfo(){return this._unitInfo}measureUnitIdInfo(){return this._measureUnitIdInfo}setFontSize(e){this._fontSize!==e&&(this._fontSize=e,this._currencyLabelDiv.style.fontSize=e+"px",this._measureUnitIdLabelDiv.style.fontSize=e+"px",this._unitLabelDiv.style.fontSize=e+"px",this._width=null,this._labelBottom=null)}labelBottom(){if(null!==this._labelBottom)return this._labelBottom;const e=this._controlsContainer.getBoundingClientRect(),t=this._currencyAndUnitLabelsWrapper.getBoundingClientRect(),i=e.y-t.y;return this._labelBottom=e.height+2*i}_resetSizesAndVisibility(){this._width=null,this._labelBottom=null,this._updateVisibility()}_textMarginAndPadding(){return Number(et.css_wrapper_margin)+Number(et.css_row_left_right_padding)+2}_currencyTooltipContent(){const e=this._currencyInfo;return null===e?"":null===e.selectedCurrency?Array.from(e.currencies).map((t=>(0, -r.ensureDefined)(e.displayedValues.get(t)))).join(", "):e.displayedValues.get(e.selectedCurrency)||""}_unitTooltipContent(){const e=this._unitInfo;return null===e?"":null===e.selectedUnit?Array.from(e.units).map((t=>(0,r.ensureDefined)(e.names.get(t)))).join(", "):e.descriptions.get(e.selectedUnit)||""}_measureUnitIdTooltipContent(){const e=this._measureUnitIdInfo;return null===e?"":null===e.selectedMeasureUnitId?Array.from(e.measureUnitIds).map((t=>(0,r.ensureDefined)(e.names.get(t)))).join(", "):e.descriptions.get(e.selectedMeasureUnitId)||""}_updateVisibility(){const e=this.isEnabled();this._currencyAndUnitLabelsWrapper.classList.toggle("js-hidden",!e)}}async function it(e,t,s,r){const{UnitConversionRenderer:n}=await Promise.all([i.e(2666),i.e(956),i.e(2109),i.e(4015),i.e(3842),i.e(5145),i.e(855),i.e(6),i.e(2587),i.e(6752),i.e(6036),i.e(6025),i.e(7111),i.e(962),i.e(6408),i.e(2544),i.e(5057),i.e(2704)]).then(i.bind(i,41153));return new n(e,s,t,r)}var st=i(68335),rt=i(77212),nt=i(10786),ot=i(24120),at=i(42226),lt=i(39875),ct=i(97754),ht=i.n(ct),dt=i(58035);class ut{constructor({setMode:e,className:t=""}){const s=this._wrapper=document.createElement("div");s.classList.add(t),s.addEventListener("dblclick",this._stopPropagation,{capture:!0}),s.addEventListener("touchstart",this._stopPropagation,{capture:!0});const r=s.appendChild(document.createElement("div"));r.className=dt.priceScaleModeButtons,this._autoScaleButton=r.appendChild(this._createButton({title:o.t(null,{context:'The first letter of the "auto" word'},i(9846)),tooltip:o.t(null,void 0,i(50834)),onClick:()=>e("auto"),ariaLabel:Pe.PLATFORM_ACCESSIBILITY_ENABLED?o.t(null,void 0,i(74327)):void 0})),this._logarithmButton=r.appendChild(this._createButton({title:o.t(null,{context:'The first letter of the "logarithmic" word'},i(55765)),tooltip:o.t(null,void 0,i(12285)),onClick:()=>e("log"),ariaLabel:Pe.PLATFORM_ACCESSIBILITY_ENABLED?o.t(null,void 0,i(84112)):void 0}))}destroy(){this._wrapper.removeEventListener("dblclick",this._stopPropagation),this._wrapper.removeEventListener("touchstart",this._stopPropagation),this._autoScaleButton.remove(),this._logarithmButton.remove(),this._wrapper.remove()}element(){return this._wrapper}width(){return 52}updateMode(e){const{log:t,autoScale:i}=e;this._logarithmButton.classList.toggle(dt.priceScaleModeButtons__button_activated,!!t),this._autoScaleButton.classList.toggle(dt.priceScaleModeButtons__button_activated,!!i)}_createButton(e){const{ariaLabel:t,title:i,tooltip:s,onClick:r}=e,n=document.createElement("button");return n.className=ht()(dt.priceScaleModeButtons__button,"apply-common-tooltip"),n.textContent=i,n.dataset.tooltip=s,n.addEventListener("click",r),t&&n.setAttribute("aria-label",t),n}_stopPropagation(e){e.stopPropagation()}}i(47184) +_createStudy(e){return Promise.reject("Pine Script™ and java studies are not supported")}_convertTimeToPublic(e){return this._getTimeConverter().convertInternalTimeToPublicTime(e)}_convertIndexToPublicTime(e){return null===this._chartWidget.model().mainSeries().symbolInfo()?null:this._getTimeConverter().convertTimePointIndexToPublicTime(e)}_getDefaultCreateMultipointShapeOptions(){return{filled:!0}}_convertPositionPercentToPricedPoint(e,t){const i=this._chartWidget.model().timeScale(),s=t.priceScale(),r=t.firstValue();if(null==r||!isFinite(r)||null===s)return null;const n=i.coordinateToIndex(e.x*i.width()),o=i.indexToTimePoint(n);if(null===o)return null;return{price:s.coordinateToPrice(e.y*s.height(),r),time:o}}_convertUserPointsToDataSource(e){const t=this._chartWidget.model().model(),i=t.mainSeries(),r=t.timeScale().points(),n=i.data();if(t.timeScale().isEmpty())return null;const o=e.map((e=>e.time||0)),a=this._alignPoints(o),l=(e,t,o)=>{const a=r.closestIndexLeft(e)||0,l={index:a,price:NaN},c=(0,s.ensureNotNull)(r.valueAt(a)),h=(0,s.ensureNotNull)(r.range().value());if(e>c&&a===h.lastIndex){const t=(0,s.ensureNotNull)(i.syncModel()).distance(c,e);t.success&&(l.index=l.index+t.result)}else if(ee.visible()&&0!==e.title().length)).map((e=>({title:e.title(),value:e.value()})));d.entityValues[t.id()]={isHovered:s,values:r,title:i.header()}} +this._crosshairMoved.fire(d)}_makeSubscriptionFromDelegate(e){return{subscribe:e.subscribe.bind(e),unsubscribe:e.unsubscribe.bind(e),unsubscribeAll:e.unsubscribeAll.bind(e)}}_prepareEndOfPeriodArgs(){const e=this._chartWidget.model().model(),t=e.timezone(),i=(0,s.ensureNotNull)(e.mainSeries().symbolInfo()),r=e.mainSeries().interval(),n=new c.SessionInfo(t,i.session,i.session_holidays,i.corrections);return{barBuilder:(0,c.newBarBuilder)(r,n,n),intervalObj:a.Interval.parse(r)}}_getPaneApi(e){let t=this._panes.get(e);return void 0===t&&(t=new w(e,this._chartWidget),this._panes.set(e,t)),t}_getStudyApi(e){let t=this._studies.get(e);return void 0===t&&(t=new R(e,this._chartWidget),this._studies.set(e,t)),t}_getLineDataSourceApi(e){let t=this._lineDataSources.get(e);return void 0===t&&(t=new N.LineDataSourceApi(e,this._chartWidget.model(),{apiPointsToDataSource:this._convertUserPointsToDataSource.bind(this),dataSourcePointsToPriced:e=>{const t=(0,s.ensureNotNull)(this._chartWidget.model().mainSeries().syncModel()),i=this._chartWidget.model().timeScale();return e.map((e=>{const s=i.normalizeBarIndex(e.index);return{price:e.price,time:this._convertTimeToPublic(t.projectTime(s.time_t,s.offset))}}))}}),this._lineDataSources.set(e,t)),t}_alignPoints(e){const t=this._chartWidget.model().model(),i=t.mainSeries(),s=i.interval(),r=i.symbolInfo();if(t.timeScale().isEmpty()||!a.Interval.isDWM(s)||null===r)return e;const n=(0,X.createDwmAligner)(s,r);return null===n?e:e.map((e=>n.timeToSessionStart(1e3*e)/1e3))}_onLogicalRangeChanged(){const e=this._chartWidget.model().mainSeries(),t=e.data().isEmpty();if(null!==this._chartWidget.model().timeScale().visibleBarsStrictRange()&&t)return void e.dataEvents().completed().subscribe(this,this._onLogicalRangeChanged,!0);const i=this.getVisibleRange();null!==this._prevVisibleRange&&(0,v.deepEquals)(this._prevVisibleRange,i)[0]||(this._prevVisibleRange=i,this._visibleBarsChanged.fire(i))}_canUseLineToolsSynchronizer(e){if(!o.enabled("saveload_separate_drawings_storage"))throw new Error(`${e} can only be used when 'saveload_separate_drawings_storage' featureset is enabled`)}}},66764:(e,t,i)=>{"use strict";i.d(t,{getChartWidgetApiTimeConverter:()=>n});var s=i(50151),r=i(77475);function n(e,t,i){return new a(function(e,t){const i=function(e,t){return e+t.session+t.timezone+(t.corrections||"")+(t.session_holidays||"")}(e,t);let s=o.get(i);void 0===s&&(s=(0,r.createDwmAligner)(e,t),o.set(i,s));return s}(e,t),i)}const o=new Map;class a{constructor(e,t){this._dwmAligner=e,this._chartModel=t}convertPublicTimeToInternalTime(e){return null!==this._dwmAligner?this._dwmAligner.timeToSessionStart(1e3*e)/1e3:e}convertInternalTimeToPublicTime(e){return null!==this._dwmAligner?this._dwmAligner.timeToExchangeTradingDay(1e3*e)/1e3:e}convertTimePointIndexToPublicTime(e){let t=this.convertTimePointIndexToInternalTime(e);return null!==t&&(t=this.convertInternalTimeToPublicTime(t)),t}convertTimePointIndexToInternalTime(e){const t=this._chartModel.timeScale();if(t.isEmpty())return null +;const i=t.points(),{firstIndex:r,lastIndex:n}=(0,s.ensureNotNull)(i.range().value());let o=null;if(r<=e&&e<=n)o=i.valueAt(e);else if(e>n){const i=this._chartModel.mainSeries().syncModel();if(null!==i){const r=(0,s.ensureNotNull)(t.indexToTimePoint(n));o=i.projectTime(r,e-n)}}return o}}},58487:(e,t,i)=>{"use strict";i.d(t,{ChartWidgetBase:()=>qi});var s=i(27714),r=i(50151),n=i(3343),o=i(11542),a=i(76422),l=(i(82992),i(49483)),c=i(56840),h=i(11014),d=i(51768),u=i(87095),p=i(59224),_=i(5894),m=i(53180),g=i(51608);function f(e,t){const i=Object.create(Object.getPrototypeOf(e));for(const s of t)Object.prototype.hasOwnProperty.call(e,s)&&(i[s]=e[s]);return i}var v=i(82723),y=i(90995),S=i(85067);let b;class w extends S.DialogRenderer{constructor(){super(),this._dialog=null,this._subscribe=e=>{this._setVisibility(e)}}show(){this._load().then((e=>e.show()))}hide(){var e;null===(e=this._dialog)||void 0===e||e.hide()}static getInstance(){return b||(b=new w),b}_load(){return Promise.all([i.e(2666),i.e(956),i.e(2109),i.e(4015),i.e(3842),i.e(5145),i.e(855),i.e(6),i.e(5649),i.e(8056),i.e(5993),i.e(6221),i.e(6752),i.e(8149),i.e(6106),i.e(4781),i.e(9465),i.e(6747),i.e(3780),i.e(962),i.e(1740),i.e(4062),i.e(6408),i.e(2544),i.e(5057),i.e(2052),i.e(3263),i.e(5164),i.e(4862)]).then(i.bind(i,56396)).then((e=>{var t,i;return null===(t=this._dialog)||void 0===t||t.hide(),null===(i=this._dialog)||void 0===i||i.visible().unsubscribe(this._subscribe),this._dialog=new e.ObjectTreeDialogRenderer,this._dialog.visible().subscribe(this._subscribe),this._dialog}))}}var C=i(1722),P=i(33703),x=i(88640);async function T(e,t,s,r,n,a="default"){let l,c=[];const h=e.model().model(),d=(0,C.clone)(t),u=new x.default({inputs:d}),p=function(e,t){return"symbol"===t?e.inputs.filter((t=>t.id===e.symbolInputId())):e.inputs.filter((e=>e.confirm))}(s,a),_=()=>{l&&h.removeCustomSource(l)},m=()=>{_(),n()},g=e=>{r({inputs:e,parentSources:c}),_()},f=p.filter(P.isTimeOrPriceNotHiddenInput);if(f.length>0)try{const t=await Promise.all([i.e(5362),i.e(2666),i.e(956),i.e(2109),i.e(4015),i.e(3842),i.e(5145),i.e(855),i.e(6),i.e(8056),i.e(5993),i.e(2191),i.e(6221),i.e(2587),i.e(2639),i.e(3502),i.e(9842),i.e(7807),i.e(3353),i.e(4215),i.e(9327),i.e(6625),i.e(7194),i.e(6884),i.e(5940),i.e(1762),i.e(962),i.e(1740),i.e(6408),i.e(750),i.e(4403),i.e(4713),i.e(7051),i.e(3030)]).then(i.bind(i,73339)),r=await t.selectInputValuesOnChart(e,f,u,s.shortDescription,s.inputs);if(l=r.customSourceId,r.destPane){const e=r.destPane.mainDataSource();c=e===h.mainSeries()?[]:[e]}else c=[]}catch(e){return void m()}f.length!==p.length?Promise.all([i.e(5362),i.e(2666),i.e(956),i.e(2109),i.e(4015),i.e(3842),i.e(5145),i.e(855),i.e(6),i.e(8056),i.e(5993),i.e(2191),i.e(6221),i.e(2587),i.e(2639),i.e(3502),i.e(9842),i.e(7807),i.e(3353),i.e(4215),i.e(9327),i.e(6625),i.e(7194),i.e(6884),i.e(5940),i.e(1762),i.e(962),i.e(1740),i.e(6408),i.e(750),i.e(4403),i.e(4713),i.e(7051),i.e(3030)]).then(i.bind(i,29638)).then((t=>{const r=new t.ConfirmInputsDialogRenderer(function(e){ +if("symbol"===e)return o.t(null,void 0,i(45743));return o.t(null,void 0,i(46689))}(a),p,u,a,s,e.model(),g,m);return r.show(),r})):g(u.state().inputs||{})}let I=null;i(83135);var M=i(70027),A=i(58096);const L=(0,M.parseHtmlElement)(function(e=""){return`
`}());class k{constructor(e){this._shown=!1,this._el=L.cloneNode(!0),this.setSize(A.spinnerSizeMap[e||A.DEFAULT_SIZE])}spin(e){return this._el.classList.add("tv-spinner--shown"),void 0===this._container&&(this._container=e,void 0!==e&&e.appendChild(this._el)),this._shown=!0,this}stop(e){return e&&void 0!==this._container&&this._container.removeChild(this._el),this._el&&this._el.classList.remove("tv-spinner--shown"),this._shown=!1,this}setStyle(e){return Object.keys(e).forEach((t=>{const i=e[t];void 0!==i&&this._el.style.setProperty(t,i)})),this}style(){return this._el.style}setSize(e){const t=void 0!==e?`tv-spinner--size_${e}`:"";return this._el.className=`tv-spinner ${t} ${this._shown?"tv-spinner--shown":""}`,this}getEl(){return this._el}destroy(){this.stop(),delete this._el,delete this._container}}var D=i(78071),E=i(97906),V=i(38618),B=i(57898),R=i(14483);function N(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function O(e){return e.reduce(((e,t)=>{for(const i in t)if(N(t,i)){const s=t[i],r=e[i];r?r.push(s):e[i]=[s]}return e}),{})}var F=i(36298),W=i(97145),H=i(39347),z=i(86909),U=(i(3994),i(74359)),j=i(28571);const G=new F.TranslatedString("move left",o.t(null,void 0,i(15086))),q=new F.TranslatedString("move right",o.t(null,void 0,i(61711)));class ${constructor(e){this._chartModel=null,this._animation=null,this._chart=e,this._chart.withModel(this,(()=>{this._chartModel=this._chart.model()}))}destroy(){var e;null===(e=this._animation)||void 0===e||e.stop()}move(e){if(null!==this._chartModel){const t=this._chartModel.timeScale();if(t.isEmpty())return;const i=t.barSpacing(),s=.003/i,r=1.1/i,n=Math.round(r/s);this._moveImpl(e,((t,i,o)=>{const a=Math.min(i,n),l=e*s*Math.pow(a,2)/2;if(i<=n)return t-l;const c=Number.isFinite(o)?Math.max(0,n-o):0;return t-l-e*(i-a-c)*r-e*(r*c-s*Math.pow(c,2)/2)}),(e=>Math.max(0,n-e)+n))}}moveByBar(e){if(null!==this._chartModel){if(this._chartModel.timeScale().isEmpty())return;const t=300;this._moveImpl(e,((i,s)=>i-e*(Math.floor(Math.max(0,s-t)/100)+1)),(()=>0),!0)}}stopMove(){var e;null===(e=this._animation)||void 0===e||e.stop(),this._animation=null}scrollToRealtime(e){null!==this._chartModel&&this._chartModel.timeScale().scrollToRealtime(e)}_moveImpl(e,t,i,s){if(null===this._chartModel)return;const r=this._chartModel.timeScale();if(r.isEmpty())return;if(this._chartModel.changeTimeScale(1===e?G:q),s&&null!==r.visibleBarsStrictRange()){const e=r.indexToCoordinate(r.visibleBarsStrictRange().lastBar())+r.barSpacing()/2;Math.abs(r.width()-e)>r.barSpacing()/6&&r.setRightOffset(Math.round(r.rightOffset()))}const n=performance.now();let o=1/0;const a=r.rightOffset();this._animation={getPosition:e=>(e=Math.min(o,e),t(a,e-n,o-e)),finished:e=>e>=o,stop:()=>{const e=performance.now()-n +;o=performance.now()+i(e)}},this._chartModel.model().setTimeScaleAnimation(this._animation)}}var Y=i(14787);function K(e,t,s,r,n){return Promise.all([i.e(5362),i.e(2285),i.e(6306),i.e(2666),i.e(956),i.e(2109),i.e(4015),i.e(3842),i.e(5145),i.e(855),i.e(6),i.e(5649),i.e(8056),i.e(5993),i.e(2191),i.e(6221),i.e(2587),i.e(2639),i.e(3502),i.e(8149),i.e(9842),i.e(7807),i.e(3353),i.e(4215),i.e(6036),i.e(9327),i.e(6625),i.e(7194),i.e(6884),i.e(5940),i.e(3980),i.e(826),i.e(2486),i.e(4894),i.e(7391),i.e(7555),i.e(962),i.e(1740),i.e(750),i.e(4403),i.e(4713),i.e(7051),i.e(5664),i.e(4648),i.e(5983),i.e(6265)]).then(i.bind(i,63374)).then((i=>{const o=new(0,i.EditObjectDialogRenderer)(e,t,r,n);return o.show(s),o}))}var Z=i(28853);let X=null;var J=i(58229),Q=i(92249);const ee={[Y.TabNames.symbol]:"symbol",[Y.TabNames.legend]:"legend",[Y.TabNames.scales]:"scales",[Y.TabNames.trading]:"trading",[Y.TabNames.events]:"events",[Y.TabNames.eventsAndAlerts]:"events",[Y.TabNames.timezoneSessions]:"canvas",[Y.TabNames.text]:"text",[Y.TabNames.style]:"style",[Y.TabNames.visibility]:"visibility"},te={[Y.TabNames.style]:"style",[Y.TabNames.visibility]:"visibilities"};async function ie(e,t,s={},r,n){const o=r.activeChartWidget.value(),{initialTab:a,tabName:l}=s;if(l&&!a&&(s.initialTab=te[l]),(0,Q.isStudyLineTool)(e)&&function(e){return[J.LineToolVbPFixed,null].filter(C.notNull).some((t=>e instanceof t))}(e))return o.propertiesDefinitionsForSource(e).then((i=>null!==i?K(e,t,s,n,i):null));if((0,Z.isStudy)(e)&&function(e){const{shortId:t}=e.metaInfo();return"Overlay"===t}(e)||(0,Q.isLineTool)(e))return o.propertiesDefinitionsForSource(e).then((r=>{if(null!==r){return function(e){return Promise.all([i.e(5362),i.e(2666),i.e(956),i.e(2109),i.e(4015),i.e(3842),i.e(5145),i.e(855),i.e(6),i.e(5649),i.e(8056),i.e(5993),i.e(2191),i.e(6221),i.e(2587),i.e(2639),i.e(3502),i.e(8149),i.e(9842),i.e(7807),i.e(3353),i.e(4215),i.e(9327),i.e(6625),i.e(7194),i.e(6884),i.e(5940),i.e(3980),i.e(826),i.e(2486),i.e(7391),i.e(8904),i.e(962),i.e(1740),i.e(750),i.e(4403),i.e(4713),i.e(7051),i.e(5664),i.e(4648),i.e(5983),i.e(6780)]).then(i.bind(i,75892)).then((t=>{const i=new(0,t.SourcePropertiesEditorRenderer)(e);return null!==X&&X.hide(),i.show({shouldReturnFocus:e.shouldReturnFocus}),X=i,i}))}({propertyPages:r,model:t,source:e,activePageId:l&&ee[l],shouldReturnFocus:s.shouldReturnFocus})}return null}));if((0,Z.isStudy)(e))return K(e,t,s,n);{const e=l&&ee[l],t=r.getChartPropertiesDialogRenderer();return t.setActivePage(e),t.show(s)}}var se=i(33013),re=i(45345),ne=i(24633);async function oe(){return(await Promise.all([i.e(5866),i.e(962),i.e(139)]).then(i.bind(i,81200))).ErrorCardRenderer}var ae=i(42960);const le=(0,se.getHexColorByName)("color-cold-gray-700"),ce=(0,se.getHexColorByName)("color-cold-gray-400");class he{constructor(e){this._container=null,this._errorCardRenderer=null,this._mainSeriesErrorMessage=null,this._banErrorMessage=new W.WatchedValue(null).spawn(),this._errorMessageHandler=e=>{ +this._chartWidget.hasModel()?this._updatePaneWidgets(e):this._renderErrorWithoutModel(e)},this._chartWidget=e,this._subscribeToMainSeriesErrors()}destroy(){var e,t;null===(e=this._mainSeriesErrorMessage)||void 0===e||e.destroy(),this._banErrorMessage.destroy(),null===(t=this._errorCardRenderer)||void 0===t||t.then((e=>{e.container.remove(),e.destroy()}))}updatePaneWidgets(){this._updatePaneWidgets()}setContainer(e){var t;if(this._container!==e){this._container=e,null===(t=this._errorCardRenderer)||void 0===t||t.then((e=>e.container.remove()));const i=this._getErrorMessage();i&&this._errorMessageHandler(i)}}_updatePaneWidgets(e=this._getErrorMessage()){this._chartWidget.paneWidgets().forEach((t=>t.setErrorMessage(e)))}async _renderErrorWithoutModel(e){if(null===this._container||null===e&&null===this._errorCardRenderer)return;const t=await this._getErrorCardRenderer();this._container.contains(t.container)||this._container.appendChild(t.container),t.update(this._createErrorCardRendererState(e))}async _getErrorCardRenderer(){return this._errorCardRenderer||(this._errorCardRenderer=this._createErrorCardRenderer())}async _createErrorCardRenderer(){return new(await oe())}_createErrorCardRendererState(e){return e?{message:e.message,icon:e.icon,textColor:re.watchedTheme.value()===ne.StdTheme.Dark?ce:le,backgroundColor:re.watchedTheme.value()===ne.StdTheme.Dark?"#131722":"#FFF",solutionId:e.solutionId}:{message:null}}_subscribeToMainSeriesErrors(){const e=this._chartWidget;e.withModel(this,(()=>{const t=e.model().model().mainSeries();this._mainSeriesErrorMessage=(0,E.combine)(((e,t)=>{if(e)return e;switch(t){case"invalid_symbol":return{message:o.t(null,void 0,i(32619)),icon:"ghost"};case"no_data":return{message:o.t(null,void 0,i(95222)),icon:"ghost"};case null:return null}}),this._banErrorMessage.weakReference(),(0,ae.getSeriesDisplayErrorWV)(t).ownership()),this._mainSeriesErrorMessage.subscribe(this._errorMessageHandler,{callWithLast:!0})}))}_getErrorMessage(){var e;return this._banErrorMessage.value()||(null===(e=this._mainSeriesErrorMessage)||void 0===e?void 0:e.value())||null}}var de=i(31964),ue=i(91280),pe=i(38325),_e=i(75531),me=i(93613),ge=i(1803),fe=i(54355);class ve{constructor(e,t){this._showed=!1,this._cw=e,this._element=document.createElement("div"),this._element.classList.add(fe.screen),t.appendChild(this._element),this._cw.withModel(this,this._connectToModel)}show(e){if(e){const e=this._cw.model().mainSeries().status();if(1!==e&&2!==e)return}this._cw.setInLoadingState(!0),this._showed||(this._showed=!0,this._show())}hide(){this._cw.setInLoadingState(!1),this._showed&&this._hide()}isShown(){return this._showed}_connectToModel(){const e=this._cw.model().mainSeries().dataEvents();e.symbolError().subscribe(this,(e=>{e!==ge.permissionDenied&&this.hide()})),e.seriesError().subscribe(this,(()=>{(0,R.enabled)("hide_loading_screen_on_series_error")&&this.hide()})),e.completed().subscribe(this,this.hide)}_show(){const e=this._cw.properties().childs().paneProperties.childs();let t +;if(e.backgroundType.value()===me.ColorType.Solid)t=e.background.value();else{t=`linear-gradient(${e.backgroundGradientStartColor.value()},${e.backgroundGradientEndColor.value()})`}this._element.style.background=t,this._element.classList.add(fe.fade)}_hide(){this._showed=!1,this._element.classList.remove(fe.fade)}}function ye(e,t){let{deltaX:i,deltaY:s}=e;switch(i/=100,s/=100,t.deltaMode){case t.DOM_DELTA_PAGE:i*=120,s*=120;break;case t.DOM_DELTA_LINE:i*=32,s*=32}return{deltaX:i,deltaY:s}}class Se{constructor(){this._totalDeltaX=0,this._totalDeltaY=0,this._prevWheelTime=0}processWheel(e){e.timeStamp-this._prevWheelTime>100&&this._reset(),this._totalDeltaX+=e.deltaX,this._totalDeltaY+=e.deltaY,this._prevWheelTime=e.timeStamp;const t={deltaX:e.deltaX,deltaY:e.deltaY};return 0===this._totalDeltaX||0===this._totalDeltaY||(Math.abs(this._totalDeltaX)>=Math.abs(3*this._totalDeltaY)&&(t.deltaY=0),Math.abs(this._totalDeltaY)>=Math.abs(3*this._totalDeltaX)&&(t.deltaX=0)),ye(t,e)}_reset(){this._totalDeltaX=0,this._totalDeltaY=0}}var be=i(24377),we=i(37160),Ce=i(42184),Pe=i(16838),xe=i(30383);class Te{constructor(e,t,i){this._handleEl=null,this._resizeInfo=null,this._colorCache={lineColor:"",backgroundColor:"",color:""},this._chart=e,this._topPaneIndex=t,this._bottomPaneIndex=i,this._element=document.createElement("div"),this._element.classList.add(xe.paneSeparator),this._element.style.background=this._color(),this.adjustSize(),this._element.addEventListener("click",(()=>{}));const s=document.createElement("div");s.classList.add(xe.handle),this._element.appendChild(s),this._mouseEventHandler=new Ce.MouseEventHandler(s,this,{treatVertTouchDragAsPageScroll:!1,treatHorzTouchDragAsPageScroll:!0}),this._handleEl=s,Pe.PLATFORM_ACCESSIBILITY_ENABLED&&this._element.setAttribute("aria-hidden","true")}destroy(){this._mouseEventHandler.destroy(),this._element.parentElement&&this._element.parentElement.removeChild(this._element)}getElement(){return this._element}hide(){this._element.classList.add("js-hidden")}show(){this._element.classList.remove("js-hidden")}adjustSize(){this._element.style.height=Te.height()+"px"}mouseEnterEvent(e){const{topPane:t,bottomPane:i}=this._topBottomPane(!0);null!==t&&null!==i&&(0,r.ensureNotNull)(this._handleEl).classList.add(xe.hovered)}mouseLeaveEvent(e){(0,r.ensureNotNull)(this._handleEl).classList.remove(xe.hovered)}mouseDownEvent(e){this._mouseDownOrTouchStartEvent(e)}touchStartEvent(e){this._mouseDownOrTouchStartEvent(e)}pressedMouseMoveEvent(e){this._pressedMouseOrTouchMoveEvent(e)}touchMoveEvent(e){this._pressedMouseOrTouchMoveEvent(e)}mouseUpEvent(e){this._mouseUpOrTouchEndEvent(e)}touchEndEvent(e){this._mouseUpOrTouchEndEvent(e)}update(){this._element.style.background=this._color().toString()}paint(){}image(){const{topPane:e}=this._topBottomPane(!1),t=e.leftPriceAxisesContainer().getWidth(),i=e.width(),r=e.rightPriceAxisesContainer().getWidth(),n=this._color(),o=(0,U.createDisconnectedCanvas)(document,(0,s.size)({width:t,height:1})),a=(0,U.getPrescaledContext2D)(o);a.fillStyle=n,a.fillRect(0,0,t,1) +;const l=(0,U.createDisconnectedCanvas)(document,(0,s.size)({width:i,height:1})),c=(0,U.getPrescaledContext2D)(l);c.fillStyle=n,c.fillRect(0,0,i,1);const h=(0,U.createDisconnectedCanvas)(document,(0,s.size)({width:r,height:1})),d=(0,U.getPrescaledContext2D)(h);return d.fillStyle=n,d.fillRect(0,0,r,1),{type:"separator",leftAxis:{content:o.toDataURL(),canvas:o,contentWidth:t,contentHeight:1},rightAxis:{content:h.toDataURL(),canvas:h,contentWidth:r,contentHeight:1},content:l.toDataURL(),canvas:l,contentWidth:i,contentHeight:1}}static height(){const e=window.devicePixelRatio||1;return e>=1?1:1/e}_mouseDownOrTouchStartEvent(e){const{topPane:t,bottomPane:i}=this._topBottomPane(!0);if(null===t||null===i)return;const s=t.state().stretchFactor()+i.state().stretchFactor(),n=s/(t.height()+i.height()),o=30*n;s<=2*o||(this._resizeInfo={startY:e.pageY,prevStretchTopPane:t.state().stretchFactor(),maxPaneStretch:s-o,totalStretch:s,pixelStretchFactor:n,minPaneStretch:o},(0,r.ensureNotNull)(this._handleEl).classList.add(xe.active))}_pressedMouseOrTouchMoveEvent(e){const{topPane:t,bottomPane:i}=this._topBottomPane(!0),s=this._resizeInfo;if(null===s||null===t||null===i)return;const r=(e.pageY-s.startY)*s.pixelStretchFactor,n=(0,we.clamp)(s.prevStretchTopPane+r,s.minPaneStretch,s.maxPaneStretch);t.state().setStretchFactor(n),i.state().setStretchFactor(s.totalStretch-n),this._chart.model().model().fullUpdate()}_mouseUpOrTouchEndEvent(e){const{topPane:t,bottomPane:i}=this._topBottomPane(!0),s=this._resizeInfo;null!==s&&null!==t&&null!==i&&(this._chart.model().addPaneStretchFactorUndoCommand(t.state(),i.state(),s.prevStretchTopPane,t.state().stretchFactor()),this._resizeInfo=null,(0,r.ensureNotNull)(this._handleEl).classList.remove(xe.active))}_color(){const e=this._chart.properties().childs().paneProperties.childs().separatorColor.value(),t=this._chart.model().model().backgroundColor().value();if(this._colorCache.lineColor!==e||this._colorCache.backgroundColor!==t){const i=(0,be.parseRgba)(t),s=(0,be.parseRgba)(e),r=0===i[3]&&0===s[3]?"rgba(0,0,0,0)":(0,be.rgbaToString)((0,be.blendRgba)(i,s));this._colorCache={lineColor:e,backgroundColor:t,color:r}}return this._colorCache.color}_topBottomPane(e){const t=this._chart.paneWidgets();let i=null,s=null;for(let s=this._topPaneIndex;s>=0;--s){const r=t[s];if(!e||!r.state().collapsed().value()){i=r;break}}for(let i=this._bottomPaneIndex;i.1&&(this._currentScale=i,Math.abs(this._currentScale-1)>.1?this._element.style.transform=`scale(${this._currentScale})`:(this._currentScale=1,this._element.style.transform=""))}drawLabelForScreenshot(e,t){if(null===this._info||"gear"===this._mode)return;const i=(0,Oe.makeFont)(t.fontSize,He.CHART_FONT_FAMILY);e.fillStyle=h.themes[t.theme].getThemedColor("color-price-axis-label-back"),e.globalAlpha=.5,e.beginPath();const s=je(t.fontSize)*ze/2,r=(0,Ae.point)(t.offset+t.width/2,t.height/2);e.arc(r.x,r.y,s,0,2*Math.PI,!0),e.fill(),e.globalAlpha=1,e.fillStyle=h.themes[t.theme].getThemedColor("color-price-axis-label-text"),e.textAlign="center",e.font=i,e.textBaseline="middle",e.fillText(this._info.label,r.x,r.y)}setAxisNameInfo(e){this._info=e,null!==e&&(this._labelElement.textContent=e.label)}static height(e){return(ze+Ue)*e}}var qe=i(10643),$e=i(94194);const Ye={enableTooltip:!0,showLabels:!0,enableMenu:!0,enableHighlight:!0};class Ke{constructor(e,t,i,r,n,o=null){this._invalidated=!0,this._size=(0,s.size)({width:0,height:0}),this._offset=0,this._axisInfo=null,this._onLabelHovered=new B.Delegate,this._highlighted=!1,this._labelMode="auto",this._fixedLabelMode=null,this._canvasConfiguredHandler=()=>this.update(),this._timeAxisWidget=o,this._isLeft="left"===e,this._rendererOptionsProvider=r.rendererOptionsProvider,this._sourcesTitlesProvider=r.sourcesTitlesProvider,this._contextMenuItemsProvider=r.contextMenuItemsProvider,this._backgroundBasedTheme=r.backgroundBasedTheme,this._getBackgroundTopColor=r.getBackgroundTopColor,this._getBackgroundBottomColor=r.getBackgroundBottomColor,this._showHorizontalBorder=Boolean(r.showHorizontalBorder),this._properties=t,this._axisInfo=i,this._labelOptions={...Ye,...n},this._properties.lineColor.subscribe(this,this._onPropertyChanged),this._cell=document.createElement("div"),this._cell.classList.add(We["price-axis-stub"]),this._labelOptions.enableTooltip&&this._cell.classList.add("apply-common-tooltip"),this._cell.style.width="25px",this._cell.style.height="100%",this._cell.style.position="absolute",this._cell.style.left="0",this._cell.style.overflow="hidden",this._labelOptions.showLabels?(this._label=new Ge,this._label.setAxisNameInfo(this._axisInfo),this._cell.appendChild(this._label.getElement()),this._labelOptions.enableTooltip&&(0,$e.setTooltipData)(this._cell,"text",(e=>this._tooltipContent()))):this._label=null,this._mouseEventHandler=new Ce.MouseEventHandler(this._cell,this,{treatHorzTouchDragAsPageScroll:!0, +treatVertTouchDragAsPageScroll:!0}),this._canvasBinding=(0,U.createBoundCanvas)(this._cell,(0,s.size)({width:16,height:16})),this._canvasBinding.subscribeSuggestedBitmapSizeChanged(this._canvasConfiguredHandler);const a=this._canvasBinding.canvasElement;a.style.position="absolute",a.style.left="0",a.style.top="0",Pe.PLATFORM_ACCESSIBILITY_ENABLED&&this._cell.setAttribute("aria-hidden","true")}destroy(){this._canvasBinding.unsubscribeSuggestedBitmapSizeChanged(this._canvasConfiguredHandler),this._canvasBinding.dispose(),this._properties.lineColor.unsubscribe(this,this._onPropertyChanged),this._mouseEventHandler.destroy()}mouseEnterEvent(e){this._mouseOrTouchEnterEvent(e)}touchStartEvent(e){this._mouseOrTouchEnterEvent(e)}mouseLeaveEvent(e){this._mouseOrTouchLeaveEvent(e)}touchEndEvent(e){this._mouseOrTouchLeaveEvent(e)}mouseClickEvent(e){this._mouseClickOrTapEvent(e)}tapEvent(e){this._mouseClickOrTapEvent(e)}update(){}getElement(){return this._cell}onLabelHovered(){return this._onLabelHovered}setSizeAndOffset(e,t){(0,s.equalSizes)(this._size,e)||(this._size=e,this._canvasBinding.resizeCanvasElement(e),this._cell.style.width=`${e.width}px`,this._cell.style.minWidth=`${e.width}px`,this._cell.style.height=`${e.height}px`,this._invalidated=!0),this._offset!==t&&(this._offset=t,this._cell.style.left=`${t}px`)}paint(e){if(e{this.setLabelMode((0,r.ensureNotNull)(this._fixedLabelMode)),this._fixedLabelMode=null}))}}var Ze=i(10688);class Xe{constructor(e,t,i,r,n,o=null){this._axises=[],this._stubs=[],this._size=(0,s.size)({width:0,height:0}),this._onLabelHovered=new B.Delegate,this._scalesProperties=e,this._priceAxisWidgetFactory=i,this._timeAxisWidget=o,this._rendererOptionsProvider=r.rendererOptionsProvider,this._titlesProvider=r.titlesProvider,this._stubContextMenuProvider=r.stubContextMenuProvider,this._backgroundBasedTheme=r.backgroundBasedTheme,this._getBackgroundTopColor=r.getBackgroundTopColor,this._getBackgroundBottomColor=r.getBackgroundBottomColor,this._showHorisontalBorder=Boolean(r.showHorizontalBorder),this._labelsOptions={...Ye,...n};const a=this._scalesProperties.childs();this._stubProperties={lineColor:a.lineColor,fontSize:a.fontSize},this._side=t,this._cell=document.createElement("div"),this._cell.classList.add("chart-markup-table","price-axis-container"),this._cell.style.width="25px",this._cell.style.position="relative"}destroy(){this.setScales([],0,0,0)}onLabelHovered(){return this._onLabelHovered}setScales(e,t,i,s){for(;e.length>this._axises.length&&this._axises.lengtho;){const e=(0,r.ensureDefined)(this._stubs.pop());e.onLabelHovered().unsubscribeAll(this),this._cell.removeChild(e.getElement()),e.destroy()}for(;this._stubs.length{this._labelsOptions.showLabels&&this._labelsOptions.enableHighlight&&this._onLabelHovered.fire({owner:t,axis:(0,r.ensureNotNull)(e)},i)})),this._stubs.push(t),this._cell.appendChild(t.getElement())}const a=this._labelsOptions.enableMenu;1===s?this._stubs.forEach(((e,t)=>e.setLabelMode(a?"gear":"symbol"))):this._stubs.forEach(((e,t)=>e.setLabelMode(te.updateCurrencyLabel()))}optimalWidths(){return this._axises.map((e=>e.optimalWidth()))}setSizes(e,t){this._size=(0,s.size)({width:t.reduce(((e,t)=>e+t),0),height:e}),this._cell.style.width=this._size.width+"px",this._cell.style.minWidth=this._size.width+"px",this._cell.style.height=this._size.height+"px",t.length!==this._axises.length+this._stubs.length&&(0,r.assert)(t.length===this._axises.length+this._stubs.length,"Widgets count should be the same as widths one");let i=0;this._forEachWidgetFromLeft(((r,n)=>{const o=t[n];r.setSizeAndOffset((0,s.size)({width:o,height:e}),i),i+=o}))}update(){this._axises.forEach((e=>e.update())),this._stubs.forEach((e=>e.update()))}paint(e){this._axises.forEach(((t,i)=>t.paint(e(i)))),this._stubs.forEach(((t,i)=>t.paint(e(i))))}paintStubs(e){this._stubs.forEach((t=>t.paint(e)))}restoreDefaultCursor(){this._axises.forEach((e=>e.restoreDefaultCursor()))}getWidth(){return this._size.width}findAxisWidgetForScale(e){const t=this._axises.find((t=>t.priceScale()===e));return void 0===t?null:t}getScreenshotData(){const e=this._getImage();return{canvas:e,content:e.toDataURL(),contentHeight:this._size.height,contentWidth:this._size.width}}getImage(){return this._getImage()}slotsCount(){return this._axises.length+this._stubs.length}highlightPriceAxisByLabel(e){this._axises.forEach((t=>{const i=t.axisInfo();t.setHighlighted(null!==i&&i.equals(e))}))}axes(){return this._axises}_stubParams(e){return{rendererOptionsProvider:this._rendererOptionsProvider,backgroundBasedTheme:this._backgroundBasedTheme,sourcesTitlesProvider:()=>this._titlesProvider(this._side,e), +contextMenuItemsProvider:()=>this._stubContextMenuProvider(this._side,e),getBackgroundTopColor:this._getBackgroundTopColor,getBackgroundBottomColor:this._getBackgroundBottomColor,showHorizontalBorder:this._showHorisontalBorder}}_getImage(){const e=(0,U.createDisconnectedCanvas)(document,this._size),t=(0,U.getPrescaledContext2D)(e);let i=0;return this._forEachWidgetFromLeft(((e,s)=>{const r=e.getWidth();0!==r&&0!==this._size.height&&(t.drawImage(e.getImage(),i,0,r,this._size.height),i+=r)})),e}_forEachWidgetFromLeft(e){const t=[...this._axises,...this._stubs],i="left"===this._side,s=i?-1:t.length,r=i?-1:1;for(let n=i?t.length-1:0;n!==s;n+=r)e(t[n],n,t)}}var Je=i(34565),Qe=i(55824),et=i(60682);class tt{constructor(){this._width=null,this._labelBottom=null,this._currencyInfo=null,this._unitInfo=null,this._measureUnitIdInfo=null,this._fontSize=0,this._currencyAndUnitLabelsWrapper=document.createElement("div"),this._currencyAndUnitLabelsWrapper.className=et["price-axis-currency-label-wrapper"],this._currencyAndUnitLabelsWrapper.setAttribute("data-name","currency-unit-label-wrapper"),this._controlsContainer=document.createElement("div"),this._controlsContainer.className=et["price-axis-currency-label"],this._currencyAndUnitLabelsWrapper.appendChild(this._controlsContainer),this._currencyLabelDiv=document.createElement("div"),this._currencyLabelDiv.className=et.row,this._currencyLabelDiv.classList.add("apply-common-tooltip"),(0,$e.setTooltipData)(this._currencyLabelDiv,"text",(e=>this._currencyTooltipContent())),this._currencyText=document.createElement("div"),this._currencyText.className=et["price-axis-currency-label-text"],this._currencyLabelDiv.appendChild(this._currencyText),this._currencyArrowDown=document.createElement("div"),this._currencyArrowDown.className=et["price-axis-currency-label-arrow-down"],this._currencyArrowDown.innerHTML=Qe,this._currencyLabelDiv.appendChild(this._currencyArrowDown),this._measureUnitIdLabelDiv=document.createElement("div"),this._measureUnitIdLabelDiv.className=et.row,this._measureUnitIdLabelDiv.classList.add("apply-common-tooltip"),this._measureUnitIdLabelDiv.classList.add("readonly"),(0,$e.setTooltipData)(this._measureUnitIdLabelDiv,"text",(e=>this._measureUnitIdTooltipContent())),this._measureUnitIdText=document.createElement("div"),this._measureUnitIdText.className=et["price-axis-currency-label-text"],this._measureUnitIdLabelDiv.appendChild(this._measureUnitIdText),this._unitLabelDiv=document.createElement("div"),this._unitLabelDiv.className=et.row,this._unitLabelDiv.classList.add("apply-common-tooltip"),(0,$e.setTooltipData)(this._unitLabelDiv,"text",(e=>this._unitTooltipContent())),this._unitText=document.createElement("div"),this._unitText.className=et["price-axis-currency-label-text"],this._unitLabelDiv.appendChild(this._unitText),this._unitArrowDown=document.createElement("div"),this._unitArrowDown.className=et["price-axis-currency-label-arrow-down"],this._unitArrowDown.innerHTML=Qe,this._unitLabelDiv.appendChild(this._unitArrowDown), +this._controlsContainer.appendChild(this._currencyLabelDiv),this._controlsContainer.appendChild(this._measureUnitIdLabelDiv),this._controlsContainer.appendChild(this._unitLabelDiv),this.disableCurrency(),this.disableUnit()}element(){return this._currencyAndUnitLabelsWrapper}currencyLabelElement(){return this._currencyLabelDiv}unitLabelElement(){return this._unitLabelDiv}isEnabled(){return this.currencyLabelEnabled()||this.unitLabelEnabled()||this.measureUnitIdLableEnabled()}isHidden(){return this._currencyAndUnitLabelsWrapper.classList.contains(et.hidden)}setCurrencyExpanded(e){this._currencyLabelDiv.classList.toggle(et.expanded,e)}setUnitExpanded(e){this._unitLabelDiv.classList.toggle(et.expanded,e)}width(){if(null!==this._width)return this._width;let e=0;if(this.currencyLabelEnabled()){const t=this._currencyText.getBoundingClientRect(),i=this._currencyArrowDown.getBoundingClientRect();e=Math.max(e,t.width+i.width+2*this._textMarginAndPadding())}if(this.measureUnitIdLableEnabled()){const t=this._measureUnitIdText.getBoundingClientRect();e=Math.max(e,t.width+2*this._textMarginAndPadding())}if(this.unitLabelEnabled()){const t=this._unitText.getBoundingClientRect(),i=this._unitArrowDown.getBoundingClientRect();e=Math.max(e,t.width+i.width+2*this._textMarginAndPadding())}return this._width=e}drawLabel(e,t,i){var s,r,n;if(!this.isEnabled())return;const o=Math.round(Number(et.css_wrapper_margin)*i),a=(0,we.ceiledEven)(t*i)-2*o,l=Math.round(this.labelBottom()*i),c=l-2*o,h=Math.round(Number(et.css_value_currency_label_radius)*i);e.fillStyle=getComputedStyle(this._currencyAndUnitLabelsWrapper).backgroundColor,e.fillRect(0,0,Math.ceil(t*i),l);const d=[];d.push(this.currencyLabelEnabled()&&null!==(s=this._currencyText.textContent)&&void 0!==s?s:""),d.push(this.measureUnitIdLableEnabled()&&null!==(r=this._measureUnitIdText.textContent)&&void 0!==r?r:""),d.push(this.unitLabelEnabled()&&null!==(n=this._unitText.textContent)&&void 0!==n?n:""),e.font=(0,Oe.makeFont)(this._fontSize,He.CHART_FONT_FAMILY);const u=new Je.TextWidthCache;let p=0;const _=[];d.forEach((t=>{let i=0;""!==t&&(i=u.yMidCorrection(e,t),p++),_.push(i)}));const m=c/p;e.beginPath();const g=getComputedStyle(this._controlsContainer);e.fillStyle=g.backgroundColor,e.strokeStyle=g.borderColor,(0,Ne.drawRoundRect)(e,o,o,a,c,h),e.fill(),e.stroke(),e.fillStyle=getComputedStyle(this._currencyLabelDiv).color,e.textBaseline="middle",e.textAlign="left";const f=Math.round(this._textMarginAndPadding()*i)+o,v=m/2;let y=o+v;d.forEach(((t,s)=>{""!==t&&((0,U.drawScaled)(e,i,i,(()=>{e.fillText(t,f/i,(y+_[s])/i)})),y=Math.ceil(y+2*v))}))}setHidden(e){this._currencyAndUnitLabelsWrapper.classList.toggle(et.hidden,e)}enableCurrency(){this._currencyLabelDiv.classList.remove("js-hidden"),this._resetSizesAndVisibility()}disableCurrency(){this._currencyLabelDiv.classList.add("js-hidden"),this._resetSizesAndVisibility()}enableUnit(){this._unitLabelDiv.classList.remove("js-hidden"),this._resetSizesAndVisibility()}disableUnit(){this._unitLabelDiv.classList.add("js-hidden"), +this._resetSizesAndVisibility()}enableMeasureUnitId(){this._measureUnitIdLabelDiv.classList.remove("js-hidden"),this._resetSizesAndVisibility()}disableMeasureUnitId(){this._measureUnitIdLabelDiv.classList.add("js-hidden"),this._resetSizesAndVisibility()}currencyLabelEnabled(){return!this._currencyLabelDiv.classList.contains("js-hidden")}unitLabelEnabled(){return!this._unitLabelDiv.classList.contains("js-hidden")}measureUnitIdLableEnabled(){return!this._measureUnitIdLabelDiv.classList.contains("js-hidden")}currencyConversionAvailable(){return!this._currencyLabelDiv.classList.contains("readonly")}unitConversionAvailable(){return!this._unitLabelDiv.classList.contains("readonly")}setCurrencyInfo(e){if(this._currencyInfo===e)return!1;this._currencyInfo=e;const t=null===e.selectedCurrency?o.t(null,void 0,i(95093)):(0,r.ensureDefined)(e.displayedValues.get(e.selectedCurrency));return this._currencyText.textContent!==t&&(this._currencyText.textContent=t,this._width=null),this._currencyArrowDown.classList.contains("js-hidden")!==e.readOnly&&(this._currencyArrowDown.classList.toggle("js-hidden",e.readOnly),this._currencyLabelDiv.classList.toggle("readonly",e.readOnly),this._width=null),!0}setUnitInfo(e){if(null!==this._unitInfo&&this._unitInfo.selectedUnit===e.selectedUnit&&0===this._unitInfo.availableGroups.size==(0===e.availableGroups.size)&&this._unitInfo.originalUnits.size===e.originalUnits.size)return this._unitInfo=e,!1;this._unitInfo=e;const t=null===e.selectedUnit?o.t(null,void 0,i(95093)):(0,r.ensureDefined)(e.names.get(e.selectedUnit));return this._unitText.textContent!==t&&(this._unitText.textContent=t,this._width=null),this._unitArrowDown.classList.contains("js-hidden")!==(0===e.availableGroups.size)&&(this._unitArrowDown.classList.toggle("js-hidden",0===e.availableGroups.size),this._unitLabelDiv.classList.toggle("readonly",0===e.availableGroups.size),this._width=null),!0}setMeasureUnitIdInfo(e){if(this._measureUnitIdInfo===e)return!1;this._measureUnitIdInfo=e;const t=null===e.selectedMeasureUnitId?o.t(null,void 0,i(95093)):(0,r.ensureDefined)(e.names.get(e.selectedMeasureUnitId));return this._measureUnitIdText.textContent!==t&&(this._measureUnitIdText.textContent=t,this._width=null),this._measureUnitIdLabelDiv.classList.contains("js-hidden")!==(0===e.names.size)&&(this._measureUnitIdLabelDiv.classList.toggle("js-hidden",0===e.names.size),this._width=null),!0}currencyInfo(){return this._currencyInfo}unitInfo(){return this._unitInfo}measureUnitIdInfo(){return this._measureUnitIdInfo}setFontSize(e){this._fontSize!==e&&(this._fontSize=e,this._currencyLabelDiv.style.fontSize=e+"px",this._measureUnitIdLabelDiv.style.fontSize=e+"px",this._unitLabelDiv.style.fontSize=e+"px",this._width=null,this._labelBottom=null)}labelBottom(){if(null!==this._labelBottom)return this._labelBottom;const e=this._controlsContainer.getBoundingClientRect(),t=this._currencyAndUnitLabelsWrapper.getBoundingClientRect(),i=e.y-t.y;return this._labelBottom=e.height+2*i}_resetSizesAndVisibility(){this._width=null,this._labelBottom=null, +this._updateVisibility()}_textMarginAndPadding(){return Number(et.css_wrapper_margin)+Number(et.css_row_left_right_padding)+2}_currencyTooltipContent(){const e=this._currencyInfo;return null===e?"":null===e.selectedCurrency?Array.from(e.currencies).map((t=>(0,r.ensureDefined)(e.displayedValues.get(t)))).join(", "):e.displayedValues.get(e.selectedCurrency)||""}_unitTooltipContent(){const e=this._unitInfo;return null===e?"":null===e.selectedUnit?Array.from(e.units).map((t=>(0,r.ensureDefined)(e.names.get(t)))).join(", "):e.descriptions.get(e.selectedUnit)||""}_measureUnitIdTooltipContent(){const e=this._measureUnitIdInfo;return null===e?"":null===e.selectedMeasureUnitId?Array.from(e.measureUnitIds).map((t=>(0,r.ensureDefined)(e.names.get(t)))).join(", "):e.descriptions.get(e.selectedMeasureUnitId)||""}_updateVisibility(){const e=this.isEnabled();this._currencyAndUnitLabelsWrapper.classList.toggle("js-hidden",!e)}}async function it(e,t,s,r){const{UnitConversionRenderer:n}=await Promise.all([i.e(2666),i.e(956),i.e(2109),i.e(4015),i.e(3842),i.e(5145),i.e(855),i.e(6),i.e(2587),i.e(6752),i.e(6036),i.e(6025),i.e(7111),i.e(962),i.e(6408),i.e(2544),i.e(5057),i.e(2704)]).then(i.bind(i,41153));return new n(e,s,t,r)}var st=i(68335),rt=i(77212),nt=i(10786),ot=i(24120),at=i(42226),lt=i(39875),ct=i(97754),ht=i.n(ct),dt=i(58035);class ut{constructor({setMode:e,className:t=""}){const s=this._wrapper=document.createElement("div");s.classList.add(t),s.addEventListener("dblclick",this._stopPropagation,{capture:!0}),s.addEventListener("touchstart",this._stopPropagation,{capture:!0});const r=s.appendChild(document.createElement("div"));r.className=dt.priceScaleModeButtons,this._autoScaleButton=r.appendChild(this._createButton({title:o.t(null,{context:'The first letter of the "auto" word'},i(9846)),tooltip:o.t(null,void 0,i(50834)),onClick:()=>e("auto"),ariaLabel:Pe.PLATFORM_ACCESSIBILITY_ENABLED?o.t(null,void 0,i(74327)):void 0})),this._logarithmButton=r.appendChild(this._createButton({title:o.t(null,{context:'The first letter of the "logarithmic" word'},i(55765)),tooltip:o.t(null,void 0,i(12285)),onClick:()=>e("log"),ariaLabel:Pe.PLATFORM_ACCESSIBILITY_ENABLED?o.t(null,void 0,i(84112)):void 0}))}destroy(){this._wrapper.removeEventListener("dblclick",this._stopPropagation),this._wrapper.removeEventListener("touchstart",this._stopPropagation),this._autoScaleButton.remove(),this._logarithmButton.remove(),this._wrapper.remove()}element(){return this._wrapper}width(){return 52}updateMode(e){const{log:t,autoScale:i}=e;this._logarithmButton.classList.toggle(dt.priceScaleModeButtons__button_activated,!!t),this._autoScaleButton.classList.toggle(dt.priceScaleModeButtons__button_activated,!!i)}_createButton(e){const{ariaLabel:t,title:i,tooltip:s,onClick:r}=e,n=document.createElement("button");return n.className=ht()(dt.priceScaleModeButtons__button,"apply-common-tooltip"),n.textContent=i,n.dataset.tooltip=s,n.addEventListener("click",r),t&&n.setAttribute("aria-label",t),n}_stopPropagation(e){e.stopPropagation()}}i(47184) ;const pt=new F.TranslatedString("change no overlapping labels",o.t(null,void 0,i(83935))),_t=new F.TranslatedString("toggle auto scale",o.t(null,void 0,i(63060))),mt=new F.TranslatedString("toggle log scale",o.t(null,void 0,i(60166))),gt=o.t(null,void 0,i(75633)),ft=o.t(null,void 0,i(94420)),vt=o.t(null,void 0,i(81520)),yt=o.t(null,void 0,i(25933)),St=o.t(null,void 0,i(17258)),bt=o.t(null,void 0,i(50834)),wt=o.t(null,{context:"scale_menu"},i(70361)),Ct=o.t(null,{context:"scale_menu"},i(47807)),Pt=o.t(null,{context:"scale_menu"},i(34727)),xt=o.t(null,{context:"scale_menu"},i(72116)),Tt=o.t(null,{context:"scale_menu"},i(19238)),It=o.t(null,{context:"scale_menu"},i(54138));const Mt=function(e){const t=new nt.LimitedPrecisionNumericFormatter(e);return(e,i)=>(0,C.isNumber)(i)&&!e.isLog()?t.format(i):""}(4),At={contextMenuEnabled:!0,currencyConversionEnabled:!1,unitConversionEnabled:!1,countdownEnabled:!0,contextMenu:{general:!0,source:!0},pressedMouseMoveScale:!0,mouseWheelScale:!0,pinchScale:!0,croppedTickMarks:!0};class Lt{constructor(e,t,i,r,n,o,a,l,c){this._actions=null,this._priceScale=null,this._scaleModeButtons=null,this._widthCache=new Je.TextWidthCache(1e3),this._color=null,this._fontSize=null,this._currencyFontSize=0,this._currencyLabelWidth=null,this._isVisible=!0,this._currencyMenu=null,this._unitMenu=null,this._size=(0,s.size)({width:0,height:0}),this._currentCursorClassName="",this._destroyed=!1,this._highlighted=!1,this._highlightColorCache=null,this._mouseWheelHelper=null,this._dragScaleActive=!1,this._offset=NaN,this._pinching=!1,this._lastHittestResult=null,this._isHovered=new W.WatchedValue(!1),this._recalcCurrencyAndUnitVisibility=()=>{if(null===this._currencyLabel)return;let e=!0;switch((0,at.currencyUnitVisibilityProperty)().value()){case"alwaysOff":e=!1;break;case"visibleOnMouseOver":const t=this._chart.anyPriceAxisHovered().value(),i=null!==this._currencyMenu&&this._currencyMenu.isOpened(),s=null!==this._unitMenu&&this._unitMenu.isOpened();e=t||i||s}this._currencyLabel.setHidden(!e)},this._handleAutoLogButtonsVisibilityProperty=e=>{const t=e.value();"alwaysOff"===t?this._scaleModeButtons&&this._destroyScaleModeButtons():(this._scaleModeButtons||this._createScaleModeButtons(),"alwaysOn"===t?(this._isHovered.unsubscribe(this._updatePriceScaleModeButtonsVisibility),this._updatePriceScaleModeButtonsVisibility(!0)):this._isHovered.subscribe(this._updatePriceScaleModeButtonsVisibility,{callWithLast:!0}))},this._updatePriceScaleModeButtonsVisibility=e=>{var t;null===(t=this._scaleModeButtons)||void 0===t||t.element().classList.toggle("price-axis__modeButtons_hidden",!e)},this._updateScaleModeButtons=()=>{var e;this._priceScale&&(null===(e=this._scaleModeButtons)||void 0===e||e.updateMode(this._priceScale.mode()))},this._chart=e,this._pane=t,this._undoModel=i,this._properties=r,this._isLeft="left"===o,this._options=(0,C.merge)((0,C.clone)(At),a),this._rendererOptionsProvider=n,this._backgroundBasedTheme=c,this._cell=document.createElement("div"),this._cell.className="price-axis", this._cell.style.width="25px",this._cell.style.left="0",this._canvasConfiguredHandler=()=>{this._undoModel.model().lightUpdate()},this._canvasBinding=(0,U.createBoundCanvas)(this._cell,(0,s.size)({width:16,height:16})),this._canvasBinding.subscribeSuggestedBitmapSizeChanged(this._canvasConfiguredHandler);const h=this._canvasBinding.canvasElement;h.style.position="absolute",h.style.zIndex="1",h.style.left="0",h.style.top="0",this._topCanvasBinding=(0,U.createBoundCanvas)(this._cell,(0,s.size)({width:16,height:16})),this._topCanvasBinding.subscribeSuggestedBitmapSizeChanged(this._canvasConfiguredHandler);const d=this._topCanvasBinding.canvasElement;d.style.position="absolute",d.style.zIndex="2",d.style.left="0",d.style.top="0",Pe.PLATFORM_ACCESSIBILITY_ENABLED&&this._cell.setAttribute("aria-hidden","true"),this._mouseEventHandler=new Ce.MouseEventHandler(this._cell,this,{treatVertTouchDragAsPageScroll:!1,treatHorzTouchDragAsPageScroll:!0}),this._options.currencyConversionEnabled||this._options.unitConversionEnabled?(this._currencyLabel=new tt,this._cell.appendChild(this._currencyLabel.element())):this._currencyLabel=null,this._properties.childs().fontSize.subscribe(this,this._onFontSizeChanged),this._options.mouseWheelScale&&(this._mouseWheelHelper=new Se,this._cell.addEventListener("wheel",this._onMousewheel.bind(this),{passive:!1})),this._axisInfo=l,this._offset=0,this.restoreDefaultCursor(),(0,at.currencyUnitVisibilityProperty)().subscribe(this,this._recalcCurrencyAndUnitVisibility),(0,lt.autoLogButtonsVisibilityProperty)().subscribe(this,this._handleAutoLogButtonsVisibilityProperty),this._handleAutoLogButtonsVisibilityProperty((0,lt.autoLogButtonsVisibilityProperty)()),this._chart.anyPriceAxisHovered().subscribe(this._recalcCurrencyAndUnitVisibility,{callWithLast:!0}),this.update()}getContextMenuActions(){var e;this._initActions();const t=(0,r.ensureNotNull)(this._actions),i=this._chart.actions(),s=[];return(null===(e=this._priceScale)||void 0===e?void 0:e.resetScaleAvailable().value())&&s.push(t.reset,new H.Separator),s.push(this._autoScaleAction()),this._isMainSeriesAxis()&&s.push(this._lockScaleAction()),s.push(i.scaleSeriesOnly,this._invertAction(),new H.Separator,this._regularScaleAction(),this._percentageAction(),this._indexedTo100Action(),this._logAction(),new H.Separator),l.CheckMobile.any()||(s.push(this._createMergeScalesAction()),s.push(new H.Separator)),R.enabled("fundamental_widget")||s.push(new H.Action({actionId:"Chart.PriceScale.Labels",options:{label:ft,subItems:[i.showSymbolLabelsAction,i.showSeriesLastValue,null,null,i.showHighLowPriceLabels,R.enabled("show_average_close_price_line_and_label")?i.showAverageClosePriceLabel:null,null,i.showStudyPlotNamesAction,i.showStudyLastValue,t.alignLabels].filter(Boolean)}})),s.push((0,ot.createLinesAction)(this._chart)),this._options.countdownEnabled&&s.push(i.showCountdown),this._undoModel.crossHairSource().isMenuEnabled()&&s.push(i.addPlusButton),!(0, l.onWidget)()&&R.enabled("show_chart_property_page")&&R.enabled("chart_property_page_scales")&&i.scalesProperties&&s.push(new H.Separator,i.scalesProperties),s}getElement(){return this._cell}onOptimalWidthNeedToBeRecalculated(e){(this._size.width1e-14){const o=r.formatPrice(Math.floor(Math.min(e,i))+.11111111111111,n),a=r.formatPrice(Math.ceil(Math.max(e,i))-.11111111111111,n);s=Math.max(s,this._widthCache.measureText(t,o),this._widthCache.measureText(t,a))}}}let o=0;this._isCurrencyLabelEnabled()&&(null===this._currencyLabelWidth&&(this._currencyLabelWidth=(0,r.ensureNotNull)(this._currencyLabel).width()),o=Math.round(this._currencyLabelWidth));const a=s||34;let l=Math.max(o,null!==(i=null===(t=this._scaleModeButtons)||void 0===t?void 0:t.width())&&void 0!==i?i:0,Math.ceil(n.borderSize+n.additionalPaddingInner+n.paddingInner+n.paddingOuter+a+4));return l+=l%2,l}setSizeAndOffset(e,t){(0,s.equalSizes)(this._size,e)||(this._size=e,this._canvasBinding.resizeCanvasElement(e),this._topCanvasBinding.resizeCanvasElement(e),this._cell.style.width=e.width+"px",this._cell.style.height=e.height+"px",this._cell.style.minWidth=e.width+"px"),this._offset!==t&&(this._offset=t,this._cell.style.left=t+"px")}getWidth(){return this._size.width}getImage(){const e=this._size,t=(0,U.createDisconnectedCanvas)(document,e);return(0,U.getPrescaledContext2D)(t).drawImage(this._canvasBinding.canvasElement,0,0,e.width,e.height),null===this._currencyLabel||this._currencyLabel.isHidden()||this._currencyLabel.drawLabel((0,U.getContext2D)(t),e.width,(0,de.getCanvasDevicePixelRatio)(t)),t}update(){null!==this._priceScale&&(this._priceScale.marks(),this._updateCurrencyLabelFont(),this.rendererOptions())}paint(e){if(!this._isVisible||0===this._size.width||0===this._size.height)return;if(e===ue.InvalidationLevel.None)return;const t=this._pane.state(),i=!t.maximized().value()&&t.collapsed().value(),s=this._pane.hasState();(0,U.tryApplySuggestedCanvasBitmapSize)(this._canvasBinding),(0,U.tryApplySuggestedCanvasBitmapSize)(this._topCanvasBinding);const n=this._groupedSources(),o=null!==this._currencyLabel&&!this._currencyLabel.isHidden(),a=(e,t,i)=>{if(o){e.save(), @@ -356,80 +356,80 @@ y.hotkeyGroup=this._hotkeys,y.hotkeyHash=188);var S=new w({actionId:C.ChartDialo actionId:C.ChartLinesTogglePrePostMarketLineVisibility,options:{label:i.tf(null,void 0,i(87899)),checkable:!0,checked:!1,statName:"ToggleAverageClosePriceLine"}});De.binding=new a(De,Me.averageClosePriceLineVisible,this.model(),le)}var Ee=new w({actionId:C.ChartPriceScaleToggleCountdownToBarCloseVisibility,options:{label:i.tf(null,void 0,i(94370)),checkable:!0,checked:!1,statName:"ToggleCountdown"}});Ee.binder=new a(Ee,this.model().mainSeries().properties().showCountdown,this.model(),he);var Ve=new w({actionId:C.ChartPriceScaleToggleAddOrderPlusButtonVisibility,options:{label:i.tf(null,void 0,i(97378)),checkable:!0,checked:Z.value(),statName:"ToggleAddOrderPlusButton"}});Ve.binder=new a(Ve,Z,this.model(),de);var Be=null;this._options.goToDateEnabled&&(Be=new w({actionId:C.ChartDialogsShowGoToDate,options:{label:j(i.tf(null,void 0,i(75190))),statName:"GoToDate",onExecute:function(){var t=e._chartWidgetCollection.activeChartWidget.value();h(t)},hotkeyGroup:this._hotkeys,hotkeyHash:u.Modifiers.Alt+71}}));var Re=this._createShowSymbolInfoDialogAction(),Ne=new w({actionId:C.ChartPriceScaleMergeAllScalesToLeft,options:{label:ge,statName:"MergeAllScalesToLeft",onExecute:function(){e.model().mergeAllScales("left")}}}),Oe=new w({actionId:C.ChartPriceScaleMergeAllScalesToRight,options:{label:fe,statName:"MergeAllScalesToRight",onExecute:function(){e.model().mergeAllScales("right")}}}),Fe=new w({actionId:C.ChartPriceScaleMoveToLeft,options:{label:ve,statName:"MoveScaleToLeft",onExecute:function(){e.model().mergeAllScales("left")}}}),We=new w({actionId:C.ChartPriceScaleMoveToRight,options:{label:ye,statName:"MoveScaleToRight",onExecute:function(){e.model().mergeAllScales("right")}}});var He=o.enabled("show_object_tree");this._actions={chartProperties:z,mainSeriesPropertiesAction:U,scalesProperties:G,timeScaleReset:b,invertSeriesScale:t,logSeriesScale:_,autoSeriesScale:s,lockSeriesScale:r,regularSeriesScale:n,percentSeriesScale:c,indexedTo100SeriesScale:p,compareOrAdd:F,paneObjectTree:He?W:void 0,insertIndicator:N,symbolSearch:v,showSymbolInfoDialog:Re,changeInterval:S,seriesHide:Y,studyHide:Y,lineToggleLock:$,lineHide:Y,scaleSeriesOnly:K,drawingToolbarAction:pe,stayInDrawingModeAction:me,hideAllMarks:Se,applyTimeZone:f,showCountdown:Ee,addPlusButton:Ve,showSeriesLastValue:we,showHighLowPriceLabels:Ae,showHighLowPriceLines:Le,showAverageClosePriceLabel:ke,showAverageClosePriceLine:De,showSymbolLabelsAction:Ce,showStudyLastValue:xe,showStudyPlotNamesAction:Ie,undo:m,redo:g,mergeLeftScalesAction:Ne,mergeRightScalesAction:Oe,moveScaleToLeft:Fe,moveScaleToRight:We,moveChartAction:undefined},this._actions.chartReset=this._createChartResetAction();const ze=this._createApplyColorThemeAction();ze&&(this._actions.applyColorTheme=ze);const Ue=this._createAddToWatchlistAction();if(Ue&&(this._actions.addToWatchlist=Ue),!TradingView.onWidget()&&o.enabled("text_notes")&&(this._actions.addToTextNotes=undefined),null!==Be&&(this._actions.gotoDate=Be),this.createSessionBreaksActions(),!this.readOnly()){ var je=this._createRemoveSelectedObjectAction();this._hotkeys.add({handler:function(){this.removeSelectedSources()}.bind(this),desc:"Remove selected source",hotkey:d.isMacKeyboard?46:8}),this._actions.paneRemoveAllStudies=x,this._actions.paneRemoveAllDrawingTools=T,this._actions.paneRemoveAllStudiesDrawingTools=I,this._actions.applyStudiesToAllCharts=E,this._actions.studyRemove=je,this._actions.lineRemove=je,o.enabled("property_pages")&&(this._actions.format=B)}this._actions.showPriceLine=new w({actionId:C.ChartLinesToggleSeriesPriceLineVisibility,options:{label:i.tf(null,void 0,i(91492)),checkable:!0,statName:"TogglePriceLine"}}),this._actions.showPriceLine.binding=new a(this._actions.showPriceLine,this.model().mainSeries().properties().showPriceLine,this.model(),ue),this._registerLineToolHotkeys(),this._updateScalesActions()}options(){return this._options}executeActionById(e){if("takeScreenshot"===e)return console.warn('Action "takeScreenshot" is deprecated. Use method "takeScreenshot" instead'),void this._chartWidgetCollection.takeScreenshot();e in this._actions?this._actions[e]instanceof w&&this._actions[e].execute():console.warn("Unknown action id: "+e)}getCheckableActionState(e){if(e in this._actions){var t=this._actions[e];if(t instanceof w&&t.isCheckable())return t.isChecked();console.warn("Action "+e+" has no state")}else console.warn("Unknown action id: "+e);return null}_updateScalesActions(){if(null!==this._actions){var e=this.model().mainSeries(),t=e.priceScale(),i=e.properties(),s=t.isLockScale(),r=i.style.value()===n.STYLE_PNF;this._actions.percentSeriesScale.update({disabled:s||r,checked:t.isPercentage()}),this._actions.logSeriesScale.update({disabled:s||r,checked:t.isLog()}),this._actions.regularSeriesScale.update({disabled:s||r,checked:t.isRegular()}),this._actions.indexedTo100SeriesScale.update({disabled:s||r,checked:t.isIndexedTo100()}),this._actions.invertSeriesScale.update({checked:t.isInverted()}),this._actions.lockSeriesScale.update({checked:t.isLockScale()}),this._actions.autoSeriesScale.update({checked:t.isAutoScale(),disabled:t.properties().autoScaleDisabled.value()})}}defaultSymbol(){return this._defSymbol}widget(){return this._mainDiv}_onBackgroundColorChanged(){for(var e=0;e0;)for(var t=this._content.panes[e].sources,i=t.length;i-- >0;)if("MainSeries"===t[i].type)return t[i].state}updateUndoRedo(){this._model&&(this.actions().undo.update({disabled:this._model.undoHistory().undoStack().isEmpty()}),this.actions().redo.update({disabled:this._model.undoHistory().redoStack().isEmpty()}))}createSessionBreaksActions(){var e=new w({actionId:C.ChartSessionBreaksToggleVisibility,options:{ -label:i.tf(null,void 0,i(59827)),checkable:!0,statName:"ToggleSessionBreaks"}});e.binder=new a(e,this._model.chartModel().sessions().properties().graphics.vertlines.sessBreaks.visible,this.model(),me),this._actions.sessionBreaks=e}updateActionForIntradayOnly(e){e&&e instanceof w&&e.update({disabled:this.model().mainSeries().isDWM()})}containsVolume(){return this.model().dataSources().some((function(e){return e instanceof p&&"Volume"===e.metaInfo().shortId}))}containsStudyByPredicate(e){return!!this._model&&this._model.dataSources().some((function(t){if(!(t instanceof p))return!1;var i=t.metaInfo();return e(i)}))}containsStudy(e){return this.containsStudyByPredicate((function(t){return t.id===e||t.fullId===e}))}isSmall(){return this._width()<550||this._height()<300}onWidget(){return this._onWidget}onCmeWidget(){return"cme"===this.widgetCustomer()}widgetCustomer(){return this._widgetCustomer}resize(){var e=this._height()+"px",t=this._width()+"px";this._mainDiv.style.height=e,this._mainDiv.style.width=t,this._elMainTable.style.height=e,this._elMainTable.style.width=t,this._resizeHandler&&this._mainDiv&&this._resizeHandler()}applyOverrides(e){var t={};for(var i in e)i.startsWith("mainSeriesProperties.priceAxisProperties")||(t[i]=e[i]);if(applyPropertiesOverrides(this.properties(),null,!1,t,null),this._model){applyPropertiesOverrides(this._model.model().properties(),null,!1,t),applyPropertiesOverrides(this._model.mainSeries().properties(),null,!1,t,"mainSeriesProperties"),this._model.model().sessions().applyOverrides(t);const e=this._model.chartModel().watermarkSource();null!==e&&e.applyOverrides(t)}}applyStudiesOverrides(e){N.mergeDefaultsOverrides(e),this._applyStudiesOverrides()}setActive(e){this._isActive=e,F().isTouch&&(e&&0!==this.selectPointMode().value()?this.startTrackingMode():this.exitTrackingMode()),this._paneWidgets.forEach((function(e){e.update()})),e||this.model().selectionMacro((function(e){e.clearSelection()}))}isActive(){return this._isActive}showReplayOrderConfirmationDialog(){if(!this.model().isInReplay())return Promise.resolve()}_addPerfMark(e){G("ChartWidget."+this._id+"."+e)}getResizerDetacher(){return this._options}}},3162:(e,t,i)=>{"use strict";var s=i(50151).assert,r=i(75531).layouts,n=i(18687).createUndoHistory,o=i(88348),a=i(4741),l=i(68335),c=i(76422),h=i(14483),d=i(97145).WatchedValue,u=i(59224).getLogger("Chart.ChartWidgetCollection"),p=i(21861).preventDefaultForContextMenu,_=i(88732),m=i(13323).GeneralChartPropertiesRenderer,g=i(42120).CompareDialogRenderer,f=i(84015).isOnMobileAppPage,v=i(57898).Delegate;const{isSupportedLayout:y,tryGuessingTheMostSuitableLayout:S}=i(75531);var b,w=i(71026).AriaChartDescription;const C=i(36174).randomHash;var P=i(55148),x=P.applyIndicatorsToAllChartsImpl,T=P.applyIndicatorToAllChartsImpl,I=P.lineToolsAndGroupsDTOsImpl,M=P.getStateForChartImpl,A=P.resetLineToolsInvalidatedImpl,L=P.applyLineToolUpdateNotificationImpl,k=P.createClipboardHandler,D=P.chartsSymbolsImpl,E=P.updateLayoutImpl,V=P.computeContentBoxImpl,B=(P.getVisuallyAdjacentDefImpl, -P.setLayoutImpl),R=P.removeChartWidgetSubscriptionsImpl,N=P.generateNewChartId,O=P.syncCrosshairImpl,F=P.createBroadcastChannel,W=P.destroyBroadcastChannel,H=P.syncScrollImpl,z=P.allInitialModelsCreated,U=P.allInitialSymbolsResolved,j=P.applyThemeImpl,G=P.isFirstChartInLayout,q=P.deserializedChartIds,$=P.handleDateRangeLockChange,Y=P.handleInternalDateRangeLockChange,K=P.handleTrackTimeLockChange,Z=P.handleInternalTrackTimeLockChange,X=P.handleIntervalLockChange,J=P.handleInternalIntervalLockChange,Q=P.handleSymbolLockChange,ee=P.handleInternalSymbolLockChange,te=(P.handleConnectionLimitReachedChanged,P.createLeftBottomChartWidgetWV),ie=P.subscribeToEventsForDateRangeSync,se=P.unsubscribeFromEventsForDateRangeSync,re=P.syncChartsDateRangesWithActiveChartRange,ne=P.subscribeToCompletedEventForDateRangeUpdate,oe=P.resetLayoutSizesImpl,ae=P.unloadUnusedChartsImpl,le=new Map,ce={saveChartEnabled:!0,takeScreenshotEnabled:!0,publishedChartsEnabled:!0};e.exports=function(e){var t=this,he=Object.assign({},ce,e),de=new d,ue=he.readOnly||!1,pe=C(),_e=[],me=0,ge=new d,fe=new d,ve=new d,ye="s",Se=new d(null),be=new Map,we=new d([]),Ce=new d,Pe=[];const xe={isConfirmationAboutReplayLocked:!1,loadingChart:!1,setTimeFrameActive:!1,setNewResolution:!1};var Te=!1,Ie=!1,Me=new d(!1),Ae=new d(null),Le=new d(!1),ke=new d(!1);ke.subscribe((e=>Q(vt(),e)));var De=new d(ke.value());De.subscribe((e=>ee(vt(),e)));var Ee=new d(!1);Ee.subscribe((e=>X(vt(),e)));var Ve=new d(Ee.value());Ve.subscribe((e=>J(vt(),e)));var Be=new d(ye),Re=new d(!1);Re.subscribe((e=>K(vt(),e)));var Ne=P.combinedTrackTimeLock(Be,Re,_e);Re.subscribe((e=>K(vt(),e)));var Oe=new d(Ne.value());Oe.subscribe((e=>Z(vt(),e)));var Fe=new d(!1);Fe.subscribe((e=>$(vt(),e))),Se.subscribe(Ut);var We=new d(Fe.value());We.subscribe((e=>Y(vt(),e)));var He=new d(TVSettings.getBool("chart.syncCrosshair",!0)),ze=a.createGroup({desc:"Layout"}),Ue=null,je=null,Ge=null,qe=null;if(window.TVD){var $e=window.TVD.crosshairSyncEnabled;$e?($e.value()&&(Ge=F(vt)),qe=$e.subscribe((e=>{e?Ge=F(vt):(W(vt()),Ge=null)}))):Ge=F(vt)}var Ye=He.value();He.subscribe((function(e){Ye=e=!!e,TVSettings.setValue("chart.syncCrosshair",e);for(var t=0;t<_e.length;++t){var i=_e[t].chartWidget;i.hasModel()&&i.model().model().lightUpdate()}}));var Ke=he.resizerBridge.width,Ze=he.resizerBridge.height,Xe=new d(null),Je=new d(null);Xe.subscribe((e=>{Je.setValue(null===e?null:e.chartWidget)}));var Qe=he.widgetOptions||{},et=he.metaInfo||{},tt={id:new d(et.id||null),name:new d(et.name),description:new d(et.description),username:new d(et.username),uid:new d(et.uid),lastModified:new d(et.lastModified)},it=n();it.onChange().subscribe(null,(function(e){c.emit("undo_redo_state_changed",e)}));var st=he.resizerBridge.container.value();st.addEventListener("contextmenu",p);var rt,nt=new v,ot=new v,at=new v,lt=new d(!1),ct=new d(null),ht=null,dt=null;he.seriesControlBarEnabled&&(rt="0px",ct.setValue(document.createElement("div")),ct.value().style.left=rt,ct.value().style.right=rt,ct.value().style.bottom=rt, -ct.value().classList.add("chart-toolbar","chart-controls-bar"),ct.value().setAttribute("data-is-chart-toolbar-component","true"),st.appendChild(ct.value()),Promise.all([i.e(2666),i.e(4015),i.e(3842),i.e(5145),i.e(6),i.e(5649),i.e(8056),i.e(5993),i.e(6639),i.e(6036),i.e(9916),i.e(6106),i.e(5166),i.e(1033),i.e(4987),i.e(962),i.e(2544),i.e(2052),i.e(7260)]).then(i.bind(i,33279)).then((({BottomToolbarRenderer:e})=>{var i=he.resizerBridge,s=[i.container.spawn(),i.width.spawn(),i.height.spawn()],r=i.container.value(),n=function(){var e=r.getBoundingClientRect(),t=V(vt());return t.top=e.top+t.top,t.left=e.left+t.left,t},o=new v,a=function(){o.fire()};s.forEach((function(e){e.subscribe(a)}));var l=function(){s.forEach((function(e){e.destroy()})),o.destroy()};ht=new e(ct.value(),o,n,t,ChartApiInstance,Qe,he.seriesControlBar),dt=function(){null!==ht&&(ht.destroy(),ht=null,ct.value().remove(),ct.setValue(null)),l()}})));var ut=new m(t),pt=new g(t);function _t(){lt.setValue(_e.some((e=>{const t=e.chartWidget.lineToolsSynchronizer();return null!==t&&t.hasChanges().value()})))}function mt(e){return P.checkProFeatureImpl(vt(),e)}Ae.subscribe((()=>Ct()));const gt=new Map,ft=()=>P.updateLinkingGroupCharts(vt());function vt(){return{undoHistory:it,chartWidgetsDefs:_e,chartsCountToSave:yt,actualLayoutCount:St,savedChartWidgetOptions:Pe,activeChartWidget:de,options:he,parent:st,toastsFactory:null,crosshairLockRaw:Ye,crossHairSyncBroadcast:Ge,setChartStorageNotificationSubscription:e=>{je=e},maximizedChartDef:Xe,setMaximized:Mt,layoutTemplate:ve,widthWV:Ke,heightWV:Ze,checkProFeature:mt,lineToolsSynchronizerHasChanges:lt,recalcHasChanges:_t,onZoom:ot,onScroll:at,layoutType:ye,layoutWV:Be,setLayoutType:e=>{ye=e},isPhoneSize:Me,viewMode:Ce,updateViewMode:Lt,loadingContent:Te,setLoadingContent:e=>{Te=e},initialLoading:Ie,inlineChartsCount:fe,updateWatchedValue:kt,checkAllPendingModelsAlreadyCreated:At,readOnly:ue,symbolLock:ke,internalSymbolLock:De,intervalLock:Ee,internalIntervalLock:Ve,dateRangeLock:We,internalDateRangeLock:We,trackTimeLock:Re,internalTrackTimeLock:Oe,crosshairLock:He,customLegendWidgetsFactoriesMap:Jt,globalDetachable:ge,saveChartService:Ue,customSources:Zt,updateActivityView:Dt,chartWidgetCreatedDelegate:nt,sizingState:Ae,currentLayoutResizeAction:Se,allLayoutSizesState:be,splitters:we,widgetOptions:Qe,bottomToolbar:ct,replayContainer:Xt,layoutSizesChanged:Le,subscribeToCompletedEventForDateRangeSync:(e,t)=>ne(vt(),e,t),subscribeToEventsForDateRangeSync:e=>ie(vt(),e),unsubscribeFromEventsForDateRangeSync:e=>se(vt(),e),syncChartsDateRangesWithActiveChartRange:e=>re(vt(),e),combinedTrackTimeLock:Ne,chartWidgetIdToCompletedCallbackMap:le,flags:xe,linkingGroupsCharts:gt,updateLinkingGroupCharts:ft}}function yt(){return St()}function St(){return r[ye].count}function bt(e,t,i,s,r){return M(vt(),e,t,i,s,r)}function wt(e){return e.value()?1:0}function Ct(){E(vt())}Ke.subscribe(Ct),Ze.subscribe(Ct),this.updateLayout=Ct;const Pt=P.activeLinkingGroupWV(de),xt=P.allLinkingGroupsWV(vt());function Tt(e){ -return e.rdState.owner.value()!==e}function It(e){return B(vt(),e,t)}function Mt(e){Xe.value()!==e&&(Xe.setValue(e),It(ye))}function At(){_e.every((e=>e.chartWidget.hasModel()))&&(kt(),c.emit("layout_changed"))}function Lt(){"s"===ye||Xe.value()?Ce.setValue(b.ForceFullscreen):Ce.setValue(b.Multichart)}function kt(){var e=Math.min(ve.value().count,_e.length)-1;if(e<0)de.deleteValue();else{var t=me;t<0&&(t=0),t>e&&(t=e),de.setValue(_e[t].chartWidget)}}function Dt(){for(var e=_e.length;e--;){var t=e===me;_e[e].container.value().classList.toggle("active",t),_e[e].container.value().classList.toggle("inactive",!t)}}function Et(e){{const t=ni().indexOf(e);w.getInstance().updateChartDescription(e,t,ye)}}function Vt(e){Et(de.value())}const Bt=new v;var Rt=new v,Nt=new d,Ot=new d([]),Ft=null;function Wt(e){var t=e.mainSeries().properties();t.style.subscribe(null,Ht),Ht(t.style),e.model().onSelectedSourceChanged().subscribe(null,zt),Fe.value()&&(ie(vt(),e),re(vt())),zt(e.selection().allSources())}function Ht(e){Nt.setValue(e.value())}function zt(){var e=Ft.model();Ot.setValue(e.selection().allSources())}function Ut(e){Fe.value()&&null===e&&re(vt())}de.subscribe((function(e){if(e){for(var t,i=_e.length;i--;)if(_e[i].chartWidget===e){t=i;break}if(!isFinite(t))throw new Error("Cannot make detached ChartWidget active");if(me!==t){Xe.value()&&(Tt(_e[t])||Xe.setValue(_e[t])),me=t,Dt();for(i=_e.length;i--;)_e[i].chartWidget!==e&&_e[i].chartWidget.setActive(!1);li(),e.setActive(!0),o.activePointSelectionMode.setValue(e.selectPointMode().value())}!function(e){if(Ft!==e){if(Ft&&(Ft.modelCreated().unsubscribe(null,Wt),Ft.hasModel())){var t=Ft.model();Fe.value()&&se(vt(),t),t.mainSeries().properties().style.unsubscribe(null,Ht),t.model().onSelectedSourceChanged().unsubscribe(null,zt),Ft=null}e&&(Ft=e,e.hasModel()?Wt(e.model()):e.modelCreated().subscribe(null,Wt))}}(e)}}),{callWithLast:!0});var jt=new v;function Gt(){he.resizerBridge.requestFullscreen()}function qt(){he.resizerBridge.exitFullscreen()}function $t(){return he.resizerBridge.fullscreenable}function Yt(){return he.resizerBridge.fullscreen}function Kt(e){if(0!==_e.length){for(var t=_e.length;t--;)_e[t].chartWidget.setActive(!1);_e[me].chartWidget.setActive(e)}}ue||(ze.add({desc:"Switch active chart",hotkey:h.enabled("accessible_keyboard_shortcuts")?l.Modifiers.Shift+39:9,handler:function(){Vt()}}),ze.add({desc:"Switch active chart",hotkey:h.enabled("accessible_keyboard_shortcuts")?l.Modifiers.Shift+37:l.Modifiers.Shift+9,handler:function(){Vt()}})),ze.add({desc:"Fullscreen mode",hotkey:l.Modifiers.Shift+70,isDisabled:h.enabled("widget")||!$t().value(),handler:function(){Yt().value()?qt():Gt()}}),he.takeScreenshotEnabled&&(ze.add({desc:"Screenshot server",hotkey:l.Modifiers.Alt+83,handler:P.takeServerScreenshot.bind(this,he.snapshotUrl,t)}),f("any")||(ze.add({desc:"Download client screenshot",hotkey:l.Modifiers.Mod+l.Modifiers.Alt+83,handler:P.downloadScreenshot.bind(this,t)}),ze.add({desc:"Copy client screenshot",hotkey:l.Modifiers.Mod+l.Modifiers.Shift+83, -handler:P.copyScreenshotToClipboard.bind(this,t)}))),he.saveChartEnabled&&ze.add({desc:"Save Chart Layout",hotkey:l.Modifiers.Mod+83,handler:function(){Rt.fire()}});var Zt=new Map,Xt=null,Jt=new Map;const Qt=k(vt());he.globalEvents&&Qt.listen();const ei=ke.spawn(),ti=Ee.spawn(),ii=Fe.spawn(),si=Re.spawn(),ri=He.spawn(),ni=()=>_e.map((e=>e.chartWidget)),oi=te(ni,Be.readonly(),Bt,nt);function ai(e,t){if(Te=!0,Ie=Boolean(t),Pe.splice(0),e){if(e.charts||(e={layout:"s",charts:[e]}),e.layoutsSizes)for(const t of Object.keys(e.layoutsSizes))be.set(t,e.layoutsSizes[t]);var i=new Set;e.charts.forEach((function(e){e.chartId&&i.add(e.chartId)})),e.charts.forEach((function(e){if(!e.chartId){var t=N((function(e){return i.has(e)}));i.add(t),e.chartId=t}}));let t=e.layout;if(!y(t)){const e=S(t);u.logError(`Loading unsupported layout ${t}. Force migration to ${e}`),t=e}ye=mt(t||"s");for(var s=0;sJe.readonly(),leftBottomChartWidget:()=>oi,activeLinkingGroup:()=>Pt,allLinkingGroups:()=>xt,linkingGroupsCharts:e=>P.getLinkingGroupCharts(vt(),e).readonly(),destroy:function(){if(jt.fire(),Kt(!1),null!==dt&&(dt(),dt=null),R(vt()),ei.destroy(),ti.destroy(),si.destroy(),ii.destroy(),Ne.destroy(),ri.destroy(),Se.unsubscribe(Ut),_e.forEach((function(e){void 0!==e.timingsMeter&&e.timingsMeter.destroy(),e.chartWidget.linkingGroupIndex().unsubscribe(ft),e.chartWidget.destroy()})),he.resizerBridge.remove(),we.value().forEach((e=>{e.mouseHandler.destroy(),e.mouseListener.destroy()})),window.removeEventListener("resize",Ct),o.tool.unsubscribe(li),o.tool.unsubscribe(ci),st.remove(),Zt.clear(),Jt.clear(),ze.destroy(),je&&je.destroy(),Qt&&Qt.destroy(),Pt.destroy(),xt.destroy(),window.TVD){const e=window.TVD.crosshairSyncEnabled;e&&e.unsubscribe(qe),W(vt())}oi.destroy(),!0},onAboutToBeDestroyed:jt,layout:Be.readonly(),setLayout:It,activeChartWidget:de,viewMode:Ce,activeChartStyle:Nt.readonly(),setChartStyleToWidget:P.setChartStyleToWidget.bind(this),selectedSources:Ot.readonly(),metaInfo:tt,state:function(e,i,s,r){for(var n=[],o=yt(),a=0;a{c.layoutsSizes[t]=e})),c}, -lineToolsAndGroupsDTOs:function(){return I(vt())},resetLineToolsInvalidated:function(e,t){return A(vt(),e,t)},applyLineToolUpdateNotification:L.bind(null,_e),readOnly:function(){return ue},onZoom:function(){return ot},onScroll:function(){return at},resizerBridge:function(){return he.resizerBridge},lock:{symbol:ei,interval:ti,dateRange:ii,crosshair:ri,trackTime:si},setSymbol:(e,t)=>P.setSymbol(vt(),e,t),setSymbolAll:(e,t)=>P.setSymbolAll(vt(),e,t),setResolution:(e,t,i)=>P.setResolution(vt(),e,t,i),setTimeFrame:function(e){xe.loadingChart||xe.setTimeFrameActive||(xe.setTimeFrameActive=!0,Ee.value()?_e.forEach((function(t){t.chartWidget.loadRange(e)})):de.value().loadRange(e),xe.setTimeFrameActive=!1)},updateLayout:Ct,setChartLayoutWithUndo:function(e){return P.setChartLayoutWithUndoImpl(vt(),this,e)},images:P.getSnapshot.bind(this,this,he.widgetOptions.customerReadableName,Qe.onWidget),clientSnapshot:P.getClientSnapshot.bind(this,this,he.widgetOptions.customerReadableName,Qe.onWidget),tags:function(){for(var e=[],t=0;t<_e.length&&tO(vt(),e,t,i,s),syncScroll:function(e,t){return H(vt(),e,t)},clearChartMetaInfo:function(){tt.id.setValue(null),tt.uid.setValue(void 0),tt.name.setValue(void 0)},takeScreenshot:P.takeScreenshot.bind(this,he.snapshotUrl,this),takeServerScreenshot:P.takeServerScreenshot.bind(this,he.snapshotUrl,this),loadContent:ai,purgeUnusedWidgets:function(){for(var e=r[ye].count;e<_e.length;e++)_e[e].chartWidget.destroy();_e.splice(r[ye].count)},applyOverrides:function(e){for(var t=0;t<_e.length;t++)_e[t].chartWidget.applyOverrides(e)},applyStudiesOverrides:function(e){for(var t=0;t<_e.length;t++)_e[t].chartWidget.applyStudiesOverrides(e)},switchChart:Vt,startFullscreen:Gt,exitFullscreen:qt,fullscreen:Yt,fullscreenable:$t,chartWidgetCreated:function(){return nt},saveKeysPressed:function(){return Rt},getContainer:function(){return st},onWidget:Qe.onWidget,applyTheme:function(e){return j(vt(),t,e)},applyIndicatorsToAllCharts:function(e){x(vt(),e)},applyIndicatorsToAllChartsAvailable:function(){return!ue&&St()>1},applyIndicatorToAllCharts:async function(e,t,i,s){await T(vt(),e,t,i,s)},setActive:Kt,inlineChartsCount:fe.readonly(),revertToInline:function(){Mt(null);for(var e=0;e<_e.length;e++)_e[e].rdState.bridge().attach()},chartMarketStatuses:function(){return _e.map((function(e){return"-"}))},chartSeriesStatuses:function(){return _e.map((function(e){var t=e.chartWidget.hasModel()?e.chartWidget.model().mainSeries().status():null;return(null===t?"":_.SERIES_STATUS_TEXT[t])+" ("+t+")"}))},undoHistory:it,lineToolsSynchronizerHasChanges:lt,applyPreferencesToAllCharts:function(e){},getToasts:function(){return Promise.resolve(null)},addCustomSource:function(e,t,i){s(!Zt.has(e),"Cannot create the same custom source multiple times"),Zt.set(e,{factory:t,layer:i});for(var r=0;r<_e.length;++r){ -var n=_e[r].chartWidget;n.hasModel()&&n.model().model().addCustomSource(e,t,i)}},removeCustomSource:function(e){s(Zt.has(e),"Cannot remove not created custom source"),Zt.delete(e);for(var t=0;t<_e.length;++t){var i=_e[t].chartWidget;i.hasModel()&&i.model().model().removeCustomSource(e)}},addCustomWidgetToLegend:function(e,t){s(!Jt.has(e),"Cannot create the same custom widget in legend multiple times"),Jt.set(e,t);for(var i=0;i<_e.length;++i)_e[i].chartWidget.addCustomWidgetToLegend(e,t)},addReplayWidget:function(e){s(null===Xt,"Cannot create replay container multiple times"),(Xt=document.createElement("div")).style.position="absolute",Xt.style["min-height"]="51px",Xt.style.overflow="hidden",Xt.style.left="0px",Xt.style.right="0px";var t=null===ct.value()?0:ct.value().offsetHeight;Xt.style.bottom=`${t}px`,Xt.setAttribute("data-is-chart-toolbar-component","true"),st.prepend(Xt),e(Xt,(()=>Ct())),Ct()},destroyReplayWidget:function(){s(null!==Xt,"Cannot remove replay container, container is not created"),Xt.remove(),Xt=null,Ct()},setViewMode:function(e){Ce.setValue(e)},moveActiveChartWithUndo:function(e){},activeChartCanBeMoved:function(){return!1},generalPropertiesDefinitions:function(){return de.value().generalPropertiesDefinitions()},reconnectChartApi:function(e){undefined(e)},setBroker:function(e){0},setSaveChartService:function(e){Ue=e;for(var t=0;t<_e.length;++t){_e[t].chartWidget.setSaveChartService(e)}},getCompareDialogRenderer:function(){return pt},getChartPropertiesDialogRenderer:function(){return ut},clipboard:Qt,chartsSymbols:function(){return D(vt())},isFirstChartInLayout:G.bind(null,vt()),deserializedChartIds:q.bind(null,vt()),resetLayoutSizes:oe.bind(null,vt()),unloadUnusedCharts:ae.bind(null,vt()),layoutSizesChanged:()=>Le,clientId:pe,ariaDescribeChart:Et}),ai(he.content,!0),Be.subscribe((function(){Dt()})),Be.hook=function(e){return e===this.value()?e:mt(e)},ue&&(Be.writeLock=!0),window.addEventListener("resize",Ct);var hi=0;function di(){0===--hi&&c.emitOnce("onChartReady")}_e.forEach((function(e){if(e){hi++;var t=e.chartWidget;t.withModel(null,(function(){he.metaInfo&&t.model().model().setChartSaveTime(1e3*he.metaInfo.lastModified);var e=t.model().mainSeries();if(e.bars().size()>0||e.isFailed())di();else{var i=e.dataEvents(),s=function(){di(),i.barReceived().unsubscribe(null,s),i.completed().unsubscribe(null,s),i.error().unsubscribe(null,s)};i.barReceived().subscribe(null,s),i.completed().subscribe(null,s),i.error().subscribe(null,s)}}))}})),z(vt()).then(U).then((function(){window.saver&&window.is_authenticated&&he.widgetOptions.justCloned&&window.saver.saveChartSilently()})).catch(u.logError.bind(u))}},10643:(e,t,i)=>{"use strict";i.d(t,{ContextMenuManager:()=>s});var s,r=i(78071),n=i(39347),o=i(59064);!function(e){let t=null,s=null;const a=[],l={createAction:e=>new n.Action({actionId:"Chart.CustomActionId",options:e}),createAsyncAction:e=>new n.Action({actionId:"Chart.CustomActionId",options:{},optionsLoader:e}),createSeparator:()=>new n.Separator};async function c(e,n={},o={menuName:""},c){ -null!==t&&(e=await t(e,l,o));let d=null;const u=()=>{const e=(0,r.indexOf)(a,(e=>e.renderer===d));-1!==e&&a.splice(e,1),void 0!==c&&c()};let p=!1;if(null!==s&&(d=await s(e,o,u)),d)p=!0,h();else{const t=await Promise.all([i.e(3842),i.e(5649),i.e(3502),i.e(6752),i.e(8149),i.e(6639),i.e(9916),i.e(6985),i.e(962),i.e(2544),i.e(5128),i.e(1584)]).then(i.bind(i,20323));d=new t.ContextMenuRenderer(e,n,u,h)}return a.push({renderer:d,isExternal:p}),d}function h(){(0,o.globalCloseMenu)(),a.forEach((e=>{e.isExternal&&e.renderer.isShown()&&e.renderer.hide()}))}e.createMenu=c,e.showMenu=function(e,t,i={},s,r){return c(e,i,s,r).then((e=>e.show(t)))},e.setCustomRendererFactory=function(e){s=e},e.setCustomItemsProcessor=function(e){t=e},e.hideAll=h,e.getShown=function(){for(let e=0;e{"use strict";i.d(t,{createSymbolSearchAction:()=>a});var s=i(11542),r=i(39347),n=i(53180),o=i(82723);i(14483);function a(){return new r.Action({actionId:"Chart.Dialogs.ShowChangeSymbol",options:{label:(0,n.appendEllipsis)(s.t(null,void 0,i(28089))),statName:"ChangeSymbol",onExecute:()=>{(0,o.showDialog)({defaultValue:"",trackResultsOptions:{trackResults:!1,emptySearchType:"empty_result__supercharts"}})}}})}},85067:(e,t,i)=>{"use strict";i.d(t,{DialogRenderer:()=>r});var s=i(97145);class r{constructor(){this._container=document.createElement("div"),this._visibility=new s.WatchedValue(!1)}visible(){return this._visibility.readonly()}_setVisibility(e){this._visibility.setValue(e)}}},14787:(e,t,i)=>{"use strict";var s;i.d(t,{TabNames:()=>s}),function(e){e.background="Background",e.coordinates="Coordinates",e.drawings="Drawings",e.events="Events",e.eventsAndAlerts="Events & Alerts",e.inputs="Inputs",e.properties="Properties",e.scales="Scales",e.legend="Legend",e.sourceCode="Source Code",e.style="Style",e.symbol="Symbol",e.timezoneSessions="Timezone/Sessions",e.trading="Trading",e.visibility="Visibility",e.text="Text"}(s||(s={}))},241:(e,t,i)=>{"use strict";i.d(t,{createFavoriteDrawingToolbar:()=>a,getFavoriteDrawingToolbarPromise:()=>o});var s=i(69774);let r=null,n=null;function o(){return n}function a(){null===n&&(n=Promise.all([i.e(9417),i.e(2666),i.e(4015),i.e(3842),i.e(6),i.e(5649),i.e(8056),i.e(5993),i.e(2191),i.e(3502),i.e(6752),i.e(8149),i.e(6639),i.e(9327),i.e(9916),i.e(6106),i.e(6985),i.e(1109),i.e(4788),i.e(962),i.e(2544),i.e(1890),i.e(2052),i.e(5128),i.e(2306)]).then(i.bind(i,9629)).then((({FavoriteDrawingToolbar:e})=>(r=null!==r?r:new e({left:window.innerWidth/2,top:s.HEADER_TOOLBAR_HEIGHT_EXPANDED+61}),r))))}},31964:(e,t,i)=>{"use strict";function s(e){var t,i;return Math.max(1,(null===(i=null===(t=e.ownerDocument)||void 0===t?void 0:t.defaultView)||void 0===i?void 0:i.devicePixelRatio)||1)}i.d(t,{getCanvasDevicePixelRatio:()=>s})},10688:(e,t,i)=>{"use strict";i.d(t,{getPriceAxisNameInfo:()=>o});const s=["Z","Y","X","W","V","U","T","S"],r=["A","B","C","D","E","F","G","H"];class n{constructor(e){this.label=e}equals(e){ -return null!==e&&this.label===e.label}}function o(e,t){const i="left"===e?s:r;return new n(t{"use strict";i.d(t,{CHART_WIDGET_COLLECTION_SERVICE:()=>s});i(16216);const s={id:"ChartWidgetCollectionService"};var r;!function(e){e.Multichart="multichart",e.ForceFullscreen="force-fullscreen"}(r||(r={}))},91280:(e,t,i)=>{"use strict";i.d(t,{InvalidationLevel:()=>s,InvalidationMask:()=>a,defaultInvalidationLevel:()=>o});var s,r=i(50151);class n{constructor(e=o){this._paneInvalidationLevel=o,this._leftPriceScalesInvalidationMap=new Map,this._rightPriceScalesInvalidationMap=new Map,this._legendWidgetInvalidated=!1,this._invalidationLevel=e}fullInvalidation(){return this._invalidationLevel}invalidateAll(e){this._invalidationLevel=Math.max(this._invalidationLevel,e)}invalidatePane(e){this._paneInvalidationLevel=Math.max(this._invalidationLevel,e)}invalidateLegendWidgetLayout(){this._legendWidgetInvalidated=!0}invalidatePriceScale(e,t,i){const s="left"===e?this._leftPriceScalesInvalidationMap:this._rightPriceScalesInvalidationMap,r=s.get(t)||o;s.set(t,Math.max(r,i))}invalidationLevelForPane(){return Math.max(this._paneInvalidationLevel,this._invalidationLevel)}legendWidgetLayoutInvalidated(){return this._legendWidgetInvalidated||this._invalidationLevel===s.Full}getterForPriceScaleInvalidationLevelBySide(e){const t="left"===e?this._leftPriceScalesInvalidationMap:this._rightPriceScalesInvalidationMap;return e=>Math.max(t.get(e)||o,this._invalidationLevel)}priceScaleSideMaxLevel(e){const t="left"===e?this._leftPriceScalesInvalidationMap:this._rightPriceScalesInvalidationMap;let i=this._invalidationLevel;return t.size>0&&t.forEach((e=>{e>i&&(i=e)})),i}merge(e){this._invalidationLevel=Math.max(this._invalidationLevel,e._invalidationLevel),this._paneInvalidationLevel=Math.max(this._paneInvalidationLevel,e._paneInvalidationLevel),e._leftPriceScalesInvalidationMap.forEach(((e,t)=>{const i=this._leftPriceScalesInvalidationMap.get(t)||o;this._leftPriceScalesInvalidationMap.set(t,Math.max(i,e))})),e._rightPriceScalesInvalidationMap.forEach(((e,t)=>{const i=this._rightPriceScalesInvalidationMap.get(t)||o;this._rightPriceScalesInvalidationMap.set(t,Math.max(i,e))})),this._legendWidgetInvalidated=this._legendWidgetInvalidated||e._legendWidgetInvalidated}}!function(e){e[e.None=0]="None",e[e.Cursor=1]="Cursor",e[e.Light=2]="Light",e[e.Full=3]="Full"}(s||(s={}));const o=s.None;class a{constructor(e=o){this._panesOrderChanged=!1,this._keepVisibleTimeRangeOnResize=!1,this._timeAxisInvalidationLevel=o,this._invalidatedPanes=new Map,this._additionalActions=[],this._timeScaleInvalidations=[],this._invalidationLevel=e}invalidateAll(e){this._invalidationLevel!==e&&(this._invalidationLevel=Math.max(this._invalidationLevel,e),this._invalidatedPanes.forEach((e=>{e.invalidateAll(this._invalidationLevel)})))}invalidateAllPane(e,t){this._invalidatedPanes.has(e)||this._invalidatedPanes.set(e,new n(this._invalidationLevel)),(0,r.ensureDefined)(this._invalidatedPanes.get(e)).invalidateAll(t)}invalidatePriceScale(e,t,i,s){ -this._invalidatedPanes.has(e)||this._invalidatedPanes.set(e,new n(this._invalidationLevel)),(0,r.ensureDefined)(this._invalidatedPanes.get(e)).invalidatePriceScale(t,i,s)}invalidateTimeScale(e){this._timeAxisInvalidationLevel=Math.max(this._timeAxisInvalidationLevel,e)}invalidatePanesOrder(){this._panesOrderChanged=!0}lockVisibleTimeRangeOnResize(){this._keepVisibleTimeRangeOnResize=!0}fullInvalidation(){return this._invalidationLevel}maxPaneInvalidation(){const e=[];return this._invalidatedPanes.forEach((t=>{e.push(t.fullInvalidation())})),Math.max(...e,this._invalidationLevel)}invalidateForPane(e){return this._invalidatedPanes.get(e)||new n(this._invalidationLevel)}invalidateForTimeScale(){return Math.max(this._timeAxisInvalidationLevel,this._invalidationLevel)}validationActions(){return this._additionalActions}addValidationAction(e){this._additionalActions.push(e)}merge(e){this._invalidationLevel=Math.max(this._invalidationLevel,e._invalidationLevel),this._panesOrderChanged=this._panesOrderChanged||e._panesOrderChanged,this._keepVisibleTimeRangeOnResize=this._keepVisibleTimeRangeOnResize||e._keepVisibleTimeRangeOnResize,this._invalidatedPanes.forEach((e=>{e.invalidateAll(this._invalidationLevel)})),e._invalidatedPanes.forEach(((e,t)=>{this._invalidatedPanes.has(t)||this._invalidatedPanes.set(t,new n(this._invalidationLevel)),(0,r.ensureDefined)(this._invalidatedPanes.get(t)).merge(e)})),this._timeAxisInvalidationLevel=Math.max(this._timeAxisInvalidationLevel,e._timeAxisInvalidationLevel);for(let t=0;t0===e.type));if(-1!==i){const[s]=this._timeScaleInvalidations.splice(i,1);null===(t=(e=s.value).onFinish)||void 0===t||t.call(e,!1)}}}},38325:(e,t,i)=>{"use strict";i.d(t,{lastMouseOrTouchEventInfo:()=>r,setLastMouseOrTouchEventInfo:()=>n});let s=(0,i(49483).supportTouch)()?{isTouch:!0,stylus:!1}:{ -isTouch:!1};function r(){return s}function n(e){s=e.isTouch?{isTouch:!0,stylus:e.stylus}:{isTouch:!1}}},26097:(e,t,i)=>{"use strict";i.d(t,{layoutInitialSizingState:()=>n});var s=i(3308);i(50151);function r(e){return e.map((t=>{if((0,s.default)(t))return{percent:1/e.length};{const i=t.slice(1);return{percent:1/e.length,substate:r(i)}}}))}function n(e){return r(e.slice(1))}},75531:(e,t,i)=>{"use strict";i.r(t),i.d(t,{isMultipleLayout:()=>o,isSingleLayout:()=>n,isSupportedLayout:()=>a,layouts:()=>r,tryGuessingTheMostSuitableLayout:()=>l});i(34976),i(26097);let s;s={};const r={...{s:{title:"1 chart",count:1,layoutType:"s",sizer:(e,t)=>{if(0!==t)throw new RangeError("invalid index");return e},splitters:()=>[],resizeApplier:(e,t,i,s,r)=>r,syncSublayoutsBySplitter:(e,t)=>t,expression:["h",0]}},...s};function n(e){return"s"===e}function o(e){return!n(e)}function a(e){return n(e)||s.hasOwnProperty(e)}function l(e){return"s"}},72414:(e,t,i)=>{"use strict";i.d(t,{LineToolsGroupControllerApi:()=>o});var s=i(98517),r=i(50151),n=i(92249);class o{constructor(e,t){this._controller=e,this._model=t}createGroupFromSelection(){return this._controller.createGroupFromSelection().id}removeGroup(e){const t=(0,r.ensureDefined)(this._groupById(e));this._controller.removeGroup(t)}groups(){return this._controller.groups().map((e=>e.id))}shapesInGroup(e){const t=(0,r.ensureDefined)(this._groupById(e));return(0,s.sortSources)(t.lineTools()).map((e=>e.id()))}excludeShapeFromGroup(e,t){const i=(0,r.ensureDefined)(this._groupById(e)),s=(0,r.ensureNotNull)(this._model.dataSourceForId(t));(0,r.assert)((0,n.isLineTool)(s),"Passed shapeId is not a line tool"),this._controller.excludeLineToolFromGroup(i,s)}addShapeToGroup(e,t){const i=(0,r.ensureDefined)(this._groupById(e)),s=(0,r.ensureNotNull)(this._model.dataSourceForId(t));(0,r.assert)((0,n.isLineTool)(s),"Passed shapeId is not a line tool"),this._controller.addLineToolToGroup(i,s)}availableZOrderOperations(e){const t=(0,r.ensureDefined)(this._groupById(e));return this._controller.availableZOrderOperations(t)}bringToFront(e){const t=(0,r.ensureDefined)(this._groupById(e));this._controller.bringToFront(t)}bringForward(e){const t=(0,r.ensureDefined)(this._groupById(e));this._controller.bringForward(t)}sendBackward(e){const t=(0,r.ensureDefined)(this._groupById(e));this._controller.sendBackward(t)}sendToBack(e){const t=(0,r.ensureDefined)(this._groupById(e));this._controller.sendToBack(t)}insertAfter(e,t){const i=(0,r.ensureDefined)(this._groupById(e)),s=(0,r.ensureNotNull)(this._groupById(t)||this._model.dataSourceForId(t));this._controller.insertAfter(i,s)}insertBefore(e,t){const i=(0,r.ensureDefined)(this._groupById(e)),s=(0,r.ensureNotNull)(this._groupById(t)||this._model.dataSourceForId(t));this._controller.insertBefore(i,s)}groupVisibility(e){return(0,r.ensureDefined)(this._groupById(e)).visibility()}setGroupVisibility(e,t){const i=(0,r.ensureDefined)(this._groupById(e));this._controller.setGroupVisibility(i,t)}groupLock(e){return(0,r.ensureDefined)(this._groupById(e)).locked()}setGroupLock(e,t){ -const i=(0,r.ensureDefined)(this._groupById(e));this._controller.setGroupLock(i,t)}getGroupName(e){return(0,r.ensureDefined)(this._groupById(e)).name().value()}setGroupName(e,t){const i=(0,r.ensureDefined)(this._groupById(e));this._controller.setGroupName(i,t)}canBeGroupped(e){const t=e.map((e=>(0,r.ensureNotNull)(this._model.dataSourceForId(e))));return!t.some((e=>!(0,n.isLineTool)(e)))&&this._controller.canBeGroupped(t)}_groupById(e){return this._controller.groups().find((t=>t.id===e))}}},86972:(e,t,i)=>{"use strict";i.d(t,{lineToolsSelectHotkeys:()=>r});i(42053);var s=i(68335);const r={LineToolFibRetracement:{hash:s.Modifiers.Alt+70,action:"setTool",description:"Draw Fib Retracement"},LineToolHorzLine:{hash:s.Modifiers.Alt+72,action:"drawRightThere",description:"Draw Horizontal Line here"},LineToolHorzRay:{hash:s.Modifiers.Alt+74,action:"drawRightThere",description:"Draw Horizontal Ray here"},LineToolRectangle:{hash:s.Modifiers.Alt+s.Modifiers.Shift+82,action:"setTool",description:"Draw Rectangle"},LineToolTrendLine:{hash:s.Modifiers.Alt+84,action:"setTool",description:"Draw Trend Line"},LineToolVertLine:{hash:s.Modifiers.Alt+86,action:"drawRightThere",description:"Draw Vertical Line here"},LineToolCrossLine:{hash:s.Modifiers.Alt+67,action:"drawRightThere",description:"Draw Cross Line here"}}},42184:(e,t,i)=>{"use strict";i.d(t,{MouseEventHandler:()=>u,defaultPreventedHandler:()=>h});var s=i(49483),r=i(50151),n=i(1722),o=i(80007),a=i(38325);const l=s.isSafari?"click":"auxclick",c={treatVertTouchDragAsPageScroll:!1,treatHorzTouchDragAsPageScroll:!1,ignoreClickAndTapOnDblClickOrDblTap:!1};function h(e){return t=>{t.preventDefault(),e(t)}}function d(e){let t=!1;return{clickOrTap:i=>{t=!1,setTimeout((()=>!t&&e.clickOrTap(i)),501)},doubleClickOrDoubleTap:i=>{var s;t=!0,null===(s=e.doubleClickOrDoubleTap)||void 0===s||s.call(e,i)}}}class u{constructor(e,t,i){if(this._clickCount=0,this._clickTimeoutId=null,this._clickPosition={x:Number.NEGATIVE_INFINITY,y:Number.POSITIVE_INFINITY},this._tapCount=0,this._tapTimeoutId=null,this._tapPosition={x:Number.NEGATIVE_INFINITY,y:Number.POSITIVE_INFINITY},this._longTapTimeoutId=null,this._longTapActive=!1,this._mouseMoveStartPosition=null,this._touchMoveStartPosition=null,this._touchMoveExceededManhattanDistance=!1,this._cancelClick=!1,this._cancelTap=!1,this._unsubscribeOutsideMouseEvents=null,this._unsubscribeOutsideTouchEvents=null,this._unsubscribeMobileSafariEvents=null,this._unsubscribeMousemove=null,this._unsubscribeRootMouseEvents=null,this._unsubscribeRootTouchEvents=null,this._pinchInfo=null,this._pinchPrevented=!1,this._preventTouchDragProcess=!1,this._mousePressed=!1,this._lastTouchEventTimeStamp=0,this._activeTouchId=null,this._acceptMouseLeave=!s.CheckMobile.iOS(),this._onFirefoxOutsideMouseUp=e=>{this._mouseUpHandler(e)},this._onMobileSafariDoubleClick=e=>{if(this._firesTouchEvents(e)){const t=this._makeCompatEvent(e);if(++this._tapCount,this._tapTimeoutId&&this._tapCount>1){const{manhattanDistance:i}=this._touchMouseMoveWithDownInfo(_(e),this._tapPosition) -;i<30&&!this._cancelTap&&this._processTouchEvent(t,this._handlers.doubleTapEvent),this._resetTapTimeout()}}else{const t=this._makeCompatEvent(e);if(++this._clickCount,this._clickTimeoutId&&this._clickCount>1){const{manhattanDistance:i}=this._touchMouseMoveWithDownInfo(_(e),this._clickPosition);i<5&&!this._cancelClick&&this._processMouseEvent(t,this._handlers.mouseDoubleClickEvent),this._resetClickTimeout()}}},this._target=e,this._options=(0,n.merge)((0,n.clone)(c),i||{}),this._options.ignoreClickAndTapOnDblClickOrDblTap){const{mouseClickEvent:e,mouseDoubleClickEvent:i,tapEvent:s,doubleTapEvent:r}=t;if(e){const s=d({clickOrTap:e,doubleClickOrDoubleTap:i});t.mouseClickEvent=s.clickOrTap,t.mouseDoubleClickEvent=s.doubleClickOrDoubleTap}if(s){const e=d({clickOrTap:s,doubleClickOrDoubleTap:r});t.tapEvent=e.clickOrTap,t.doubleTapEvent=e.doubleClickOrDoubleTap}}this._handlers=t,this._init()}destroy(){null!==this._unsubscribeOutsideMouseEvents&&(this._unsubscribeOutsideMouseEvents(),this._unsubscribeOutsideMouseEvents=null),null!==this._unsubscribeOutsideTouchEvents&&(this._unsubscribeOutsideTouchEvents(),this._unsubscribeOutsideTouchEvents=null),null!==this._unsubscribeMousemove&&(this._unsubscribeMousemove(),this._unsubscribeMousemove=null),null!==this._unsubscribeRootMouseEvents&&(this._unsubscribeRootMouseEvents(),this._unsubscribeRootMouseEvents=null),null!==this._unsubscribeRootTouchEvents&&(this._unsubscribeRootTouchEvents(),this._unsubscribeRootTouchEvents=null),null!==this._unsubscribeMobileSafariEvents&&(this._unsubscribeMobileSafariEvents(),this._unsubscribeMobileSafariEvents=null),this._clearLongTapTimeout(),this._resetClickTimeout()}_mouseEnterHandler(e){this._unsubscribeMousemove&&this._unsubscribeMousemove();const t=this._mouseMoveHandler.bind(this);if(this._unsubscribeMousemove=()=>{this._target.removeEventListener("mousemove",t)},this._target.addEventListener("mousemove",t),this._firesTouchEvents(e))return;const i=this._makeCompatEvent(e);this._processMouseEvent(i,this._handlers.mouseEnterEvent),this._acceptMouseLeave=!0}_resetClickTimeout(){null!==this._clickTimeoutId&&clearTimeout(this._clickTimeoutId),this._clickCount=0,this._clickTimeoutId=null,this._clickPosition={x:Number.NEGATIVE_INFINITY,y:Number.POSITIVE_INFINITY}}_resetTapTimeout(){null!==this._tapTimeoutId&&clearTimeout(this._tapTimeoutId),this._tapCount=0,this._tapTimeoutId=null,this._tapPosition={x:Number.NEGATIVE_INFINITY,y:Number.POSITIVE_INFINITY}}_mouseMoveHandler(e){if(this._mousePressed||null!==this._touchMoveStartPosition)return;if(this._firesTouchEvents(e))return;const t=this._makeCompatEvent(e);this._processMouseEvent(t,this._handlers.mouseMoveEvent),this._acceptMouseLeave=!0}_touchMoveHandler(e){const t=f(e.changedTouches,(0,r.ensureNotNull)(this._activeTouchId));if(null===t)return;if(this._lastTouchEventTimeStamp=g(e),null!==this._pinchInfo)return;if(this._preventTouchDragProcess)return;this._pinchPrevented=!0;const i=this._touchMouseMoveWithDownInfo(_(t),(0, -r.ensureNotNull)(this._touchMoveStartPosition)),{xOffset:s,yOffset:n,manhattanDistance:a}=i;if(this._touchMoveExceededManhattanDistance||!(a<5)){if(!this._touchMoveExceededManhattanDistance){const e=.5*s,t=n>=e&&!this._options.treatVertTouchDragAsPageScroll,i=e>n&&!this._options.treatHorzTouchDragAsPageScroll;t||i||(this._preventTouchDragProcess=!0),this._touchMoveExceededManhattanDistance=!0,this._cancelTap=!0,this._clearLongTapTimeout(),this._resetTapTimeout()}if(!this._preventTouchDragProcess){const i=this._makeCompatEvent(e,t);this._processTouchEvent(i,this._handlers.touchMoveEvent),(0,o.preventDefault)(e)}}}_mouseMoveWithDownHandler(e){if(0!==e.button)return;const t=this._touchMouseMoveWithDownInfo(_(e),(0,r.ensureNotNull)(this._mouseMoveStartPosition)),{manhattanDistance:i}=t;if(i>=5&&(this._cancelClick=!0,this._resetClickTimeout()),this._cancelClick){const t=this._makeCompatEvent(e);this._processMouseEvent(t,this._handlers.pressedMouseMoveEvent)}}_touchMouseMoveWithDownInfo(e,t){const i=Math.abs(t.x-e.x),s=Math.abs(t.y-e.y);return{xOffset:i,yOffset:s,manhattanDistance:i+s}}_touchEndHandler(e){let t=f(e.changedTouches,(0,r.ensureNotNull)(this._activeTouchId));if(null===t&&0===e.touches.length&&(t=e.changedTouches[0]),null===t)return;this._activeTouchId=null,this._lastTouchEventTimeStamp=g(e),this._clearLongTapTimeout(),this._touchMoveStartPosition=null,this._unsubscribeRootTouchEvents&&(this._unsubscribeRootTouchEvents(),this._unsubscribeRootTouchEvents=null);const i=this._makeCompatEvent(e,t);if(this._processTouchEvent(i,this._handlers.touchEndEvent),++this._tapCount,this._tapTimeoutId&&this._tapCount>1){const{manhattanDistance:e}=this._touchMouseMoveWithDownInfo(_(t),this._tapPosition);e<30&&!this._cancelTap&&this._processTouchEvent(i,this._handlers.doubleTapEvent),this._resetTapTimeout()}else this._cancelTap||(this._processTouchEvent(i,this._handlers.tapEvent),this._handlers.tapEvent&&(0,o.preventDefault)(e));0===this._tapCount&&(0,o.preventDefault)(e),0===e.touches.length&&this._longTapActive&&(this._longTapActive=!1,(0,o.preventDefault)(e))}_touchCancelHandler(e){this._touchEndHandler(e)}_mouseUpHandler(e){if(0!==e.button)return;const t=this._makeCompatEvent(e);if(this._mouseMoveStartPosition=null,this._mousePressed=!1,this._unsubscribeRootMouseEvents&&(this._unsubscribeRootMouseEvents(),this._unsubscribeRootMouseEvents=null),s.isFF){this._target.ownerDocument.documentElement.removeEventListener("mouseleave",this._onFirefoxOutsideMouseUp)}if(!this._firesTouchEvents(e))if(this._processMouseEvent(t,this._handlers.mouseUpEvent),++this._clickCount,this._clickTimeoutId&&this._clickCount>1){const{manhattanDistance:i}=this._touchMouseMoveWithDownInfo(_(e),this._clickPosition);i<5&&!this._cancelClick&&this._processMouseEvent(t,this._handlers.mouseDoubleClickEvent),this._resetClickTimeout()}else this._cancelClick||this._processMouseEvent(t,this._handlers.mouseClickEvent)}_clearLongTapTimeout(){null!==this._longTapTimeoutId&&(clearTimeout(this._longTapTimeoutId),this._longTapTimeoutId=null)}_touchStartHandler(e){ -if(null!==this._activeTouchId)return this._clearLongTapTimeout(),void this._resetTapTimeout();const t=e.changedTouches[0];this._activeTouchId=t.identifier,this._lastTouchEventTimeStamp=g(e);const i=this._target.ownerDocument.documentElement;this._cancelTap=!1,this._touchMoveExceededManhattanDistance=!1,this._preventTouchDragProcess=!1,this._touchMoveStartPosition=_(t),this._unsubscribeRootTouchEvents&&(this._unsubscribeRootTouchEvents(),this._unsubscribeRootTouchEvents=null);{const t=this._touchMoveHandler.bind(this),s=this._touchEndHandler.bind(this);this._unsubscribeRootTouchEvents=()=>{i.removeEventListener("touchmove",t),i.removeEventListener("touchend",s)},i.addEventListener("touchmove",t,{passive:!1}),i.addEventListener("touchend",s,{passive:!1}),this._clearLongTapTimeout(),this._longTapTimeoutId=setTimeout(this._longTapHandler.bind(this,e),240)}const s=this._makeCompatEvent(e,t);this._processTouchEvent(s,this._handlers.touchStartEvent),this._tapTimeoutId||(this._tapCount=0,this._tapTimeoutId=setTimeout(this._resetTapTimeout.bind(this),500),this._tapPosition=_(t))}_wheelClickHandler(e){if(1!==e.button)return;if(this._firesTouchEvents(e))return;const t=this._makeCompatEvent(e);this._processMouseEvent(t,this._handlers.wheelClickEvent)}_mouseDownHandler(e){if(0!==e.button)return;const t=this._target.ownerDocument.documentElement;s.isFF&&t.addEventListener("mouseleave",this._onFirefoxOutsideMouseUp),this._cancelClick=!1,this._mouseMoveStartPosition=_(e),this._unsubscribeRootMouseEvents&&(this._unsubscribeRootMouseEvents(),this._unsubscribeRootMouseEvents=null);{const e=this._mouseMoveWithDownHandler.bind(this),i=this._mouseUpHandler.bind(this);this._unsubscribeRootMouseEvents=()=>{t.removeEventListener("mousemove",e),t.removeEventListener("mouseup",i)},t.addEventListener("mousemove",e),t.addEventListener("mouseup",i)}if(this._mousePressed=!0,this._firesTouchEvents(e))return;const i=this._makeCompatEvent(e);this._processMouseEvent(i,this._handlers.mouseDownEvent),this._clickTimeoutId||(this._clickCount=0,this._clickTimeoutId=setTimeout(this._resetClickTimeout.bind(this),500),this._clickPosition=_(e))}_init(){this._target.addEventListener("mouseenter",this._mouseEnterHandler.bind(this)),this._target.addEventListener("touchcancel",this._touchCancelHandler.bind(this));{const e=this._target.ownerDocument,t=e=>!e.target||!this._target.contains(e.target),i=e=>{if(!t(e))return;const i=e.changedTouches[0];this._lastTouchEventTimeStamp=g(e),this._processTouchEvent(this._makeCompatEvent(e,i),this._handlers.touchStartOutsideEvent)},s=e=>{t(e)&&!this._firesTouchEvents(e)&&this._processMouseEvent(this._makeCompatEvent(e),this._handlers.mouseDownOutsideEvent)};this._unsubscribeOutsideTouchEvents=()=>{e.removeEventListener("touchstart",i)},this._unsubscribeOutsideMouseEvents=()=>{e.removeEventListener("mousedown",s)},e.addEventListener("mousedown",s),e.addEventListener("touchstart",i,{passive:!0})}s.CheckMobile.iOS()&&(this._unsubscribeMobileSafariEvents=()=>{ -this._target.removeEventListener("dblclick",this._onMobileSafariDoubleClick)},this._target.addEventListener("dblclick",this._onMobileSafariDoubleClick)),this._target.addEventListener("mouseleave",this._mouseLeaveHandler.bind(this)),this._target.addEventListener("contextmenu",this._contextMenuHandler.bind(this)),this._target.addEventListener("touchstart",this._touchStartHandler.bind(this),{passive:!0}),(0,o.preventScrollByWheelClick)(this._target),this._target.addEventListener("mousedown",this._mouseDownHandler.bind(this)),this._target.addEventListener(l,this._wheelClickHandler.bind(this)),this._initPinch(),this._target.addEventListener("touchmove",(()=>{}),{passive:!1})}_initPinch(){void 0===this._handlers.pinchStartEvent&&void 0===this._handlers.pinchEvent&&void 0===this._handlers.pinchEndEvent||(this._target.addEventListener("touchstart",(e=>this._checkPinchState(e.touches)),{passive:!0}),this._target.addEventListener("touchmove",(e=>{if(null===this._pinchInfo)return;const t=f(e.touches,(0,r.ensureNotNull)(this._activeTouchId)),i=f(e.touches,this._pinchInfo.secondTouchId);if(t&&i&&void 0!==this._handlers.pinchEvent){const{startPinchDistance:s,startPinchMiddlePoint:r}=this._pinchInfo,n=m(t,i)/s,a=p(this._target);this._handlers.pinchEvent(r,{x:t.clientX-a.left,y:t.clientY-a.top},{x:i.clientX-a.left,y:i.clientY-a.top},n),(0,o.preventDefault)(e)}}),{passive:!1}),this._target.addEventListener("touchend",(e=>{this._checkPinchState(e.touches)})))}_checkPinchState(e){1===e.length&&(this._pinchPrevented=!1),2!==e.length||this._pinchPrevented||this._longTapActive?this._stopPinch():this._startPinch(e)}_startPinch(e){if(void 0!==this._handlers.pinchStartEvent&&null===this._pinchInfo){const t=p(this._target);let i,s;e[0].identifier===this._activeTouchId?(i=e[0],s=e[1]):(i=e[1],s=e[0]);const r={x:i.clientX-t.left,y:i.clientY-t.top},n={x:s.clientX-t.left,y:s.clientY-t.top},o={x:(r.x+n.x)/2,y:(r.y+n.y)/2};this._handlers.pinchStartEvent(o,r,n,{bothPointsOnTargetElement:this._target.contains(s.target)})&&(this._pinchInfo={startPinchDistance:m(i,s),startPinchMiddlePoint:o,secondTouchId:s.identifier})}this._clearLongTapTimeout()}_stopPinch(){var e,t;null!==this._pinchInfo&&(this._pinchInfo=null,null===(t=(e=this._handlers).pinchEndEvent)||void 0===t||t.call(e))}_mouseLeaveHandler(e){if(this._unsubscribeMousemove&&this._unsubscribeMousemove(),this._firesTouchEvents(e))return;if(!this._acceptMouseLeave)return;const t=this._makeCompatEvent(e);this._processMouseEvent(t,this._handlers.mouseLeaveEvent),this._acceptMouseLeave=!s.CheckMobile.iOS()}_longTapHandler(e){const t=f(e.touches,(0,r.ensureNotNull)(this._activeTouchId));if(null===t)return;const i=this._makeCompatEvent(e,t);this._processTouchEvent(i,this._handlers.longTapEvent),this._processTouchEvent(i,this._handlers.touchContextMenuEvent),this._cancelTap=!0,this._longTapActive=!0}_contextMenuHandler(e){if((0,o.preventDefault)(e),null!==this._touchMoveStartPosition)return;if(this._firesTouchEvents(e))return;const t=this._makeCompatEvent(e) -;this._processMouseEvent(t,this._handlers.contextMenuEvent),this._cancelClick=!0}_firesTouchEvents(e){return e.sourceCapabilities&&void 0!==e.sourceCapabilities.firesTouchEvents?e.sourceCapabilities.firesTouchEvents:g(e){"touchstart"!==e.type&&(0,o.preventDefault)(e)}}}}function p(e){return e.getBoundingClientRect()||{left:0,top:0}}function _(e){return{x:e.pageX,y:e.pageY}}function m(e,t){const i=e.clientX-t.clientX,s=e.clientY-t.clientY;return Math.sqrt(i*i+s*s)}function g(e){return e.timeStamp||performance.now()}function f(e,t){for(let i=0;i{"use strict";i.d(t,{actualBehavior:()=>a,availableValues:()=>o,navigationButtonsVisibilityKey:()=>r,property:()=>n,restoreNavigationButtonsVisibilitySettingsValue:()=>l});var s=i(29542);const r="NavigationButtons.visibility",{property:n,availableValues:o,actualBehavior:a,restoreDefaultValue:l}=(0,s.createVisibilityController)(r)},3228:(e,t,i)=>{"use strict";i.d(t,{actualBehavior:()=>a,availableValues:()=>o,property:()=>n,restorePaneButtonsVisibilitySettingsValue:()=>l});var s=i(29542),r=i(78159);const{property:n,availableValues:o,actualBehavior:a,restoreDefaultValue:l}=(0,s.createVisibilityController)("PaneButtons.visibility",r.navigationButtonsVisibilityKey)},77212:(e,t,i)=>{"use strict";i.d(t,{ActionBinder:()=>s});class s{constructor(e,t,i,s,r=null){this._property=t,this._undoModel=i,this._undoText=s,this._action=e,this.setValue(t.value()),t.subscribe(this,this._propertyChanged),null!==r?e.update({onExecute:r.bind(this)}):e.update({onExecute:this._onActionCallback.bind(this)})}destroy(){this._property.unsubscribe(this,this._propertyChanged)}value(){return this._action.isChecked()}setValue(e){this._action.update({checked:Boolean(e)})}_onActionCallback(){this._undoModel.setProperty(this._property,this.value(),this._undoText)}_propertyChanged(e){this.setValue(e.value())}}},43886:(e,t,i)=>{"use strict";i.d(t,{isCustomStudy:()=>r});const s={VbPFixed:!0,PivotPointsStandard:!0,VbPVisible:!0,VbPAnchored:!0};function r(e){return e in s}},96362:(e,t,i)=>{"use strict";i.d(t,{MetaInfoHelper:()=>u});var s=i(50151),r=i(42856),n=i(72877),o=i(1722),a=i(59224),l=i(33703);function c(e){ -return!e.groupId&&!e.isHidden&&e.id!==l.RangeDependentStudyInputNames.FirstBar&&e.id!==l.RangeDependentStudyInputNames.LastBar}var h=i(43886);const d=(0,a.getLogger)("Platform.GUI.PropertyDialog.Indicators.MetaInfo");class u{constructor(e){this._metaInfo=e}hasUserEditableInputs(){return this._metaInfo.inputs.some(c)}getUserEditableInputs(){return this._metaInfo.inputs.filter(c)}hasUserEditableProperties(){return r.StudyMetaInfo.isScriptStrategy(this._metaInfo)}hasUserEditableStyles(){const e=this._metaInfo;return e.plots.length>0||void 0!==e.bands||void 0!==e.filledAreas||(0,h.isCustomStudy)(e.shortId)||r.StudyMetaInfo.isScriptStrategy(this._metaInfo)||Object.values(e.graphics).some((e=>void 0!==e))}getUserEditablePlots(){const e=new Set,t=this._metaInfo;return t.plots.filter((i=>{if((0,n.isColorerPlot)(i)||(0,n.isTextColorerPlot)(i)||(0,n.isDataOffsetPlot)(i)||(0,n.isOhlcColorerPlot)(i)||(0,n.isAlertConditionPlot)(i)||(0,n.isDataPlot)(i))return!1;if((0,n.isOhlcPlot)(i)){const r=i.target;if(e.has(r))return!1;e.add(r);const n=(0,s.ensureDefined)(t.ohlcPlots);return!(0,s.ensureDefined)(n[r]).isHidden}{const e=t.styles?t.styles[i.id]:void 0;return void 0===e||!e.isHidden}}))}hasUserEditableOptions(){return this.hasUserEditableInputs()||this.hasUserEditableProperties()||this.hasUserEditableStyles()}getStrategyProperties(){const e=this._metaInfo,t=e.inputs.filter(_),i={...p};for(const s of t){const t=s.internalID;i[t]=s,p.hasOwnProperty(t)||d.logWarn(`Unknown strategy input internal id ${t} in ${e.fullId}`)}return(0,o.clone)(i)}}const p={currency:void 0,backtest_fill_limits_assumption:void 0,calc_on_every_tick:void 0,calc_on_order_fills:void 0,commission_value:void 0,commission_type:void 0,initial_capital:void 0,pyramiding:void 0,slippage:void 0,default_qty_type:void 0,default_qty_value:void 0,margin_long:void 0,margin_short:void 0,use_bar_magnifier:void 0,process_orders_on_close:void 0,fill_orders_on_standard_ohlc:void 0};function _(e){return"strategy_props"===e.groupId}},83526:(e,t,i)=>{"use strict";i.d(t,{checkAuthBeforeSaveLoad:()=>n});var s=i(14483),r=i(39080);function n(e,t){s.enabled("saveload_requires_authentication")?(0,r.runOrSigninWithFeature)(e,{...t,feature:"savedCharts"}):e()}},68456:(e,t,i)=>{"use strict";i.d(t,{AbstractJsonStoreService:()=>r,CommonJsonStoreService:()=>n});var s=i(57898);class r{constructor(e,t,i,r,n){this._onChange=new s.Delegate,this._handleChange=()=>{this._onChange.fire(this.get())},this._crossTabEvents=e,this._jsonKeyValueStore=t,this.CROSSTAB_EVENT_NAME=i,this.JSON_STORE_KEY=r,this.defaultStoreValue=this._serialize(n),this._subscribe()}get(){const e=this._jsonKeyValueStore.getJSON(this.JSON_STORE_KEY,this.defaultStoreValue);return this._deserialize(e)}set(e,t){const i=this._serialize(e);this._jsonKeyValueStore.setJSON(this.JSON_STORE_KEY,i,t),this._crossTabEvents.emit(this.CROSSTAB_EVENT_NAME),this._onChange.fire(e)}getOnChange(){return this._onChange}destroy(){this._unsubscribe(),this._onChange.destroy(),delete this._onChange}_subscribe(){ -this._crossTabEvents.on(this.CROSSTAB_EVENT_NAME,this._handleChange),this._jsonKeyValueStore.onSync.subscribe(this,this._handleChange)}_unsubscribe(){this._crossTabEvents.off(this.CROSSTAB_EVENT_NAME,this._handleChange),this._jsonKeyValueStore.onSync.unsubscribe(this,this._handleChange)}}class n extends r{_serialize(e){return e}_deserialize(e){return e}}},10638:(e,t,i)=>{"use strict";i.d(t,{LoadChartService:()=>d});var s=i(14483),r=i(61595),n=i(83526),o=i(85067),a=i(21097),l=i(56840),c=i(68456);class h extends c.CommonJsonStoreService{constructor(e,t){super(e,t,"FAVORITE_CHARTS_CHANGED","loadChartDialog.favorites",{})}}class d extends o.DialogRenderer{constructor(e=null){super(),this._chartWidgetCollection=null,this._promise=null,this._dialog=null,this._subscribe=e=>{this._setVisibility(e)},this._getChartEntry=e=>({id:e.id,url:e.url,title:e.name,symbol:e.short_symbol,interval:e.interval,toolsCount:0,modified:e.modified_iso,favorite:void 0,active:()=>this._isActiveChart(e.id),openAction:()=>r.backend.loadChart(e),deleteAction:()=>r.backend.removeChart(e.image_url).then((()=>this._deleteChart(e.id))),favoriteAction:e=>Promise.resolve(this._updateFavorites(e))}),this._updateFavorites=e=>{var t;null===(t=this._favoriteChartsService)||void 0===t||t.set(e)},this._isActiveChart=e=>null!==this._chartWidgetCollection&&e===this._chartWidgetCollection.metaInfo.id.value(),this._deleteChart=e=>{this._isActiveChart(e)&&(s.enabled("saveload_storage_customization")?null!==this._chartWidgetCollection&&this._chartWidgetCollection.clearChartMetaInfo():location.href="/chart/"+location.search)},this._chartWidgetCollection=e,this._favoriteChartsService=new h(a.TVXWindowEvents,l)}showLoadDialog(){(0,n.checkAuthBeforeSaveLoad)(this._showLoadDialog.bind(this),{source:"Load chart",sourceMeta:"Chart"})}show(){this.showLoadDialog()}hide(){var e,t;null===(e=this._dialog)||void 0===e||e.hide(),null===(t=this._dialog)||void 0===t||t.visible().unsubscribe(this._subscribe)}_showLoadDialog(){(s.enabled("saveload_requires_authentication")&&!window.is_authenticated?Promise.resolve([]):r.backend.getCharts()).then((e=>e.map(this._getChartEntry))).then((e=>{const t=this._promise=Promise.all([i.e(2666),i.e(956),i.e(2109),i.e(4015),i.e(3842),i.e(5145),i.e(855),i.e(5993),i.e(2587),i.e(6752),i.e(8149),i.e(4781),i.e(6747),i.e(898),i.e(962),i.e(1740),i.e(6408),i.e(2544),i.e(5057),i.e(5164),i.e(5009)]).then(i.bind(i,34557)).then((i=>{if(this._promise===t){this._dialog&&(this._dialog.hide(),this._dialog.visible().unsubscribe(this._subscribe));const t={charts:e,favoriteChartsService:this._favoriteChartsService,chartWidgetCollection:this._chartWidgetCollection};this._dialog=new i.LoadChartDialogRenderer(t),this._dialog.visible().subscribe(this._subscribe),this._dialog.show()}}))}))}async _changeFavoriteState(e,t,i){return Promise.resolve()}}},75593:(e,t,i)=>{"use strict";i.d(t,{CustomStatusModel:()=>c});var s=i(97145);const r="#9598a1",n=!1,o=null,a='';class l{constructor(e){ -this._visible=new s.WatchedValue(n),this._tooltip=new s.WatchedValue(o),this._icon=new s.WatchedValue(a),this._color=new s.WatchedValue(r),this._tooltipContent=new s.WatchedValue(null),this._symbol=e}symbol(){return this._symbol}tooltip(){return this._tooltip}icon(){return this._icon}color(){return this._color}visible(){return this._visible}tooltipContent(){return this._tooltipContent}}class c{constructor(){this._symbolCustomStatuses=new Map}getSymbolCustomStatus(e){if(this._symbolCustomStatuses.has(e))return this._symbolCustomStatuses.get(e);const t=new l(e);return this._symbolCustomStatuses.set(e,t),t}hideAll(){for(const e of this._symbolCustomStatuses.values())e.visible().setValue(!1)}static getInstance(){return null===this._instance&&(this._instance=new c),this._instance}}c._instance=null},98425:(e,t,i)=>{"use strict";i.d(t,{restoreShowMarketOpenStatusProperty:()=>l,showMarketOpenStatusProperty:()=>a});var s=i(59680),r=i(56840);const n="Chart.ShowMarketOpenStatus";function o(){return r.getBool(n,true)}const a=(0,s.createPrimitiveProperty)(o());function l(){a.setValue(true),r.remove(n)}r.onSync.subscribe(null,(()=>a.setValue(o()))),a.subscribe(null,(()=>r.setValue(n,a.value())))},10585:(e,t,i)=>{"use strict";i.d(t,{MarketStatusModel:()=>l});i(50151);var s=i(97145),r=i(57333),n=i(41249);function o(){return window.ChartApiInstance.serverTime()/1e3}function a(e,t,i){return e<=i?t<=i?1/0:t/1e3:Math.min(e,t)/1e3}class l{constructor(e){this._marketStatus=new s.WatchedValue(null),this._lastMarketStatus=null,this._sessionsSpec=null,this._nextSessionEdgeInternal=null,this._nextSessionEdge=new s.WatchedValue(null),this._recalcNextSessionEdgeTimerId=null,this._futuresContractExpirationTime=null,this._quotesProvider=e,e.quotesUpdate().subscribe(this,this._update.bind(this)),e.quoteSymbolChanged().subscribe(this,this._resetStatus)}destroy(){this._quotesProvider.quotesUpdate().unsubscribeAll(this),this._quotesProvider.quoteSymbolChanged().unsubscribeAll(this),null!==this._recalcNextSessionEdgeTimerId&&clearTimeout(this._recalcNextSessionEdgeTimerId)}futuresContractExpirationTime(){return this._futuresContractExpirationTime}setSymbolInfo(e){var t,i,s,n,o;if(this._nextSessionEdgeInternal=null,null===e)return void(this._sessionsSpec=null);const a=new r.SessionSpec(e.timezone,null!==(t=e.session_display)&&void 0!==t?t:e.session,e.session_holidays,e.corrections);let l,c;const h=null===(i=e.subsessions)||void 0===i?void 0:i.find((e=>"premarket"===e.id)),d=null===(s=e.subsessions)||void 0===s?void 0:s.find((e=>"postmarket"===e.id));void 0!==h&&(l=new r.SessionSpec(e.timezone,null!==(n=h["session-display"])&&void 0!==n?n:h.session,e.session_holidays,h["session-correction"])),void 0!==d&&(c=new r.SessionSpec(e.timezone,null!==(o=d["session-display"])&&void 0!==o?o:d.session,e.session_holidays,d["session-correction"])),this._sessionsSpec={general:a,preMarket:l,postMarket:c},this._recalculateNextSessionEdge()}status(){return this._marketStatus}nextSessionEdge(){return this._nextSessionEdge}_resetStatus(){this._lastMarketStatus=null, -this._marketStatus.setValue(null)}_update(e){void 0!==e&&void 0!==e.values.current_session&&(this._lastMarketStatus=e.values.current_session),null!==this._lastMarketStatus?this._marketStatus.setValue(this._lastMarketStatus):this._resetStatus()}_getNextSessionEdgeInternal(){var e;if(null===this._sessionsSpec||"24x7"===this._sessionsSpec.general.spec())return null;const t=1e3*o();if(null===this._nextSessionEdgeInternal||(null!==(e=this._nextSessionEdgeInternal.timestamp)&&void 0!==e?e:1/0)<=t/1e3){const{general:e,preMarket:i,postMarket:s}=this._sessionsSpec,r=(0,n.get_timezone)(e.timezone()),l=(0,n.utc_to_cal)(r,t),c=a((0,n.cal_to_utc)(r,e.alignToNearestSessionStart(l,1)),(0,n.cal_to_utc)(r,e.alignToNearestSessionEnd(l,1)),t),h=a(void 0!==i?(0,n.cal_to_utc)(r,i.alignToNearestSessionStart(l,1)):1/0,void 0!==i?(0,n.cal_to_utc)(r,i.alignToNearestSessionEnd(l,1)):1/0,t),d=a(void 0!==s?(0,n.cal_to_utc)(r,s.alignToNearestSessionStart(l,1)):1/0,void 0!==s?(0,n.cal_to_utc)(r,s.alignToNearestSessionEnd(l,1)):1/0,t);let u=Math.min(c,h,d);if(u===1/0){const t=o(),i=6e4,s=new Date(Math.round(new Date(1e3*t).getTime()/i)*i).getTime()+i,l=(0,n.utc_to_cal)(r,s),c=a((0,n.cal_to_utc)(r,e.alignToNearestSessionStart(l,1)),(0,n.cal_to_utc)(r,e.alignToNearestSessionEnd(l,1)),s),p=Math.min(c,h,d);p!==1/0?(this._nextSessionEdgeInternal={timestamp:u},u=p):this._nextSessionEdgeInternal={timestamp:null}}this._nextSessionEdgeInternal=u===d?{timestamp:u,status:"post_market"}:u===h?{timestamp:u,status:"pre_market"}:{timestamp:u}}return this._nextSessionEdgeInternal}_recalculateNextSessionEdge(){const e=this._getNextSessionEdgeInternal();if(null===e||null===e.timestamp)return void this._nextSessionEdge.setValue(null);const t={status:e.status,remainingSeconds:Math.max(0,e.timestamp-o())};if(null===this._recalcNextSessionEdgeTimerId){const e=Number.isFinite(t.remainingSeconds)?Math.ceil(t.remainingSeconds%60):1;this._recalcNextSessionEdgeTimerId=setTimeout((()=>this._recalculateNextSessionEdgeByTimer()),1e3*e)}this._nextSessionEdge.setValue(t)}_recalculateNextSessionEdgeByTimer(){this._recalcNextSessionEdgeTimerId=null,this._recalculateNextSessionEdge()}}},77248:(e,t,i)=>{"use strict";i.d(t,{CRUCIAL_REALTIME_BATS:()=>a,firstReplacedByBatsExchange:()=>l,isDelay:()=>h,isEod:()=>c,witoutRealtime:()=>d});i(50151);var s=i(79982),r=i.n(s);const n=["DJ","JSE","BELEX"],o=["NZX"],a=["AMEX","NASDAQ","NYSE"];function l(e){return null}function c(e,t){return r().hasEodSymbols(e.full_name)||6===t}function h(e){return void 0!==e&&e>0}function d(e){return"index"===e.type&&n.includes(e.listed_exchange)||"futures"===e.type&&o.includes(e.listed_exchange)}},31330:(e,t,i)=>{"use strict";i.d(t,{canShowSpreadActions:()=>r,globalKeypressMatches:()=>n});var s=i(14483);i(94025),i(82992);new RegExp("^quandl","i");function r(){let e=!1;return s.enabled("show_spread_operators")&&(e=!0),e}function n(e){if(e.ctrlKey)return!1;if(e.metaKey)return!1;if(!e.charCode)return!1;if(!e.which||e.which<=32)return!1;const t=e.target -;return!t||!/^(input|textarea)$/i.test(t.tagName)&&"listbox"!==t.getAttribute("role")}},13702:(e,t,i)=>{"use strict";function s(){return Promise.all([i.e(2666),i.e(956),i.e(2109),i.e(4015),i.e(5145),i.e(855),i.e(6),i.e(8056),i.e(2587),i.e(2639),i.e(9842),i.e(7807),i.e(3353),i.e(962),i.e(1740),i.e(6408),i.e(5057),i.e(750),i.e(1754)]).then(i.bind(i,89324))}i.d(t,{loadNewSymbolSearch:()=>s})},40493:(e,t,i)=>{"use strict";i.d(t,{tradingService:()=>n});var s=i(16216);const r={id:"TradingService"};function n(){return(0,s.hasService)(r)?(0,s.service)(r):null}},96005:(e,t,i)=>{"use strict";i.d(t,{TradingViewApiBase:()=>j});var s=i(50151),r=i(82992),n=i(76422),o=i(14483),a=i(10643),l=i(75531),c=i(51768),h=i(11014),d=i(45345),u=i(57898);class p{constructor(e){this._toolbarThemeChanged=new u.Delegate,this._onWatchedThemeChanged=e=>{this._toolbarThemeChanged.fire(e)},this._opts=e,d.watchedTheme.subscribe(this._onWatchedThemeChanged)}destroy(){d.watchedTheme.unsubscribe(this._onWatchedThemeChanged)}isStdTheme(){const e=this._opts.chartWidgetCollection.getAll().every((e=>(0,h.isStdTheme)((0,h.extractThemeFromModel)(e.model()))));return Promise.resolve(e)}async setStdTheme(e,t=!0,i){await(0,h.loadTheme)(this._opts.chartWidgetCollection,{themeName:e,standardTheme:!0,syncState:t,noUndo:i})}setStdThemeForLayout(e,t=!0){(0,d.setTheme)(e),t&&(0,h.syncTheme)()}getCurrentThemeName(){return(0,h.getCurrentTheme)().name}toolbarThemeChanged(){return this._toolbarThemeChanged}}var _=i(88913),m=i(88348),g=i(97145),f=i(46100),v=i(92249),y=i(56954),S=i.t(y,2);const b=new u.Delegate;var w=i(50151).ensureNotNull,C=i(68582).isLineToolRiskReward,P=i(88913).supportedLineTools,x=i(92249).createLineToolProperties,T=i(92249).prepareLineToolPropertiesByOwnerSource,I=i(45973).lineToolEntityInfo,M=i(72414).LineToolsGroupControllerApi,A=i(47513).RemoveSourcesUndoCommand;const{isLineDrawnWithPressedButton:L,isLineToolFinishRequiredWhenCreatedByApi:k}=i(15367),D=i(81155).EnvironmentState;var E=i(75444).ChartWidgetApiBase,V=i(88348);i(51768).trackEvent;function B(e,t){return t.map((function(t){return e.dataSourceForId(t)}))}class R extends E{executeActionById(e){this._chartWidget.executeActionById(e)}getCheckableActionState(e){return this._chartWidget.getCheckableActionState(e)}setZoomEnabled(e){this._chartWidget.model().model().setZoomEnabled(e)}setScrollEnabled(e){this._chartWidget.model().model().setScrollEnabled(e)}refreshMarks(){this._chartWidget.refreshMarks()}clearMarks(e){this._chartWidget.clearMarks(e)}setEntityVisibility(e,t){console.warn("`setEntityVisibility` is deprecated. Use shape/study API instead");var i=this._chartWidget.model().model().dataSourceForId(e);if(i){var s=i.properties();s&&s.visible&&s.visible.setValue(t)}}availableZOrderOperations(e){var t=B(this._chartWidget.model().model(),e);return this._chartWidget.model().availableZOrderOperations(t)}sendToBack(e){var t=B(this._chartWidget.model().model(),e);this._chartWidget.model().sendToBack(t)}bringToFront(e){var t=B(this._chartWidget.model().model(),e) -;this._chartWidget.model().bringToFront(t)}insertAfter(e,t){var i=this._chartWidget.model().model(),s=B(i,e),r=i.dataSourceForId(t);this._chartWidget.model().insertAfter(s,r)}insertBefore(e,t){var i=this._chartWidget.model().model(),s=B(i,e),r=i.dataSourceForId(t);this._chartWidget.model().insertBefore(s,r)}bringForward(e){var t=B(this._chartWidget.model().model(),e);this._chartWidget.model().bringForward(t)}sendBackward(e){var t=B(this._chartWidget.model().model(),e);this._chartWidget.model().sendBackward(t)}showPropertiesDialog(e){var t=this._chartWidget.model().model().dataSourceForId(e);if(null===t)throw new Error("Study or shape "+e+" does not exist");this._chartWidget.showChartPropertiesForSource(t)}getAllShapes(){return this._chartWidget.model().model().allLineTools().map(I).filter((function(e){return null!==e.name}))}removeEntity(e,t){var i=this._chartWidget.model().chartModel().dataSourceForId(e);i?t&&t.disableUndo?new A(this._chartWidget.model().chartModel(),[i],"").redo():this._chartWidget.model().removeSource(i,!0,!0):console.warn("Can't find a source with id: "+e)}removeEntityWithUndo(e){var t=this._chartWidget.model().chartModel().dataSourceForId(e);this._chartWidget.model().removeSource(t,!1)}drawOnAllCharts(e){V.drawOnAllCharts.setValue(e)}getVisiblePriceRange(){return console.warn("`getVisiblePriceRange` is deprecated. Use Price Scale API instead"),this._chartWidget.model().mainSeries()?this._chartWidget.model().mainSeries().priceScale().priceRangeInPrice():null}scrollPosition(){return console.warn("`scrollPosition` is deprecated. Use rightOffset from Time Scale API instead"),this._chartWidget.model().timeScale().rightOffset()}defaultScrollPosition(){return console.warn("`defaultScrollPosition` is deprecated. Use defaultRightOffset from Time Scale API instead"),this._chartWidget.model().timeScale().defaultRightOffset().value()}_createTradingPrimitive(e,t){var i,s=this._chartWidget.model(),r=s.model(),n=r.paneForSource(r.mainSeries());function o(){var e=TradingView.CLOSE_PLOT,t=w(s.mainSeries().bars().last());return{index:t.index,price:t.value[e]}}return(i=t?r.createLineTool(n,o(),e):s.createLineTool({pane:n,point:o(),linetool:e}))?i._adapter:void 0}createOrderLine(e){e=e||{};return this._createTradingPrimitive("LineToolOrder",e.disableUndo)}createPositionLine(e){e=e||{};return this._createTradingPrimitive("LineToolPosition",e.disableUndo)}createExecutionShape(e){e=e||{};return this._createTradingPrimitive("LineToolExecution",e.disableUndo)}createShape(e,t){return this.createMultipointShape([e],t)}createMultipointShape(e,t){const i=Object.assign({},this._getDefaultCreateMultipointShapeOptions(),t);var s=P[i.shape]||P.flag;var r=this._chartWidget.model().model(),n=r.mainSeries();if(!r.timeScale().isEmpty()){var o=r.dataSourceForId(i.ownerStudyId)||n,a=r.paneForSource(o),l=this._convertUserPointsToDataSource(e);if(s.onlySelectable)throw new Error('Cannot create "'+i.shape+'" shape');if("LineToolIcon"===s.name){if(i.icon=i.icon||i.overrides&&i.overrides.icon, -!i.hasOwnProperty("icon"))throw new Error("icon must be specified in options");i.overrides=i.overrides||{},i.overrides.icon=i.icon}var c,h,d=x(s.name,void 0,this._chartWidget.model().model());if(T(d,o),i.overrides)for(var u in i.overrides)d[u]?d[u].mergeAndFire(i.overrides[u]):C(s.name)&&-1!==["profitLevel","stopLevel"].indexOf(u)&&d.addProperty(u,i.overrides[u]);if(void 0!==d.text&&i.text&&d.text.setValue(i.text),d.hasChild("filled")&&i.filled&&d.filled.setValue(!0),null!==(h=i.disableUndo?(c=this._chartWidget.model().model()).createLineTool(a,l[0],s.name,d,void 0,o):(c=this._chartWidget.model()).createLineTool({pane:a,point:l[0],linetool:s.name,properties:d,ownerSource:o}))){if(C(s.name)){if(l.length>2)throw new Error("Wrong points count for "+i.shape+". Required 1 or 2");2===l.length&&(h.startChanging(1,l[1]),h.setPoint(1,l[1]),h.endChanging())}else{var p=h.pointsCount();if(p!==l.length&&-1!==p)throw new Error("Wrong points count for "+i.shape+". Required "+p);for(var _=new D(void 0,!0),m=L(s.name),g=1;g{this.setActiveChart(this._chartIndex(e))};const{chartApiInstance:t,chartWidgetCollection:i,studyMarket:s,saveChartService:o,loadChartService:a,sharingChartService:l=null,webview:c=null}=e;this._chartWidgetCollection=i,this._studyMarket=s,this._saveChartService=o,this._sharingChartService=l,this._loadChartLayoutDialog=a,this._intervalsService=null,this._alertsWidgetDialog=null,this._detailsDialogController=null,this._supportedChartStylesSpawn=r.linking.supportedChartStyles.spawn(),this._chartWidgetCollection.onAboutToBeDestroyed.subscribe(null,(()=>this.destroy()),!0),this._webview=c;const h=new W.ChartChangesWatcher(this._chartWidgetCollection,window.saver,n);this._chartChangesWatcher=h,this._chartHasChanged=(0,H.createWVFromGetterAndSubscription)((()=>h.hasChanges()),h.getOnChange());const d=i.lock;this._symbolSync=d.symbol.spawn(),this._intervalSync=d.interval.spawn(),this._dateRangeSync=d.dateRange.spawn(),this._crosshairSync=d.crosshair.spawn(),this._timeSync=d.trackTime.spawn()}destroy(){var e,t,i;this._chartHasChanged.destroy(),this._chartChangesWatcher.destroy(),this._supportedChartStylesSpawn.destroy(),null===(e=this._intervalsService)||void 0===e||e.destroy(),null===(t=this._themesApi)||void 0===t||t.destroy(),null===(i=this._widgebarApi)||void 0===i||i.destroy(),this._widgetbarApiRejectionReason="This ITradingViewApi instance has been destroyed",this._symbolSync.destroy(),this._intervalSync.destroy(),this._dateRangeSync.destroy(),this._crosshairSync.destroy(),this._timeSync.destroy(),this._drawOnAllCharts.destroy(),this._isDestroyed=!0,(0,m.properties)().childs().magnet.unsubscribeAll(this),(0,m.properties)().childs().magnetMode.unsubscribeAll(this)}themes(){return null===this._themesApi&&(this._themesApi=new p({chartWidgetCollection:this._chartWidgetCollection})),this._themesApi}dialogs(){var e,t,i,s,r,n;return{Indicators:this._studyMarket,Compare:this._chartWidgetCollection.getCompareDialogRenderer(),ObjectsTree:null,ChartProperties:this._chartWidgetCollection.getChartPropertiesDialogRenderer(),ChartLayoutSaveAs:null!==(t=null===(e=this._saveChartService)||void 0===e?void 0:e.getSaveAsController())&&void 0!==t?t:null,ChartLayoutRename:null!==(s=null===(i=this._saveChartService)||void 0===i?void 0:i.getRenameController())&&void 0!==s?s:null,ChartLayoutCreate:null!==(n=null===(r=this._saveChartService)||void 0===r?void 0:r.getCreateController())&&void 0!==n?n:null,ChartLayoutLoad:this._loadChartLayoutDialog,Alerts:this._alertsWidgetDialog,Details:this._detailsDialogController,FinancialsCharts:null,Technicals:null,Forecast:null}}subscribe(e,t){n.subscribe(e,t,void 0)}unsubscribe(e,t){n.unsubscribe(e,t,void 0)}webview(){return U(),this._webview} -studyTemplatesDrawerApi(){U()}fontIconsSettingsDrawer(){U()}intervalsService(){U()}supportedChartTypes(){return this._supportedChartStylesSpawn}setBrokerName(e){this._chartWidgetCollection.setBroker(e)}getDrawOnAllCharts(){return(0,m.drawOnAllCharts)().value()}drawOnAllCharts(e){return(0,m.drawOnAllCharts)().setValue(e)}drawOnAllChartsEnabled(){return this._drawOnAllCharts}getDrawOnAllChartsMode(){return(0,m.drawOnAllChartsMode)().value()}drawOnAllChartsMode(e){(0,m.drawOnAllChartsMode)().setValue(e)}disableTrackingEvents(){(0,c.disableTrackingEvents)()}getSaveChartService(){return this._saveChartService}symbolSync(){return this._symbolSync}intervalSync(){return this._intervalSync}dateRangeSync(){return this._dateRangeSync}crosshairSync(){return this._crosshairSync}timeSync(){return this._timeSync}setSymbolSearchUI(e){U()}chart(e=0){if(e<0||e>=this.chartsCount())throw Error("Incorrect index: "+e);return this._getChartWidgetApi(this._chartWidgetCollection.getAll()[e])}activeChart(){return this._getChartWidgetApi(this._activeChartWidget())}setActiveChart(e){if(e>=0&&e(this._favoriteDrawingsToolbar||(this._favoriteDrawingsToolbar=new e.FavoriteDrawingsApi),this._favoriteDrawingsToolbar)))}sharingChart(){return this._sharingChartService}watchlist(){U()}setWatchlistApiPromise(e){U()}news(){U()}setNewsApiPromise(e){U()}widgetbar(){U()}setWidgetbarApiPromise(e){U()} -getChartStorage(){return getChartStorage()}setDebugMode(e){o.setEnabled("charting_library_debug_mode",e)}setFeatureEnabled(e,t){"chart_crosshair_menu"!==e?o.setEnabled(e,t):F.addPlusButtonProperty.setValue(t)}magnetEnabled(){return null===this._magnetEnabledWatchedValue&&(this._magnetEnabledWatchedValue=new g.WatchedValue((0,m.properties)().childs().magnet.value()),this._magnetEnabledWatchedValue.subscribe((e=>{(0,f.saveDefaultProperties)(!0),(0,m.properties)().childs().magnet.setValue(e),(0,f.saveDefaultProperties)(!1)})),(0,m.properties)().childs().magnet.subscribe(this,(()=>{(0,s.ensureNotNull)(this._magnetEnabledWatchedValue).setValue((0,m.properties)().childs().magnet.value())}))),this._magnetEnabledWatchedValue}magnetMode(){return null===this._magnetModeWatchedValue&&(this._magnetModeWatchedValue=new g.WatchedValue((0,m.properties)().childs().magnetMode.value()),this._magnetModeWatchedValue.subscribe((e=>{(0,f.saveDefaultProperties)(!0),(0,m.properties)().childs().magnetMode.setValue(e),(0,f.saveDefaultProperties)(!1)})),(0,m.properties)().childs().magnetMode.subscribe(this,(()=>{(0,s.ensureNotNull)(this._magnetModeWatchedValue).setValue((0,m.properties)().childs().magnetMode.value())}))),this._magnetModeWatchedValue}flushBufferedData(){b.fire()}chartWidgetCollectionState(...e){return this._chartWidgetCollection.state(...e)}chartWidgetCollectionSeriesStatuses(){return this._chartWidgetCollection.chartSeriesStatuses()}initAllLineTools(){return Promise.all(Object.keys(S).filter((e=>!S[e])).map((e=>(0,v.initLineTool)(e)))).then((()=>{}))}watermark(){{const e=O.WatermarkApi.getInstance();if(!e.ready())throw new Error("Watermark API is not initialised yet.");return e}}setContextMenuOptions(e){j.setContextMenuOptions(e)}changeSymbol(e,t,i){r.linking.interval.setValue((0,s.ensureNotNull)(N.Interval.normalize(t))),r.linking.setSymbolAndLogInitiator(e,"API"),i&&this.activeChart().onDataLoaded().subscribe(null,i,!0)}getSymbolInterval(e){const t={symbol:this.linking.proSymbol.value(),interval:this.linking.interval.value()};return null==e||e(t),t}hasChartChanges(){return this._chartHasChanged}setForceFullscreenMode(){U()}setMultichartMode(){U()}setDateRangeLinkingEnabled(e){this._chartWidgetCollection.lock.dateRange.setValue(e)}static setContextMenuOptions(e){void 0!==e.items_processor&&a.ContextMenuManager.setCustomItemsProcessor(e.items_processor),void 0!==e.renderer_factory&&a.ContextMenuManager.setCustomRendererFactory(e.renderer_factory)}_getChartWidgetApi(e){let t=this._chartWidgets.get(e);return void 0===t&&(t=new R(e,this._activateChart.bind(null,e)),this._chartWidgets.set(e,t)),t}_chartIndex(e){return this._chartWidgetCollection.getAll().indexOf(e)}_activeChartWidget(){return this._chartWidgetCollection.activeChartWidget.value()}}},75117:(e,t,i)=>{"use strict";var s=i(82992).linking,r=(i(51608).createDeferredPromise, -i(76422)),n=i(10643).ContextMenuManager,o=i(88348),a=i(94025),l=i(61595).backend,c=i(59224),h=i(3615).showWarning,d=i(3615).showConfirm,u=i(88913),p=i(52092).CLOSE_POPUPS_AND_DIALOGS_COMMAND,_=i(96005).TradingViewApiBase,m=i(42856).StudyMetaInfo,g=i(152).getStudyInputsInfo,f=i(70120).getStudyStylesInfo,v=i(57898).Delegate,y=i(97145).WatchedValue;e.exports=class extends _{constructor(e){const{chartWidgetCollection:t,saveChartService:i,loadChartService:s,sharingChartService:r,alertsDispatcher:n,supportTicketData:o,favoriteServices:a,chartApiInstance:l=null,studyMarket:c=null,webview:h,alertsFacadeChannelPushApi:d}=e;super({chartApiInstance:l,chartWidgetCollection:t,studyMarket:c,saveChartService:i,loadChartService:s,sharingChartService:r,webview:h}),this._chartApiInstance=l,this._loadChartService=s,this._alertsDispatcher=n,this._supportTicketData=o,this._favoriteServices=a,this._alertsFacadeChannelPushApi=d,this._proxyWatchListChangedDelegate=null,this._lockDrawingsWatchedValue=null,this._hideDrawingsWatchedValue=null,this._hideIndicatorsWatchedValue=null,this._replayApi=null,this._getDataSourceHub=function(){return t.activeChartWidget.value().model().model()},this._alertService=this._alertsDispatcher&&this._alertsFacadeChannelPushApi?new undefined(this._alertsDispatcher,this._getDataSourceHub,this._alertsFacadeChannelPushApi):null,this._activeChangedChangedDelegate=new v,this._chartWidgetCollection.activeChartWidget.subscribe(function(){this._activeChangedChangedDelegate.fire()}.bind(this))}onContextMenu(e){r.subscribe("onContextMenu",(function(t){t.callback(e(t.unixtime,t.price))}))}onGrayedObjectClicked(e){r.subscribe("onGrayedObjectClicked",e)}onActiveChartChanged(){return this._activeChangedChangedDelegate}viewMode(){throw new Error("not implemented")}viewModeWatchedValue(){throw new Error("not implemented")}saveChart(e,t){if(this._saveChartService){var i=this._saveChartService.saveToJSON(t);return e&&e(JSON.parse(i.content))}}loadChart(e){this._chartApiInstance.disconnect(),e.extendedData&&(this._chartWidgetCollection.metaInfo.id.setValue(e.extendedData.uid),this._chartWidgetCollection.metaInfo.uid.setValue(e.extendedData.uid),this._chartWidgetCollection.metaInfo.name.setValue(e.extendedData.name)),this._chartWidgetCollection.loadContent(e.json),this._chartWidgetCollection.purgeUnusedWidgets(),this._chartApiInstance.connect(),s.setSymbolAndLogInitiator(this.activeChart().symbol(),"API"),r.emit("chart_loaded")}getStudiesList(){return this._chartApiInstance.allStudiesMetadata().filter((function(e){return!e.is_hidden_study})).map((function(e){return e.description}))}getStudyInputs(e){{const t=m.findStudyMetaInfoByDescription(this._chartApiInstance.allStudiesMetadata(),e);return g(t)}}getStudyStyles(e){{const t=m.findStudyMetaInfoByDescription(this._chartApiInstance.allStudiesMetadata(),e);return f(t)}}getSavedCharts(e){l.getCharts().then(e)}loadChartFromServer(e){l.loadChart(e)}saveChartToServer(e,t,i){this._saveChartService&&this._saveChartService.saveChartSilently(e,t,i)}setAutosave(e){ -this._saveChartService&&this._saveChartService.autoSaveEnabled().setValue(e)}removeChartFromServer(e,t){l.removeChart(e).then(t)}getIntervals(){var e=[],t=a.getCustomResolutions();return null!==this._chartApiInstance&&(e=this._chartApiInstance.defaultResolutions()),a.mergeResolutions(e,t)}closePopupsAndDialogs(){n.hideAll(),r.emit(p)}selectedLineTool(){for(var e=Object.keys(u.supportedLineTools),t=o.tool.value(),i=0;i{"use strict";i.d(t,{WatermarkApi:()=>o});var s=i(50151),r=i(63821),n=i(65632);class o{constructor(){this._widgets=null,this._provider=null,this._watermarkProperties=(0,n.watermarkProperty)();const e=(0,s.ensureDefined)(this._watermarkProperties.child("color")),t=(0,s.ensureDefined)(this._watermarkProperties.child("visibility"));this._colorWatchedValue=(0,r.convertPropertyToWatchedValue)(e),this._visibilityWatchedValue=(0,r.convertPropertyToWatchedValue)(t)}setWidgetCollection(e){this._widgets=e}setContentProvider(e){this._provider=e,this._widgets&&this._widgets.getAll().forEach((e=>{e.model().model().lightUpdate()}))}provider(){return this._provider}ready(){return null!==this._widgets}destroy(){this._colorWatchedValue.destroy(),this._visibilityWatchedValue.destroy()}visibility(){return this._visibilityWatchedValue}color(){return this._colorWatchedValue}static getInstance(){return null===this._instance&&(this._instance=new o),this._instance}}o._instance=null},85402:(e,t,i)=>{"use strict";i.d(t,{AbstractBarColorer:()=>s});class s{constructor(){this._backColorers=[]}barStyle(e,t,i){const s={};for(const r of this._backColorers)r.applyBarStyle(e,t,s,i);return this.applyBarStyle(e,t,s,i),s}pushBackBarColorer(e){this._backColorers.unshift(e)}firstColoredBar(e){return null}}},11095:(e,t,i)=>{"use strict";i.d(t,{addPlusButtonProperty:()=>_,restoreAddPlusButtonSettingsValue:()=>m,showPlusButtonOnCursor:()=>d});var s=i(4741),r=i(14483),n=i(56840),o=i(59680),a=i(97145);const l="add_plus_button";function c(){const e=s.keyboardPressedKeysState.value();return void 0!==e&&(Boolean(e.modifiers&s.Modifiers.Alt&&e.modifiers&s.Modifiers.Mod)&&(void 0===e.code||e.altOrOptionCode()||e.controlOrMetaCode()))}const h=new a.WatchedValue(c());s.keyboardPressedKeysState.subscribe((()=>h.setValue(c())));const d=h.readonly();function u(){return r.enabled("chart_crosshair_menu")}function p(){return n.getBool(l,u())}const _=(0, -o.createPrimitiveProperty)(p());function m(){_.setValue(u()),n.remove(l)}n.onSync.subscribe(null,(()=>_.setValue(p()))),_.subscribe(null,(()=>{n.setValue(l,_.value()),r.setEnabled("chart_crosshair_menu",!r.enabled("chart_crosshair_menu"))}))},83654:(e,t,i)=>{"use strict";i.d(t,{alignToStep:()=>n});var s=i(60521),r=i.n(s);function n(e,t){return r()(e).div(t).round(0,r().roundHalfUp).mul(t).toNumber()}},28640:(e,t,i)=>{"use strict";i.d(t,{AppliedTimeFrame:()=>r});var s=i(83669);class r{constructor(e){this._appliedTimeFrame=new s.WatchedObject(null),this._appliedTimeFrameInfo=null,this._appliedTimeFrameChangedBound=this._appliedTimeFrameChanged.bind(this),this._model=e,e.mainSeries().dataEvents().seriesTimeFrame().subscribe(this,this._onSeriesTimeFrame),this._appliedTimeFrame.subscribe(this._appliedTimeFrameChangedBound)}destroy(){this._appliedTimeFrame.unsubscribe(this._appliedTimeFrameChangedBound),this._model.timeScale().logicalRangeChanged().unsubscribeAll(this),this._model.mainSeries().dataEvents().seriesTimeFrame().unsubscribeAll(this)}appliedTimeFrame(){return this._appliedTimeFrame}_appliedTimeFrameChanged(){this._model.timeScale().logicalRangeChanged().unsubscribe(this,this._invalidateAppliedTimeFrame)}_onSeriesTimeFrame(e,t,i,s){if(s){const e=this._model.timeScale();this._appliedTimeFrameInfo={logicalRange:e.logicalRange(),baseIndex:e.baseIndex()},e.logicalRangeChanged().subscribe(this,this._invalidateAppliedTimeFrame)}}_invalidateAppliedTimeFrame(){if(null===this._appliedTimeFrameInfo)return;const e=this._model.timeScale(),t=e.logicalRange(),i=e.baseIndex(),s=this._appliedTimeFrameInfo.logicalRange,r=this._appliedTimeFrameInfo.baseIndex;(null===t||null===s||Math.abs(i-t.left()-(r-s.left()))>=.01||Math.abs(i-t.right()-(r-s.right()))>=.01)&&this._appliedTimeFrame.setValue(null)}}},12416:(e,t,i)=>{"use strict";i.d(t,{defaultsPreferencesByWhiteList:()=>x,preferencesByWhiteList:()=>P});var s=i(1722),r=i(67980),n=i(62615),o=i(59224),a=i(74304),l=i(85804),c=i(16776),h=i(30888),d=i(93613);const u=(0,o.getLogger)("Chart.ApplyPreferencesToAllCharts"),p={color:"",style:0},_={autoScale:!1,autoScaleDisabled:!1,lockScale:!1,percentage:!1,percentageDisabled:!1,log:!1,logDisabled:!1,alignLabels:!1,isInverted:!1,indexedTo100:!1},m={backgroundType:d.ColorType.Solid,background:"",backgroundGradientStartColor:"",backgroundGradientEndColor:"",topMargin:0,bottomMargin:0,rightOffset:0,gridLinesMode:"both",horzGridProperties:(0,h.deepExtend)({},p),vertGridProperties:(0,h.deepExtend)({},p),crossHairProperties:(0,h.deepExtend)({},{color:"",style:0,transparency:0,width:0}),legendProperties:(0,h.deepExtend)({},{showStudyArguments:!1,showStudyTitles:!1,showStudyValues:!1,showSeriesTitle:!1,showSeriesOHLC:!1,showLegend:!1,showLastDayChange:!1,showBarChange:!0,showVolume:!1,showPriceSource:!1,showBackground:!0,backgroundTransparency:0,showLogo:!0}),axisProperties:(0,h.deepExtend)({},_),separatorColor:""},g={lineColor:"",textColor:"",fontSize:0,scaleSeriesOnly:!1,showSeriesLastValue:!1, -seriesLastValueMode:a.PriceAxisLastValueMode.LastValueAccordingToScale,showSeriesPrevCloseValue:!1,showStudyLastValue:!1,showSymbolLabels:!1,showStudyPlotLabels:!1,showBidAskLabels:!1,showPrePostMarketPriceLabel:!0,showFundamentalLastValue:!1,showFundamentalNameLabel:!1,showPriceScaleCrosshairLabel:!0,showTimeScaleCrosshairLabel:!0},f={...g},v={visible:!1,futureOnly:!1,breaks:(0,h.deepExtend)({},{color:"",visible:!1,style:0,width:0})},y={style:0,minTick:"",showPriceLine:!1,priceLineWidth:0,priceLineColor:"",baseLineColor:"",showPrevClosePriceLine:!1,showCountdown:!0,prevClosePriceLineWidth:0,sessionId:"regular",prevClosePriceLineColor:"",esdShowDividends:!1,esdShowSplits:!1,esdShowEarnings:!1,esdShowBreaks:!1,showContinuousContractSwitches:!1,showContinuousContractSwitchesBreaks:!1,showFuturesContractExpiration:!1,showLastNews:!1,dividendsAdjustment:!1,backAdjustment:!1,settlementAsClose:!0,statusViewStyle:(0,h.deepExtend)({},{fontSize:16,showExchange:!0,showInterval:!0,symbolTextSource:"description"}),priceAxisProperties:(0,h.deepExtend)({},_),highLowAvgPrice:(0,h.deepExtend)({},{highLowPriceLinesVisible:!1,highLowPriceLabelsVisible:!1,averageClosePriceLabelVisible:!1,averageClosePriceLineVisible:!1,highLowPriceLinesColor:"",highLowPriceLinesWidth:0,averagePriceLineColor:"",averagePriceLineWidth:0}),candleStyle:(0,h.deepExtend)({},n.candleStylePreferencesDefault),hollowCandleStyle:(0,h.deepExtend)({},n.hollowCandlePreferencesStyleDefault),barStyle:(0,h.deepExtend)({},n.barStylePreferencesDefault),lineStyle:(0,h.deepExtend)({},n.lineStyleDefault),lineWithMarkersStyle:(0,h.deepExtend)({},n.lineStyleDefault),steplineStyle:(0,h.deepExtend)({},n.lineStyleDefault),areaStyle:(0,h.deepExtend)({},n.areaStylePreferencesDefault),hlcAreaStyle:(0,h.deepExtend)({},n.hlcAreaStylePreferencesDefault),baselineStyle:(0,h.deepExtend)({},n.baselineStylePreferencesDefault),hiloStyle:(0,h.deepExtend)({},n.hiloStylePreferencesDefault),haStyle:(0,h.deepExtend)({},n.haStylePreferencesDefault),renkoStyle:(0,h.deepExtend)({},n.renkoStylePreferencesDefault),pbStyle:(0,h.deepExtend)({},n.pbStylePreferencesDefault),kagiStyle:(0,h.deepExtend)({},n.kagiStylePreferencesDefault),pnfStyle:(0,h.deepExtend)({},n.pnfStylePreferencesDefault),rangeStyle:(0,h.deepExtend)({},n.rangeStylePreferencesDefault),columnStyle:(0,h.deepExtend)({},n.columnStylePreferencesDefault),useVolumeWeightBars:!1},S={priceScaleSelectionStrategyName:"auto",timeScale:(0,h.deepExtend)({},{defaultRightOffset:0,defaultRightOffsetPercentage:5,usePercentageRightOffset:!1}),mainSeries:(0,h.deepExtend)({},y),sessions:(0,h.deepExtend)({},c.sessionsPreferencesDefault),paneProperties:(0,h.deepExtend)({},m),chartEventsSourceProperties:(0,h.deepExtend)({},v),tradingProperties:(0,h.deepExtend)({},r.tradingPreferencesDefault)},b={timezone:"",scalesProperties:(0,h.deepExtend)({},f),...S},w={scalesProperties:(0,h.deepExtend)({},g),...S};function C(e,t,i,r,n=!0){if(void 0===t[e])return u.logDebug(`We haven't had this property ${r}.${e} yet, please, remove it from whiteList`),null;if((0, -s.isObject)(i[e])){const s=Object.keys(i[e]);let o="";return s.map((s=>({[s]:C(s,t[e],i[e],`${r}.${e}`,n)}))).reduce(((e,t)=>(o=Object.keys(t)[0],e[o]=t[o],e)),{})}return n?t[e].value():t[e]}function P(e,t,i=b){const s={timezone:"",priceScaleSelectionStrategyName:"auto",timeScale:{defaultRightOffset:e.timeScale().defaultRightOffset().value(),defaultRightOffsetPercentage:e.timeScale().defaultRightOffsetPercentage().value(),usePercentageRightOffset:e.timeScale().usePercentageRightOffset().value()},mainSeries:{},sessions:{},paneProperties:{},scalesProperties:{},chartEventsSourceProperties:{},tradingProperties:{}},r=["timeScale","mainSeries","sessions"],n=i.mainSeries,o=Object.keys(i),a=Object.keys(n),l=t.properties(),c=e.properties(),h=i.sessions,d=Object.keys(h),u=e.sessions().properties();return a.forEach((e=>{s.mainSeries[e]=C(e,l,n,"mainSeries")})),d.forEach((e=>{s.sessions[e]=C(e,u,h,"sessions")})),o.forEach((e=>{r.includes(e)||(s[e]=C(e,c,i,"preferences"))})),s}function x(e,t,i=w,s=!0){const r={timeScale:{defaultRightOffset:e.timeScale().rightOffsetDefaultValue(),defaultRightOffsetPercentage:e.timeScale().defaultRightOffsetPercentage().value(),usePercentageRightOffset:e.timeScale().usePercentageRightOffset().value()},mainSeries:{},sessions:(0,h.deepExtend)({},c.sessionsPreferencesDefault),paneProperties:{},scalesProperties:{},chartEventsSourceProperties:{},tradingProperties:{},priceScaleSelectionStrategyName:"auto"},n=["timeScale","mainSeries","sessions"],o=i.mainSeries,a=Object.keys(i),d=Object.keys(o),u=(0,l.factoryDefaults)("chartproperties.mainSeriesProperties"),p=(0,l.factoryDefaults)("chartproperties");return d.forEach((e=>{s&&"style"===e||(r.mainSeries[e]=C(e,u,o,"mainSeries",!1))})),a.forEach((e=>{n.includes(e)||(r[e]=C(e,p,i,"preferences",!1))})),r}},39875:(e,t,i)=>{"use strict";i.d(t,{autoLogButtonsVisibilityOptions:()=>n,autoLogButtonsVisibilityProperty:()=>r,restoreAutoLogButtonsVisibilitySettingsValue:()=>o});var s=i(29542);const{property:r,availableValues:n,restoreDefaultValue:o}=(0,s.createVisibilityController)("PriceAxisAutoLogButtons.visibility")},81580:(e,t,i)=>{"use strict";i.d(t,{axisLabelBackgroundColor:()=>r});var s=i(33013);const r={common:s.colorsPalette["color-tv-blue-500"],active:s.colorsPalette["color-tv-blue-800"]}},77475:(e,t,i)=>{"use strict";i.d(t,{createDwmAligner:()=>c,createTimeToBarTimeAligner:()=>d,isAlignmentEnabled:()=>h});var s=i(41249),r=i(14483),n=i(36274),o=i(98829),a=i(60156);const l=new o.SessionInfo("Etc/UTC","0000-0000:1234567");function c(e,t){if(!h()||!n.Interval.isDWM(e))return null;const i=new o.SessionInfo(t.timezone,t.session,t.session_holidays,t.corrections),r=(0,a.newBarBuilder)(e,i,l);return{timeToSessionStart:e=>r.tradingDayToSessionStart(e),timeToExchangeTradingDay:e=>{const t=s.utc_to_cal(i.timezone,e),r=i.spec.correctTradingDay(t);return s.set_hms(r,0,0,0,0,s.get_timezone("Etc/UTC")),r.getTime()}}}function h(){return!r.enabled("disable_resolution_rebuild")}function d(e,t){if(!h())return e=>e -;const i=new o.SessionInfo(t.timezone,t.session,t.session_holidays,t.corrections),s=(0,a.newBarBuilder)(e,i,i,!1);return e=>s.alignTimeIfPossible(e)}},98829:(e,t,i)=>{"use strict";i.d(t,{BarBuilderBase:()=>a,SessionInfo:()=>o});var s=i(41249),r=i(60062),n=i(57333);class o{constructor(e,t,i,s){this.init(e,t,i,s),this._state={timezone:e,spec:t,holidays:i,corrections:s}}init(e,t,i,r){this.timezone=s.get_timezone(e),this.spec=new n.SessionSpec(e,t,i,r)}state(){return this._state}static fromState(e){return new o(e.timezone,e.spec,e.holidays,e.corrections)}}class a{alignTime(e){if(isNaN(e))return NaN;let t=this.indexOfBar(e);return t===r.SessionStage.POST_SESSION&&(this.moveTo(e),t=this.indexOfBar(e)),t<0?NaN:this.startOfBar(t)}}},60156:(e,t,i)=>{"use strict";i.r(t),i.d(t,{SessionInfo:()=>o.SessionInfo,alignExchangeTimeToSessionStartAndReturnUTC:()=>P,alignPeriodsBackForDataRequest:()=>S,alignPeriodsBackForVisibleRange:()=>b,getPeriodsBetweenDates:()=>C,isTradingNow:()=>x,newBarBuilder:()=>y});var s=i(41249),r=i(36274),n=i(37160),o=i(98829),a=i(60062);class l extends o.BarBuilderBase{constructor(e,t){super(),this._sessionStartMs=-Number.MAX_VALUE,this._sessionEndMs=-Number.MAX_VALUE,this._periodSec=e,this._session=t}alignTimeIfPossible(e){const t=this.alignTime(e);return isNaN(t)?e:t}indexOfBar(e){return e=this._sessionEndMs?a.SessionStage.POST_SESSION:(0,n.toInt)(s.time_seconds_diff(e,this._sessionStartMs)/this._periodSec)}startOfBar(e){if(e===a.SessionStage.PRE_SESSION){const e=s.get_cal_from_unix_timestamp_ms(this._session.timezone,this._sessionStartMs-1),t=this._session.spec.alignToNearestSessionEnd(e,-1);return s.cal_to_utc(this._session.timezone,t)}if(e===a.SessionStage.POST_SESSION)return this._sessionEndMs;if(e<0)throw new Error("Negative offset is not supported");return this._sessionStartMs+s.time_seconds(this._periodSec*e)}endOfBar(e){if(e<0)throw new Error("Index cannot be negative");const t=this.startOfBar(e)+1e3*this._periodSec;return t>this._sessionEndMs?this._sessionEndMs:t}isLastBar(e,t){return t>=this._sessionStartMs+s.time_seconds(this._periodSec*(e+1)-1)}moveTo(e){const t=this._session.timezone,i=s.utc_to_cal(t,e),r=this._session.spec.alignToSessionStart(i);this._sessionStartMs=s.cal_to_utc(t,i),s.add_minutes(i,r),this._sessionEndMs=s.cal_to_utc(t,i)}indexOfLastBarInSession(){return(0,n.toInt)((this._sessionEndMs-1-this._sessionStartMs)/1e3/this._periodSec)}moveNext(){this.moveTo(this._sessionEndMs)}}var c=i(54606);function h(e,t){const i=s.clone(t),r=e.businessDaysToCalendarDays(i,1);r>1&&s.add_date(i,r-1);const n=e.leftBorderOfDailyBar(i);if(null===n)throw new Error("Cannot calculate left border of daily bar");return s.cal_to_utc(s.get_timezone(e.timezone()),n)}class d extends o.BarBuilderBase{constructor(e,t,i,s,r=!1){super(),this._periodStart=-Number.MAX_VALUE,this._periodEnd=-Number.MAX_VALUE,this._periodLastBarStart=-Number.MAX_VALUE,this._periodStartDay=new c.BusinessDay(0,0,0),this._periodEndDay=new c.BusinessDay(0,0,0),this._period=i, -this._sessionTgt=e,this._builder=s,this._useBusinessDays=r,this._sessionSrc=r?new o.SessionInfo("Etc/UTC","24x7"):t||e}builder(){return this._builder}alignTimeIfPossible(e){return this.tradingDayToSessionStart(e)}tradingDayToSessionStart(e){return this.moveTo(e),this.startOfBar(0)}indexOfBar(e){if(this._useBusinessDays){const t=c.BusinessDay.fromCalendar(s.get_cal_from_unix_timestamp_ms(this._sessionSrc.timezone,e));return t.before(this._periodStartDay)?a.SessionStage.PRE_SESSION:this._periodEndDay.before(t)?a.SessionStage.POST_SESSION:0}return e=this._periodEnd?a.SessionStage.POST_SESSION:0}startOfBar(e){if(e===a.SessionStage.PRE_SESSION){const e=s.get_cal_from_unix_timestamp_ms(this._sessionTgt.timezone,this._periodStart-1),t=this._sessionTgt.spec.alignToNearestSessionEnd(e,-1);return s.cal_to_utc(this._sessionTgt.timezone,t)-1}return e===a.SessionStage.POST_SESSION||e>0?this._periodEnd:e===a.SessionStage.LASTBAR_SESSION?this._periodLastBarStart:this._periodStart}moveTo(e){const t=s.get_cal_from_unix_timestamp_ms(this._sessionSrc.timezone,e);this._sessionSrc.spec.correctTradingDay(t);const i=s.get_year(t),r=this._indexOfPeriodInYear(t),n=r+this._period,o=this._sessionTgt.spec,a=this._sessionTgt.timezone,l=this._builder.startOfPeriod(a,r,i);this._periodStart=h(o,l);const d=s.clone(l),u=o.businessDaysToCalendarDays(d,1);u>1&&s.add_date(d,u-1),this._periodStartDay=c.BusinessDay.fromCalendar(d);const p=this._builder.startOfPeriod(a,n,i);this._periodEnd=h(o,p);const _=s.clone(p);for(s.add_date(_,-1);o.isCalWeekEnd(_);)s.add_date(_,-1);this._periodEndDay=c.BusinessDay.fromCalendar(_),s.add_date(p,-1),function(e,t){for(;e.isCalWeekEnd(t);)s.add_date(t,-1)}(this._sessionTgt.spec,p),this._periodLastBarStart=h(o,p),(this._periodLastBarStart=this._periodLastBarStart}currentRange(){return{from:this._periodStartDay,to:this._periodEndDay}}indexOfBarInYear(e){const t=s.get_cal_from_unix_timestamp_ms(this._sessionSrc.timezone,e),i=s.get_year(t),r=this._builder.indexOfPeriod(t),o=this._sessionTgt.timezone;let a=this._builder.startOfPeriod(o,r,i),l=h(this._sessionTgt.spec,a);return a=s.get_cal_from_unix_timestamp_ms(s.get_timezone("Etc/UTC"),l),i=0&&(r-=7),(0,n.toInt)((r+i)/7))}class _{indexOfPeriod(e){ -return s.get_day_of_year(e)-1}startOfPeriod(e,t,i){const r=s.days_per_year(i);return s.get_cal(s.get_timezone("Etc/UTC"),i,s.JANUARY,1+Math.min(t,r))}}class m extends _{constructor(e){super(),this._sessionsSpec=e}indexOfPeriod(e){return super.indexOfPeriod(e)-function(e,t){const i=p(e,t),r=s.get_cal(s.get_timezone("Etc/UTC"),s.get_year(t),s.JANUARY,1);s.add_date(r,7*i);const n=i*e.weekEndsCount()+e.holidaysFromYearStart(r),o=s.get_day_of_year(t)-s.get_day_of_year(r);return n+o-e.calendarDaysToBusinessDays(r,o)}(this._sessionsSpec,e)}startOfPeriod(e,t,i){const r=7-this._sessionsSpec.weekEndsCount(),o=Math.max(0,(0,n.toInt)(t/r)-1),a=s.get_cal(s.get_timezone("Etc/UTC"),i,s.JANUARY,1),l=s.get_days_per_year(a);if(s.add_date(a,7*o),(t-=r*o-this._sessionsSpec.holidaysFromYearStart(a))>0){const e=this._sessionsSpec.businessDaysToCalendarDays(a,t);s.add_date(a,e)}let c=s.get_day_of_year(a)-1;return is.get_days_per_year(r)?this.startOfPeriod(e,0,i+1):(s.add_date(r,a),r)}}class v{indexOfPeriod(e){return s.get_month(e)}startOfPeriod(e,t,i){if(t<0){const e=(0,n.toInt)((11-t)/12);i-=e,t+=12*e}else t>s.DECEMBER&&(i++,t=s.JANUARY);return s.get_cal(s.get_timezone("Etc/UTC"),i,t,1)}}function y(e,t,i,s=!1){const n=r.Interval.parse(e),o=n.multiplier();return n.isMinutes()?new l(60*o,t):n.isSeconds()?new l(o,t):n.isTicks()?new l(1,t):n.isRange()?new l(60*o,t):new d(t,i,o,function(e,t){switch(e){case r.ResolutionKind.Days:return new g(t);case r.ResolutionKind.Weeks:return new f(t);case r.ResolutionKind.Months:return new v}throw new Error(`Unknown dwm resolution: ${e}`)}(n.kind(),t),s)}function S(e,t,i,s,r,n,o){return w(e,t,i,s,r,n,o,0)}function b(e,t,i,s,r,n,o){return w(e,t,i,s,r,n,o,1)}function w(e,t,i,s,n,a,l,c){const h=r.Interval.parse(n+s);if(h.isMonths()){const e=new Date(l);return 0===c&&e.setUTCDate(1),function(e,t){T(e,Math.floor(t/12));let i=e.getUTCMonth()-t%12;i<0&&(T(e,1),i+=12);e.setUTCMonth(i);for(;e.getUTCMonth()!==i;)I(e,1)}(e,a*h.multiplier()),e.getTime()}const d=new o.SessionInfo("Etc/UTC",e,t,i),u=h.inMilliseconds(),p=h.isDWM();let _;_=p?864e5:60*d.spec.maxTradingDayLength()*1e3;let m=0 -;m=h.isWeeks()?7:7-d.spec.weekEndsCount();const g=_/u,f=m*g;let v;if(a=g&&(f=_/6048e5*g);return f%1<=Number.EPSILON*Math.ceil(f)?Math.round(f):Math.ceil(f)}function P(e,t){const i=s.clone(t);return e.alignToSessionStart(i),s.cal_to_utc(s.get_timezone(e.timezone()),i)}function x(e,t){const i=s.utc_to_cal(t.timezone,+e);let r=s.get_day_of_week(i),n=s.get_minutes_from_midnight(i);const o=t.spec.findSession(t.spec.getWeekIndex(i),r,n).getEntry();return o.isOvernight()&&n>o.startOffset()+o.length()&&r===o.dayOfWeek()-1&&(r++,n-=1440),r===o.dayOfWeek()&&n>=o.startOffset()&&n{"use strict";i.d(t,{BusinessDay:()=>r});var s=i(41249);class r{constructor(e,t,i){this.year=e,this.month=t,this.day=i}toString(){return`${this.year}-${this.month}-${this.day}`}compareTo(e){return this.year>e.year||this.year===e.year&&this.month>e.month||this.year===e.year&&this.month===e.month&&this.day>e.day?1:this.year===e.year&&this.month===e.month&&this.day===e.day?0:-1}before(e){return-1===this.compareTo(e)}toCalendar(e){return s.get_cal(s.get_timezone("Etc/UTC"),this.year,this.month-1,this.day)}addDays(e){const t=this.toCalendar(s.get_timezone("Etc/UTC"));return s.add_date(t,e),r.fromCalendar(t)}static fromCalendar(e){return new r(s.get_year(e),s.get_month(e)+1,s.get_day_of_month(e))}}},60062:(e,t,i)=>{"use strict";var s;i.d(t,{SessionStage:()=>s}),function(e){e[e.PRE_SESSION=-1]="PRE_SESSION",e[e.POST_SESSION=-2]="POST_SESSION",e[e.LASTBAR_SESSION=-3]="LASTBAR_SESSION"}(s||(s={}))},94421:(e,t,i)=>{"use strict";i.d(t,{extrapolateBarsFrontByCount:()=>n,extrapolateBarsFrontToTime:()=>r});var s=i(60062);function r(e,t,i,s,n=!1){if(t>i){const o=r(e,i,t,s,n);return o.count=-o.count,o}return o(e,t,1,((e,t)=>t>i||0!==s&&e>s),n)}function n(e,t,i,s=!1){const r=i<0?-1:1;return o(e,t,r,((e,t)=>e>=i*r),s)}function o(e,t,i,r,n){let o=0,a=t;e.moveTo(a);let l=0,c=Number.MAX_VALUE,h=!1,d=t;const u=[];for(;!r(o,a);){if(l>15)throw new Error("Internal error 0x10 while extrapolating.");const r=e.indexOfBar(a);if(r===s.SessionStage.PRE_SESSION&&1===i)a=e.startOfBar(0),e.moveTo(a);else if(r===s.SessionStage.PRE_SESSION&&-1===i)a=e.startOfBar(s.SessionStage.PRE_SESSION),e.moveTo(a);else if(r===s.SessionStage.POST_SESSION&&1===i)a=e.startOfBar(s.SessionStage.POST_SESSION),e.moveTo(a);else{ -if(r===s.SessionStage.POST_SESSION&&-1===i)throw new Error("Internal error 0x12 while extrapolating.");{const p=e.startOfBar(r);if(p>t&&i>0||t>p&&i<0){if(h&&c===p)throw new Error("Internal error 0x11 while extrapolating.");h=!0,c=p,l=0,o++,d=p,n&&u.push(d)}if(0===r&&-1===i)a=p-1;else{a=e.startOfBar(r+i);const t=e.startOfBar(s.SessionStage.POST_SESSION);a>t&&(e.moveTo(t),a=e.startOfBar(0))}}}l++}return{time:d,times:u,count:o}}},57333:(e,t,i)=>{"use strict";i.d(t,{SessionSpec:()=>v});var s=i(41249),r=i(78071),n=i(54606);function o(e,t){return e.compareTo(t)}class a{constructor(e,t,i){this._dayOfWeek=e,this._start=t,this._length=i}start(){return this._start+s.minutesPerDay*this.sessionStartDaysOffset()}startOffset(){return this._start}sessionStartDaysOffset(){return this._start>=0?0:this._start%s.minutesPerDay==0?-Math.ceil(this._start/s.minutesPerDay):-Math.floor(this._start/s.minutesPerDay)}sessionEndDaysOffset(){const e=this._start+this._length;return e>=0?0:e%s.minutesPerDay==0?-Math.ceil(e/s.minutesPerDay):-Math.floor(e/s.minutesPerDay)}isOvernight(){return this._start<0}dayOfWeek(){return this._dayOfWeek}sessionStartDayOfWeek(){let e=this._dayOfWeek-this.sessionStartDaysOffset();return es.SATURDAY&&(e=1),e}length(){return this._length}weight(){return this._dayOfWeek*s.minutesPerDay+this._start}compareTo(e){const t=this.weight(),i=t+this._length,s=e.weight(),r=s+e._length;return t<=s&&ss?1:-1}contains(e){const t=60*s.get_hours(e)+s.get_minutes(e);let i=s.get_day_of_week(e)-this._dayOfWeek;i>0&&(i-=7);const r=i*s.minutesPerDay+t;return r>=this._start&&r=48&&e<=57}class _{constructor(){this.entries=[],this.firstDayOfWeek=s.MONDAY,this.weekEndsCount=-1,this.maxTradingDayLength=0}parseSessions(e,t){var i;let s=!1;this._clear(),this.timezone=e;const{hasErrors:r,spec:n}=this._parseFirstDayOfWeek(t);if("24x7"===n.toLowerCase())for(const e of d)this.entries.push(_._createSessionEntry(e,0,0,0,0));else{let e=!1;const t=new Map;for(const i of n.split("|")){const r=i.split(":");if(1!==r.length&&2!==r.length){s=!0,u.logError(`Bad session section: ${i}`);continue}const n=1===r.length;if(n){if(e){s=!0,u.logError(`Duplicated default section: ${i}`);continue}e=!0}const o=n?h:_._parseWorkingDays(r[1]);for(const e of o)n&&t.has(e)||t.set(e,r[0])}for(const e of d){const i=t.get(e);if(void 0!==i)for(const t of i.split(",")){const{hasErrors:i,sessionEntry:r}=_._parseSessionEntry(e,t);i&&(s=i),this.entries.push(r)}}}this.entries.sort(o);const a=new Map;for(const e of this.entries){const t=e.dayOfWeek() -;a.set(t,e.length()+(null!==(i=a.get(t))&&void 0!==i?i:0))}return this.maxTradingDayLength=0,a.forEach((e=>{this.maxTradingDayLength=Math.max(this.maxTradingDayLength,e)})),this.weekEndsCount=7-a.size,s||r}static parseHolidaysAndCorrections(e,t,i){const r=new Map,n=new Map,o=e=>{const t=this._parseDay(e),i=t.toString(),s=n.get(i);return void 0!==s?s:(n.set(i,t),t)};if(""!==t){const e=[];for(const i of t.split(",")){if(8!==i.length)throw new Error(`bad holiday date: ${i}`);const t=o(i);r.set(t,e)}}if(""===i)return r;const l=s.get_timezone("Etc/UTC");for(const e of i.split(";")){const t=e.split(":");if(2!==t.length)throw new Error(`bad correction section: ${e}`);const i=[];if("dayoff"!==t[0])for(const e of t[0].split(","))i.push(this._parseSessionEntry(1,e).sessionEntry);for(const e of t[1].split(",")){if(8!==e.length)throw new Error(`bad correction date: ${e}`);const t=o(e),n=s.get_day_of_week(s.get_cal(l,t.year,t.month-1,t.day)),c=[];for(const e of i)c.push(new a(n,e.startOffset(),e.length()));r.set(t,c)}}return r}_clear(){this.entries=[],this.timezone="",this.firstDayOfWeek=s.MONDAY,this.weekEndsCount=-1}_parseFirstDayOfWeek(e){const t=e.split(";");if(t.length>2)return u.logError(`Only one \`first day\` specification expected @ session ${e}`),{hasErrors:!0,spec:e};if(1===t.length)return{hasErrors:!1,spec:e};let i=1;let r=t[0].indexOf("-")>=0?NaN:parseInt(t[0]);return isNaN(r)&&(i=0,r=parseInt(t[1])),rs.SATURDAY?(u.logError(`Unexpected day index @ session: ${e}; day index ${r}`),{hasErrors:!0,spec:e}):(this.firstDayOfWeek=r,{hasErrors:!1,spec:t[i]})}static _parseDay(e){const t=parseInt(e.substring(0,4)),i=parseInt(e.substring(4,6)),s=parseInt(e.substring(6,8));return new n.BusinessDay(t,i,s)}static _parseSessionEntry(e,t){let i=!1,s=t.split("-");2!==s.length&&(i=!0,u.logError(`Bad sessions entry: ${t}`),s=["0000","0000"]);let r=0,n=s[0];if(n.includes("F")){const e=n.split("F");n=e[0],r=""!==e[1]?parseInt(e[1]):1}let o=0,a=s[1];if(a.includes("F")){const e=a.split("F");a=e[0],o=""!==e[1]?parseInt(e[1]):1}if(!this._isCorrectSession(n)||!this._isCorrectSession(a))throw new Error(`Incorrect entry syntax: ${t}`);const l=n,c=a;return{hasErrors:i,sessionEntry:this._createSessionEntry(e,_._minutesFromHHMM(l),_._minutesFromHHMM(c),r,o)}}static _isCorrectSession(e){return 4===e.length&&p(e.charCodeAt(0))&&p(e.charCodeAt(1))&&p(e.charCodeAt(2))&&p(e.charCodeAt(3))}static _parseWorkingDays(e){const t=[];for(let i=0;i0&&(t-=r*s.minutesPerDay),n>0&&(i-=n*s.minutesPerDay);return new a(e,t,i-t)}}function m(e,t){return e.compareTo(t)<0}function g(e,t){const i=(0,r.lowerbound)(e,t,((e,t)=>-1===e.day.compareTo(t)));return i===e.length?null:e[i]}const f=621672192e5;class v{constructor(e="Etc/UTC",t="0000-0000",i="",r=""){this._entries=[],this._firstDayOfWeek=s.MONDAY,this._entriesHash=new Map, -this._holidayAndCorrectionMap=new Map,this._holidaySessions=[],t=function(e){const t=e.lastIndexOf("/");return-1===t?e:e.slice(t+1)}(t);const n=new _;n.parseSessions(e,t),this._entries=n.entries,this._timezone=n.timezone,this._spec=t,this._firstDayOfWeek=n.firstDayOfWeek,this._weekEndsCount=n.weekEndsCount,this._maxTradingDayLength=n.maxTradingDayLength;const o=_.parseHolidaysAndCorrections(e,i,r),a=s.get_timezone(e);this._isThereCorrections=""!==i||""!==r,o.forEach(((e,t)=>{this._holidayAndCorrectionMap.set(t.toString(),e),this._holidaySessions.push({day:t,sessions:e});const i=this.getWeekIndex(t.toCalendar(a));this._entriesHash.set(i,null)})),this._holidaySessions.sort(((e,t)=>e.day.compareTo(t.day)))}entries(){return this._entries}timezone(){return this._timezone}spec(){return this._spec}firstDayOfWeek(){return this._firstDayOfWeek}addSessionEntry(e,t,i,r,n){0===i&&(i=s.minutesPerDay),r===n&&i<=t&&(r+=1),r>0&&(t-=r*s.minutesPerDay),n>0&&(i-=n*s.minutesPerDay);const o=i-t;this._entries.push(new a(e,t,o))}longestSessionLength(){let e=0,t=0;for(const t of this._holidaySessions)t.sessions.forEach((t=>{e=Math.max(e,t.length())}));return this._entries.forEach((e=>{t=Math.max(t,e.length())})),Math.max(e,t)}isWeekEnd(e){const t=(0,r.lowerbound)(this._entries,new a(e,0,0),((e,t)=>e.dayOfWeek()this._entries.length-1||this._entries[t].dayOfWeek()!==e}isCalWeekEnd(e){const t=s.get_day_of_week(e);if(!this._isThereCorrections)return this.isWeekEnd(t);const i=n.BusinessDay.fromCalendar(e),r=this._holidayAndCorrectionMap.get(i.toString());return void 0===r?this.isWeekEnd(t):0===r.length}hasWeekEnds(){return this.weekEndsCount()>0}weekEndsCount(){return this._weekEndsCount}maxTradingDayLength(){return this._maxTradingDayLength}holidaysFromYearStart(e){if(!this._isThereCorrections)return 0;const t=s.get_timezone(this._timezone),i=new n.BusinessDay(s.get_year(e),s.JANUARY,1),r=n.BusinessDay.fromCalendar(e);let o=0;const a=this._selectHolidays(i,r);for(let e=0;et.start()%e==0&&t.length()%e==0))}indexOfSession(e,t,i){const n=this._getEntriesForWeek(e);let o=(0,r.lowerbound)(n,new a(t,i,0),m);if(o!==n.length)return new l(e,o,n);let c=e;const h=7-t+this._firstDayOfWeek-1;for(i=-(s.minutesPerDay-i+h*s.minutesPerDay);;){c++;const e=this._getEntriesForWeek(c);if(0!==e.length)return o=(0,r.lowerbound)(e,new a(this._firstDayOfWeek,i,0),m),new l(c,o,e)}}findSession(e,t,i,s=0){const r=this.indexOfSession(e,t,i),n=r.entries;let o=r.entryIndex;if(0!==s){const e=n[o].dayOfWeek(),t=s>0?1:-1;for(;;){const i=o+t;if(i<0||i>=n.length||n[i].dayOfWeek()!==e)break;o=i}}return new l(r.weekIndex,o,n)}getWeekIndex(e){if(!this._isThereCorrections)return 0;const t=s.get_day_of_week(e)-s.SUNDAY,i=s.get_timezone("Etc/UTC"),r=s.get_cal(i,s.get_year(e),s.get_month(e),s.get_day_of_month(e)-t) -;return Math.floor((r.getTime()+f)/1e3/86400/7)}correctTradingDay(e){const t=s.get_day_of_week(e),i=60*s.get_hours(e)+s.get_minutes(e),r=this.getWeekIndex(e),n=this.findSession(r,t,i,0),o=n.getEntry().dayOfWeek()-t+7*(n.weekIndex-r);return 0!==o&&s.add_date(e,o),e}alignToSessionStart(e,t=0){const i=s.get_day_of_week(e),r=60*s.get_hours(e)+s.get_minutes(e),n=this.getWeekIndex(e),o=this.findSession(n,i,r,t),a=o.getEntry(),l=a.dayOfWeek()-i+7*(o.weekIndex-n);0!==l&&s.add_date(e,l);const c=a.startOffset();return s.set_hms(e,c/60,c%60,0,0,s.get_timezone(this._timezone)),a.length()}businessDaysToCalendarDays(e,t){let i=this.getWeekIndex(e),r=s.get_day_of_week(e),n=0,o=0;for(;oi);)e[a].dayOfWeek()=t)return n}i++,r=s.SUNDAY}return n}calendarDaysToBusinessDays(e,t){let i=this.getWeekIndex(e),r=s.get_day_of_week(e),n=0,o=0;for(;ni);)e[a].dayOfWeek()=t)return o}i++,r=s.SUNDAY}return o}alignToNearestSessionStart(e,t){return this._alignToNearestSessionValue(e,t,this._entrySessionStart.bind(this))}alignToNearestSessionEnd(e,t){return this._alignToNearestSessionValue(e,t,this._entrySessionEnd.bind(this))}leftBorderOfDailyBar(e){const t=this._getEntriesForDay(e);return 0===t.length?null:(t.sort(o),this._getLeftEntryBorder(e,t[0]))}bordersOfDailyBar(e){const t=this._getEntriesForDay(e);if(0===t.length)return null;t.sort(o);const i=this._getLeftEntryBorder(e,t[0]),r=t[t.length-1],n=s.clone(e);let a=60*(r.startOffset()+r.length())-1;const l=Math.floor(a/3600);return a-=3600*l,s.set_hms(n,l,a/60,a%60,0,s.get_timezone(this._timezone)),{from:i,to:n}}getEntriesForWeekByCalendar(e){const t=this.getWeekIndex(e);return this._getEntriesForWeek(t)}_getEntriesForWeek(e){let t=this._entriesHash.get(e);if(void 0===t)return this._entries;if(null!==t)return t;const i=s.get_timezone(this._timezone);t=this._entries.slice();const r=this._weekIndexToCalendar(e),a=this._weekIndexToCalendar(e+1),l=n.BusinessDay.fromCalendar(r),c=n.BusinessDay.fromCalendar(a),h=this._selectHolidays(l,c);for(const e of h){const r=e.day.toCalendar(i),n=s.get_day_of_week(r);t=t.filter((e=>e.dayOfWeek()!==n)),t=t.concat(e.sessions)}return t.sort(o),this._entriesHash.set(e,t),t}_selectHolidays(e,t){const i=[];let s=e;for(;;){const e=g(this._holidaySessions,s);if(null===e)return i;if(!e.day.before(t))return i;i.push(e),s=e.day.addDays(1)}}_weekIndexToCalendar(e){const t=1e3*(86400*e*7+86400)-f,i=s.get_cal_from_unix_timestamp_ms(s.get_timezone("Etc/UTC"),t),r=s.get_timezone("Etc/UTC");return s.get_cal(r,s.get_year(i),s.get_month(i),s.get_day_of_month(i))}_alignToNearestSessionValue(e,t,i){const r=s.get_day_of_week(e),n=60*s.get_hours(e)+s.get_minutes(e),o=this.getWeekIndex(e);let a=this.findSession(o,r,n) -;if(a.getEntry().contains(e)&&o===a.weekIndex||1===t)return i(a,s.clone(e),t);const c=a.getEntry(),h=c.contains(e),d=o===a.weekIndex,u=c.sessionStartDaysOffset()-c.dayOfWeek()>=0;if(h&&(d||u))return i(a,s.clone(e),t);let p=a.entryIndex-1;if(p<0){let e=a.weekIndex,t=a.entries;for(;p<0;)e--,t=this._getEntriesForWeek(e),p+=t.length;a=new l(e,p,t)}else a=new l(a.weekIndex,p,a.entries);return i(a,s.clone(e),t)}_entrySessionStart(e,t,i){return this._entrySessionValue(e,t,i,(e=>60*e.start()))}_entrySessionEnd(e,t,i){return this._entrySessionValue(e,t,i,(e=>60*(e.start()+e.length())-1))}_entrySessionValue(e,t,i,r){let n=s.get_day_of_week(t);const o=e.getEntry();let a=o.dayOfWeek()-o.sessionStartDaysOffset();const l=this.getWeekIndex(t);let c=e.weekIndex-l,h=!1;if(a0&&i>=0||c<0&&i<0)&&s.add_date(t,7*c),!o.contains(t)){let e=a-n;h&&i<0&&(e=-(7-a+n)),s.add_date(t,e),n=s.get_day_of_week(t)}o.isOvernight()&&n===o.dayOfWeek()&&s.add_date(t,-o.sessionStartDaysOffset());let d=r(o);const u=Math.floor(d/3600);return d-=3600*u,s.set_hms(t,u,d/60,d%60,0,s.get_timezone(this._timezone)),t}_getEntriesForDay(e){const t=s.get_day_of_week(e);return this._getEntriesForWeek(this.getWeekIndex(e)).filter((e=>e.dayOfWeek()===t))}_getLeftEntryBorder(e,t){const i=s.clone(e),r=t.startOffset();return s.set_hms(i,r/60,r%60,0,0,s.get_timezone(this._timezone)),i}}},81049:(e,t,i)=>{"use strict";i.d(t,{barFunctionByStyle:()=>r});var s=i(13497);function r(e,t){switch(e){case 12:return(0,s.barFunction)("low","low","close");case 2:case 14:case 15:case 3:case 10:case 13:return(0,s.barFunction)(null!=t?t:"close");default:return(0,s.barFunction)("close","open")}}},36112:(e,t,i)=>{"use strict";i.d(t,{BarsMarksContainer:()=>m});var s=i(50151),r=i(59224),n=i(56840),o=i.n(n),a=i(14483),l=i(36274),c=i(1722),h=i(42960),d=i(14292),u=i(28558);const p=(0,r.getLogger)("Chart.BarsMarksContainer"),_=Math.round(new Date(2037,0,1).getTime()/1e3);class m extends d.DataSource{constructor(e,t,i){const r=e.onWidget();let n;n=r?!e.hideIdeas():!!a.enabled("bars_marks")&&o().getBool("BarsMarksContainer.visibile",!1),t.merge({visible:n}),t.childs().visible.subscribe(null,(t=>{r||e.isSnapshot()||!a.enabled("bars_marks")||o().setValue("BarsMarksContainer.visibile",!!t.value())})),super(i),this._paneViews=[],this._model=e,this._properties=t,this._requests=[],this._marks={},this._loadedRange=null,this._getDataTimeout=null,this._collectedRange=null,this._lastRange=null;const l=this._model.mainSeries();l.onSymbolIntervalChanged().subscribe(this,this.clearMarks),l.dataEvents().symbolResolved().subscribe(this,this.clearMarks),l.dataEvents().completed().subscribe(this,(()=>{var e,t;const i=l.data();if(0===i.size())return;const r=(0,s.ensureNotNull)(i.first()).index,n=(0,s.ensureNotNull)(i.last()).index,o=this.timeScale();this.getData({start:null!==(e=o.indexToTimePoint(r))&&void 0!==e?e:1/0,end:null!==(t=o.indexToTimePoint(n))&&void 0!==t?t:-1/0})})),this._initialize(),this._pinnedTooltips={}}destroy(){const e=this._model.mainSeries() -;e.onSymbolIntervalChanged().unsubscribeAll(this),e.dataEvents().symbolResolved().unsubscribeAll(this),e.dataEvents().completed().unsubscribeAll(this),super.destroy()}properties(){return this._properties}marks(){return this._marks}pinTooltip(e,t){this._pinnedTooltips[e]=t}timeScale(){return this._model.timeScale()}getIntervalInTicks(){const e=this._model.mainSeries().properties().childs().interval.value(),t=l.Interval.parse(e);if(!t.isValid())throw new TypeError("Unexpected interval");return t.isRange()?60:t.inMilliseconds()/1e3}getVisibleTickMarksRange(){var e,t;if(this.timeScale().isEmpty())return{start:0,end:0};const i=(0,s.ensureNotNull)(this.timeScale().visibleBarsStrictRange()),{firstIndex:r,lastIndex:n}=(0,s.ensureNotNull)(this.timeScale().points().range().value());if(!(i.lastBar()>r&&i.firstBar(){var r,n;const o=this._marks[s],a=o.tickmark;a>=(null!==(r=t.start)&&void 0!==r?r:1/0)&&a<=(null!==(n=t.end)&&void 0!==n?n:-1/0)+i&&e.push(o)})),e}getPublishedPlates(){const e={};return window.is_authenticated?(this.getVisibleRangePlates().forEach((t=>{t.is_public&&(this._pinnedTooltips[t.id]||t.user__id===window.user.id)&&(e[t.id]=t)})),e):e}filterDisplayedPlates(e){const t=e.reduce(((e,t)=>{const i=this._getIndex(t.tickmark);return null!==i&&(e[i]=e[i]||[],e[i].push(t)),e}),{});return Object.keys(t).reduce(((e,i)=>{let s=t[i];return s=s.sort(((e,t)=>t.views_count-e.views_count)),s=s.slice(0,10),e.concat(s)}),[])}getPlatesViewData(){var e,t,i;const r=this._model.mainSeries();if(r.data().isEmpty())return[];const n=(0,h.isPriceSourceStyle)(r.style())?r.barFunction():null,o=this.filterDisplayedPlates(this.getVisibleRangePlates()),a={},l=null!==(e=this._model.lastHittestData())&&void 0!==e?e:this._model.lastSelectedHittestData();let c=null;null!==l&&this._model.hoveredSource()===this&&(c=null!==(t=l.activeItem)&&void 0!==t?t:null);const d=[];for(const e of o){const t=(0,s.ensureNotNull)(this._getIndex(e.tickmark)),i=this._getBar(t);if(null===i)continue;const r=this._layout(e.direction),o=this._theme(e.direction),l=c===e.id,h=this.timeScale().indexToCoordinate(t),u=this._offset(r,i,n),p=(0,s.ensureNotNull)(this.priceScale()).isInverted();let _=0;t in a||(a[t]={up:0,down:0}),_=a[t][r]++,d.push({id:e.id,x:h,y:u,yInverted:p,order:_,direction:r,theme:o,hovered:l,pinned:!0===this._pinnedTooltips[e.id],user__id:e.user__id,label:e.label,labelFontColor:e.labelFontColor||"#444",minSize:e.minSize||5,...this._plateViewData(e)})}const u=d.filter((e=>!0===e.hovered));for(let e=0;ee.hovered&&!t.hovered?1:0)),d}priceAxisViews(){return null}updateAllViews(e){for(const t of this._paneViews)t.update(e)}updateAllViewsAndRepaint(){this.updateAllViews((0,u.sourceChangeEvent)(this.id())),this._model.updateSource(this)}roundRange(e){return{start:Math.round(e.start),end:Math.round(e.end)}}refreshData(){null!==this._lastRange&&this.getData(this._lastRange)}getData(e){(0,c.isNumber)(e.start)&&(0,c.isNumber)(e.end)?(this._lastRange=e,e.end=_,this._pushGetDataStack(Object.assign({},e))):p.logError("Wrong range")}clearMarks(){this._abortAllRequests(),this._marks={},this._loadedRange=null}isUserDeletable(){return!1}isSavedInChart(e){return!1}isSpeciallyZOrderedSource(){return!0}showInObjectTree(){return!1}_plateViewData(e){return{}}_layout(e){switch(e){default:case 0:case 2:case 3:case 4:case 5:case 6:return"up";case 1:return"down"}}_theme(e){switch(e){default:case 0:return"neutral";case 1:case 5:return"green";case 2:case 6:return"red";case 3:return"yellow";case 4:return"blue"}}_offset(e,t,i){let r;switch(e){default:case"up":r=null===i?t[2]:i(t);break;case"down":r=null===i?t[3]:i(t)}return(0,s.ensureNotNull)(this.priceScale()).priceToCoordinate(r,(0,s.ensureNotNull)((0,s.ensureNotNull)(this.ownerSource()).firstValue()))}_getIndex(e){return this.timeScale().timePointToIndex(e)}_getBar(e){return this._model.mainSeries().data().valueAt(e)}_rangeDifference(e){return e=Object.assign({start:1/0,end:-1/0},e),this._loadedRange&&(e.startthis._loadedRange.end&&(e.start=this._loadedRange.end)),e}_rangeUnion(e,t){return e=Object.assign({start:1/0,end:-1/0},e),t&&(e.start=Math.min(t.start,e.start),e.end=Math.max(t.end,e.end)),e}_pushGetDataStack(e){(0,c.isNumber)(e.start)&&(0,c.isNumber)(e.end)?(this._getDataTimeout&&clearTimeout(this._getDataTimeout),this._collectedRange=this._rangeUnion(e,this._collectedRange),this._getDataTimeout=setTimeout((()=>{this._getData(this._collectedRange),this._getDataTimeout=this._collectedRange=null}),300)):p.logError("Wrong tickmark range")}_abortAllRequests(){this._requests.forEach((e=>{e.cancel()})),this._requests=[],this._getDataTimeout&&clearTimeout(this._getDataTimeout),this._getDataTimeout=this._collectedRange=null}}},12500:(e,t,i)=>{"use strict";i.d(t,{BarsRange:()=>r});var s=i(50151);class r{constructor(e,t){(0,s.assert)(e<=t,"The last bar in the bars range should be greater than or equal to the first bar"),this._firstBar=e,this._lastBar=t}firstBar(){return this._firstBar}lastBar(){return this._lastBar}count(){return this._lastBar-this._firstBar+1}contains(e){return this._firstBar<=e&&e<=this._lastBar}equals(e){return this._firstBar===e.firstBar()&&this._lastBar===e.lastBar()}static compare(e,t){return null===e||null===t?e===t:e.equals(t)}}},31281:(e,t,i)=>{"use strict";i.d(t,{ChartModelBase:()=>ys});var s=i(12481),r=i(27788),n=i(50151),o=i(86441),a=i(24377),l=i(33013),c=i(11542),h=i(45345),d=i(11014),u=i(51768),p=i(51608),_=i(76422),m=i(11417),g=i(67980),f=i(3587),v=i(78071),y=i(92249) -;function S(e){return(0,y.isLineTool)(e)&&e.boundToSymbol()||!1}class b{constructor(){this._items=[],this._set=new Set,this._dataSourcesCache=null,this._customSourcesCache=null,this._lineSourcesCache=null}isEmpty(){return 0===this._items.length}add(e){if(this._items.length>0&&!S(this._items[0])&&this.clear(),S(e)){const t=(0,v.lowerbound)(this._items,e,((e,t)=>e.zorder()!(0,f.isDataSource)(e)))),this._customSourcesCache}checkLineToolSelection(){this._items.forEach((e=>(0,y.isLineTool)(e)&&e.calcIsActualSymbol())),this._items=this._items.filter((e=>!(0,y.isLineTool)(e)||e.isActualSymbol())),this._invalidateCache()}remove(e){this._items=this._items.filter((t=>t!==e)),this._set.delete(e),this._invalidateCache()}clear(){this._items=[],this._set.clear(),this._invalidateCache()}_invalidateCache(){this._customSourcesCache=null,this._dataSourcesCache=null,this._lineSourcesCache=null}}var w=i(6674),C=i(33703),P=i(52329),x=i(56827),T=i(36274),I=i(46100),M=i(88640),A=i(29764),L=i(46501);class k{constructor(e){this._rendererOptions={borderSize:1,additionalPaddingInner:0,fontSize:NaN,font:"",color:"",paneBackgroundColor:"",paddingBottom:0,paddingInner:0,paddingOuter:0,paddingTop:0,lineSpacing:0},this._chartModel=e}options(){const e=this._rendererOptions,t=this._chartModel.properties().childs(),i=t.scalesProperties.childs().fontSize.value();return e.fontSize!==i&&(e.fontSize=i,e.font=(0,A.makeFont)(i,L.CHART_FONT_FAMILY,""),e.paddingTop=i/12*2.5,e.paddingBottom=i/12*2.5,e.paddingInner=i/12*4,e.additionalPaddingInner=i/12*4,e.paddingOuter=i/12*4,e.lineSpacing=i/12*2),e.color=t.scalesProperties.childs().textColor.value(),e.paneBackgroundColor=t.paneProperties.childs().background.value(),this._rendererOptions}}var D=i(74970),E=i(94739),V=i(12442),B=i(71766),R=i(85804),N=i(15742),O=i(14483),F=i(42960),W=i(16776),H=i(28558);const z=new B.PriceFormatter,U="sessions";class j extends N.CustomSourceBase{constructor(e,t,i){super(e,t),this._studySource=null,this._paneViews=[],this._metaInfo=null,this._destroyed=!1,this._isStarted=!1,this._loadedGraphics=null,this._doubleClickHandler=i,this._properties=new I.DefaultProperty("sessions"),(0,R.applyDefaultsOverrides)(this._properties.childs().graphics,void 0,!1,U),this._removeDuplicateProperties(),this._properties.subscribe(this,this._onPropertiesChanged),this._requestAndProcessMetaInfo(),t.timeScale().onReset().subscribe(this,this._clearData), -t.timeScale().logicalRangeChanged().subscribe(this,this.updateAllViews.bind(this,(0,H.viewportChangeEvent)())),t.mainSeries().sessionIdProxyProperty().subscribe(this,this._updateVisibleOfPreAndPostMarketBackground),t.mainSeries().properties().childs().interval.subscribe(this,this._processHibernate),this._updateVisibleOfPreAndPostMarketBackground(t.mainSeries().properties().childs().sessionId)}applyOverrides(e){(0,R.applyPropertiesOverrides)(this._properties.childs().graphics,void 0,!1,e,U),this._model.updateSource(this)}start(){this._isStarted=!0,this._processHibernate()}restart(){this._clearData(),O.enabled("stop_study_on_restart")&&this.stop(),this.start()}isStarted(){return this._isStarted}stop(){this._isStarted=!1,null!==this._studySource&&this._studySource.stop()}isHoveredEnabled(){return!1}paneViews(e){return this._paneViews}updateAllViews(e){this._paneViews.forEach((t=>t.update(e)))}updateViewsForPane(e,t){this.updateAllViews(t)}destroy(){this._destroyed=!0,null!==this._studySource&&(this._studySource.dataCleared().unsubscribeAll(this),this._studySource.dataUpdated().unsubscribeAll(this),this._studySource.destroy(),this._studySource=null),this._model.timeScale().logicalRangeChanged().unsubscribeAll(this),this._model.timeScale().onReset().unsubscribeAll(this),this._model.mainSeries().sessionIdProxyProperty().unsubscribeAll(this),this._model.mainSeries().properties().childs().interval.unsubscribeAll(this),this._properties.unsubscribeAll(this)}series(){return this._model.mainSeries()}priceScale(){return this.series().priceScale()}graphics(){return this._loadedGraphics||(0,n.ensureNotNull)(this._studySource).graphics()}valueAt(e,t){return null}properties(){return this._properties}graphicsInfo(){return(0,n.ensureNotNull)(this._metaInfo).graphics}firstValue(e){return this._model.mainSeries().firstValue()}formatter(){return z}state(e){const t={properties:this._properties.state()};return e&&null!==this._metaInfo&&(t.data={graphics:(0,V.saveStudyGraphics)(this.graphics(),this._model.timeScale().visibleBarsStrictRange()),metaInfo:this._metaInfo}),t}restoreState(e,t){const i=e.properties;this._migrateOutOfSessionProperty(i),this._properties.mergeAndFire(i),this._removeDuplicateProperties(),this._updateVisibleOfPreAndPostMarketBackground(this._model.mainSeries().properties().childs().sessionId),void 0!==e.data&&t&&(this._loadStudyGraphics(e.data.graphics),this._setMetaInfo(e.data.metaInfo),this._createPaneViews())}restoreOldState(e,t){const i={properties:{graphics:e.state.graphics}};void 0!==e.data&&void 0!==e.metaInfo&&t&&(i.data={metaInfo:e.metaInfo,graphics:e.data.graphics}),this.restoreState(i,t)}applyPreferences(e){this._properties.mergePreferences(e)}metaInfo(){return(0,n.ensureNotNull)(this._metaInfo)}async _requestAndProcessMetaInfo(){if(this._model.isSnapshot())return;const e=await(0,D.studyMetaInfoRepository)().findById({type:"java",studyId:"Sessions@tv-basicstudies"});this._destroyed||null===this._loadedGraphics&&(this._setMetaInfo(e), -null!==this._metaInfo&&(this._studySource=new E.StudyDataSource(this._model.chartApi(),this._model.mainSeries().seriesSource(),"sessions_",this._metaInfo),this._createPaneViews(),this._studySource.dataCleared().subscribe(this,this.updateAllViews.bind(this,(0,H.sourceChangeEvent)(this.id()))),this._studySource.dataUpdated().subscribe(this,this.updateAllViews.bind(this,(0,H.sourceChangeEvent)(this.id()))),this._studySource.setInputs({}),this._processHibernate()))}_loadStudyGraphics(e){const t=e.backgrounds;if(void 0!==t){const e=t.findIndex((e=>"inSession"===e.styleId));-1!==e&&t.splice(e,1)}this._loadedGraphics=(0,V.loadStudyGraphics)(e)}_setMetaInfo(e){const t=e.graphics.backgrounds;void 0!==t&&void 0!==t.inSession&&delete t.inSession,this._metaInfo=e}_updateVisibleOfPreAndPostMarketBackground(e){const t=!(0,F.isRegularSessionId)(e.value());this._outOfSessionVisibilityProperty().setValue(t),this._preMarketVisibilityProperty().setValue(t),this._postMarketVisibilityProperty().setValue(t)}_clearData(){null!==this._studySource&&this._studySource.clearData()}_createPaneViews(){const e={doubleClickHandler:this._doubleClickHandler};(0,V.createGraphicsPaneViews)(this,this._model,e).then((e=>{this._paneViews=e,this._model.lightUpdate()}))}_onPropertiesChanged(){this._processHibernate(),this.updateAllViews((0,H.sourceChangeEvent)(this.id()))}_processHibernate(){if(null!==this._studySource){const e=this._canBeHibernated(),t=this._isHibernated(),i=this._studySource.isStarted();!t&&e&&i?this._studySource.stop():!t||e||i||this._studySource.start()}}_canBeHibernated(){const e=this._model.mainSeries(),t=this._preMarketVisibilityProperty().value()&&this._postMarketVisibilityProperty().value()&&this._outOfSessionVisibilityProperty().value();return e.isDWM()||!t&&!this._vertLinesVisibleProperty().value()}_isHibernated(){return this._isStarted&&(null===this._studySource||!this._studySource.isStarted())}_outOfSessionVisibilityProperty(){return this._properties.childs().graphics.childs().backgrounds.childs().outOfSession.childs().visible}_preMarketVisibilityProperty(){return this._properties.childs().graphics.childs().backgrounds.childs().preMarket.childs().visible}_postMarketVisibilityProperty(){return this._properties.childs().graphics.childs().backgrounds.childs().postMarket.childs().visible}_vertLinesVisibleProperty(){return this._properties.childs().graphics.childs().vertlines.childs().sessBreaks.childs().visible}_removeDuplicateProperties(){this._properties.hasChild("properties")&&(this._properties.removeProperty("properties"),(0,I.saveDefaultProperties)(!0),this._properties.childChanged(null,""),(0,I.saveDefaultProperties)(!1))}_migrateOutOfSessionProperty(e){const t=e.graphics.backgrounds;if(void 0!==t){const i=t.outOfSession;i.color===(0,n.ensureDefined)(W.sessionsPreferencesDefault.graphics.backgrounds).outOfSession.color||"postMarket"in t||(e.graphics.backgrounds={...t,postMarket:{color:i.color,transparency:i.transparency,visible:i.visible},preMarket:{color:i.color,transparency:i.transparency,visible:i.visible}})}}} -var G=i(28853),q=i(57898),$=i(97145),Y=i(83669),K=i(91280),Z=i(42226),X=i(39875),J=i(59224),Q=i(36174),ee=i(12812),te=i(49535),ie=i(42856),se=i(1722),re=i(29921),ne=i(80842),oe=i(98517);const ae=new Map([["price",e=>(0,ne.isPriceDataSource)(e)],["trading",e=>(0,y.isTrading)(e)],["drawing",e=>(0,y.isLineTool)(e)&&!(0,y.isTrading)(e)&&!e.isPhantom()],["drawingsForAllSymbols",e=>(0,y.isLineTool)(e)&&!(0,y.isTrading)(e)&&!e.isPhantom()],["phantom",e=>(0,y.isLineTool)(e)&&e.isPhantom()],["restRowSources",e=>!(0,y.isLineTool)(e)&&!(0,y.isTrading)(e)],["legendViewSources",e=>(0,ne.isPriceDataSource)(e)||(0,y.isStudyLineTool)(e)],["leftPriceScale",(e,t)=>"left"===ce(e,t)],["rightPriceScale",(e,t)=>"right"===ce(e,t)],["overlayPriceScale",(e,t)=>"overlay"===ce(e,t)]]),le=new Map([["price","visibleSorted"],["trading","visibleSorted"],["drawing","visibleSorted"],["drawingsForAllSymbols","allSorted"],["phantom","visibleSorted"],["restRowSources","visibleSorted"],["legendViewSources","visibleSorted"],["leftPriceScale","visibleSorted"],["rightPriceScale","visibleSorted"],["overlayPriceScale","visibleSorted"]]);function ce(e,t){const i=e.priceScale();return null===i?"overlay":t.priceScalePosition(i)}class he{constructor(e){this._groupedSources=new Map,this._sources=null,this._pane=e}clear(){this._groupedSources.clear(),this._sources=null}destroy(){this.clear()}all(){return this._groupedSources.has("visibleSorted")||this._sortSources(),(0,n.ensureDefined)(this._groupedSources.get("visibleSorted"))}allIncludingHidden(){return this._groupedSources.has("allSorted")||this._sortSources(),(0,n.ensureDefined)(this._groupedSources.get("allSorted"))}allExceptSpecialSources(){if(!this._groupedSources.has("exceptSpecial")){const e=this.allIncludingHidden().filter((e=>!e.isSpeciallyZOrderedSource()));this._groupedSources.set("exceptSpecial",e)}return(0,n.ensureDefined)(this._groupedSources.get("exceptSpecial"))}tradingSources(){return this._getSourcesByGroupType("trading")}priceSources(){return this._getSourcesByGroupType("price")}lineSources(){return this._getSourcesByGroupType("drawing")}lineSourcesForAllSymbols(){return this._getSourcesByGroupType("drawingsForAllSymbols")}phantomSources(){return this._getSourcesByGroupType("phantom")}allExceptLineAndTradingSources(){return this._getSourcesByGroupType("restRowSources")}hitTestSources(){if(!this._groupedSources.has("hitTest")){const e=this.allExceptLineAndTradingSources().concat(this.lineSources());this._groupedSources.set("hitTest",e)}return(0,n.ensureDefined)(this._groupedSources.get("hitTest"))}generalSources(){if(!this._groupedSources.has("general")){const e=this.allExceptLineAndTradingSources().concat(this.lineSources());this._groupedSources.set("general",(0,oe.sortSources)(e))}return(0,n.ensureDefined)(this._groupedSources.get("general"))}leftPriceScalesSources(){return this._getSourcesByGroupType("leftPriceScale")}rightPriceScalesSources(){return this._getSourcesByGroupType("rightPriceScale")}overlayPriceScaleSources(){return this._getSourcesByGroupType("overlayPriceScale")} -legendViewSources(){return this._getSourcesByGroupType("legendViewSources")}_getSourcesByGroupType(e){const t=(0,n.ensureDefined)(le.get(e));return this._groupedSources.has(t)?this._groupedSources.has(e)||this._groupSources(e):(this._sortSources(),this._groupSources(e)),(0,n.ensureDefined)(this._groupedSources.get(e))}_sortSources(){null===this._sources&&(this._sources=this._pane.dataSources());const e=(0,oe.sortSources)(this._sources),t=e.filter((e=>!(0,y.isLineTool)(e)||e.isActualSymbol()&&e.isActualCurrency()&&e.isActualUnit()));this._groupedSources.set("allSorted",e),this._groupedSources.set("visibleSorted",t)}_groupSources(e){const t=(0,n.ensureDefined)(le.get(e)),i=ae.get(e);if(void 0!==i){const s=(0,n.ensureDefined)(this._groupedSources.get(t)).filter((e=>i(e,this._pane)));this._groupedSources.set(e,s)}}}var de=i(15367),ue=i(34256),pe=i(78211),_e=i(76544),me=i(18611),ge=i(26512),fe=i(60521),ve=i(37160);function ye(e,t,i){const s=e.div(t).toNumber();return Math.abs(Math.round(s)-s)100)throw new Error("something wrong with base")}}}tickSpan(e,t,i){const s=0===this._base?0:1/this._base,r=Math.min(1e-14,(e-t)/1e3);let n=Math.pow(10,Math.max(0,Math.ceil((0,ve.log10)(e-t)))),o=0,a=this._integralDividers[0];for(;;){const e=(0,ve.greaterOrEqual)(n,s,r)&&n>s+r,t=(0,ve.greaterOrEqual)(n,i*a,r),l=(0,ve.greaterOrEqual)(n,1,r),c=new fe.Big(n).div(a),h=0===s||ye(c,s,r);if(!(e&&t&&l&&h))break;n=c.toNumber(),a=this._integralDividers[++o%this._integralDividers.length]}if(n<=s+r&&(n=s),n=Math.max(1,n),this._fractionalDividers.length>0&&(0,ve.equal)(n,1,r))for(o=0,a=this._fractionalDividers[0];;){const e=(0,ve.greaterOrEqual)(n,i*a,r)&&n>s+r,t=new fe.Big(n).div(a),l=0===s||ye(t,s,r);if(!e||!l)break;n=t.toNumber(),a=this._fractionalDividers[++o%this._fractionalDividers.length]}return n}}class Ce{constructor(e,t,i,s){this._marks=null,this._priceScale=e,this._base=t,this._coordinateToLogicalFunc=i,this._logicalToCoordinateFunc=s}base(){return this._base}setBase(e){if(e<0)throw new Error("base < 0");this._base=e}tickSpan(e,t,i=0){if(e{const o=r.tickSpan(e,t,n);return o>i?Math.min(o,s):s}),1/0);return o>0&&isFinite(o)?o:e-t}rebuildTickMarks(){this._marks=null}marks(){return null===this._marks&&(this._marks=this._rebuildTickMarksImpl()),this._marks}_fontHeight(){return this._priceScale.fontSize()} -_tickMarkHeight(){return Math.ceil(2.5*this._fontHeight())}_rebuildTickMarksImpl(){const e=this._priceScale,t=[],i=e.mainSource();if(e.isEmpty()||null===i)return t;let s=i.firstValue();null===s&&(s=0);const r=e.height(),n=this._coordinateToLogicalFunc(r-1,s),o=this._coordinateToLogicalFunc(0,s),a=Math.max(n,o),l=Math.min(n,o);if(a===l)return t;let c=this.tickSpan(a,l),h=a%c;h+=h<0?c:0;const d=a>=l?1:-1;let u=null;const p=e.formatter();let _=NaN;for(let i=a-h;i>l;i-=c){i===_&&(c=this.tickSpan(a,l,c)),_=i;const r=this._logicalToCoordinateFunc(i,s);null!==u&&Math.abs(r-u){const e=this.mainSource();if(e&&e.model()){const t=e.model().paneForSource(e);t&&e.model().updatePane(t)}})),this._scalesProperties.subscribe(this,(()=>{this._marksCache=null})),this._properties.childs().lockScale.subscribe(this,this._updateResetAvailableValue),this._properties.childs().autoScale.subscribe(this,this._updateResetAvailableValue),this._updateResetAvailableValue(),this.setId((0,Q.randomHash)())} -id(){return this._id}setId(e){this._id=e}isLog(){return this._properties.childs().log.value()}isPercentage(){return this._properties.childs().percentage.value()}isInverted(){return this._properties.childs().isInverted.value()}isIndexedTo100(){return this._properties.childs().indexedTo100.value()}isAutoScale(){return this._properties.childs().autoScale.value()&&!this.isLockScale()}isLockScale(){return this._properties.childs().lockScale.value()}isRegular(){return!this.isPercentage()&&!this.isLog()&&!this.isIndexedTo100()}properties(){return this._properties}height(){return this.m_height}setHeight(e){this.m_height!==e&&(this.m_height=e,this._invalidateInternalHeightCache(),this._marksCache=null)}internalHeight(){if(this._internalHeightCache)return this._internalHeightCache;const e=this.height()-this.topPixelMargin()-this.bottomPixelMargin();return this._internalHeightCache=e,e}fontSize(){return this._scalesProperties.childs().fontSize.value()}priceRange(){return this._makeSureItIsValid(),this.m_priceRange}setPriceRange(e,t,i){if(!(e instanceof ue.PriceRange))throw new TypeError("incorrect price range");const s=this.m_priceRange;if(!t&&ue.PriceRange.compare(s,e))return;const r=null!==this._maxPriceRange&&this._maxPriceRange.containsStrictly(e),n=null!==this._minPriceRange&&e.containsStrictly(this._minPriceRange);this.isLockScale()&&!t&&(r||n)||(this._marksCache=null,this.m_priceRange=e,i||this._priceRangeChanged.fire(s,e))}setMinPriceRange(e){this._minPriceRange=e}setMaxPriceRange(e){this._maxPriceRange=e}recalculatePriceRangeOnce(){this._recalculatePriceRangeOnce=!0}priceRangeShouldBeRecalculatedOnce(){if(!this._recalculatePriceRangeOnce||this.isLockScale())return!1;const e=this.mainSource();return null!==e&&e.priceRangeReady()}priceRangeChanged(){return this._priceRangeChanged}mode(){const e=this._properties.childs();return{autoScale:e.autoScale.value(),lockScale:e.lockScale.value(),percentage:e.percentage.value(),indexedTo100:e.indexedTo100.value(),log:e.log.value()}}setMode(e){const t={},i=this.mode(),s=this._properties.state();let r=null;void 0!==e.autoScale&&e.autoScale!==s.autoScale&&(t.autoScale=e.autoScale,this._setAutoScaleValueWithDependentProperties(e.autoScale)),void 0!==e.lockScale&&e.lockScale!==s.lockScale&&(t.lockScale=e.lockScale,this._setLockScaleValueWithDependentProperties(e.lockScale)),void 0!==e.percentage&&e.percentage!==s.percentage&&(t.percentage=e.percentage,this._setPercentageValueWithDependentProperties(e.percentage),this._invalidatedForRange.isValid=!1),void 0!==e.indexedTo100&&e.indexedTo100!==s.indexedTo100&&(t.indexedTo100=e.indexedTo100,this._setIndexedTo100ValueWithDependentProperties(e.indexedTo100),this._invalidatedForRange.isValid=!1),void 0!==e.log&&e.log!==s.log&&(t.log=e.log,this._setLogValueWithDependentProperties(e.log));const n=this._properties.childs();s.log&&!n.log.value()&&(this._canConvertPriceRangeFromLog(this.m_priceRange)?(r=this._convertPriceRangeFromLog(this.m_priceRange),null!==r&&this.setPriceRange(r)):n.autoScale.setValue(!0)), -!s.log&&n.log.value()&&(r=this._convertPriceRangeToLog(this.m_priceRange),null!==r&&this.setPriceRange(r)),s.autoScale!==n.autoScale.value()&&n.autoScale.listeners().fire(n.autoScale,""),s.autoScaleDisabled!==n.autoScaleDisabled.value()&&n.autoScaleDisabled.listeners().fire(n.autoScaleDisabled,""),s.lockScale!==n.lockScale.value()&&n.lockScale.listeners().fire(n.lockScale,""),s.percentage!==n.percentage.value()&&(n.percentage.listeners().fire(n.percentage,""),this.updateFormatter()),s.indexedTo100!==n.indexedTo100.value()&&(n.indexedTo100.listeners().fire(n.indexedTo100,""),this.updateFormatter()),s.percentageDisabled!==n.percentageDisabled.value()&&n.percentageDisabled.listeners().fire(n.percentageDisabled,""),s.log!==n.log.value()&&n.log.listeners().fire(n.log,""),s.logDisabled!==n.logDisabled.value()&&n.logDisabled.listeners().fire(n.logDisabled,""),void 0===t.log&&void 0===t.percentage&&void 0===t.lockScale&&void 0===t.autoScale&&void 0===t.indexedTo100||this._modeChanged.fire(i,this.mode())}modeChanged(){return this._modeChanged}isEmpty(){return this._makeSureItIsValid(),0===this.m_height||!this.m_priceRange||this.m_priceRange.isEmpty()}canDetachSource(e){return this.m_dataSources.some((t=>t!==e&&(0,ne.isPriceDataSource)(t)&&!((0,G.isStudy)(t)&&t.isLinkedToSeries())))}updateAllViews(e){const t=this._getSourcesToUpdateViews();for(const i of t)i.updateAllViews(e)}logFormula(){return this._logFormula}state(){var e;const t=this._properties.childs();return{id:this._id,m_priceRange:this.isAutoScale()?null:(null===(e=this.priceRange())||void 0===e?void 0:e.serialize())||null,m_isAutoScale:this.isAutoScale(),m_isPercentage:t.percentage.value(),m_isIndexedTo100:t.indexedTo100.value(),m_isLog:t.log.value(),m_isLockScale:this.isLockScale(),m_isInverted:this.isInverted(),m_topMargin:this._margins.top,m_bottomMargin:this._margins.bottom,alignLabels:t.alignLabels.value(),logFormula:(0,se.clone)(this._logFormula)}}restoreState(e){let t=e.m_priceRange;if(void 0===t)throw new TypeError("invalid state");if(void 0===e.m_isAutoScale)throw new TypeError("invalid state");void 0!==e.id&&(this._id=e.id);const i={autoScale:e.m_isAutoScale};void 0!==e.m_isPercentage&&(i.percentage=e.m_isPercentage),void 0!==e.m_isIndexedTo100&&(i.indexedTo100=e.m_isIndexedTo100),void 0!==e.m_isLog&&(i.log=e.m_isLog),void 0!==e.m_isLockScale&&(i.lockScale=e.m_isLockScale),void 0!==e.m_isInverted&&this._properties.childs().isInverted.setValue(e.m_isInverted),this.setMode(i),t?(t instanceof ue.PriceRange||(t=new ue.PriceRange(t)),this.setPriceRange(t,!0)):this.clearPriceRange(),e.logFormula&&(this._logFormula=e.logFormula),void 0!==e.m_topMargin&&(this._margins.top=e.m_topMargin),void 0!==e.m_bottomMargin&&(this._margins.bottom=e.m_bottomMargin),void 0!==e.alignLabels&&this._properties.childs().alignLabels.setValue(e.alignLabels),this._mainSource=null,this._scaleSeriesOnly=!1}priceToLogical(e){return this.isLog()&&e?(0,pe.toLog)(e,this._logFormula):e}logicalToPrice(e){return this.isLog()?(0,pe.fromLog)(e,this._logFormula):e}priceToCoordinate(e,t){ -const i=this._priceToPercentOrIndexedTo100IfNeeded(e,t);return this._logicalToCoordinate(i)}coordinateToPrice(e,t){let i=this._coordinateToLogical(e);return this.isPercentage()?i=(0,pe.fromPercent)(i,t):this.isIndexedTo100()&&(i=(0,pe.fromIndexedTo100)(i,t)),i}mainSource(){if(null!==this._mainSource)return this._mainSource;let e;for(const t of this._priceDataSources){if(t instanceof _e.Series){e=t;break}e||(e=t)}return this._mainSource=e||null,this._correctedMarginsCache=null,this._mainSource}priceToCoordinateFn(e){this._makeSureItIsValid();const t=this.bottomPixelMargin(),i=(0,n.ensureNotNull)(this.priceRange()),s=i.minValue(),r=i.maxValue(),o=this.internalHeight()-1,a=this.isInverted(),l=o/(r-s),c=this.m_height,h=e=>{const i=t+l*(e-s);return a?i:c-1-i};return this.isPercentage()?t=>h((0,pe.toPercent)(t,e)):this.isIndexedTo100()?t=>h((0,pe.toIndexedTo100)(t,e)):this.isLog()?e=>h((0,pe.toLog)(e,this._logFormula)):e=>h(e)}pricesArrayToCoordinates(e,t,i){this._makeSureItIsValid();const s=this.bottomPixelMargin(),r=(0,n.ensureNotNull)(this.priceRange()),o=r.minValue(),a=r.maxValue(),l=this.internalHeight()-1,c=this.isInverted(),h=l/(a-o);void 0===i&&(i=e.length);const d=this.isPercentage(),u=this.isIndexedTo100(),p=this.isLog(),_=this.m_height;let m,g;for(let r=0;re?(0,pe.toLog)(e,this._logFormula):e),0===s.length)return;const h="open"in s[0],d="close"in s[0];if(null!==c)for(let e=0;e0){const t=(0,ge.unitConvertibleGroups)(d,p,e);l=(0,v.intersect)(l,new Set(t))}h+=1}if(null!==t)for(const i of this._priceDataSources){if(u.includes(i))continue;const c=i;if(!c.isUnitSource()||!c.isVisible())continue;const h=c.unit();if(null===h){t=null;break}s.add(h),d+=1;const p=(0, -n.ensureNotNull)(c.symbolSource()),_=p.symbolInfo();if(null===_){t=null;break}if(l.size>0){const t=(0,ge.unitConvertibleGroups)(_,h,e);l=(0,v.intersect)(l,new Set(t))}if(r.set(h,e.name(h)),o.set(h,e.description(h)),u.includes(p)||(l=new Set),void 0===a)a=h;else if(null!==a&&a!==h){a=null;break}}if(void 0===t)if(0===h&&0===d)t=null;else{t={availableGroups:l,selectedUnit:a||null,units:s,originalUnits:i,symbolSourceCount:h,allUnitsAreOriginal:c,names:r,descriptions:o}}return this._unitCache={value:t,availableUnitsCount:e.size()},t}measureUnitId(e){if(null!==this._measureUnitIdCache&&e.size()===this._measureUnitIdCache.availableUnitsCount)return this._measureUnitIdCache.value;let t,i;const s=new Map,r=new Map,n=new Set;let o=0;const a=this._seriesLikeSources.filter(me.isActingAsSymbolSource);for(const l of a){if(!l.isVisible())continue;const a=l.measureUnitId();if(null===a){t=null;break}n.add(a),s.set(a,e.name(a)),r.set(a,e.description(a)),void 0===i?i=a:null!==i&&i!==a&&(i=null),o+=1}return void 0===t&&(t=0===o?null:{selectedMeasureUnitId:i||null,measureUnitIds:n,names:s,descriptions:r,symbolSourceCount:o}),this._measureUnitIdCache={value:t,availableUnitsCount:e.size()},t}setMargins(e){if(!(0,se.isNumber)(e.top)||!(0,se.isNumber)(e.bottom))throw new TypeError("invalid margin");if(e.top<0||e.top>30||e.bottom<0||e.bottom>30)throw new RangeError("invalid margin");this._margins.top===e.top&&this._margins.bottom===e.bottom||(this._margins=e,this._correctedMarginsCache=null,this._invalidateInternalHeightCache(),this._marksCache=null)}topMargin(){return this._correctedMargins().top}bottomMargin(){return this._correctedMargins().bottom}invalidateMargins(){this._correctedMarginsCache=null}topPixelMargin(){return this.isInverted()?this.bottomMargin()*this.height()+this._bottomPixelMargin:this.topMargin()*this.height()+this._topPixelMargin}bottomPixelMargin(){return this.isInverted()?this.topMargin()*this.height()+this._topPixelMargin:this.bottomMargin()*this.height()+this._bottomPixelMargin}marks(){return this.isEmpty()?(this._marksCache=null,[]):(null===this._marksCache&&(this._markBuilder.rebuildTickMarks(),this._marksCache=this._markBuilder.marks(),this._onMarksChanged.fire()),this._marksCache)}onMarksChanged(){return this._onMarksChanged}priceRangeInPrice(){if(this.isEmpty())return null;const e=this.mainSource();if(null===e)return null;const t=(0,n.ensureNotNull)(e.firstValue()),i=this.height();return{from:this.coordinateToPrice(i-1,t),to:this.coordinateToPrice(0,t)}}setPriceRangeInPrice(e){if(this.isPercentage()||this.isIndexedTo100())return;const t=this.isInverted(),i=t?this.bottomMargin():this.topMargin(),s=t?this.topMargin():this.bottomMargin(),r=this.isLog();let n=r?(0,pe.toLog)(e.from,this._logFormula):e.from,o=r?(0,pe.toLog)(e.to,this._logFormula):e.to;const a=o-n;n+=s*a,o-=i*a,this.setMode({autoScale:!1}),this.setPriceRange(new ue.PriceRange(n,o)),this._marksCache=null,this._onMarksChanged.fire()}hasMainSeries(){return this._hasSeries}getStudies(){return this.dataSources().filter(G.isStudy)}lastSourceRemoved(){ -return this._lastSourceRemoved}sourcesForAutoscale(){return this._mainSource&&this._scaleSeriesOnly!==this._scalesProperties.childs().scaleSeriesOnly.value()&&(this._sourcesForAutoscale=null),this._sourcesForAutoscale||(this._sourcesForAutoscale=this._recalculateSourcesForAutoscale()),this._sourcesForAutoscale}recalculatePriceRange(e){this._invalidatedForRange={visibleBars:e,isValid:!1}}internalHeightChanged(){return this._internalHeightChanged}orderedSources(){if(this._cachedOrderedSoruces)return this._cachedOrderedSoruces;let e=this.m_dataSources.slice();return e=(0,oe.sortSources)(e),this._cachedOrderedSoruces=e,this._cachedOrderedSoruces}invalidateSourcesCache(){this._cachedOrderedSoruces=null,this._sourcesToUpdateViews=null}startScale(e){var t,i;this.isEmpty()||this.isPercentage()||this.isIndexedTo100()||null!==this._scaleStartPoint||null!==this._priceRangeSnapshot||(this._scaleStartPoint=this.m_height-e,this._priceRangeSnapshot=null!==(i=null===(t=this.priceRange())||void 0===t?void 0:t.clone())&&void 0!==i?i:null)}scaleTo(e){if(this.isPercentage()||this.isIndexedTo100()||null===this._scaleStartPoint)return;this.setMode({autoScale:!1}),(e=this.m_height-e)<0&&(e=0);let t=(this._scaleStartPoint+.2*(this.m_height-1))/(e+.2*(this.m_height-1));const i=(0,n.ensureNotNull)(this._priceRangeSnapshot).clone();t=Math.max(t,.1),i.scaleAroundCenter(t),this.setPriceRange(i)}endScale(){this.isPercentage()||this.isIndexedTo100()||null!==this._scaleStartPoint&&(this._scaleStartPoint=null,this._priceRangeSnapshot=null)}startTwoPointsScale(e,t){if(this.isEmpty()||this.isPercentage()||this.isIndexedTo100()||null!==this._twoPointsScaleStartPosition)return;const i=Math.min(e,t),s=Math.max(e,t);this._twoPointsScaleStartPosition={topLogical:this._coordinateToLogical(i),bottomLogical:this._coordinateToLogical(s)}}twoPointsScale(e,t){if(this.isPercentage()||this.isIndexedTo100()||null===this._twoPointsScaleStartPosition)return;this.setMode({autoScale:!1});const i=Math.min(e,t),s=Math.max(e,t),{topLogical:r,bottomLogical:n}=this._twoPointsScaleStartPosition,o=this.bottomPixelMargin(),a=this.internalHeight()-1,l=(this._invertedCoordinate(i)-o)/a,c=(n-r)/((this._invertedCoordinate(s)-o)/a-l);if(!Number.isFinite(c))return;const h=r-c*l,d=h+c;this.setPriceRange(new ue.PriceRange(this.priceToLogical(h),this.priceToLogical(d)))}endTwoPointsScale(){this._twoPointsScaleStartPosition=null}startScroll(e){var t,i;this.isAutoScale()||null===this._scrollStartPoint&&null===this._priceRangeSnapshot&&(this.isEmpty()||(this._scrollStartPoint=e,this._priceRangeSnapshot=null!==(i=null===(t=this.priceRange())||void 0===t?void 0:t.clone())&&void 0!==i?i:null))}scrollTo(e){if(this.isAutoScale())return;if(null===this._scrollStartPoint||null===this._priceRangeSnapshot)return;const t=this.priceRange();if(null===t)return;let i=e-this._scrollStartPoint;this.isInverted()&&(i*=-1);const s=i*(t.length()/(this.internalHeight()-1)),r=this._priceRangeSnapshot.clone();r.shift(s),this.setPriceRange(r,!0),this._marksCache=null}endScroll(){ -this.isAutoScale()||null!==this._scrollStartPoint&&(this._scrollStartPoint=null,this._priceRangeSnapshot=null)}clearPriceRange(){this.m_priceRange=null,this.recalculatePriceRangeOnce()}isVisible(){return this._isVisible}_addDataSourceImpl(e,t,i){if(t||-1===this.m_dataSources.indexOf(e)){if((0,ne.isPriceDataSource)(e)){if(void 0===i?this._priceDataSources.push(e):this._priceDataSources.splice(i,0,e),e.currencyChanged().subscribe(this,(()=>this._currencyCache=null)),e.unitChanged().subscribe(this,(()=>this._unitCache=null)),(0,me.isSymbolSource)(e)&&(this._seriesLikeSources.push(e),e.symbolResolved().subscribe(this,(()=>{this._currencyCache=null,this._unitCache=null,this._measureUnitIdCache=null})),e.isActingAsSymbolSource().subscribe(this._boundOnSourceIsActingAsSymbolSourceChanged),e instanceof _e.Series)){const t=e.properties();this._hasSeries||(t.childs().lockScale&&(this.setMode({lockScale:t.childs().lockScale.value()}),t.removeProperty("lockScale")),t.childs().pnfStyle.child("lockScale")&&t.childs().pnfStyle.removeProperty("lockScale")),this._hasSeries=!0}e.isSpeciallyZOrderedSource()||(this._sourcesThatAffectVisibility.push(e),e.properties().childs().visible.listeners().subscribe(this,this._onSourceVisibilityChanged))}(0,G.isStudy)(e)&&(e.onIsActualIntervalChange().subscribe(this,this._dropScaleCache),e.onHibernationStateChange().subscribe(this,this._dropScaleCache),0===this._studiesCount&&(0,Pe.hideAllIndicators)().subscribe(this,this._dropScaleCache),this._studiesCount++),(0,y.isLineTool)(e)&&(0===this._drawingCount&&(0,Pe.hideAllDrawings)().subscribe(this,this._dropScaleCache),this._drawingCount++),this.m_dataSources.push(e),this._mainSource=null,this.mainSource()===e&&(this._correctedMarginsCache=null,this._internalHeightCache=null,this._marksCache=null),this._dropScaleCache(),this.updateFormatter(),this._initScaleProperties(),this.invalidateSourcesCache(),this._updateIsVisible()}}_recalculateSourcesForAutoscale(){this._mainSource&&(this._scaleSeriesOnly=this._scalesProperties.childs().scaleSeriesOnly.value());const e=this._scaleSeriesOnly&&this._hasSeries;return this.m_dataSources.filter((t=>!!(t.properties().visible.value()||t instanceof _e.Series)&&(e?t instanceof _e.Series:(0,G.isStudy)(t)?!t.isSourceHidden()&&t.isIncludedInAutoScale():t.isIncludedInAutoScale())))}_updateAutoScaleDisabledProperty(e){const t=this._properties.childs(),i=t.indexedTo100.value()||t.percentage.value()||t.lockScale.value();e?t.autoScaleDisabled.setValueSilently(i):t.autoScaleDisabled.setValue(i)}_setAutoScaleValueWithDependentProperties(e){const t=this._properties.childs();t.autoScale.setValueSilently(e),e&&(t.percentage.setValueSilently(!1),t.indexedTo100.setValueSilently(!1),t.lockScale.setValueSilently(!1),t.logDisabled.setValueSilently(!1)),this._updateAutoScaleDisabledProperty(!0)}_setLockScaleValueWithDependentProperties(e){const t=this._properties.childs();t.lockScale.setValueSilently(e),e&&(t.autoScale.setValueSilently(!1),t.percentage.setValueSilently(!1),t.indexedTo100.setValueSilently(!1),t.log.setValueSilently(!1)), -t.percentageDisabled.setValueSilently(e),t.logDisabled.setValueSilently(e),this._updateAutoScaleDisabledProperty(!0)}_setPercentageValueWithDependentProperties(e){const t=this._properties.childs();t.percentage.setValueSilently(e),e&&(t.autoScale.setValueSilently(!0),t.log.setValueSilently(!1),t.lockScale.setValueSilently(!1),t.indexedTo100.setValueSilently(!1)),this._updateAutoScaleDisabledProperty(!0)}_setIndexedTo100ValueWithDependentProperties(e){const t=this._properties.childs();t.indexedTo100.setValueSilently(e),e&&(t.autoScale.setValueSilently(!0),t.log.setValueSilently(!1),t.lockScale.setValueSilently(!1),t.percentage.setValueSilently(!1)),this._updateAutoScaleDisabledProperty(!0)}_setLogValueWithDependentProperties(e){const t=this._properties.childs();t.log.setValueSilently(e),e&&(t.lockScale.setValueSilently(!1),t.percentage.setValueSilently(!1),t.indexedTo100.setValueSilently(!1)),this._updateAutoScaleDisabledProperty(!0)}_recalculatePriceRangeImpl(){const e=this._invalidatedForRange.visibleBars;if(null===e)return;let t=null;const i=this.sourcesForAutoscale(),s=this.isPercentage(),r=this.isIndexedTo100();let n=0,o=0;for(const a of i){if(!a.properties().visible.value())continue;const i=a.firstValue();if(null===i||s&&0===i)continue;const l=e.firstBar(),c=e.lastBar(),h=a.autoScaleInfo(l,c);let d=h.range;d&&(s?d=(0,pe.toPercentRange)(d,i):r&&(d=(0,pe.toIndexedTo100Range)(d,i)),t=null===t?d:t.merge(d)),void 0!==h.topPixelMargin&&(n=Math.max(n,h.topPixelMargin)),void 0!==h.bottomPixelMargin&&(o=Math.max(o,h.bottomPixelMargin))}if((Math.abs(n-this._topPixelMargin)>0||Math.abs(o-this._bottomPixelMargin)>0)&&(this._bottomPixelMargin=o,this._topPixelMargin=n,this._marksCache=null,this._invalidateInternalHeightCache()),t){if(t.minValue()===t.maxValue()&&(t=new ue.PriceRange(t.minValue()-.5,t.maxValue()+.5)),this.isLog()){const e=this._convertPriceRangeFromLog(t),i=(0,pe.logFormulaForPriceRange)(e);if(!(0,pe.logFormulasAreSame)(i,this._logFormula)){const s=this._priceRangeSnapshot?this._convertPriceRangeFromLog(this._priceRangeSnapshot):null;this._logFormula=i,t=this._convertPriceRangeToLog(e),s&&(this._priceRangeSnapshot=this._convertPriceRangeToLog(s))}}this.setPriceRange(t)}else this.m_priceRange||(this.setPriceRange(new ue.PriceRange(-.5,.5)),this._logFormula=(0,pe.logFormulaForPriceRange)(null));this._invalidatedForRange.isValid=!0;const a=this.mainSource();null!==a&&this._recalculatePriceRangeOnce&&(this._recalculatePriceRangeOnce=!a.priceRangeReady())}_makeSureItIsValid(){this._invalidatedForRange.isValid||(this._invalidatedForRange.isValid=!0,this._recalculatePriceRangeImpl())}_invalidateInternalHeightCache(){this._internalHeightCache=null,this._internalHeightChanged.fire()}_coordinateToLogical(e){if(this._makeSureItIsValid(),this.isEmpty())return 0;const t=this._invertedCoordinate(e),i=(0,n.ensureNotNull)(this.priceRange()),s=i.minValue()+(i.maxValue()-i.minValue())*((t-this.bottomPixelMargin())/(this.internalHeight()-1));return this.logicalToPrice(s)}_logicalToCoordinate(e){if(this._makeSureItIsValid(), -this.isEmpty())return 0;e=this.priceToLogical(e);const t=(0,n.ensureNotNull)(this.priceRange()),i=this.bottomPixelMargin()+(this.internalHeight()-1)*(e-t.minValue())/(t.maxValue()-t.minValue());return this._invertedCoordinate(i)}_convertPriceRangeFromLog(e){if(null===e)return null;const t=(0,pe.fromLog)(e.minValue(),this._logFormula),i=(0,pe.fromLog)(e.maxValue(),this._logFormula);return new ue.PriceRange(t,i)}_convertPriceRangeToLog(e){if(null===e)return null;const t=(0,pe.toLog)(e.minValue(),this._logFormula),i=(0,pe.toLog)(e.maxValue(),this._logFormula);return new ue.PriceRange(t,i)}_canConvertPriceRangeFromLog(e){if(null===e)return!1;const t=(0,pe.fromLog)(e.minValue(),this._logFormula),i=(0,pe.fromLog)(e.maxValue(),this._logFormula);return isFinite(t)&&isFinite(i)}_onSourceVisibilityChanged(){this._dropScaleCache(),this._updateIsVisible()}_dropScaleCache(){this._sourcesForAutoscale=null,this._currencyCache=null,this._unitCache=null,this._measureUnitIdCache=null}_updateIsVisible(){if(!Te)return void this._isVisible.setValue(!0);const e=this._sourcesThatAffectVisibility.some((e=>e.isVisible()));this._isVisible.setValue(e)}_invertedCoordinate(e){return this.isInverted()?e:this.height()-1-e}_initScaleProperties(){const e=this.isLockScale(),t=this.properties().childs();e&&(t.percentage.setValue(!1),t.indexedTo100.setValue(!1),t.log.setValue(!1),t.autoScale.setValue(!1)),t.percentageDisabled.setValue(e),t.logDisabled.setValue(e),this._updateAutoScaleDisabledProperty(!1),t.percentage.value()&&(t.log.setValue(!1),t.indexedTo100.setValue(!1)),t.indexedTo100.value()&&(t.log.setValue(!1),t.percentage.setValue(!1))}_correctedMargins(){if(null===this._correctedMarginsCache){const e=this.mainSource();this._correctedMarginsCache=null!==e?e.correctScaleMargins(this._margins):this._margins}return this._correctedMarginsCache}_getSourcesToUpdateViews(){return this._sourcesToUpdateViews||(this._sourcesToUpdateViews=this.m_dataSources.filter((e=>!(0,y.isLineTool)(e)||e.isActualSymbol()&&e.isActualCurrency()))),this._sourcesToUpdateViews}_mainSourceFormatter(){const e=this.mainSource();return(null==e?void 0:e.formatter())||Me}_priceToPercentOrIndexedTo100IfNeeded(e,t){return this.isPercentage()?(0,pe.toPercent)(e,t):this.isIndexedTo100()?(0,pe.toIndexedTo100)(e,t):e}_onSourceIsActingAsSymbolSourceChanged(){this._dropScaleCache()}_onIsInvertedChanged(){this._marksCache=null,this._markBuilder.rebuildTickMarks()}_updateResetAvailableValue(){this._resetScaleAvailable.setValue(!this.isLockScale()&&!this.isAutoScale())}}var ke=i(29541),De=i(63009),Ee=i(53588),Ve=i(88732),Be=i(13333);const Re=[],Ne=[];class Oe{constructor(e){this._studies={},this._deferreds={},this._container=e,Re.push(e),Ne.push(this)}add(e,t){this._deferreds[e]&&(this._deferreds[e].resolve(t),delete this._deferreds[e]),this._studies[e]=t}get(e){return this._studies[e]?Promise.resolve(this._studies[e]):(this._deferreds[e]||(this._deferreds[e]=(0,p.createDeferredPromise)()),this._deferreds[e].promise)}reset(){const e=Re.indexOf(this._container);~e&&(Re.splice(e,1), -Ne.splice(e,1))}static instance(e){const t=Re.indexOf(e);return~t?Ne[t]:new Oe(e)}}var Fe=i(99366);var We=i(4949),He=i(2823),ze=i(53086),Ue=i(78856),je=i(44010),Ge=i(87440),qe=i(16410);const $e=O.enabled("clear_price_scale_on_error_or_empty_bars"),Ye=(0,J.getLogger)("Chart.Pane");function Ke(e,t,i){e.setMargins({top:t,bottom:i})}const Ze="chart.pane";class Xe{constructor(e,t,i,s){this.m_dataSources=[],this._sourceWatchedValuesSubscriptions=new Map,this.m_mainDataSource=null,this._cachedOrderedSources=new he(this),this._sourcesById=new Map,this._priceSourcesById=new Map,this._sourcePropertiesChanged=new q.Delegate,this._sourcesZOrderChanged=new q.Delegate,this._tagsChanged=new q.Delegate,this._stretchFactor=1e3,this._isInInsertManyDataSourcesState=!1,this._lastLineDataSourceZOrder=null,this._rightPriceScales=[],this._leftPriceScales=[],this._lockedPriceScale=null,this._currentPriceScaleRatio=null,this._onPriceScalesChanged=new q.Delegate,this._isRecalculatingScales=!1,this._priceDataSources=[],this._symbolSources=[],this._lollipopDataSources=[],this._symbolSourceResolved=new q.Delegate,this._symbolSourceResolvingActive=new $.WatchedValue(!1),this._bulkActions={activeCounter:0},this._height=0,this._width=0,this._sizeChanged=new q.Delegate,this._dataSourcesCollectionChanged=new q.Delegate,this._symbolSourceCollectionChanged=new q.Delegate,this._priceSourcesCollectionChanged=new q.Delegate,this._maximized=new $.WatchedValue(!1),this._collapsed=new $.WatchedValue(!1),this._resetPriceScalesAvailable=new $.WatchedValue(!1),this._destroyed=new q.Delegate,this._executionsPositionController=null,this._seriesDisplayError=null,this._onPriceScaleIsVisibleChanged=()=>{this._model.fullUpdate()},this._recalcSymbolSourceResolvingActive=()=>{for(const e of this._symbolSources)if(e.symbolResolvingActive().value())return void this._symbolSourceResolvingActive.setValue(!0);this._symbolSourceResolvingActive.setValue(!1)},this._onSymbolSourceCollectionChanged=()=>{0===this._bulkActions.activeCounter?this._symbolSourceCollectionChanged.fire():this._bulkActions.symbolSourceCollectionChanged=!0},this._onSeriesDisplayError=e=>{if(null!==e){for(const e of this._leftPriceScales)e.clearPriceRange();for(const e of this._rightPriceScales)e.clearPriceRange()}},this._updateResetPriceScalesAvailableValue=()=>{const e=e=>e.resetScaleAvailable().value(),t=this._leftPriceScales.some(e)||this._rightPriceScales.some(e);this._resetPriceScalesAvailable.setValue(t)},this._priceScaleSelectionStrategy=(0,te.createPriceScaleSelectionStrategy)(i.properties().childs().priceScaleSelectionStrategyName.value()),this._id=null!=s?s:(0,Q.randomHashN)(6),this._timeScale=e,this.m_mainDataSource=null,this._properties=t,this._model=i,i.properties().childs().priceScaleSelectionStrategyName.subscribe(null,(e=>{this._priceScaleSelectionStrategy=(0,te.createPriceScaleSelectionStrategy)(e.value()),this._priceScaleSelectionStrategy.apply(this)})),this._timeScale.barSpacingChanged().subscribe(this,(()=>{ -this.m_mainDataSource===this._model.mainSeries()&&this._recalculatePriceScaleByScaleRatio(this.m_mainDataSource.priceScale())})),$e&&(this._seriesDisplayError=(0,F.getSeriesDisplayErrorWV)(this._model.mainSeries()),this._seriesDisplayError.subscribe(this._onSeriesDisplayError)),t.childs().topMargin.subscribe(this,this._updateMargins),t.childs().bottomMargin.subscribe(this,this._updateMargins),this._updateMargins()}destroy(){var e;this._properties.childs().topMargin.unsubscribeAll(this),this._properties.childs().bottomMargin.unsubscribeAll(this),this._model.properties().childs().priceScaleSelectionStrategyName.unsubscribeAll(this),this._timeScale.barSpacingChanged().unsubscribeAll(this),this._leftPriceScales.concat(this._rightPriceScales).forEach((e=>{e.modeChanged().unsubscribeAll(this),e.priceRangeChanged().unsubscribeAll(this),e.internalHeightChanged().unsubscribeAll(this),e.isVisible().unsubscribe(this._onPriceScaleIsVisibleChanged),e.resetScaleAvailable().unsubscribe(this._updateResetPriceScalesAvailableValue)}));for(const e of this.m_dataSources)this.removeSourceFromPriceScale(e),e.destroy&&e.destroy();null===(e=this._seriesDisplayError)||void 0===e||e.destroy(),this._destroyed.fire()}id(){return this._id}bulkActionMacro(e){const t=this._bulkActions;t.activeCounter+=1,e(),t.activeCounter-=1,0===t.activeCounter&&(this._dataSourcesCollectionChanged.fire(),t.symbolSourceCollectionChanged&&(this._symbolSourceCollectionChanged.fire(),t.symbolSourceCollectionChanged=!1),t.priceSourcesCollectionChanged&&(this._priceSourcesCollectionChanged.fire(),t.priceSourcesCollectionChanged=!1))}defaultPriceScale(){var e,t;const i=null!==(t=null===(e=this.m_mainDataSource)||void 0===e?void 0:e.priceScale())&&void 0!==t?t:null;if(null!==i)return i;const s=this.properties().childs().axisProperties.state();return s.autoScale=!0,new Le(this._model.properties().childs().scalesProperties,s)}leftPriceScales(){return this._leftPriceScales}rightPriceScales(){return this._rightPriceScales}visibleLeftPriceScales(){var e;const t=this._model.priceScaleSlotsCount(),i=this._leftPriceScales.filter((e=>e.isVisible().value())),s=null===(e=this.mainDataSource())||void 0===e?void 0:e.priceScale();if(i.length>t.left&&(null==s?void 0:s.isVisible().value())){const e=(0,v.moveToHead)(i,s);return e.splice(t.left),e}return i}visibleRightPriceScales(){var e;const t=this._model.priceScaleSlotsCount(),i=this._rightPriceScales.filter((e=>e.isVisible().value())),s=null===(e=this.mainDataSource())||void 0===e?void 0:e.priceScale();if(i.length>t.right&&(null==s?void 0:s.isVisible().value())){const e=(0,v.moveToHead)(i,s);return e.splice(t.right),e}return i}clearSeries(e){const t=this._model.mainSeries();for(let i=this.m_dataSources.length-1;i>=0;i--)this.m_dataSources[i]===t&&this._removeSourceFromCollections(i,e)}sourcesByGroup(){return this._cachedOrderedSources}dataSourceForId(e){return this._sourcesById.get(e)||null}changeSourceId(e,t){var i;e===this._model.mainSeries()&&(null===(i=(0, -ee.getPersistentLogger)())||void 0===i||i.addPersistentLogEntry(`changeSourceId for series from ${e.id()} to ${t}`,J.LOGLEVEL.INFO,Ze)),(0,n.assert)(this.hasDataSource(e));const s=e.id();e.setId(t),this._sourcesById.delete(s),this._sourcesById.set(t,e),(0,ne.isPriceDataSource)(e)&&(this._priceSourcesById.delete(s),this._priceSourcesById.set(t,e))}movePriceScale(e,t,i){const s=this.priceScalePosition(e);if(s!==t)this.removePriceScale(e),this._placePriceScale(e,t,i),e.invalidateMargins(),this._invalidateSourcesCache();else if(void 0!==i&&"overlay"!==s){const t="left"===s?this._leftPriceScales:this._rightPriceScales,r=t.indexOf(e);t.splice(r,1),t.splice(i,0,e)}}mainDataSource(){return this.m_mainDataSource}isEmpty(){return null===this.m_mainDataSource}recalculatePriceScale(e,t){if(!e)return;const i=e.sourcesForAutoscale();if((e.isAutoScale()||e.priceRangeShouldBeRecalculatedOnce())&&i&&i.length>0&&!this.timeScale().isEmpty()){const t=this.timeScale().visibleBarsStrictRange();e.recalculatePriceRange(t)}e.updateAllViews(t)}onSourceTagsChanged(){this._tagsChanged.fire()}insertDataSource(e,t,i,s){e.setZorder(i),t||(s=!1,t=this.findSuitableScale(e)),this._addSourceToCollections(e);let r=!1;e===this.model().mainSeries()?(this.m_mainDataSource=this.model().mainSeries(),r=!0):null===this.m_mainDataSource&&(0,ne.isPriceDataSource)(e)&&(this.m_mainDataSource=e,r=!0),s||t.addDataSource(e,this._isInInsertManyDataSourcesState),e.setPriceScale(t),t.invalidateMargins(),e.onTagsChanged&&e.onTagsChanged().subscribe(this,this.onSourceTagsChanged),r&&this._processMainSourceChange(),this._tagsChanged.fire(),(0,ne.isPriceDataSource)(e)&&this.recalculatePriceScale(t,(0,H.sourceChangeEvent)(e.id())),this._invalidateSourcesCache()}addDataSource(e,t,i){let s=e.zorder();i||((0,y.isLineTool)(e)&&!e.isSpeciallyZOrderedSource()?(s=null!==this._lastLineDataSourceZOrder?this._lastLineDataSourceZOrder+1:this.newLineToolZOrder(),this._isInInsertManyDataSourcesState&&(this._lastLineDataSourceZOrder=s)):(0,G.isStudy)(e)&&!e.isSpeciallyZOrderedSource()&&(s=this.newStudyZOrder())),this.insertDataSource(e,t,s)}removeDataSource(e,t,i,s){const r=this.m_dataSources.indexOf(e);if(-1===r)return void Ye.logDebug("removeDataSource: invalid data source");this._removeSourceFromCollections(r,!!i),e!==this.m_mainDataSource||t||(this.m_mainDataSource=null);const n=e.priceScale();s||this.removeSourceFromPriceScale(e),e.onTagsChanged&&e.onTagsChanged().unsubscribe(this,this.onSourceTagsChanged),(0,ne.isPriceDataSource)(e)&&!t&&this._processMainSourceChange(),this._tagsChanged.fire(),n&&(0,ne.isPriceDataSource)(e)&&this.recalculatePriceScale(n,(0,H.sourceChangeEvent)(e.id())),this._invalidateSourcesCache()}hasDataSource(e){return this._sourcesById.has(e.id())}hasPriceDataSource(e){return this._priceSourcesById.has(e.id())}dataSources(){return this.m_dataSources}priceDataSources(){return this._priceDataSources}lollipopDataSources(){return this._lollipopDataSources}symbolSources(){return this._symbolSources}replaceSource(e,t,i){ -const s=this.m_mainDataSource===e,r=e.zorder(),n=null==i?void 0:i.replaceSource(e,t);this.insertDataSource(t,i,r,n),this.removeDataSource(e,s,void 0,n),this._sourcesById.set(t.id(),t),(0,ne.isPriceDataSource)(t)&&this._priceSourcesById.set(t.id(),t),s&&(this.m_mainDataSource=t,this._processMainSourceChange())}findSuitableScale(e,t,i){return this._priceScaleSelectionStrategy.findSuitableScale(this,e,t,i)}createNewPriceScaleIfPossible(){return this._priceScaleSelectionStrategy.createNewPriceScaleIfPossible(this)}canCreateNewPriceScale(){return this._priceScaleSelectionStrategy.canCreateNewPriceScale(this)}isOverlay(e){const t=e.priceScale();return null===t||"overlay"===this.priceScalePosition(t)}recalculate(e){this._leftPriceScales.forEach((t=>this.recalculatePriceScale(t,e))),this._rightPriceScales.forEach((t=>this.recalculatePriceScale(t,e)));for(const t of this.m_dataSources)this.isOverlay(t)&&!(0,y.isLineTool)(t)&&this.recalculatePriceScale(t.priceScale(),e);this.updateAllViews(e),this._model.updatePane(this)}updateAllViews(e){for(const t of this.m_dataSources)t.updateAllViews(e);for(const t of this.model().customSources())t.updateViewsForPane(this,e)}updateLollipopViews(e){}priceScalePosition(e){return this._leftPriceScales.includes(e)?"left":this._rightPriceScales.includes(e)?"right":"overlay"}createPriceScaleAtPosition(e,t){const i=this.properties().childs().axisProperties.state();i.autoScale=!0;const s=new Le(this.model().properties().childs().scalesProperties,i);return s.setHeight(this.height()),Ke(s,this._defaultTopMargin(),this._defaultBottomMargin()),this._placePriceScale(s,e,t),s}removePriceScale(e){e.modeChanged().unsubscribeAll(this),e.priceRangeChanged().unsubscribeAll(this),e.internalHeightChanged().unsubscribeAll(this),e.isVisible().unsubscribe(this._onPriceScaleIsVisibleChanged),e.resetScaleAvailable().unsubscribe(this._updateResetPriceScalesAvailableValue),e===this._lockedPriceScale&&(this._lockedPriceScale=null,this._currentPriceScaleRatio=null);const t=this._leftPriceScales.indexOf(e);-1!==t&&(this._leftPriceScales[t].invalidateMargins(),this._leftPriceScales.splice(t,1));const i=this._rightPriceScales.indexOf(e);if(-1!==i&&(this._rightPriceScales[i].invalidateMargins(),this._rightPriceScales.splice(i,1)),null===e.mainSource()){const t=e.dataSources().length;0!==t&&Ye.logError("Invalid priceScale state: empty mainSource but non-empty data sources="+t)}this._onPriceScalesChanged.fire(),this._updateResetPriceScalesAvailableValue()}priceScaleIndex(e,t){switch(t){case"left":return this.leftPriceScales().indexOf(e);case"right":return this.rightPriceScales().indexOf(e)}}move(e,t,i){const s=e.priceScale();this.removeSourceFromPriceScale(e),t.addDataSource(e),e.setPriceScale(t),t.invalidateMargins(),this._processMainSourceChange(),this._invalidateSourcesCache(),e.isIncludedInAutoScale()&&(null!==s&&this.recalculatePriceScale(s,(0,H.sourceChangeEvent)(e.id())),this.recalculatePriceScale(t,(0,H.sourceChangeEvent)(e.id()))),this._onPriceScalesChanged.fire()}setZOrders(e){e.forEach(((e,t)=>{t.setZorder(e)})), -this._invalidateSourcesCache(),0===this._bulkActions.activeCounter&&this._dataSourcesCollectionChanged.fire(),this.model().lightUpdate()}isMainPane(){return this.hasDataSource(this.model().mainSeries())}isLast(){const e=this.model().panes();return e[e.length-1]===this}newStudyZOrder(){return(0,De.newStudyZOrder)(this._priceDataSources)}newLineToolZOrder(e){return(0,De.newLineToolZOrder)(this.m_dataSources,e)}model(){return this._model}containsMainSeries(){return this._sourcesById.has(this.model().mainSeries().id())}applyPriceScaleRatio(e,t){var i;null!==this._lockedPriceScale&&this._lockedPriceScale!==e||this._currentPriceScaleRatio===t||!this.isMainPane()||null===this._lockedPriceScale&&e!==(null===(i=this.mainDataSource())||void 0===i?void 0:i.priceScale())||(this._setNewPriceRangeByScaleRatio(e,t,this._mainSourceVisiblePriceRange(e),!0,!0),null!==this._lockedPriceScale?this._tryToApplyNewPriceScaleRatio():e.isLog()||this.model().mainSeriesScaleRatioPropertyOnChanged())}sendToBack(e){const t=this.sourcesByGroup().allExceptSpecialSources();this._batchReorder(e,t[0],De.moveBeforeSource)}bringToFront(e){const t=this.sourcesByGroup().allExceptSpecialSources();this._batchReorder(e,t[t.length-1],De.moveAfterSource)}sendBackward(e){const t=this.sourcesByGroup().allIncludingHidden(),i=t.indexOf(e[0]);if(0===i)this.bringToFront(e);else{const s=t[i-1];this.insertBefore(e,s)}}bringForward(e){const t=this.sourcesByGroup().allExceptSpecialSources(),i=t.indexOf(e[e.length-1]);if(i===t.length-1)this.sendToBack(e);else{const s=t[i+1];this.insertAfter(e,s)}}insertAfter(e,t){this._batchReorder(e,t,De.moveAfterSource)}insertBefore(e,t){this._batchReorder(e,t,De.moveBeforeSource)}maximized(){return this._maximized}collapsed(){return this._collapsed}getPriceScaleById(e){const t=this.m_dataSources.find((t=>{var i;return(null===(i=t.priceScale())||void 0===i?void 0:i.id())===e}));return void 0===t?null:t.priceScale()}priceScaleSelectionStrategy(){return this._priceScaleSelectionStrategy}setPriceScaleSelectionStrategy(e){this._priceScaleSelectionStrategy=e,e.apply(this)}findTargetPriceAxisViews(e,t,i,s){if((0,f.isDataSource)(e)&&this.model().paneForSource(e)!==this)return[];const r=e.priceScale();if(t===r)return i;if(null===r)return[];if("overlay"===this.priceScalePosition(r))return t===this.defaultPriceScale()?i:[];const n=this.priceScalePosition(t);if(n!==this.priceScalePosition(r))return[];const o="left"===n?this.leftPriceScales():this.rightPriceScales();return o.indexOf(t)1}properties(){return this._properties}setPriceAutoScale(e,t){e.setMode({autoScale:t}),this.timeScale().isEmpty()||this.recalculatePriceScale(e,(0,H.viewportChangeEvent)())}state(e,t,i,s,r,n){var o,a;const l={sources:[],mainSourceId:null===(o=this.m_mainDataSource)||void 0===o?void 0:o.id(),stretchFactor:this._stretchFactor,leftAxisesState:[],rightAxisesState:[],overlayPriceScales:{},priceScaleRatio:this._currentPriceScaleRatio, -isCollapsed:this._collapsed.value()},c=new Map,h=e=>{if(c.has(e))return c.get(e);let o=null;const a=i&&!e.isSavedInStudyTemplates()||!e.state||(0,y.isLineTool)(e)&&n||!e.isSavedInChart(Boolean(t))||!(o=e.state(t,r))||s&&(0,y.isLineTool)(e)&&e.isActualSymbol&&!e.isActualSymbol()||e.isPhantom()?null:o;return c.set(e,a),a};if(e){l.sources=[];for(let e=0;enull!==c.get(e),u=e=>!n||!(0,y.isLineTool)(e);l.leftAxisesState=this._leftPriceScales.map((e=>({state:e.state(),sources:e.dataSources().filter(d).filter(u).map((e=>e.id()))}))),l.rightAxisesState=this._rightPriceScales.map((e=>({state:e.state(),sources:e.dataSources().filter(d).filter(u).map((e=>e.id()))}))),l.overlayPriceScales={};for(const e of this.m_dataSources)if(this.isOverlay(e)&&e.isSavedInChart(Boolean(t))){const t=e.priceScale();l.overlayPriceScales[e.id()]=null!==(a=null==t?void 0:t.state())&&void 0!==a?a:null}return l}restoreState(e){var t;const{state:i,withData:s,version:r,seriesId:o=this._model.mainSeries().id(),settingsMigration:a={},contentOverrides:l,restoreSilently:c,reason:h=0}=e;null===(t=(0,ee.getPersistentLogger)())||void 0===t||t.addPersistentLogEntry(`Restoring pane with seriesId ${o}`,J.LOGLEVEL.INFO,Ze),i.stretchFactor&&(this._stretchFactor=i.stretchFactor);const d={};if(i.sources){const e=i.sources.filter((e=>{var t;return!!e&&("MainSeries"===e.type||(!(null===(t=e.points)||void 0===t?void 0:t.some((e=>null===e.time_t||!isFinite(e.time_t))))||(Ye.logNormal("Dropped invalid "+e.type+". Reason: non-numeric point time"),!1)))})),t=e.findIndex(Ee.isMainSeriesState);-1!==t&&this.model().mainSeries().setObsoleteZOrder(e[t].zorder),r<3&&(0,De.reorderDataSourcesStateZOrder)(e);const n=-1!==this.m_dataSources.indexOf(this._model.mainSeries());this.clearSeries(Boolean(c)),this.m_mainDataSource=null,n&&this._addSourceToCollections(this._model.mainSeries(),c),(()=>{const t=e.find((e=>e.id===i.mainSourceId));if(void 0===t)return void Ye.logWarn("There is no main source with id "+i.mainSourceId+", total sources="+e.length);if(!window.TradingView[t.type]||!(0,de.isLineToolName)(t.type))return void Ye.logNormal("The type of main source is not line tool - fix is unnecessary");let s=null;for(const i of e)if(!window.TradingView[t.type]||!(0,de.isLineToolName)(i.type)){if(null!==s)return void Ye.logWarn("Pane contains more than 1 possibly main sources - auto fix cannot be applied");s=i}if(null===s)return void Ye.logWarn("Pane contains only line tools - possible we need to remove this pane?");const r=i.mainSourceId;let n=0;i.mainSourceId=s.id,e.forEach((e=>{e.ownerSource===r&&(e.ownerSource=null==s?void 0:s.id,n+=1)})),Ye.logNormal("Auto fix broken pane is applied, changed line tools="+n+", changed from="+r+" to="+s.id)})();for(const t of e)if("study_Sessions"===t.type){this.model().sessions().restoreOldState(t,s);break}for(const t of e)"study_Sessions"!==t.type&&(null===this._model.dataSourceForId(t.id)||"MainSeries"===t.type?(d[t.id]=t.ownerSource,(0, -Ee.isMainSeriesState)(t)?this._restoreMainSeries(t,s,n,a,l,c):(0,Ee.isStudyState)(t)?this.restoreStudy(t,s,o,a,c,h):(0,Ee.isLineToolState)(t)?(t.state&&(t.state.zOrderVersion=2),this.restoreLineTool(t,s,void 0,c)):"ChartEventsSource"===t.type&&this._restoreSpecialSource(t,s,c)):Ye.logError("Duplicate id while restoring pane: "+t.type+","+t.id))}const u=new Set,p=(e,t)=>{e.priceScale()!==t&&(this.removeSourceFromPriceScale(e),e.setPriceScale(t),t.addDataSource(e))},_=(e,t,i)=>{if(u.has(e))return;u.add(e);const s=i.m_showSymbolLabels;void 0!==s&&e===this.model().mainSeries()&&this.model().properties().childs().scalesProperties.childs().showSymbolLabels.setValue(s),this._model.children(e,!0).forEach((e=>_(e,t,i))),p(e,t)},m=e=>{const t=(0,R.defaults)("chartproperties").paneProperties.axisProperties,i=new Le(this.model().properties().childs().scalesProperties,t);return i.restoreState(e.state),i.setHeight(this._height),e.sources.forEach((e=>{const s=this.dataSourceForId(e);s&&_(s,i,t)})),0===i.dataSources().length?null:i},g=e=>e.map(m).filter((e=>null!==e));let f;if(i.leftAxisesState)f=g(i.leftAxisesState);else{const e=m({state:i.leftAxisState,sources:i.leftAxisSources});f=null!==e?[e]:[]}let v;if(this._leftPriceScales.slice().forEach((e=>this.removePriceScale(e))),this._leftPriceScales=[],f.forEach((e=>this._placePriceScale(e,"left"))),i.rightAxisesState)v=g(i.rightAxisesState);else{const e=m({state:i.rightAxisState,sources:i.rightAxisSources});v=null!==e?[e]:[]}this._rightPriceScales.slice().forEach((e=>this.removePriceScale(e))),this._rightPriceScales=[],v.forEach((e=>this._placePriceScale(e,"right"))),this._currentPriceScaleRatio=i.priceScaleRatio||i.leftPriceScaleRatio||i.rightPriceScaleRatio||null;const S=new Map;for(const e of this.m_dataSources){if(u.has(e))continue;let t;if(i.overlayPriceScales&&i.overlayPriceScales[e.id()]){let s=i.overlayPriceScales[e.id()];S.has(null==s?void 0:s.id)?t=S.get(null==s?void 0:s.id):(s=(0,n.ensure)(s),t=new Le(this._model.properties().childs().scalesProperties),t.setHeight(this._height),s.m_isAutoScale=!0,s.m_isLog=!1,s.m_isPercentage=!1,s.m_isLockScale=!1,t.restoreState(s),S.set(s.id,t))}else t=new Le(this._model.properties().childs().scalesProperties),t.setHeight(this._height);p(e,t)}for(const e of Object.keys(d)){const t=d[e],i=this.dataSourceForId(e);t&&i&&null===i.ownerSource()&&i.setOwnerSource(this.dataSourceForId(t))}if(i.mainSourceId&&!this.containsMainSeries()&&(this.m_mainDataSource=this.dataSourceForId(i.mainSourceId)),!this.m_mainDataSource)for(const e of this.m_dataSources)if((0,ne.isPriceDataSource)(e)){this.m_mainDataSource=e;break}for(const e of this.m_dataSources)(0,y.isLineTool)(e)?(e.ownerSource()||e.setOwnerSource(this.mainDataSource()),e.isFixed()&&e.restoreFixedPoint()):(0,G.isStudy)(e)&&!e.ownerSource()&&e.isLinkedToSeries()&&e.setOwnerSource(this.model().mainSeries());this._updateMargins(),this._cachedOrderedSources.clear()}onPriceScalesChanged(){return this._onPriceScalesChanged}setPaneSize(e){let t;switch(e){case"large":t=1;break;case"medium":t=.6;break -;case"small":t=.3;break;case"tiny":t=.15;break;default:throw new Error("Unknown size enum value: "+e)}this._stretchFactor=1e3*t}stretchFactor(){return this._stretchFactor}setStretchFactor(e){this._stretchFactor=e}customSources(e){return this.model().customSources(e)}createDrawingsCaches(){re.ExecutionsPositionController.recreateOrderedByBarsSourcesCache(this)}clearDrawingCaches(){re.ExecutionsPositionController.clearOrderedByBarsSourcesCache()}executionsPositionController(){return this._executionsPositionController||(this._executionsPositionController=new re.ExecutionsPositionController(this)),this._executionsPositionController}width(){return this._width}height(){return this._height}setHeight(e){if(this._height!==e){this._height=e,this._leftPriceScales.forEach((t=>t.setHeight(e))),this._rightPriceScales.forEach((t=>t.setHeight(e)));for(let t=0;t(e.paneViews(this)||[]).some((e=>{const r=e.renderer(t,i);return r&&r.doesIntersectWithBox&&r.doesIntersectWithBox(s)}))))}logicalRectToPixels(e){const t=this.defaultPriceScale(),i=this.timeScale(),s=(0,n.ensureNotNull)((0,n.ensureNotNull)(t.mainSource()).firstValue()),r=t.priceToCoordinate(e.p1.price,s),a=i.indexToCoordinate(e.p1.index),l=t.priceToCoordinate(e.p2.price,s),c=i.indexToCoordinate(e.p2.index),h=new o.Point(Math.min(a,c),Math.min(r,l)),d=new o.Point(Math.max(a,c),Math.max(r,l));return(0,o.box)(h,d)}timeScale(){return this._timeScale}restoreLineTool(e,t,i,s,r){var o,a,l,c,h,d,u,p,_,m,g;delete e.state.lastUpdateTime,e.state.intervalsVisibilities=(0,We.mergeIntervalVisibilitiesDefaults)(e.state.intervalsVisibilities),i=void 0===i||i,Fe.LineToolElliott.migrateState(e),"LineToolGannComplex"!==(g=e).type||void 0!==g.version&&1!==g.version||(g.type="LineToolGannFixed"),Array.isArray(e.positionPercents)&&(e.positionPercents=e.positionPercents[0]);const f=e.type,v=e.id,S=e.state,b=i?e.zorder:this.newLineToolZOrder();(0,n.assert)((0, -de.isLineToolName)(f),"invalid data source type:"+f+" (expected to be a Line Tool)");let w,C,P=null;if((0,Ee.isStudyLineToolState)(e)){P=this._model.studyVersioning();const t=P.patchPointsBasedStudyState(e);e=t;const i=t.metaInfo;Object.assign(i,ie.StudyMetaInfo.parseIdString(null==i?void 0:i.fullId));const s=P.updateMetaInfo(i)||i;C=(0,y.createStudyLineToolProperties)(f,i,s,S,P),w=(0,y.createLineTool)(f,this._model,C,s,!0)}else C=(0,y.createLineToolProperties)(f,S,this._model,!1),t?null===(o=C.child("fixedSize"))||void 0===o||o.setValue(!1):null===(a=C.child("fixedSize"))||void 0===a||a.setValue(!0),w=(0,y.createLineTool)(f,this._model,C,null,!0);w.setId(v),w.linkKey().setValue(e.linkKey||null);e.alertId&&w.canHasAlert();let x=null!==(l=e.indexes)&&void 0!==l?l:[];if(x=x.slice(0,null!==(h=null===(c=e.points)||void 0===c?void 0:c.length)&&void 0!==h?h:x.length),w.isFixed()?void 0!==e.positionPercents?w.restorePositionPercents(e.positionPercents):w.restorePositionPercents({x:.5,y:.5}):e.points&&w.restorePoints(e.points,x,t),w instanceof He.LineToolBarsPattern||w instanceof ze.LineToolCallout||w instanceof Ue.LineToolTrendAngle||w instanceof je.LineToolGhostFeed||w instanceof Ge.LineToolParallelChannel)null===(u=(d=w).restoreData)||void 0===u||u.call(d,e);else if(t&&(0,Ee.isStudyLineToolState)(e)&&w.restoreData){const t=e;P&&(t.graphics=P.patchPointsBasedStudyData(t.metaInfo,t.graphics)),null===(p=w.restoreData)||void 0===p||p.call(w,t)}const T=null==e.version?1:e.version,I=null==w.version?1:w.version;if(T!==I&&(null===(m=(_=w).migrateVersion)||void 0===m||m.call(_,T,I,{pane:this,model:this._model,properties:C})),void 0!==b&&w.setZorder(b),r)(0,y.prepareLineToolPropertiesByOwnerSource)(w.properties(),r),w.setOwnerSource(r);else{const t=e.ownerSource?this.dataSourceForId(e.ownerSource):null;w.setOwnerSource(t)}return w.isFixed()&&w.restoreFixedPoint(),void 0!==e.userEditEnabled&&w.setUserEditEnabled(e.userEditEnabled),void 0!==e.isSelectionEnabled&&w.setSelectionEnabled(e.isSelectionEnabled),this._addSourceToCollections(w,s),this._cachedOrderedSources.clear(),w}restoreStudy(e,t,s,r,n,o){var a;if(t&&void 0===e.data&&void 0===e.nonSeriesData&&void 0===e.indexes)return Ye.logError("Cannot restore (skipping) study without data "+e.id+", "+e.metaInfo.id),null;const l=e.id,h=e.state,d=e.zorder;s=null!=s?s:this._model.mainSeries().id();const u=(null!==(a=e.parentSources)&&void 0!==a?a:e.ownerSource?[e.ownerSource]:[]).filter((e=>e!==s));let p=(0,se.clone)(e.metaInfo);if(Object.assign(p,ie.StudyMetaInfo.parseIdString(p.id)),function(e){return"Script$TV_EARNINGS@tv-scripting"===e||"Script$TV_DIVIDENDS@tv-scripting"===e||"Script$TV_SPLITS@tv-scripting"===e||"ESD$TV_EARNINGS@tv-scripting"===e||"ESD$TV_DIVIDENDS@tv-scripting"===e||"ESD$TV_SPLITS@tv-scripting"===e||"Earnings@tv-basicstudies"===e||"Dividends@tv-basicstudies"===e||"Splits@tv-basicstudies"===e||"BarSetContinuousRollDates@tv-corestudies"===e}(p.id)&&!t)return Ye.logNormal("Skipping study "+p.id),null;let _=h -;const m=this._model.studyVersioning(),g=m.patchPropsStateAndMetaInfo(_,p,{oldShowStudyLastValueProperty:t&&!(null==r?void 0:r.showStudyLastValueProperty)});_=g.propsState,p=g.metaInfo;const f=new P.StudyStub(this._model,e,p.shortDescription);let v;f.setId(l),f.setZorder(d);let y=!1;const S=i=>{if(y&&this._model.dataSourceForId(l)!==f)return;f.setStatus({type:Be.StudyStatusType.Undefined});const s=i||new ie.StudyMetaInfo(p),r=Oe.instance(this._model),n=n=>{var a;const c=(0,x.prepareStudyPropertiesForLoadChart)(p,i,_,m),h=(0,G.createStudy)(this._model,c,n,s,void 0,o);if(h.setId(l),h.setOwnFirstValue(null!==(a=e.ownFirstValue)&&void 0!==a?a:null),e.customFields&&h.restoreStateCustomFields(e.customFields),t){const t=e,{data:i,nsData:s,indexes:r}=m.patchStudyData(p,t.data,t.nonSeriesData,t.indexes);h.restoreData(i,s,r)}this._model.replaceStudyStub(f,h)||(v=h),r.add(l,h)};if(u.length>0){const e=u.map((e=>r.get(e)));Promise.all(e).then(n)}else n([])};if(t)S(null);else{let e=null;0;const t=e=>{const t=m.updateMetaInfoAsync(e);t.sync?S(t.result):t.result.then(S).catch((e=>f.setFailed("error: "+e)))};e?e.then(t).catch((()=>f.setFailed(c.t(null,void 0,i(28523))))):t(p)}const b=null!=v?v:f;if(b){b.setZorder(d);const t=e.metaInfo.linkedToSeries?this._model.mainSeries():u.length?this.dataSourceForId(u[0]):null;b.setOwnerSource(t),this._addSourceToCollections(b,n),this._processMainSourceChange(),y=b===f}return this._cachedOrderedSources.clear(),b}clipboardLineToolOwnerSource(e){const t=this.dataSourceForId(e);if(null!==t){const e=t.ownerSource();if(null!==e&&null!==e.firstValue())return e}const i=this.mainDataSource();if(null!==i&&null!==i.firstValue())return i;for(const e of this.dataSources())if((0,ne.isPriceDataSource)(e)&&null!==e.firstValue())return e;return null}realignLineTools(e){var t;let i=!1;for(const s of this.m_dataSources)!(0,y.isLineTool)(s)||void 0!==e&&(null===(t=null==s?void 0:s.ownerSource())||void 0===t?void 0:t.symbolSource())!==e&&(0,me.isActingAsSymbolSource)(e)||(s.realign(),s.updateAllViews((0,H.sourceChangeEvent)(s.id())),i=!0);return i&&this._invalidateSourcesCache(),i}startScalePrice(e,t){e.startScale(t)}scalePriceTo(e,t){e.scaleTo(t),this.updateAllViews((0,H.viewportChangeEvent)())}endScalePrice(e){e.endScale()}startScrollPrice(e,t){e.startScroll(t)}scrollPriceTo(e,t){e.scrollTo(t),this.updateAllViews((0,H.viewportChangeEvent)())}endScrollPrice(e){e.endScroll()}resetPriceScale(e){const t=this.timeScale().visibleBarsStrictRange();e.resetScaleAvailable().value()&&e.resetScale(),e.recalculatePriceRange(t),this.updateAllViews((0,H.viewportChangeEvent)())}resetPriceScalesAvailable(){return this._resetPriceScalesAvailable.readonly()}restorePriceScaleState(e,t){e.restoreState(t),this.updateAllViews((0,H.viewportChangeEvent)())}beginInsertManyLineDataSources(){this._isInInsertManyDataSourcesState=!0,this._lastLineDataSourceZOrder=null}endInsertManyLineDataSources(){this._isInInsertManyDataSourcesState=!1,this._lastLineDataSourceZOrder=null}removeSourceFromPriceScale(e){const t=e.priceScale();if(null!==t){ -const i=t.dataSources();i.indexOf(e)>=0&&t.removeDataSource(e),0===i.length&&this.removePriceScale(t)}}_invalidateSourcesCache(){this._cachedOrderedSources.clear(),this._leftPriceScales.forEach((e=>e.invalidateSourcesCache())),this._rightPriceScales.forEach((e=>e.invalidateSourcesCache()))}_processMainSourceChange(){let e=!1;if(null===this.m_mainDataSource)for(const t of this.m_dataSources)if((0,ne.isPriceDataSource)(t)&&!this.isOverlay(t)&&(!(0,G.isStudy)(t)||!t.isLinkedToSeries())){this.m_mainDataSource=t,e=!0;break}if(this.m_mainDataSource&&e){let e=this.m_dataSources.filter(y.isLineTool);e=(0,oe.sortSources)(e);for(const t of e)this.move(t,(0,n.ensureNotNull)(this.m_mainDataSource.priceScale()),!0)}else if(!this.m_mainDataSource||this.isOverlay(this.m_mainDataSource)&&0===this._nonOverlayPricesSourcesCount()){let e=null;if(this.m_dataSources.includes(this._model.mainSeries()))e=this._model.mainSeries();else for(const t of this.m_dataSources)if((0,ne.isPriceDataSource)(t)&&this.isOverlay(t)&&t.showInObjectTree()){e=t;break}if(null!==e){const t=this.m_mainDataSource===e;this.m_mainDataSource=e;const i=this.createNewPriceScaleIfPossible();if(t&&e===this._model.mainSeries()){const t=(0,n.ensureNotNull)(e.priceScale());this._model.children(e,!0).forEach((e=>{this.removeSourceFromPriceScale(e),i.addDataSource(e),e.setPriceScale(i)})),this.removePriceScale(t)}this.move(e,i,!0),this.recalculatePriceScale(e.priceScale(),(0,H.globalChangeEvent)())}}}_addSourceToCollections(e,t){this.m_dataSources.push(e),this._sourcesById.set(e.id(),e),this._invalidateSourcesCache();const i=()=>{this._sourcePropertiesChanged.fire(e)};e.properties().subscribe(this,i),e.zOrderChanged().subscribe(this,(t=>this._sourcesZOrderChanged.fire(e,t))),(0,y.isLineTool)(e)&&(e.normalizedPointsChanged().subscribe(this,i),e.fixedPointChanged().subscribe(this,i),e.hasAlert().subscribe(i),e.sharingMode().subscribe(i),e.linkKey().subscribe(i),this._sourceWatchedValuesSubscriptions.set(e.id(),i));const s=(0,me.isSymbolSource)(e)?e:null;(0,ne.isPriceDataSource)(e)&&(this._priceSourcesById.set(e.id(),e),e.currencyChanged().subscribe(this,(()=>this._invalidateSourcesCache())),e.unitChanged().subscribe(this,(()=>this._invalidateSourcesCache())),this._priceDataSources.push(e),this._onPriceSourcesCollectionChanged(),null!==s&&(this._symbolSources.push(s),s.symbolResolved().subscribe(this,(()=>this._symbolSourceResolved.fire(e))),s.symbolResolvingActive().subscribe(this._recalcSymbolSourceResolvingActive),s.symbolHibernated().subscribe(this._onSymbolSourceCollectionChanged),this._recalcSymbolSourceResolvingActive(),this._onSymbolSourceCollectionChanged())),e.isMultiPaneAvailable()&&this.model().addMultiPaneSource(e),t||0!==this._bulkActions.activeCounter||this._dataSourcesCollectionChanged.fire()}_removeSourceFromCollections(e,t){const i=this.m_dataSources[e];i.properties().unsubscribeAll(this),i.zOrderChanged().unsubscribeAll(this),this.m_dataSources.splice(e,1),this._sourcesById.delete(i.id());const s=i.id();if((0, -y.isLineTool)(i)&&(i.normalizedPointsChanged().unsubscribeAll(this),i.fixedPointChanged().unsubscribeAll(this),this._sourceWatchedValuesSubscriptions.has(s))){const e=this._sourceWatchedValuesSubscriptions.get(s);i.hasAlert().unsubscribe(e),i.linkKey().unsubscribe(e)}this._invalidateSourcesCache();const r=(0,me.isSymbolSource)(i)?i:null;(0,ne.isPriceDataSource)(i)&&(this._priceSourcesById.delete(i.id()),i.currencyChanged().unsubscribeAll(this),i.unitChanged().unsubscribeAll(this),(0,v.removeItemFromArray)(this._priceDataSources,i),this._onPriceSourcesCollectionChanged(),null!==r&&((0,v.removeItemFromArray)(this._symbolSources,r),r.symbolResolved().unsubscribeAll(this),r.symbolResolvingActive().unsubscribe(this._recalcSymbolSourceResolvingActive),r.symbolHibernated().unsubscribe(this._onSymbolSourceCollectionChanged),this._recalcSymbolSourceResolvingActive(),this._onSymbolSourceCollectionChanged())),i.isMultiPaneAvailable()&&this.model().removeMultiPaneSource(i),t||0!==this._bulkActions.activeCounter||this._dataSourcesCollectionChanged.fire()}_recalculatePriceScaleByScaleRatio(e){this.isMainPane()&&e===this._lockedPriceScale&&(null!==this._currentPriceScaleRatio?this._applyOldScaleRatioToPriceScale():this._tryToApplyNewPriceScaleRatio())}_defaultBottomMargin(){return.01*this.properties().childs().bottomMargin.value()}_defaultTopMargin(){return.01*this.properties().childs().topMargin.value()}_updateMargins(){const e=this._defaultTopMargin(),t=this._defaultBottomMargin();for(const i of this._leftPriceScales)Ke(i,e,t);for(const i of this._rightPriceScales)Ke(i,e,t);for(const i of this.m_dataSources)if(this.isOverlay(i)){const s=i.priceScale();null!==s&&(Ke(s,e,t),this.recalculatePriceScale(s,(0,H.viewportChangeEvent)()))}for(const e of this._leftPriceScales)this.recalculatePriceScale(e,(0,H.viewportChangeEvent)());for(const e of this._rightPriceScales)this.recalculatePriceScale(e,(0,H.viewportChangeEvent)());this.updateAllViews((0,H.viewportChangeEvent)())}_batchReorder(e,t,i){i(this.sourcesByGroup().allExceptSpecialSources(),e,t),this._invalidateSourcesCache(),this._dataSourcesCollectionChanged.fire(),this.model().fullUpdate()}_placePriceScale(e,t,i){if("overlay"===t)return void e.invalidateMargins();const s="left"===t?this._leftPriceScales:this._rightPriceScales,r=void 0===i?s.length:i;s.splice(r,0,e),e.modeChanged().subscribe(this,this._onPriceScaleModeChanged.bind(this,e)),e.internalHeightChanged().subscribe(this,this._recalculatePriceScaleByScaleRatio.bind(this,e)),e.priceRangeChanged().subscribe(this,this._recalculateTimeScaleByScaleRatio.bind(this,e)),e.priceRangeChanged().subscribe(this,this._onPriceScaleSetMinMaxPriceRange.bind(this,e)),e.isVisible().subscribe(this._onPriceScaleIsVisibleChanged),e.resetScaleAvailable().subscribe(this._updateResetPriceScalesAvailableValue),e.isLockScale()&&((0,n.assert)(null===this._lockedPriceScale),this._lockedPriceScale=e,this._currentPriceScaleRatio=null),e.invalidateMargins(),this._onPriceScalesChanged.fire(),this._updateResetPriceScalesAvailableValue()} -_onPriceScaleModeChanged(e,t,i){if(i.lockScale&&(this._lockedPriceScale!==e&&null!==this._lockedPriceScale&&this._lockedPriceScale.setMode({lockScale:!1}),this._lockedPriceScale=e,this._currentPriceScaleRatio=(0,ke.scaleRatio)(this.timeScale(),e)),t.lockScale&&!i.lockScale&&(this._lockedPriceScale=null,this._currentPriceScaleRatio=null),t.percentage===i.percentage&&t.indexedTo100===i.indexedTo100)return;const s=this.timeScale().visibleBarsStrictRange();null!==s&&(e.recalculatePriceRange(s),e.updateAllViews((0,H.viewportChangeEvent)()))}_applyOldScaleRatioToPriceScale(){this._isRecalculatingScales||null===this._currentPriceScaleRatio||null===this._lockedPriceScale||(this._isRecalculatingScales=!0,this._setNewPriceRangeByScaleRatio(this._lockedPriceScale,this._currentPriceScaleRatio,this._mainSourceVisiblePriceRange(this._lockedPriceScale)),this._isRecalculatingScales=!1)}_setNewPriceRangeByScaleRatio(e,t,i,s,r){const n=(0,ke.priceRangeByScaleRatio)(e,this.timeScale().barSpacing(),t);e.setPriceRange(null!==n?n:i,s,r)}_applyOldScaleRatioToTimeScale(){this._isRecalculatingScales||null===this._currentPriceScaleRatio||(this._isRecalculatingScales=!0,this._setNewBarSpacingByScaleRatio(),this._isRecalculatingScales=!1)}_tryToApplyNewPriceScaleRatio(){const e=(0,n.ensureNotNull)(this._lockedPriceScale),t=(0,ke.scaleRatio)(this.timeScale(),e);this._currentPriceScaleRatio===t||e.isLog()||(this._currentPriceScaleRatio=t,this.model().mainSeriesScaleRatioPropertyOnChanged())}_recalculateTimeScaleByScaleRatio(e){e===this._lockedPriceScale&&(null!==this._currentPriceScaleRatio?this._applyOldScaleRatioToTimeScale():this._tryToApplyNewPriceScaleRatio())}_setNewBarSpacingByScaleRatio(){const e=this.timeScale().getValidBarSpacing((0,ke.barSpacingByScaleRatio)((0,n.ensureNotNull)(this._lockedPriceScale),this._currentPriceScaleRatio));this.timeScale().isValidBarSpacing(e)&&this.timeScale().setBarSpacing(e)}_mainSourceVisiblePriceRange(e){const t=this.timeScale().visibleBarsStrictRange();return null!==t?(0,n.ensureNotNull)((0,n.ensureNotNull)(e.mainSource()).priceRange(t.firstBar(),t.lastBar())):new ue.PriceRange(-.5,.5)}_setMinMaxPriceRange(){const e=(0,n.ensureNotNull)(this._lockedPriceScale),t=(0,ke.priceRangeByScaleRatio)(e,this.timeScale().maxBarSpacing(),this._currentPriceScaleRatio),i=(0,ke.priceRangeByScaleRatio)(e,this.timeScale().minBarSpacing(),this._currentPriceScaleRatio);null!==t&&e.setMaxPriceRange(t),null!==i&&e.setMinPriceRange(i)}_onPriceScaleSetMinMaxPriceRange(e){e===this._lockedPriceScale&&this._setMinMaxPriceRange()}_onPriceSourcesCollectionChanged(){0===this._bulkActions.activeCounter?this._priceSourcesCollectionChanged.fire():this._bulkActions.priceSourcesCollectionChanged=!0}_nonOverlayPricesSourcesCount(){return this.m_dataSources.filter((e=>(!(0,G.isStudy)(e)||!e.isLinkedToSeries())&&((0,ne.isPriceDataSource)(e)&&e.showInObjectTree()&&!this.isOverlay(e)))).length}_restoreMainSeries(e,t,i,s,r,n){var o,a,l;const c=e.id,h=e.state;if(h&&r&&(h.style=null!==(o=r.style)&&void 0!==o?o:h.style, +return this._aboutToBeDestroyed}destroy(){this._aboutToBeDestroyed.fire(),null!==this._removeMaximizeHotkey&&(this._removeMaximizeHotkey(),this._removeMaximizeHotkey=null),0!==this._drawRafId&&this._parent.ownerDocument.defaultView.cancelAnimationFrame(this._drawRafId),null!==this._backgroundTopColorSpawn&&this._backgroundTopColorSpawn.destroy(),null!==this._backgroundBottomColorSpawn&&this._backgroundBottomColorSpawn.destroy(),null!==this._timingsMeter&&(this._timingsMeter.stopCollect(),this._timingsMeter=null);for(var e=0;e0;)for(var t=this._content.panes[e].sources,i=t.length;i-- >0;)if("MainSeries"===t[i].type)return t[i].state}updateUndoRedo(){this._model&&(this.actions().undo.update({disabled:this._model.undoHistory().undoStack().isEmpty()}),this.actions().redo.update({ +disabled:this._model.undoHistory().redoStack().isEmpty()}))}createSessionBreaksActions(){var e=new w({actionId:C.ChartSessionBreaksToggleVisibility,options:{label:i.tf(null,void 0,i(59827)),checkable:!0,statName:"ToggleSessionBreaks"}});e.binder=new a(e,this._model.chartModel().sessions().properties().graphics.vertlines.sessBreaks.visible,this.model(),me),this._actions.sessionBreaks=e}updateActionForIntradayOnly(e){e&&e instanceof w&&e.update({disabled:this.model().mainSeries().isDWM()})}containsVolume(){return this.model().dataSources().some((function(e){return e instanceof p&&"Volume"===e.metaInfo().shortId}))}containsStudyByPredicate(e){return!!this._model&&this._model.dataSources().some((function(t){if(!(t instanceof p))return!1;var i=t.metaInfo();return e(i)}))}containsStudy(e){return this.containsStudyByPredicate((function(t){return t.id===e||t.fullId===e}))}isSmall(){return this._width()<550||this._height()<300}onWidget(){return this._onWidget}onCmeWidget(){return"cme"===this.widgetCustomer()}widgetCustomer(){return this._widgetCustomer}resize(){var e=this._height()+"px",t=this._width()+"px";this._mainDiv.style.height=e,this._mainDiv.style.width=t,this._elMainTable.style.height=e,this._elMainTable.style.width=t,this._resizeHandler&&this._mainDiv&&this._resizeHandler()}applyOverrides(e){var t={};for(var i in e)i.startsWith("mainSeriesProperties.priceAxisProperties")||(t[i]=e[i]);if(applyPropertiesOverrides(this.properties(),null,!1,t,null),this._model){applyPropertiesOverrides(this._model.model().properties(),null,!1,t),applyPropertiesOverrides(this._model.mainSeries().properties(),null,!1,t,"mainSeriesProperties"),this._model.model().sessions().applyOverrides(t);const e=this._model.chartModel().watermarkSource();null!==e&&e.applyOverrides(t)}}applyStudiesOverrides(e){N.mergeDefaultsOverrides(e),this._applyStudiesOverrides()}setActive(e){this._isActive=e,F().isTouch&&(e&&0!==this.selectPointMode().value()?this.startTrackingMode():this.exitTrackingMode()),this._paneWidgets.forEach((function(e){e.update()})),e||this.model().selectionMacro((function(e){e.clearSelection()}))}isActive(){return this._isActive}showReplayOrderConfirmationDialog(){if(!this.model().isInReplay())return Promise.resolve()}_addPerfMark(e){G("ChartWidget."+this._id+"."+e)}getResizerDetacher(){return this._options}}},3162:(e,t,i)=>{"use strict";var s=i(50151).assert,r=i(75531).layouts,n=i(18687).createUndoHistory,o=i(88348),a=i(4741),l=i(68335),c=i(76422),h=i(14483),d=i(97145).WatchedValue,u=i(59224).getLogger("Chart.ChartWidgetCollection"),p=i(21861).preventDefaultForContextMenu,_=i(88732),m=i(13323).GeneralChartPropertiesRenderer,g=i(42120).CompareDialogRenderer,f=i(84015).isOnMobileAppPage,v=i(57898).Delegate;const{isSupportedLayout:y,tryGuessingTheMostSuitableLayout:S}=i(75531);var b,w=i(71026).AriaChartDescription;const C=i(36174).randomHash +;var P=i(55148),x=P.applyIndicatorsToAllChartsImpl,T=P.applyIndicatorToAllChartsImpl,I=P.lineToolsAndGroupsDTOsImpl,M=P.getStateForChartImpl,A=P.resetLineToolsInvalidatedImpl,L=P.applyLineToolUpdateNotificationImpl,k=P.createClipboardHandler,D=P.chartsSymbolsImpl,E=P.updateLayoutImpl,V=P.computeContentBoxImpl,B=(P.getVisuallyAdjacentDefImpl,P.setLayoutImpl),R=P.removeChartWidgetSubscriptionsImpl,N=P.generateNewChartId,O=P.syncCrosshairImpl,F=P.createBroadcastChannel,W=P.destroyBroadcastChannel,H=P.syncScrollImpl,z=P.allInitialModelsCreated,U=P.allInitialSymbolsResolved,j=P.applyThemeImpl,G=P.isFirstChartInLayout,q=P.deserializedChartIds,$=P.handleDateRangeLockChange,Y=P.handleInternalDateRangeLockChange,K=P.handleTrackTimeLockChange,Z=P.handleInternalTrackTimeLockChange,X=P.handleIntervalLockChange,J=P.handleInternalIntervalLockChange,Q=P.handleSymbolLockChange,ee=P.handleInternalSymbolLockChange,te=(P.handleConnectionLimitReachedChanged,P.createLeftBottomChartWidgetWV),ie=P.subscribeToEventsForDateRangeSync,se=P.unsubscribeFromEventsForDateRangeSync,re=P.syncChartsDateRangesWithActiveChartRange,ne=P.subscribeToCompletedEventForDateRangeUpdate,oe=P.resetLayoutSizesImpl,ae=P.unloadUnusedChartsImpl,le=new Map,ce={saveChartEnabled:!0,takeScreenshotEnabled:!0,publishedChartsEnabled:!0};e.exports=function(e){var t=this,he=Object.assign({},ce,e),de=new d,ue=he.readOnly||!1,pe=C(),_e=[],me=0,ge=new d,fe=new d,ve=new d,ye="s",Se=new d(null),be=new Map,we=new d([]),Ce=new d,Pe=[];const xe={isConfirmationAboutReplayLocked:!1,loadingChart:!1,setTimeFrameActive:!1,setNewResolution:!1};var Te=!1,Ie=!1,Me=new d(!1),Ae=new d(null),Le=new d(!1),ke=new d(!1);ke.subscribe((e=>Q(vt(),e)));var De=new d(ke.value());De.subscribe((e=>ee(vt(),e)));var Ee=new d(!1);Ee.subscribe((e=>X(vt(),e)));var Ve=new d(Ee.value());Ve.subscribe((e=>J(vt(),e)));var Be=new d(ye),Re=new d(!1);Re.subscribe((e=>K(vt(),e)));var Ne=P.combinedTrackTimeLock(Be,Re,_e);Re.subscribe((e=>K(vt(),e)));var Oe=new d(Ne.value());Oe.subscribe((e=>Z(vt(),e)));var Fe=new d(!1);Fe.subscribe((e=>$(vt(),e))),Se.subscribe(Ut);var We=new d(Fe.value());We.subscribe((e=>Y(vt(),e)));var He=new d(TVSettings.getBool("chart.syncCrosshair",!0)),ze=a.createGroup({desc:"Layout"}),Ue=null,je=null,Ge=null,qe=null;if(window.TVD){var $e=window.TVD.crosshairSyncEnabled;$e?($e.value()&&(Ge=F(vt)),qe=$e.subscribe((e=>{e?Ge=F(vt):(W(vt()),Ge=null)}))):Ge=F(vt)}var Ye=He.value();He.subscribe((function(e){Ye=e=!!e,TVSettings.setValue("chart.syncCrosshair",e);for(var t=0;t<_e.length;++t){var i=_e[t].chartWidget;i.hasModel()&&i.model().model().lightUpdate()}}));var Ke=he.resizerBridge.width,Ze=he.resizerBridge.height,Xe=new d(null),Je=new d(null);Xe.subscribe((e=>{Je.setValue(null===e?null:e.chartWidget)}));var Qe=he.widgetOptions||{},et=he.metaInfo||{},tt={id:new d(et.id||null),name:new d(et.name),description:new d(et.description),username:new d(et.username),uid:new d(et.uid),lastModified:new d(et.lastModified)},it=n();it.onChange().subscribe(null,(function(e){c.emit("undo_redo_state_changed",e)})) +;var st=he.resizerBridge.container.value();st.addEventListener("contextmenu",p);var rt,nt=new v,ot=new v,at=new v,lt=new d(!1),ct=new d(null),ht=null,dt=null;he.seriesControlBarEnabled&&(rt="0px",ct.setValue(document.createElement("div")),ct.value().style.left=rt,ct.value().style.right=rt,ct.value().style.bottom=rt,ct.value().classList.add("chart-toolbar","chart-controls-bar"),ct.value().setAttribute("data-is-chart-toolbar-component","true"),st.appendChild(ct.value()),Promise.all([i.e(2666),i.e(4015),i.e(3842),i.e(5145),i.e(6),i.e(5649),i.e(8056),i.e(5993),i.e(6639),i.e(6036),i.e(9916),i.e(6106),i.e(5166),i.e(1033),i.e(4987),i.e(962),i.e(2544),i.e(2052),i.e(7260)]).then(i.bind(i,33279)).then((({BottomToolbarRenderer:e})=>{var i=he.resizerBridge,s=[i.container.spawn(),i.width.spawn(),i.height.spawn()],r=i.container.value(),n=function(){var e=r.getBoundingClientRect(),t=V(vt());return t.top=e.top+t.top,t.left=e.left+t.left,t},o=new v,a=function(){o.fire()};s.forEach((function(e){e.subscribe(a)}));var l=function(){s.forEach((function(e){e.destroy()})),o.destroy()};ht=new e(ct.value(),o,n,t,ChartApiInstance,Qe,he.seriesControlBar),dt=function(){null!==ht&&(ht.destroy(),ht=null,ct.value().remove(),ct.setValue(null)),l()}})));var ut=new m(t),pt=new g(t);function _t(){lt.setValue(_e.some((e=>{const t=e.chartWidget.lineToolsSynchronizer();return null!==t&&t.hasChanges().value()})))}function mt(e){return P.checkProFeatureImpl(vt(),e)}Ae.subscribe((()=>Ct()));const gt=new Map,ft=()=>P.updateLinkingGroupCharts(vt());function vt(){return{undoHistory:it,chartWidgetsDefs:_e,chartsCountToSave:yt,actualLayoutCount:St,savedChartWidgetOptions:Pe,activeChartWidget:de,options:he,parent:st,toastsFactory:null,crosshairLockRaw:Ye,crossHairSyncBroadcast:Ge,setChartStorageNotificationSubscription:e=>{je=e},maximizedChartDef:Xe,setMaximized:Mt,layoutTemplate:ve,widthWV:Ke,heightWV:Ze,checkProFeature:mt,lineToolsSynchronizerHasChanges:lt,recalcHasChanges:_t,onZoom:ot,onScroll:at,layoutType:ye,layoutWV:Be,setLayoutType:e=>{ye=e},isPhoneSize:Me,viewMode:Ce,updateViewMode:Lt,loadingContent:Te,setLoadingContent:e=>{Te=e},initialLoading:Ie,inlineChartsCount:fe,updateWatchedValue:kt,checkAllPendingModelsAlreadyCreated:At,readOnly:ue,symbolLock:ke,internalSymbolLock:De,intervalLock:Ee,internalIntervalLock:Ve,dateRangeLock:We,internalDateRangeLock:We,trackTimeLock:Re,internalTrackTimeLock:Oe,crosshairLock:He,customLegendWidgetsFactoriesMap:Jt,globalDetachable:ge,saveChartService:Ue,customSources:Zt,updateActivityView:Dt,chartWidgetCreatedDelegate:nt,sizingState:Ae,currentLayoutResizeAction:Se,allLayoutSizesState:be,splitters:we,widgetOptions:Qe,bottomToolbar:ct,replayContainer:Xt,layoutSizesChanged:Le,subscribeToCompletedEventForDateRangeSync:(e,t)=>ne(vt(),e,t),subscribeToEventsForDateRangeSync:e=>ie(vt(),e),unsubscribeFromEventsForDateRangeSync:e=>se(vt(),e),syncChartsDateRangesWithActiveChartRange:e=>re(vt(),e),combinedTrackTimeLock:Ne,chartWidgetIdToCompletedCallbackMap:le,flags:xe,linkingGroupsCharts:gt,updateLinkingGroupCharts:ft}}function yt(){ +return St()}function St(){return r[ye].count}function bt(e,t,i,s,r){return M(vt(),e,t,i,s,r)}function wt(e){return e.value()?1:0}function Ct(){E(vt())}Ke.subscribe(Ct),Ze.subscribe(Ct),this.updateLayout=Ct;const Pt=P.activeLinkingGroupWV(de),xt=P.allLinkingGroupsWV(vt());function Tt(e){return e.rdState.owner.value()!==e}function It(e){return B(vt(),e,t)}function Mt(e){Xe.value()!==e&&(Xe.setValue(e),It(ye))}function At(){_e.every((e=>e.chartWidget.hasModel()))&&(kt(),c.emit("layout_changed"))}function Lt(){"s"===ye||Xe.value()?Ce.setValue(b.ForceFullscreen):Ce.setValue(b.Multichart)}function kt(){var e=Math.min(ve.value().count,_e.length)-1;if(e<0)de.deleteValue();else{var t=me;t<0&&(t=0),t>e&&(t=e),de.setValue(_e[t].chartWidget)}}function Dt(){for(var e=_e.length;e--;){var t=e===me;_e[e].container.value().classList.toggle("active",t),_e[e].container.value().classList.toggle("inactive",!t)}}function Et(e){{const t=ni().indexOf(e);w.getInstance().updateChartDescription(e,t,ye)}}function Vt(e){Et(de.value())}const Bt=new v;var Rt=new v,Nt=new d,Ot=new d([]),Ft=null;function Wt(e){var t=e.mainSeries().properties();t.style.subscribe(null,Ht),Ht(t.style),e.model().onSelectedSourceChanged().subscribe(null,zt),Fe.value()&&(ie(vt(),e),re(vt())),zt(e.selection().allSources())}function Ht(e){Nt.setValue(e.value())}function zt(){var e=Ft.model();Ot.setValue(e.selection().allSources())}function Ut(e){Fe.value()&&null===e&&re(vt())}de.subscribe((function(e){if(e){for(var t,i=_e.length;i--;)if(_e[i].chartWidget===e){t=i;break}if(!isFinite(t))throw new Error("Cannot make detached ChartWidget active");if(me!==t){Xe.value()&&(Tt(_e[t])||Xe.setValue(_e[t])),me=t,Dt();for(i=_e.length;i--;)_e[i].chartWidget!==e&&_e[i].chartWidget.setActive(!1);li(),e.setActive(!0),o.activePointSelectionMode.setValue(e.selectPointMode().value())}!function(e){if(Ft!==e){if(Ft&&(Ft.modelCreated().unsubscribe(null,Wt),Ft.hasModel())){var t=Ft.model();Fe.value()&&se(vt(),t),t.mainSeries().properties().style.unsubscribe(null,Ht),t.model().onSelectedSourceChanged().unsubscribe(null,zt),Ft=null}e&&(Ft=e,e.hasModel()?Wt(e.model()):e.modelCreated().subscribe(null,Wt))}}(e)}}),{callWithLast:!0});var jt=new v;function Gt(){he.resizerBridge.requestFullscreen()}function qt(){he.resizerBridge.exitFullscreen()}function $t(){return he.resizerBridge.fullscreenable}function Yt(){return he.resizerBridge.fullscreen}function Kt(e){if(0!==_e.length){for(var t=_e.length;t--;)_e[t].chartWidget.setActive(!1);_e[me].chartWidget.setActive(e)}}ue||(ze.add({desc:"Switch active chart",hotkey:h.enabled("accessible_keyboard_shortcuts")?l.Modifiers.Shift+39:9,handler:function(){Vt()}}),ze.add({desc:"Switch active chart",hotkey:h.enabled("accessible_keyboard_shortcuts")?l.Modifiers.Shift+37:l.Modifiers.Shift+9,handler:function(){Vt()}})),ze.add({desc:"Fullscreen mode",hotkey:l.Modifiers.Shift+70,isDisabled:h.enabled("widget")||!$t().value(),handler:function(){Yt().value()?qt():Gt()}}),he.takeScreenshotEnabled&&(ze.add({desc:"Screenshot server",hotkey:l.Modifiers.Alt+83, +handler:P.takeServerScreenshot.bind(this,he.snapshotUrl,t)}),f("any")||(ze.add({desc:"Download client screenshot",hotkey:l.Modifiers.Mod+l.Modifiers.Alt+83,handler:P.downloadScreenshot.bind(this,t)}),ze.add({desc:"Copy client screenshot",hotkey:l.Modifiers.Mod+l.Modifiers.Shift+83,handler:P.copyScreenshotToClipboard.bind(this,t)}))),he.saveChartEnabled&&ze.add({desc:"Save Chart Layout",hotkey:l.Modifiers.Mod+83,handler:function(){Rt.fire()}});var Zt=new Map,Xt=null,Jt=new Map;const Qt=k(vt());he.globalEvents&&Qt.listen();const ei=ke.spawn(),ti=Ee.spawn(),ii=Fe.spawn(),si=Re.spawn(),ri=He.spawn(),ni=()=>_e.map((e=>e.chartWidget)),oi=te(ni,Be.readonly(),Bt,nt);function ai(e,t){if(Te=!0,Ie=Boolean(t),Pe.splice(0),e){if(e.charts||(e={layout:"s",charts:[e]}),e.layoutsSizes)for(const t of Object.keys(e.layoutsSizes))be.set(t,e.layoutsSizes[t]);var i=new Set;e.charts.forEach((function(e){e.chartId&&i.add(e.chartId)})),e.charts.forEach((function(e){if(!e.chartId){var t=N((function(e){return i.has(e)}));i.add(t),e.chartId=t}}));let t=e.layout;if(!y(t)){const e=S(t);u.logError(`Loading unsupported layout ${t}. Force migration to ${e}`),t=e}ye=mt(t||"s");for(var s=0;sJe.readonly(),leftBottomChartWidget:()=>oi,activeLinkingGroup:()=>Pt,allLinkingGroups:()=>xt,linkingGroupsCharts:e=>P.getLinkingGroupCharts(vt(),e).readonly(),destroy:function(){if(jt.fire(),Kt(!1),null!==dt&&(dt(),dt=null),R(vt()),ei.destroy(),ti.destroy(),si.destroy(),ii.destroy(),Ne.destroy(),ri.destroy(),Se.unsubscribe(Ut),_e.forEach((function(e){void 0!==e.timingsMeter&&e.timingsMeter.destroy(),e.chartWidget.linkingGroupIndex().unsubscribe(ft),e.chartWidget.destroy()})),he.resizerBridge.remove(),we.value().forEach((e=>{e.mouseHandler.destroy(),e.mouseListener.destroy()})),window.removeEventListener("resize",Ct),o.tool.unsubscribe(li),o.tool.unsubscribe(ci),st.remove(),Zt.clear(),Jt.clear(),ze.destroy(),je&&je.destroy(),Qt&&Qt.destroy(),Pt.destroy(),xt.destroy(),window.TVD){const e=window.TVD.crosshairSyncEnabled;e&&e.unsubscribe(qe),W(vt())}oi.destroy(),!0},onAboutToBeDestroyed:jt,layout:Be.readonly(),setLayout:It,activeChartWidget:de,viewMode:Ce,activeChartStyle:Nt.readonly(),setChartStyleToWidget:P.setChartStyleToWidget.bind(this),selectedSources:Ot.readonly(),metaInfo:tt,state:function(e,i,s,r){ +for(var n=[],o=yt(),a=0;a{c.layoutsSizes[t]=e})),c},lineToolsAndGroupsDTOs:function(){return I(vt())},resetLineToolsInvalidated:function(e,t){return A(vt(),e,t)},applyLineToolUpdateNotification:L.bind(null,_e),readOnly:function(){return ue},onZoom:function(){return ot},onScroll:function(){return at},resizerBridge:function(){return he.resizerBridge},lock:{symbol:ei,interval:ti,dateRange:ii,crosshair:ri,trackTime:si},setSymbol:(e,t)=>P.setSymbol(vt(),e,t),setSymbolAll:(e,t)=>P.setSymbolAll(vt(),e,t),setResolution:(e,t,i)=>P.setResolution(vt(),e,t,i),setTimeFrame:function(e){xe.loadingChart||xe.setTimeFrameActive||(xe.setTimeFrameActive=!0,Ee.value()?_e.forEach((function(t){t.chartWidget.loadRange(e)})):de.value().loadRange(e),xe.setTimeFrameActive=!1)},updateLayout:Ct,setChartLayoutWithUndo:function(e){return P.setChartLayoutWithUndoImpl(vt(),this,e)},images:P.getSnapshot.bind(this,this,he.widgetOptions.customerReadableName,Qe.onWidget),clientSnapshot:P.getClientSnapshot.bind(this,this,he.widgetOptions.customerReadableName,Qe.onWidget),tags:function(){for(var e=[],t=0;t<_e.length&&tO(vt(),e,t,i,s),syncScroll:function(e,t){return H(vt(),e,t)},clearChartMetaInfo:function(){tt.id.setValue(null),tt.uid.setValue(void 0),tt.name.setValue(void 0)},takeScreenshot:P.takeScreenshot.bind(this,he.snapshotUrl,this),takeServerScreenshot:P.takeServerScreenshot.bind(this,he.snapshotUrl,this),loadContent:ai,purgeUnusedWidgets:function(){for(var e=r[ye].count;e<_e.length;e++)_e[e].chartWidget.destroy();_e.splice(r[ye].count)},applyOverrides:function(e){for(var t=0;t<_e.length;t++)_e[t].chartWidget.applyOverrides(e)},applyStudiesOverrides:function(e){for(var t=0;t<_e.length;t++)_e[t].chartWidget.applyStudiesOverrides(e)},switchChart:Vt,startFullscreen:Gt,exitFullscreen:qt,fullscreen:Yt,fullscreenable:$t,chartWidgetCreated:function(){return nt},saveKeysPressed:function(){return Rt},getContainer:function(){return st},onWidget:Qe.onWidget,applyTheme:function(e){return j(vt(),t,e)},applyIndicatorsToAllCharts:function(e){x(vt(),e)},applyIndicatorsToAllChartsAvailable:function(){return!ue&&St()>1},applyIndicatorToAllCharts:async function(e,t,i,s){await T(vt(),e,t,i,s)},setActive:Kt,inlineChartsCount:fe.readonly(),revertToInline:function(){Mt(null);for(var e=0;e<_e.length;e++)_e[e].rdState.bridge().attach()},chartMarketStatuses:function(){return _e.map((function(e){return"-"}))},chartSeriesStatuses:function(){return _e.map((function(e){var t=e.chartWidget.hasModel()?e.chartWidget.model().mainSeries().status():null;return(null===t?"":_.SERIES_STATUS_TEXT[t])+" ("+t+")"}))}, +undoHistory:it,lineToolsSynchronizerHasChanges:lt,applyPreferencesToAllCharts:function(e){},getToasts:function(){return Promise.resolve(null)},addCustomSource:function(e,t,i){s(!Zt.has(e),"Cannot create the same custom source multiple times"),Zt.set(e,{factory:t,layer:i});for(var r=0;r<_e.length;++r){var n=_e[r].chartWidget;n.hasModel()&&n.model().model().addCustomSource(e,t,i)}},removeCustomSource:function(e){s(Zt.has(e),"Cannot remove not created custom source"),Zt.delete(e);for(var t=0;t<_e.length;++t){var i=_e[t].chartWidget;i.hasModel()&&i.model().model().removeCustomSource(e)}},addCustomWidgetToLegend:function(e,t){s(!Jt.has(e),"Cannot create the same custom widget in legend multiple times"),Jt.set(e,t);for(var i=0;i<_e.length;++i)_e[i].chartWidget.addCustomWidgetToLegend(e,t)},addReplayWidget:function(e){s(null===Xt,"Cannot create replay container multiple times"),(Xt=document.createElement("div")).style.position="absolute",Xt.style["min-height"]="51px",Xt.style.overflow="hidden",Xt.style.left="0px",Xt.style.right="0px";var t=null===ct.value()?0:ct.value().offsetHeight;Xt.style.bottom=`${t}px`,Xt.setAttribute("data-is-chart-toolbar-component","true"),st.prepend(Xt),e(Xt,(()=>Ct())),Ct()},destroyReplayWidget:function(){s(null!==Xt,"Cannot remove replay container, container is not created"),Xt.remove(),Xt=null,Ct()},setViewMode:function(e){Ce.setValue(e)},moveActiveChartWithUndo:function(e){},activeChartCanBeMoved:function(){return!1},generalPropertiesDefinitions:function(){return de.value().generalPropertiesDefinitions()},reconnectChartApi:function(e){undefined(e)},setBroker:function(e){0},setSaveChartService:function(e){Ue=e;for(var t=0;t<_e.length;++t){_e[t].chartWidget.setSaveChartService(e)}},getCompareDialogRenderer:function(){return pt},getChartPropertiesDialogRenderer:function(){return ut},clipboard:Qt,chartsSymbols:function(){return D(vt())},isFirstChartInLayout:G.bind(null,vt()),deserializedChartIds:q.bind(null,vt()),resetLayoutSizes:oe.bind(null,vt()),unloadUnusedCharts:ae.bind(null,vt()),layoutSizesChanged:()=>Le,clientId:pe,ariaDescribeChart:Et}),ai(he.content,!0),Be.subscribe((function(){Dt()})),Be.hook=function(e){return e===this.value()?e:mt(e)},ue&&(Be.writeLock=!0),window.addEventListener("resize",Ct);var hi=0;function di(){0===--hi&&c.emitOnce("onChartReady")}_e.forEach((function(e){if(e){hi++;var t=e.chartWidget;t.withModel(null,(function(){he.metaInfo&&t.model().model().setChartSaveTime(1e3*he.metaInfo.lastModified);var e=t.model().mainSeries();if(e.bars().size()>0||e.isFailed())di();else{var i=e.dataEvents(),s=function(){di(),i.barReceived().unsubscribe(null,s),i.completed().unsubscribe(null,s),i.error().unsubscribe(null,s)};i.barReceived().subscribe(null,s),i.completed().subscribe(null,s),i.error().subscribe(null,s)}}))}})),z(vt()).then(U).then((function(){window.saver&&window.is_authenticated&&he.widgetOptions.justCloned&&window.saver.saveChartSilently()})).catch(u.logError.bind(u))}},10643:(e,t,i)=>{"use strict";i.d(t,{ContextMenuManager:()=>s});var s,r=i(78071),n=i(39347),o=i(59064) +;!function(e){let t=null,s=null;const a=[],l={createAction:e=>new n.Action({actionId:"Chart.CustomActionId",options:e}),createAsyncAction:e=>new n.Action({actionId:"Chart.CustomActionId",options:{},optionsLoader:e}),createSeparator:()=>new n.Separator};async function c(e,n={},o={menuName:""},c){null!==t&&(e=await t(e,l,o));let d=null;const u=()=>{const e=(0,r.indexOf)(a,(e=>e.renderer===d));-1!==e&&a.splice(e,1),void 0!==c&&c()};let p=!1;if(null!==s&&(d=await s(e,o,u)),d)p=!0,h();else{const t=await Promise.all([i.e(3842),i.e(5649),i.e(3502),i.e(6752),i.e(8149),i.e(6639),i.e(9916),i.e(6985),i.e(962),i.e(2544),i.e(5128),i.e(1584)]).then(i.bind(i,20323));d=new t.ContextMenuRenderer(e,n,u,h)}return a.push({renderer:d,isExternal:p}),d}function h(){(0,o.globalCloseMenu)(),a.forEach((e=>{e.isExternal&&e.renderer.isShown()&&e.renderer.hide()}))}e.createMenu=c,e.showMenu=function(e,t,i={},s,r){return c(e,i,s,r).then((e=>e.show(t)))},e.setCustomRendererFactory=function(e){s=e},e.setCustomItemsProcessor=function(e){t=e},e.hideAll=h,e.getShown=function(){for(let e=0;e{"use strict";i.d(t,{createSymbolSearchAction:()=>a});var s=i(11542),r=i(39347),n=i(53180),o=i(82723);i(14483);function a(){return new r.Action({actionId:"Chart.Dialogs.ShowChangeSymbol",options:{label:(0,n.appendEllipsis)(s.t(null,void 0,i(28089))),statName:"ChangeSymbol",onExecute:()=>{(0,o.showDialog)({defaultValue:"",trackResultsOptions:{trackResults:!1,emptySearchType:"empty_result__supercharts"}})}}})}},85067:(e,t,i)=>{"use strict";i.d(t,{DialogRenderer:()=>r});var s=i(97145);class r{constructor(){this._container=document.createElement("div"),this._visibility=new s.WatchedValue(!1)}visible(){return this._visibility.readonly()}_setVisibility(e){this._visibility.setValue(e)}}},14787:(e,t,i)=>{"use strict";var s;i.d(t,{TabNames:()=>s}),function(e){e.background="Background",e.coordinates="Coordinates",e.drawings="Drawings",e.events="Events",e.eventsAndAlerts="Events & Alerts",e.inputs="Inputs",e.properties="Properties",e.scales="Scales",e.legend="Legend",e.sourceCode="Source Code",e.style="Style",e.symbol="Symbol",e.timezoneSessions="Timezone/Sessions",e.trading="Trading",e.visibility="Visibility",e.text="Text"}(s||(s={}))},241:(e,t,i)=>{"use strict";i.d(t,{createFavoriteDrawingToolbar:()=>a,getFavoriteDrawingToolbarPromise:()=>o});var s=i(69774);let r=null,n=null;function o(){return n}function a(){null===n&&(n=Promise.all([i.e(9417),i.e(2666),i.e(4015),i.e(3842),i.e(6),i.e(5649),i.e(8056),i.e(5993),i.e(2191),i.e(3502),i.e(6752),i.e(8149),i.e(6639),i.e(9327),i.e(9916),i.e(6106),i.e(6985),i.e(1109),i.e(4788),i.e(962),i.e(2544),i.e(1890),i.e(2052),i.e(5128),i.e(2306)]).then(i.bind(i,9629)).then((({FavoriteDrawingToolbar:e})=>(r=null!==r?r:new e({left:window.innerWidth/2,top:s.HEADER_TOOLBAR_HEIGHT_EXPANDED+61}),r))))}},31964:(e,t,i)=>{"use strict";function s(e){var t,i +;return Math.max(1,(null===(i=null===(t=e.ownerDocument)||void 0===t?void 0:t.defaultView)||void 0===i?void 0:i.devicePixelRatio)||1)}i.d(t,{getCanvasDevicePixelRatio:()=>s})},10688:(e,t,i)=>{"use strict";i.d(t,{getPriceAxisNameInfo:()=>o});const s=["Z","Y","X","W","V","U","T","S"],r=["A","B","C","D","E","F","G","H"];class n{constructor(e){this.label=e}equals(e){return null!==e&&this.label===e.label}}function o(e,t){const i="left"===e?s:r;return new n(t{"use strict";i.d(t,{CHART_WIDGET_COLLECTION_SERVICE:()=>s});i(16216);const s={id:"ChartWidgetCollectionService"};var r;!function(e){e.Multichart="multichart",e.ForceFullscreen="force-fullscreen"}(r||(r={}))},91280:(e,t,i)=>{"use strict";i.d(t,{InvalidationLevel:()=>s,InvalidationMask:()=>a,defaultInvalidationLevel:()=>o});var s,r=i(50151);class n{constructor(e=o){this._paneInvalidationLevel=o,this._leftPriceScalesInvalidationMap=new Map,this._rightPriceScalesInvalidationMap=new Map,this._legendWidgetInvalidated=!1,this._invalidationLevel=e}fullInvalidation(){return this._invalidationLevel}invalidateAll(e){this._invalidationLevel=Math.max(this._invalidationLevel,e)}invalidatePane(e){this._paneInvalidationLevel=Math.max(this._invalidationLevel,e)}invalidateLegendWidgetLayout(){this._legendWidgetInvalidated=!0}invalidatePriceScale(e,t,i){const s="left"===e?this._leftPriceScalesInvalidationMap:this._rightPriceScalesInvalidationMap,r=s.get(t)||o;s.set(t,Math.max(r,i))}invalidationLevelForPane(){return Math.max(this._paneInvalidationLevel,this._invalidationLevel)}legendWidgetLayoutInvalidated(){return this._legendWidgetInvalidated||this._invalidationLevel===s.Full}getterForPriceScaleInvalidationLevelBySide(e){const t="left"===e?this._leftPriceScalesInvalidationMap:this._rightPriceScalesInvalidationMap;return e=>Math.max(t.get(e)||o,this._invalidationLevel)}priceScaleSideMaxLevel(e){const t="left"===e?this._leftPriceScalesInvalidationMap:this._rightPriceScalesInvalidationMap;let i=this._invalidationLevel;return t.size>0&&t.forEach((e=>{e>i&&(i=e)})),i}merge(e){this._invalidationLevel=Math.max(this._invalidationLevel,e._invalidationLevel),this._paneInvalidationLevel=Math.max(this._paneInvalidationLevel,e._paneInvalidationLevel),e._leftPriceScalesInvalidationMap.forEach(((e,t)=>{const i=this._leftPriceScalesInvalidationMap.get(t)||o;this._leftPriceScalesInvalidationMap.set(t,Math.max(i,e))})),e._rightPriceScalesInvalidationMap.forEach(((e,t)=>{const i=this._rightPriceScalesInvalidationMap.get(t)||o;this._rightPriceScalesInvalidationMap.set(t,Math.max(i,e))})),this._legendWidgetInvalidated=this._legendWidgetInvalidated||e._legendWidgetInvalidated}}!function(e){e[e.None=0]="None",e[e.Cursor=1]="Cursor",e[e.Light=2]="Light",e[e.Full=3]="Full"}(s||(s={}));const o=s.None;class a{constructor(e=o){this._panesOrderChanged=!1,this._keepVisibleTimeRangeOnResize=!1,this._timeAxisInvalidationLevel=o,this._invalidatedPanes=new Map,this._additionalActions=[],this._timeScaleInvalidations=[],this._invalidationLevel=e}invalidateAll(e){ +this._invalidationLevel!==e&&(this._invalidationLevel=Math.max(this._invalidationLevel,e),this._invalidatedPanes.forEach((e=>{e.invalidateAll(this._invalidationLevel)})))}invalidateAllPane(e,t){this._invalidatedPanes.has(e)||this._invalidatedPanes.set(e,new n(this._invalidationLevel)),(0,r.ensureDefined)(this._invalidatedPanes.get(e)).invalidateAll(t)}invalidatePriceScale(e,t,i,s){this._invalidatedPanes.has(e)||this._invalidatedPanes.set(e,new n(this._invalidationLevel)),(0,r.ensureDefined)(this._invalidatedPanes.get(e)).invalidatePriceScale(t,i,s)}invalidateTimeScale(e){this._timeAxisInvalidationLevel=Math.max(this._timeAxisInvalidationLevel,e)}invalidatePanesOrder(){this._panesOrderChanged=!0}lockVisibleTimeRangeOnResize(){this._keepVisibleTimeRangeOnResize=!0}fullInvalidation(){return this._invalidationLevel}maxPaneInvalidation(){const e=[];return this._invalidatedPanes.forEach((t=>{e.push(t.fullInvalidation())})),Math.max(...e,this._invalidationLevel)}invalidateForPane(e){return this._invalidatedPanes.get(e)||new n(this._invalidationLevel)}invalidateForTimeScale(){return Math.max(this._timeAxisInvalidationLevel,this._invalidationLevel)}validationActions(){return this._additionalActions}addValidationAction(e){this._additionalActions.push(e)}merge(e){this._invalidationLevel=Math.max(this._invalidationLevel,e._invalidationLevel),this._panesOrderChanged=this._panesOrderChanged||e._panesOrderChanged,this._keepVisibleTimeRangeOnResize=this._keepVisibleTimeRangeOnResize||e._keepVisibleTimeRangeOnResize,this._invalidatedPanes.forEach((e=>{e.invalidateAll(this._invalidationLevel)})),e._invalidatedPanes.forEach(((e,t)=>{this._invalidatedPanes.has(t)||this._invalidatedPanes.set(t,new n(this._invalidationLevel)),(0,r.ensureDefined)(this._invalidatedPanes.get(t)).merge(e)})),this._timeAxisInvalidationLevel=Math.max(this._timeAxisInvalidationLevel,e._timeAxisInvalidationLevel);for(let t=0;t0===e.type));if(-1!==i){const[s]=this._timeScaleInvalidations.splice(i,1);null===(t=(e=s.value).onFinish)||void 0===t||t.call(e,!1)}}}},38325:(e,t,i)=>{"use strict";i.d(t,{lastMouseOrTouchEventInfo:()=>r,setLastMouseOrTouchEventInfo:()=>n});let s=(0,i(49483).supportTouch)()?{isTouch:!0,stylus:!1}:{isTouch:!1};function r(){return s}function n(e){s=e.isTouch?{isTouch:!0,stylus:e.stylus}:{isTouch:!1}}},26097:(e,t,i)=>{"use strict";i.d(t,{layoutInitialSizingState:()=>n});var s=i(3308);i(50151);function r(e){return e.map((t=>{if((0,s.default)(t))return{percent:1/e.length};{const i=t.slice(1);return{percent:1/e.length,substate:r(i)}}}))}function n(e){return r(e.slice(1))}},75531:(e,t,i)=>{"use strict";i.r(t),i.d(t,{isMultipleLayout:()=>o,isSingleLayout:()=>n,isSupportedLayout:()=>a,layouts:()=>r,tryGuessingTheMostSuitableLayout:()=>l});i(34976),i(26097);let s;s={};const r={...{s:{title:"1 chart",count:1,layoutType:"s",sizer:(e,t)=>{if(0!==t)throw new RangeError("invalid index");return e},splitters:()=>[],resizeApplier:(e,t,i,s,r)=>r,syncSublayoutsBySplitter:(e,t)=>t,expression:["h",0]}},...s};function n(e){return"s"===e}function o(e){return!n(e)}function a(e){return n(e)||s.hasOwnProperty(e)}function l(e){return"s"}},72414:(e,t,i)=>{"use strict";i.d(t,{LineToolsGroupControllerApi:()=>o});var s=i(98517),r=i(50151),n=i(92249);class o{constructor(e,t){this._controller=e,this._model=t}createGroupFromSelection(){return this._controller.createGroupFromSelection().id}removeGroup(e){const t=(0,r.ensureDefined)(this._groupById(e));this._controller.removeGroup(t)}groups(){return this._controller.groups().map((e=>e.id))}shapesInGroup(e){const t=(0,r.ensureDefined)(this._groupById(e));return(0,s.sortSources)(t.lineTools()).map((e=>e.id()))}excludeShapeFromGroup(e,t){const i=(0,r.ensureDefined)(this._groupById(e)),s=(0,r.ensureNotNull)(this._model.dataSourceForId(t));(0,r.assert)((0,n.isLineTool)(s),"Passed shapeId is not a line tool"),this._controller.excludeLineToolFromGroup(i,s)}addShapeToGroup(e,t){const i=(0,r.ensureDefined)(this._groupById(e)),s=(0,r.ensureNotNull)(this._model.dataSourceForId(t));(0,r.assert)((0,n.isLineTool)(s),"Passed shapeId is not a line tool"),this._controller.addLineToolToGroup(i,s)}availableZOrderOperations(e){const t=(0,r.ensureDefined)(this._groupById(e));return this._controller.availableZOrderOperations(t)}bringToFront(e){const t=(0,r.ensureDefined)(this._groupById(e));this._controller.bringToFront(t)}bringForward(e){const t=(0,r.ensureDefined)(this._groupById(e));this._controller.bringForward(t)}sendBackward(e){const t=(0,r.ensureDefined)(this._groupById(e));this._controller.sendBackward(t)}sendToBack(e){const t=(0,r.ensureDefined)(this._groupById(e));this._controller.sendToBack(t)}insertAfter(e,t){const i=(0,r.ensureDefined)(this._groupById(e)),s=(0,r.ensureNotNull)(this._groupById(t)||this._model.dataSourceForId(t));this._controller.insertAfter(i,s)}insertBefore(e,t){const i=(0, +r.ensureDefined)(this._groupById(e)),s=(0,r.ensureNotNull)(this._groupById(t)||this._model.dataSourceForId(t));this._controller.insertBefore(i,s)}groupVisibility(e){return(0,r.ensureDefined)(this._groupById(e)).visibility()}setGroupVisibility(e,t){const i=(0,r.ensureDefined)(this._groupById(e));this._controller.setGroupVisibility(i,t)}groupLock(e){return(0,r.ensureDefined)(this._groupById(e)).locked()}setGroupLock(e,t){const i=(0,r.ensureDefined)(this._groupById(e));this._controller.setGroupLock(i,t)}getGroupName(e){return(0,r.ensureDefined)(this._groupById(e)).name().value()}setGroupName(e,t){const i=(0,r.ensureDefined)(this._groupById(e));this._controller.setGroupName(i,t)}canBeGroupped(e){const t=e.map((e=>(0,r.ensureNotNull)(this._model.dataSourceForId(e))));return!t.some((e=>!(0,n.isLineTool)(e)))&&this._controller.canBeGroupped(t)}_groupById(e){return this._controller.groups().find((t=>t.id===e))}}},86972:(e,t,i)=>{"use strict";i.d(t,{lineToolsSelectHotkeys:()=>r});i(42053);var s=i(68335);const r={LineToolFibRetracement:{hash:s.Modifiers.Alt+70,action:"setTool",description:"Draw Fib Retracement"},LineToolHorzLine:{hash:s.Modifiers.Alt+72,action:"drawRightThere",description:"Draw Horizontal Line here"},LineToolHorzRay:{hash:s.Modifiers.Alt+74,action:"drawRightThere",description:"Draw Horizontal Ray here"},LineToolRectangle:{hash:s.Modifiers.Alt+s.Modifiers.Shift+82,action:"setTool",description:"Draw Rectangle"},LineToolTrendLine:{hash:s.Modifiers.Alt+84,action:"setTool",description:"Draw Trend Line"},LineToolVertLine:{hash:s.Modifiers.Alt+86,action:"drawRightThere",description:"Draw Vertical Line here"},LineToolCrossLine:{hash:s.Modifiers.Alt+67,action:"drawRightThere",description:"Draw Cross Line here"}}},42184:(e,t,i)=>{"use strict";i.d(t,{MouseEventHandler:()=>u,defaultPreventedHandler:()=>h});var s=i(49483),r=i(50151),n=i(1722),o=i(80007),a=i(38325);const l=s.isSafari?"click":"auxclick",c={treatVertTouchDragAsPageScroll:!1,treatHorzTouchDragAsPageScroll:!1,ignoreClickAndTapOnDblClickOrDblTap:!1};function h(e){return t=>{t.preventDefault(),e(t)}}function d(e){let t=!1;return{clickOrTap:i=>{t=!1,setTimeout((()=>!t&&e.clickOrTap(i)),501)},doubleClickOrDoubleTap:i=>{var s;t=!0,null===(s=e.doubleClickOrDoubleTap)||void 0===s||s.call(e,i)}}}class u{constructor(e,t,i){if(this._clickCount=0,this._clickTimeoutId=null,this._clickPosition={x:Number.NEGATIVE_INFINITY,y:Number.POSITIVE_INFINITY},this._tapCount=0,this._tapTimeoutId=null,this._tapPosition={x:Number.NEGATIVE_INFINITY,y:Number.POSITIVE_INFINITY},this._longTapTimeoutId=null,this._longTapActive=!1,this._mouseMoveStartPosition=null,this._touchMoveStartPosition=null,this._touchMoveExceededManhattanDistance=!1,this._cancelClick=!1,this._cancelTap=!1,this._unsubscribeOutsideMouseEvents=null,this._unsubscribeOutsideTouchEvents=null,this._unsubscribeMobileSafariEvents=null,this._unsubscribeMousemove=null,this._unsubscribeRootMouseEvents=null,this._unsubscribeRootTouchEvents=null,this._pinchInfo=null,this._pinchPrevented=!1,this._preventTouchDragProcess=!1, +this._mousePressed=!1,this._lastTouchEventTimeStamp=0,this._activeTouchId=null,this._acceptMouseLeave=!s.CheckMobile.iOS(),this._onFirefoxOutsideMouseUp=e=>{this._mouseUpHandler(e)},this._onMobileSafariDoubleClick=e=>{if(this._firesTouchEvents(e)){const t=this._makeCompatEvent(e);if(++this._tapCount,this._tapTimeoutId&&this._tapCount>1){const{manhattanDistance:i}=this._touchMouseMoveWithDownInfo(_(e),this._tapPosition);i<30&&!this._cancelTap&&this._processTouchEvent(t,this._handlers.doubleTapEvent),this._resetTapTimeout()}}else{const t=this._makeCompatEvent(e);if(++this._clickCount,this._clickTimeoutId&&this._clickCount>1){const{manhattanDistance:i}=this._touchMouseMoveWithDownInfo(_(e),this._clickPosition);i<5&&!this._cancelClick&&this._processMouseEvent(t,this._handlers.mouseDoubleClickEvent),this._resetClickTimeout()}}},this._target=e,this._options=(0,n.merge)((0,n.clone)(c),i||{}),this._options.ignoreClickAndTapOnDblClickOrDblTap){const{mouseClickEvent:e,mouseDoubleClickEvent:i,tapEvent:s,doubleTapEvent:r}=t;if(e){const s=d({clickOrTap:e,doubleClickOrDoubleTap:i});t.mouseClickEvent=s.clickOrTap,t.mouseDoubleClickEvent=s.doubleClickOrDoubleTap}if(s){const e=d({clickOrTap:s,doubleClickOrDoubleTap:r});t.tapEvent=e.clickOrTap,t.doubleTapEvent=e.doubleClickOrDoubleTap}}this._handlers=t,this._init()}destroy(){null!==this._unsubscribeOutsideMouseEvents&&(this._unsubscribeOutsideMouseEvents(),this._unsubscribeOutsideMouseEvents=null),null!==this._unsubscribeOutsideTouchEvents&&(this._unsubscribeOutsideTouchEvents(),this._unsubscribeOutsideTouchEvents=null),null!==this._unsubscribeMousemove&&(this._unsubscribeMousemove(),this._unsubscribeMousemove=null),null!==this._unsubscribeRootMouseEvents&&(this._unsubscribeRootMouseEvents(),this._unsubscribeRootMouseEvents=null),null!==this._unsubscribeRootTouchEvents&&(this._unsubscribeRootTouchEvents(),this._unsubscribeRootTouchEvents=null),null!==this._unsubscribeMobileSafariEvents&&(this._unsubscribeMobileSafariEvents(),this._unsubscribeMobileSafariEvents=null),this._clearLongTapTimeout(),this._resetClickTimeout()}_mouseEnterHandler(e){this._unsubscribeMousemove&&this._unsubscribeMousemove();const t=this._mouseMoveHandler.bind(this);if(this._unsubscribeMousemove=()=>{this._target.removeEventListener("mousemove",t)},this._target.addEventListener("mousemove",t),this._firesTouchEvents(e))return;const i=this._makeCompatEvent(e);this._processMouseEvent(i,this._handlers.mouseEnterEvent),this._acceptMouseLeave=!0}_resetClickTimeout(){null!==this._clickTimeoutId&&clearTimeout(this._clickTimeoutId),this._clickCount=0,this._clickTimeoutId=null,this._clickPosition={x:Number.NEGATIVE_INFINITY,y:Number.POSITIVE_INFINITY}}_resetTapTimeout(){null!==this._tapTimeoutId&&clearTimeout(this._tapTimeoutId),this._tapCount=0,this._tapTimeoutId=null,this._tapPosition={x:Number.NEGATIVE_INFINITY,y:Number.POSITIVE_INFINITY}}_mouseMoveHandler(e){if(this._mousePressed||null!==this._touchMoveStartPosition)return;if(this._firesTouchEvents(e))return;const t=this._makeCompatEvent(e) +;this._processMouseEvent(t,this._handlers.mouseMoveEvent),this._acceptMouseLeave=!0}_touchMoveHandler(e){const t=f(e.changedTouches,(0,r.ensureNotNull)(this._activeTouchId));if(null===t)return;if(this._lastTouchEventTimeStamp=g(e),null!==this._pinchInfo)return;if(this._preventTouchDragProcess)return;this._pinchPrevented=!0;const i=this._touchMouseMoveWithDownInfo(_(t),(0,r.ensureNotNull)(this._touchMoveStartPosition)),{xOffset:s,yOffset:n,manhattanDistance:a}=i;if(this._touchMoveExceededManhattanDistance||!(a<5)){if(!this._touchMoveExceededManhattanDistance){const e=.5*s,t=n>=e&&!this._options.treatVertTouchDragAsPageScroll,i=e>n&&!this._options.treatHorzTouchDragAsPageScroll;t||i||(this._preventTouchDragProcess=!0),this._touchMoveExceededManhattanDistance=!0,this._cancelTap=!0,this._clearLongTapTimeout(),this._resetTapTimeout()}if(!this._preventTouchDragProcess){const i=this._makeCompatEvent(e,t);this._processTouchEvent(i,this._handlers.touchMoveEvent),(0,o.preventDefault)(e)}}}_mouseMoveWithDownHandler(e){if(0!==e.button)return;const t=this._touchMouseMoveWithDownInfo(_(e),(0,r.ensureNotNull)(this._mouseMoveStartPosition)),{manhattanDistance:i}=t;if(i>=5&&(this._cancelClick=!0,this._resetClickTimeout()),this._cancelClick){const t=this._makeCompatEvent(e);this._processMouseEvent(t,this._handlers.pressedMouseMoveEvent)}}_touchMouseMoveWithDownInfo(e,t){const i=Math.abs(t.x-e.x),s=Math.abs(t.y-e.y);return{xOffset:i,yOffset:s,manhattanDistance:i+s}}_touchEndHandler(e){let t=f(e.changedTouches,(0,r.ensureNotNull)(this._activeTouchId));if(null===t&&0===e.touches.length&&(t=e.changedTouches[0]),null===t)return;this._activeTouchId=null,this._lastTouchEventTimeStamp=g(e),this._clearLongTapTimeout(),this._touchMoveStartPosition=null,this._unsubscribeRootTouchEvents&&(this._unsubscribeRootTouchEvents(),this._unsubscribeRootTouchEvents=null);const i=this._makeCompatEvent(e,t);if(this._processTouchEvent(i,this._handlers.touchEndEvent),++this._tapCount,this._tapTimeoutId&&this._tapCount>1){const{manhattanDistance:e}=this._touchMouseMoveWithDownInfo(_(t),this._tapPosition);e<30&&!this._cancelTap&&this._processTouchEvent(i,this._handlers.doubleTapEvent),this._resetTapTimeout()}else this._cancelTap||(this._processTouchEvent(i,this._handlers.tapEvent),this._handlers.tapEvent&&(0,o.preventDefault)(e));0===this._tapCount&&(0,o.preventDefault)(e),0===e.touches.length&&this._longTapActive&&(this._longTapActive=!1,(0,o.preventDefault)(e))}_touchCancelHandler(e){this._touchEndHandler(e)}_mouseUpHandler(e){if(0!==e.button)return;const t=this._makeCompatEvent(e);if(this._mouseMoveStartPosition=null,this._mousePressed=!1,this._unsubscribeRootMouseEvents&&(this._unsubscribeRootMouseEvents(),this._unsubscribeRootMouseEvents=null),s.isFF){this._target.ownerDocument.documentElement.removeEventListener("mouseleave",this._onFirefoxOutsideMouseUp)}if(!this._firesTouchEvents(e))if(this._processMouseEvent(t,this._handlers.mouseUpEvent),++this._clickCount,this._clickTimeoutId&&this._clickCount>1){ +const{manhattanDistance:i}=this._touchMouseMoveWithDownInfo(_(e),this._clickPosition);i<5&&!this._cancelClick&&this._processMouseEvent(t,this._handlers.mouseDoubleClickEvent),this._resetClickTimeout()}else this._cancelClick||this._processMouseEvent(t,this._handlers.mouseClickEvent)}_clearLongTapTimeout(){null!==this._longTapTimeoutId&&(clearTimeout(this._longTapTimeoutId),this._longTapTimeoutId=null)}_touchStartHandler(e){if(null!==this._activeTouchId)return this._clearLongTapTimeout(),void this._resetTapTimeout();const t=e.changedTouches[0];this._activeTouchId=t.identifier,this._lastTouchEventTimeStamp=g(e);const i=this._target.ownerDocument.documentElement;this._cancelTap=!1,this._touchMoveExceededManhattanDistance=!1,this._preventTouchDragProcess=!1,this._touchMoveStartPosition=_(t),this._unsubscribeRootTouchEvents&&(this._unsubscribeRootTouchEvents(),this._unsubscribeRootTouchEvents=null);{const t=this._touchMoveHandler.bind(this),s=this._touchEndHandler.bind(this);this._unsubscribeRootTouchEvents=()=>{i.removeEventListener("touchmove",t),i.removeEventListener("touchend",s)},i.addEventListener("touchmove",t,{passive:!1}),i.addEventListener("touchend",s,{passive:!1}),this._clearLongTapTimeout(),this._longTapTimeoutId=setTimeout(this._longTapHandler.bind(this,e),240)}const s=this._makeCompatEvent(e,t);this._processTouchEvent(s,this._handlers.touchStartEvent),this._tapTimeoutId||(this._tapCount=0,this._tapTimeoutId=setTimeout(this._resetTapTimeout.bind(this),500),this._tapPosition=_(t))}_wheelClickHandler(e){if(1!==e.button)return;if(this._firesTouchEvents(e))return;const t=this._makeCompatEvent(e);this._processMouseEvent(t,this._handlers.wheelClickEvent)}_mouseDownHandler(e){if(0!==e.button)return;const t=this._target.ownerDocument.documentElement;s.isFF&&t.addEventListener("mouseleave",this._onFirefoxOutsideMouseUp),this._cancelClick=!1,this._mouseMoveStartPosition=_(e),this._unsubscribeRootMouseEvents&&(this._unsubscribeRootMouseEvents(),this._unsubscribeRootMouseEvents=null);{const e=this._mouseMoveWithDownHandler.bind(this),i=this._mouseUpHandler.bind(this);this._unsubscribeRootMouseEvents=()=>{t.removeEventListener("mousemove",e),t.removeEventListener("mouseup",i)},t.addEventListener("mousemove",e),t.addEventListener("mouseup",i)}if(this._mousePressed=!0,this._firesTouchEvents(e))return;const i=this._makeCompatEvent(e);this._processMouseEvent(i,this._handlers.mouseDownEvent),this._clickTimeoutId||(this._clickCount=0,this._clickTimeoutId=setTimeout(this._resetClickTimeout.bind(this),500),this._clickPosition=_(e))}_init(){this._target.addEventListener("mouseenter",this._mouseEnterHandler.bind(this)),this._target.addEventListener("touchcancel",this._touchCancelHandler.bind(this));{const e=this._target.ownerDocument,t=e=>!e.target||!this._target.contains(e.target),i=e=>{if(!t(e))return;const i=e.changedTouches[0];this._lastTouchEventTimeStamp=g(e),this._processTouchEvent(this._makeCompatEvent(e,i),this._handlers.touchStartOutsideEvent)},s=e=>{ +t(e)&&!this._firesTouchEvents(e)&&this._processMouseEvent(this._makeCompatEvent(e),this._handlers.mouseDownOutsideEvent)};this._unsubscribeOutsideTouchEvents=()=>{e.removeEventListener("touchstart",i)},this._unsubscribeOutsideMouseEvents=()=>{e.removeEventListener("mousedown",s)},e.addEventListener("mousedown",s),e.addEventListener("touchstart",i,{passive:!0})}s.CheckMobile.iOS()&&(this._unsubscribeMobileSafariEvents=()=>{this._target.removeEventListener("dblclick",this._onMobileSafariDoubleClick)},this._target.addEventListener("dblclick",this._onMobileSafariDoubleClick)),this._target.addEventListener("mouseleave",this._mouseLeaveHandler.bind(this)),this._target.addEventListener("contextmenu",this._contextMenuHandler.bind(this)),this._target.addEventListener("touchstart",this._touchStartHandler.bind(this),{passive:!0}),(0,o.preventScrollByWheelClick)(this._target),this._target.addEventListener("mousedown",this._mouseDownHandler.bind(this)),this._target.addEventListener(l,this._wheelClickHandler.bind(this)),this._initPinch(),this._target.addEventListener("touchmove",(()=>{}),{passive:!1})}_initPinch(){void 0===this._handlers.pinchStartEvent&&void 0===this._handlers.pinchEvent&&void 0===this._handlers.pinchEndEvent||(this._target.addEventListener("touchstart",(e=>this._checkPinchState(e.touches)),{passive:!0}),this._target.addEventListener("touchmove",(e=>{if(null===this._pinchInfo)return;const t=f(e.touches,(0,r.ensureNotNull)(this._activeTouchId)),i=f(e.touches,this._pinchInfo.secondTouchId);if(t&&i&&void 0!==this._handlers.pinchEvent){const{startPinchDistance:s,startPinchMiddlePoint:r}=this._pinchInfo,n=m(t,i)/s,a=p(this._target);this._handlers.pinchEvent(r,{x:t.clientX-a.left,y:t.clientY-a.top},{x:i.clientX-a.left,y:i.clientY-a.top},n),(0,o.preventDefault)(e)}}),{passive:!1}),this._target.addEventListener("touchend",(e=>{this._checkPinchState(e.touches)})))}_checkPinchState(e){1===e.length&&(this._pinchPrevented=!1),2!==e.length||this._pinchPrevented||this._longTapActive?this._stopPinch():this._startPinch(e)}_startPinch(e){if(void 0!==this._handlers.pinchStartEvent&&null===this._pinchInfo){const t=p(this._target);let i,s;e[0].identifier===this._activeTouchId?(i=e[0],s=e[1]):(i=e[1],s=e[0]);const r={x:i.clientX-t.left,y:i.clientY-t.top},n={x:s.clientX-t.left,y:s.clientY-t.top},o={x:(r.x+n.x)/2,y:(r.y+n.y)/2};this._handlers.pinchStartEvent(o,r,n,{bothPointsOnTargetElement:this._target.contains(s.target)})&&(this._pinchInfo={startPinchDistance:m(i,s),startPinchMiddlePoint:o,secondTouchId:s.identifier})}this._clearLongTapTimeout()}_stopPinch(){var e,t;null!==this._pinchInfo&&(this._pinchInfo=null,null===(t=(e=this._handlers).pinchEndEvent)||void 0===t||t.call(e))}_mouseLeaveHandler(e){if(this._unsubscribeMousemove&&this._unsubscribeMousemove(),this._firesTouchEvents(e))return;if(!this._acceptMouseLeave)return;const t=this._makeCompatEvent(e);this._processMouseEvent(t,this._handlers.mouseLeaveEvent),this._acceptMouseLeave=!s.CheckMobile.iOS()}_longTapHandler(e){const t=f(e.touches,(0, +r.ensureNotNull)(this._activeTouchId));if(null===t)return;const i=this._makeCompatEvent(e,t);this._processTouchEvent(i,this._handlers.longTapEvent),this._processTouchEvent(i,this._handlers.touchContextMenuEvent),this._cancelTap=!0,this._longTapActive=!0}_contextMenuHandler(e){if((0,o.preventDefault)(e),null!==this._touchMoveStartPosition)return;if(this._firesTouchEvents(e))return;const t=this._makeCompatEvent(e);this._processMouseEvent(t,this._handlers.contextMenuEvent),this._cancelClick=!0}_firesTouchEvents(e){return e.sourceCapabilities&&void 0!==e.sourceCapabilities.firesTouchEvents?e.sourceCapabilities.firesTouchEvents:g(e){"touchstart"!==e.type&&(0,o.preventDefault)(e)}}}}function p(e){return e.getBoundingClientRect()||{left:0,top:0}}function _(e){return{x:e.pageX,y:e.pageY}}function m(e,t){const i=e.clientX-t.clientX,s=e.clientY-t.clientY;return Math.sqrt(i*i+s*s)}function g(e){return e.timeStamp||performance.now()}function f(e,t){for(let i=0;i{"use strict";i.d(t,{actualBehavior:()=>a,availableValues:()=>o,navigationButtonsVisibilityKey:()=>r,property:()=>n,restoreNavigationButtonsVisibilitySettingsValue:()=>l});var s=i(29542);const r="NavigationButtons.visibility",{property:n,availableValues:o,actualBehavior:a,restoreDefaultValue:l}=(0,s.createVisibilityController)(r)},3228:(e,t,i)=>{"use strict";i.d(t,{actualBehavior:()=>a,availableValues:()=>o,property:()=>n,restorePaneButtonsVisibilitySettingsValue:()=>l});var s=i(29542),r=i(78159);const{property:n,availableValues:o,actualBehavior:a,restoreDefaultValue:l}=(0,s.createVisibilityController)("PaneButtons.visibility",r.navigationButtonsVisibilityKey)},77212:(e,t,i)=>{"use strict";i.d(t,{ActionBinder:()=>s});class s{constructor(e,t,i,s,r=null){this._property=t,this._undoModel=i,this._undoText=s,this._action=e,this.setValue(t.value()),t.subscribe(this,this._propertyChanged),null!==r?e.update({onExecute:r.bind(this)}):e.update({onExecute:this._onActionCallback.bind(this)})}destroy(){this._property.unsubscribe(this,this._propertyChanged)}value(){return this._action.isChecked()}setValue(e){this._action.update({checked:Boolean(e)})}_onActionCallback(){this._undoModel.setProperty(this._property,this.value(),this._undoText)}_propertyChanged(e){ +this.setValue(e.value())}}},43886:(e,t,i)=>{"use strict";i.d(t,{isCustomStudy:()=>r});const s={VbPFixed:!0,PivotPointsStandard:!0,VbPVisible:!0,VbPAnchored:!0};function r(e){return e in s}},96362:(e,t,i)=>{"use strict";i.d(t,{MetaInfoHelper:()=>u});var s=i(50151),r=i(42856),n=i(72877),o=i(1722),a=i(59224),l=i(33703);function c(e){return!e.groupId&&!e.isHidden&&e.id!==l.RangeDependentStudyInputNames.FirstBar&&e.id!==l.RangeDependentStudyInputNames.LastBar}var h=i(43886);const d=(0,a.getLogger)("Platform.GUI.PropertyDialog.Indicators.MetaInfo");class u{constructor(e){this._metaInfo=e}hasUserEditableInputs(){return this._metaInfo.inputs.some(c)}getUserEditableInputs(){return this._metaInfo.inputs.filter(c)}hasUserEditableProperties(){return r.StudyMetaInfo.isScriptStrategy(this._metaInfo)}hasUserEditableStyles(){const e=this._metaInfo;return e.plots.length>0||void 0!==e.bands||void 0!==e.filledAreas||(0,h.isCustomStudy)(e.shortId)||r.StudyMetaInfo.isScriptStrategy(this._metaInfo)||Object.values(e.graphics).some((e=>void 0!==e))}getUserEditablePlots(){const e=new Set,t=this._metaInfo;return t.plots.filter((i=>{if((0,n.isColorerPlot)(i)||(0,n.isTextColorerPlot)(i)||(0,n.isDataOffsetPlot)(i)||(0,n.isOhlcColorerPlot)(i)||(0,n.isAlertConditionPlot)(i)||(0,n.isDataPlot)(i))return!1;if((0,n.isOhlcPlot)(i)){const r=i.target;if(e.has(r))return!1;e.add(r);const n=(0,s.ensureDefined)(t.ohlcPlots);return!(0,s.ensureDefined)(n[r]).isHidden}{const e=t.styles?t.styles[i.id]:void 0;return void 0===e||!e.isHidden}}))}hasUserEditableOptions(){return this.hasUserEditableInputs()||this.hasUserEditableProperties()||this.hasUserEditableStyles()}getStrategyProperties(){const e=this._metaInfo,t=e.inputs.filter(_),i={...p};for(const s of t){const t=s.internalID;i[t]=s,p.hasOwnProperty(t)||d.logWarn(`Unknown strategy input internal id ${t} in ${e.fullId}`)}return(0,o.clone)(i)}}const p={currency:void 0,backtest_fill_limits_assumption:void 0,calc_on_every_tick:void 0,calc_on_order_fills:void 0,commission_value:void 0,commission_type:void 0,initial_capital:void 0,pyramiding:void 0,slippage:void 0,default_qty_type:void 0,default_qty_value:void 0,margin_long:void 0,margin_short:void 0,use_bar_magnifier:void 0,process_orders_on_close:void 0,fill_orders_on_standard_ohlc:void 0};function _(e){return"strategy_props"===e.groupId}},83526:(e,t,i)=>{"use strict";i.d(t,{checkAuthBeforeSaveLoad:()=>n});var s=i(14483),r=i(39080);function n(e,t){s.enabled("saveload_requires_authentication")?(0,r.runOrSigninWithFeature)(e,{...t,feature:"savedCharts"}):e()}},68456:(e,t,i)=>{"use strict";i.d(t,{AbstractJsonStoreService:()=>r,CommonJsonStoreService:()=>n});var s=i(57898);class r{constructor(e,t,i,r,n){this._onChange=new s.Delegate,this._handleChange=()=>{this._onChange.fire(this.get())},this._crossTabEvents=e,this._jsonKeyValueStore=t,this.CROSSTAB_EVENT_NAME=i,this.JSON_STORE_KEY=r,this.defaultStoreValue=this._serialize(n),this._subscribe()}get(){const e=this._jsonKeyValueStore.getJSON(this.JSON_STORE_KEY,this.defaultStoreValue);return this._deserialize(e)} +set(e,t){const i=this._serialize(e);this._jsonKeyValueStore.setJSON(this.JSON_STORE_KEY,i,t),this._crossTabEvents.emit(this.CROSSTAB_EVENT_NAME),this._onChange.fire(e)}getOnChange(){return this._onChange}destroy(){this._unsubscribe(),this._onChange.destroy(),delete this._onChange}_subscribe(){this._crossTabEvents.on(this.CROSSTAB_EVENT_NAME,this._handleChange),this._jsonKeyValueStore.onSync.subscribe(this,this._handleChange)}_unsubscribe(){this._crossTabEvents.off(this.CROSSTAB_EVENT_NAME,this._handleChange),this._jsonKeyValueStore.onSync.unsubscribe(this,this._handleChange)}}class n extends r{_serialize(e){return e}_deserialize(e){return e}}},10638:(e,t,i)=>{"use strict";i.d(t,{LoadChartService:()=>d});var s=i(14483),r=i(61595),n=i(83526),o=i(85067),a=i(21097),l=i(56840),c=i(68456);class h extends c.CommonJsonStoreService{constructor(e,t){super(e,t,"FAVORITE_CHARTS_CHANGED","loadChartDialog.favorites",{})}}class d extends o.DialogRenderer{constructor(e=null){super(),this._chartWidgetCollection=null,this._promise=null,this._dialog=null,this._subscribe=e=>{this._setVisibility(e)},this._getChartEntry=e=>({id:e.id,url:e.url,title:e.name,symbol:e.short_symbol,interval:e.interval,toolsCount:0,modified:e.modified_iso,favorite:void 0,active:()=>this._isActiveChart(e.id),openAction:()=>r.backend.loadChart(e),deleteAction:()=>r.backend.removeChart(e.image_url).then((()=>this._deleteChart(e.id))),favoriteAction:e=>Promise.resolve(this._updateFavorites(e))}),this._updateFavorites=e=>{var t;null===(t=this._favoriteChartsService)||void 0===t||t.set(e)},this._isActiveChart=e=>null!==this._chartWidgetCollection&&e===this._chartWidgetCollection.metaInfo.id.value(),this._deleteChart=e=>{this._isActiveChart(e)&&(s.enabled("saveload_storage_customization")?null!==this._chartWidgetCollection&&this._chartWidgetCollection.clearChartMetaInfo():location.href="/chart/"+location.search)},this._chartWidgetCollection=e,this._favoriteChartsService=new h(a.TVXWindowEvents,l)}showLoadDialog(){(0,n.checkAuthBeforeSaveLoad)(this._showLoadDialog.bind(this),{source:"Load chart",sourceMeta:"Chart"})}show(){this.showLoadDialog()}hide(){var e,t;null===(e=this._dialog)||void 0===e||e.hide(),null===(t=this._dialog)||void 0===t||t.visible().unsubscribe(this._subscribe)}_showLoadDialog(){(s.enabled("saveload_requires_authentication")&&!window.is_authenticated?Promise.resolve([]):r.backend.getCharts()).then((e=>e.map(this._getChartEntry))).then((e=>{const t=this._promise=Promise.all([i.e(2666),i.e(956),i.e(2109),i.e(4015),i.e(3842),i.e(5145),i.e(855),i.e(5993),i.e(2587),i.e(6752),i.e(8149),i.e(4781),i.e(6747),i.e(898),i.e(962),i.e(1740),i.e(6408),i.e(2544),i.e(5057),i.e(5164),i.e(5009)]).then(i.bind(i,34557)).then((i=>{if(this._promise===t){this._dialog&&(this._dialog.hide(),this._dialog.visible().unsubscribe(this._subscribe));const t={charts:e,favoriteChartsService:this._favoriteChartsService,chartWidgetCollection:this._chartWidgetCollection};this._dialog=new i.LoadChartDialogRenderer(t),this._dialog.visible().subscribe(this._subscribe),this._dialog.show()} +}))}))}async _changeFavoriteState(e,t,i){return Promise.resolve()}}},75593:(e,t,i)=>{"use strict";i.d(t,{CustomStatusModel:()=>c});var s=i(97145);const r="#9598a1",n=!1,o=null,a='';class l{constructor(e){this._visible=new s.WatchedValue(n),this._tooltip=new s.WatchedValue(o),this._icon=new s.WatchedValue(a),this._color=new s.WatchedValue(r),this._tooltipContent=new s.WatchedValue(null),this._symbol=e}symbol(){return this._symbol}tooltip(){return this._tooltip}icon(){return this._icon}color(){return this._color}visible(){return this._visible}tooltipContent(){return this._tooltipContent}}class c{constructor(){this._symbolCustomStatuses=new Map}getSymbolCustomStatus(e){if(this._symbolCustomStatuses.has(e))return this._symbolCustomStatuses.get(e);const t=new l(e);return this._symbolCustomStatuses.set(e,t),t}hideAll(){for(const e of this._symbolCustomStatuses.values())e.visible().setValue(!1)}static getInstance(){return null===this._instance&&(this._instance=new c),this._instance}}c._instance=null},98425:(e,t,i)=>{"use strict";i.d(t,{restoreShowMarketOpenStatusProperty:()=>l,showMarketOpenStatusProperty:()=>a});var s=i(59680),r=i(56840);const n="Chart.ShowMarketOpenStatus";function o(){return r.getBool(n,true)}const a=(0,s.createPrimitiveProperty)(o());function l(){a.setValue(true),r.remove(n)}r.onSync.subscribe(null,(()=>a.setValue(o()))),a.subscribe(null,(()=>r.setValue(n,a.value())))},10585:(e,t,i)=>{"use strict";i.d(t,{MarketStatusModel:()=>l});i(50151);var s=i(97145),r=i(57333),n=i(41249);function o(){return window.ChartApiInstance.serverTime()/1e3}function a(e,t,i){return e<=i?t<=i?1/0:t/1e3:Math.min(e,t)/1e3}class l{constructor(e){this._marketStatus=new s.WatchedValue(null),this._lastMarketStatus=null,this._sessionsSpec=null,this._nextSessionEdgeInternal=null,this._nextSessionEdge=new s.WatchedValue(null),this._recalcNextSessionEdgeTimerId=null,this._futuresContractExpirationTime=null,this._quotesProvider=e,e.quotesUpdate().subscribe(this,this._update.bind(this)),e.quoteSymbolChanged().subscribe(this,this._resetStatus)}destroy(){this._quotesProvider.quotesUpdate().unsubscribeAll(this),this._quotesProvider.quoteSymbolChanged().unsubscribeAll(this),null!==this._recalcNextSessionEdgeTimerId&&clearTimeout(this._recalcNextSessionEdgeTimerId)}futuresContractExpirationTime(){return this._futuresContractExpirationTime}setSymbolInfo(e){var t,i,s,n,o;if(this._nextSessionEdgeInternal=null,null===e)return void(this._sessionsSpec=null);const a=new r.SessionSpec(e.timezone,null!==(t=e.session_display)&&void 0!==t?t:e.session,e.session_holidays,e.corrections);let l,c;const h=null===(i=e.subsessions)||void 0===i?void 0:i.find((e=>"premarket"===e.id)),d=null===(s=e.subsessions)||void 0===s?void 0:s.find((e=>"postmarket"===e.id));void 0!==h&&(l=new r.SessionSpec(e.timezone,null!==(n=h["session-display"])&&void 0!==n?n:h.session,e.session_holidays,h["session-correction"])), +void 0!==d&&(c=new r.SessionSpec(e.timezone,null!==(o=d["session-display"])&&void 0!==o?o:d.session,e.session_holidays,d["session-correction"])),this._sessionsSpec={general:a,preMarket:l,postMarket:c},this._recalculateNextSessionEdge()}status(){return this._marketStatus}nextSessionEdge(){return this._nextSessionEdge}_resetStatus(){this._lastMarketStatus=null,this._marketStatus.setValue(null)}_update(e){void 0!==e&&void 0!==e.values.current_session&&(this._lastMarketStatus=e.values.current_session),null!==this._lastMarketStatus?this._marketStatus.setValue(this._lastMarketStatus):this._resetStatus()}_getNextSessionEdgeInternal(){var e;if(null===this._sessionsSpec||"24x7"===this._sessionsSpec.general.spec())return null;const t=1e3*o();if(null===this._nextSessionEdgeInternal||(null!==(e=this._nextSessionEdgeInternal.timestamp)&&void 0!==e?e:1/0)<=t/1e3){const{general:e,preMarket:i,postMarket:s}=this._sessionsSpec,r=(0,n.get_timezone)(e.timezone()),l=(0,n.utc_to_cal)(r,t),c=a((0,n.cal_to_utc)(r,e.alignToNearestSessionStart(l,1)),(0,n.cal_to_utc)(r,e.alignToNearestSessionEnd(l,1)),t),h=a(void 0!==i?(0,n.cal_to_utc)(r,i.alignToNearestSessionStart(l,1)):1/0,void 0!==i?(0,n.cal_to_utc)(r,i.alignToNearestSessionEnd(l,1)):1/0,t),d=a(void 0!==s?(0,n.cal_to_utc)(r,s.alignToNearestSessionStart(l,1)):1/0,void 0!==s?(0,n.cal_to_utc)(r,s.alignToNearestSessionEnd(l,1)):1/0,t);let u=Math.min(c,h,d);if(u===1/0){const t=o(),i=6e4,s=new Date(Math.round(new Date(1e3*t).getTime()/i)*i).getTime()+i,l=(0,n.utc_to_cal)(r,s),c=a((0,n.cal_to_utc)(r,e.alignToNearestSessionStart(l,1)),(0,n.cal_to_utc)(r,e.alignToNearestSessionEnd(l,1)),s),p=Math.min(c,h,d);p!==1/0?(this._nextSessionEdgeInternal={timestamp:u},u=p):this._nextSessionEdgeInternal={timestamp:null}}this._nextSessionEdgeInternal=u===d?{timestamp:u,status:"post_market"}:u===h?{timestamp:u,status:"pre_market"}:{timestamp:u}}return this._nextSessionEdgeInternal}_recalculateNextSessionEdge(){const e=this._getNextSessionEdgeInternal();if(null===e||null===e.timestamp)return void this._nextSessionEdge.setValue(null);const t={status:e.status,remainingSeconds:Math.max(0,e.timestamp-o())};if(null===this._recalcNextSessionEdgeTimerId){const e=Number.isFinite(t.remainingSeconds)?Math.ceil(t.remainingSeconds%60):1;this._recalcNextSessionEdgeTimerId=setTimeout((()=>this._recalculateNextSessionEdgeByTimer()),1e3*e)}this._nextSessionEdge.setValue(t)}_recalculateNextSessionEdgeByTimer(){this._recalcNextSessionEdgeTimerId=null,this._recalculateNextSessionEdge()}}},77248:(e,t,i)=>{"use strict";i.d(t,{CRUCIAL_REALTIME_BATS:()=>a,firstReplacedByBatsExchange:()=>l,isDelay:()=>h,isEod:()=>c,witoutRealtime:()=>d});i(50151);var s=i(79982),r=i.n(s);const n=["DJ","JSE","BELEX"],o=["NZX"],a=["AMEX","NASDAQ","NYSE"];function l(e){return null}function c(e,t){return r().hasEodSymbols(e.full_name)||6===t}function h(e){return void 0!==e&&e>0}function d(e){return"index"===e.type&&n.includes(e.listed_exchange)||"futures"===e.type&&o.includes(e.listed_exchange)}},31330:(e,t,i)=>{"use strict";i.d(t,{ +canShowSpreadActions:()=>r,globalKeypressMatches:()=>n});var s=i(14483);i(94025),i(82992);new RegExp("^quandl","i");function r(){let e=!1;return s.enabled("show_spread_operators")&&(e=!0),e}function n(e){if(e.ctrlKey)return!1;if(e.metaKey)return!1;if(!e.charCode)return!1;if(!e.which||e.which<=32)return!1;const t=e.target;return!t||!/^(input|textarea)$/i.test(t.tagName)&&"listbox"!==t.getAttribute("role")}},13702:(e,t,i)=>{"use strict";function s(){return Promise.all([i.e(2666),i.e(956),i.e(2109),i.e(4015),i.e(5145),i.e(855),i.e(6),i.e(8056),i.e(2587),i.e(2639),i.e(9842),i.e(7807),i.e(3353),i.e(962),i.e(1740),i.e(6408),i.e(5057),i.e(750),i.e(1754)]).then(i.bind(i,89324))}i.d(t,{loadNewSymbolSearch:()=>s})},40493:(e,t,i)=>{"use strict";i.d(t,{tradingService:()=>n});var s=i(16216);const r={id:"TradingService"};function n(){return(0,s.hasService)(r)?(0,s.service)(r):null}},96005:(e,t,i)=>{"use strict";i.d(t,{TradingViewApiBase:()=>j});var s=i(50151),r=i(82992),n=i(76422),o=i(14483),a=i(10643),l=i(75531),c=i(51768),h=i(11014),d=i(45345),u=i(57898);class p{constructor(e){this._toolbarThemeChanged=new u.Delegate,this._onWatchedThemeChanged=e=>{this._toolbarThemeChanged.fire(e)},this._opts=e,d.watchedTheme.subscribe(this._onWatchedThemeChanged)}destroy(){d.watchedTheme.unsubscribe(this._onWatchedThemeChanged)}isStdTheme(){const e=this._opts.chartWidgetCollection.getAll().every((e=>(0,h.isStdTheme)((0,h.extractThemeFromModel)(e.model()))));return Promise.resolve(e)}async setStdTheme(e,t=!0,i){await(0,h.loadTheme)(this._opts.chartWidgetCollection,{themeName:e,standardTheme:!0,syncState:t,noUndo:i})}setStdThemeForLayout(e,t=!0){(0,d.setTheme)(e),t&&(0,h.syncTheme)()}getCurrentThemeName(){return(0,h.getCurrentTheme)().name}toolbarThemeChanged(){return this._toolbarThemeChanged}}var _=i(88913),m=i(88348),g=i(97145),f=i(46100),v=i(92249),y=i(56954),S=i.t(y,2);const b=new u.Delegate;var w=i(50151).ensureNotNull,C=i(68582).isLineToolRiskReward,P=i(88913).supportedLineTools,x=i(92249).createLineToolProperties,T=i(92249).prepareLineToolPropertiesByOwnerSource,I=i(45973).lineToolEntityInfo,M=i(72414).LineToolsGroupControllerApi,A=i(47513).RemoveSourcesUndoCommand;const{isLineDrawnWithPressedButton:L,isLineToolFinishRequiredWhenCreatedByApi:k}=i(15367),D=i(81155).EnvironmentState;var E=i(75444).ChartWidgetApiBase,V=i(88348);i(51768).trackEvent;function B(e,t){return t.map((function(t){return e.dataSourceForId(t)}))}class R extends E{executeActionById(e){this._chartWidget.executeActionById(e)}getCheckableActionState(e){return this._chartWidget.getCheckableActionState(e)}setZoomEnabled(e){this._chartWidget.model().model().setZoomEnabled(e)}setScrollEnabled(e){this._chartWidget.model().model().setScrollEnabled(e)}refreshMarks(){this._chartWidget.refreshMarks()}clearMarks(e){this._chartWidget.clearMarks(e)}setEntityVisibility(e,t){console.warn("`setEntityVisibility` is deprecated. Use shape/study API instead");var i=this._chartWidget.model().model().dataSourceForId(e);if(i){var s=i.properties();s&&s.visible&&s.visible.setValue(t)}} +availableZOrderOperations(e){var t=B(this._chartWidget.model().model(),e);return this._chartWidget.model().availableZOrderOperations(t)}sendToBack(e){var t=B(this._chartWidget.model().model(),e);this._chartWidget.model().sendToBack(t)}bringToFront(e){var t=B(this._chartWidget.model().model(),e);this._chartWidget.model().bringToFront(t)}insertAfter(e,t){var i=this._chartWidget.model().model(),s=B(i,e),r=i.dataSourceForId(t);this._chartWidget.model().insertAfter(s,r)}insertBefore(e,t){var i=this._chartWidget.model().model(),s=B(i,e),r=i.dataSourceForId(t);this._chartWidget.model().insertBefore(s,r)}bringForward(e){var t=B(this._chartWidget.model().model(),e);this._chartWidget.model().bringForward(t)}sendBackward(e){var t=B(this._chartWidget.model().model(),e);this._chartWidget.model().sendBackward(t)}showPropertiesDialog(e){var t=this._chartWidget.model().model().dataSourceForId(e);if(null===t)throw new Error("Study or shape "+e+" does not exist");this._chartWidget.showChartPropertiesForSource(t)}getAllShapes(){return this._chartWidget.model().model().allLineTools().map(I).filter((function(e){return null!==e.name}))}removeEntity(e,t){var i=this._chartWidget.model().chartModel().dataSourceForId(e);i?t&&t.disableUndo?new A(this._chartWidget.model().chartModel(),[i],"").redo():this._chartWidget.model().removeSource(i,!0,!0):console.warn("Can't find a source with id: "+e)}removeEntityWithUndo(e){var t=this._chartWidget.model().chartModel().dataSourceForId(e);this._chartWidget.model().removeSource(t,!1)}drawOnAllCharts(e){V.drawOnAllCharts.setValue(e)}getVisiblePriceRange(){return console.warn("`getVisiblePriceRange` is deprecated. Use Price Scale API instead"),this._chartWidget.model().mainSeries()?this._chartWidget.model().mainSeries().priceScale().priceRangeInPrice():null}scrollPosition(){return console.warn("`scrollPosition` is deprecated. Use rightOffset from Time Scale API instead"),this._chartWidget.model().timeScale().rightOffset()}defaultScrollPosition(){return console.warn("`defaultScrollPosition` is deprecated. Use defaultRightOffset from Time Scale API instead"),this._chartWidget.model().timeScale().defaultRightOffset().value()}_createTradingPrimitive(e,t){var i,s=this._chartWidget.model(),r=s.model(),n=r.paneForSource(r.mainSeries());function o(){var e=TradingView.CLOSE_PLOT,t=w(s.mainSeries().bars().last());return{index:t.index,price:t.value[e]}}return(i=t?r.createLineTool(n,o(),e):s.createLineTool({pane:n,point:o(),linetool:e}))?i._adapter:void 0}createOrderLine(e){e=e||{};return this._createTradingPrimitive("LineToolOrder",e.disableUndo)}createPositionLine(e){e=e||{};return this._createTradingPrimitive("LineToolPosition",e.disableUndo)}createExecutionShape(e){e=e||{};return this._createTradingPrimitive("LineToolExecution",e.disableUndo)}createShape(e,t){return this.createMultipointShape([e],t)}createMultipointShape(e,t){const i=Object.assign({},this._getDefaultCreateMultipointShapeOptions(),t);var s=P[i.shape]||P.flag;var r=this._chartWidget.model().model(),n=r.mainSeries();if(!r.timeScale().isEmpty()){ +var o=r.dataSourceForId(i.ownerStudyId)||n,a=r.paneForSource(o),l=this._convertUserPointsToDataSource(e);if(s.onlySelectable)throw new Error('Cannot create "'+i.shape+'" shape');if("LineToolIcon"===s.name){if(i.icon=i.icon||i.overrides&&i.overrides.icon,!i.hasOwnProperty("icon"))throw new Error("icon must be specified in options");i.overrides=i.overrides||{},i.overrides.icon=i.icon}var c,h,d=x(s.name,void 0,this._chartWidget.model().model());if(T(d,o),i.overrides)for(var u in i.overrides)d[u]?d[u].mergeAndFire(i.overrides[u]):C(s.name)&&-1!==["profitLevel","stopLevel"].indexOf(u)&&d.addProperty(u,i.overrides[u]);if(void 0!==d.text&&i.text&&d.text.setValue(i.text),d.hasChild("filled")&&i.filled&&d.filled.setValue(!0),null!==(h=i.disableUndo?(c=this._chartWidget.model().model()).createLineTool(a,l[0],s.name,d,void 0,o):(c=this._chartWidget.model()).createLineTool({pane:a,point:l[0],linetool:s.name,properties:d,ownerSource:o}))){if(C(s.name)){if(l.length>2)throw new Error("Wrong points count for "+i.shape+". Required 1 or 2");2===l.length&&(h.startChanging(1,l[1]),h.setPoint(1,l[1]),h.endChanging())}else{var p=h.pointsCount();if(p!==l.length&&-1!==p)throw new Error("Wrong points count for "+i.shape+". Required "+p);for(var _=new D(void 0,!0),m=L(s.name),g=1;g{this.setActiveChart(this._chartIndex(e))};const{chartApiInstance:t,chartWidgetCollection:i,studyMarket:s,saveChartService:o,loadChartService:a,sharingChartService:l=null,webview:c=null}=e;this._chartWidgetCollection=i,this._studyMarket=s,this._saveChartService=o,this._sharingChartService=l,this._loadChartLayoutDialog=a,this._intervalsService=null,this._alertsWidgetDialog=null,this._detailsDialogController=null,this._supportedChartStylesSpawn=r.linking.supportedChartStyles.spawn(),this._chartWidgetCollection.onAboutToBeDestroyed.subscribe(null,(()=>this.destroy()),!0),this._webview=c;const h=new W.ChartChangesWatcher(this._chartWidgetCollection,window.saver,n);this._chartChangesWatcher=h,this._chartHasChanged=(0,H.createWVFromGetterAndSubscription)((()=>h.hasChanges()),h.getOnChange());const d=i.lock;this._symbolSync=d.symbol.spawn(),this._intervalSync=d.interval.spawn(),this._dateRangeSync=d.dateRange.spawn(),this._crosshairSync=d.crosshair.spawn(),this._timeSync=d.trackTime.spawn()}destroy(){var e,t,i;this._chartHasChanged.destroy(),this._chartChangesWatcher.destroy(),this._supportedChartStylesSpawn.destroy(),null===(e=this._intervalsService)||void 0===e||e.destroy(),null===(t=this._themesApi)||void 0===t||t.destroy(),null===(i=this._widgebarApi)||void 0===i||i.destroy(),this._widgetbarApiRejectionReason="This ITradingViewApi instance has been destroyed",this._symbolSync.destroy(),this._intervalSync.destroy(),this._dateRangeSync.destroy(),this._crosshairSync.destroy(),this._timeSync.destroy(),this._drawOnAllCharts.destroy(),this._isDestroyed=!0,(0,m.properties)().childs().magnet.unsubscribeAll(this),(0,m.properties)().childs().magnetMode.unsubscribeAll(this)}themes(){return null===this._themesApi&&(this._themesApi=new p({chartWidgetCollection:this._chartWidgetCollection})),this._themesApi}dialogs(){var e,t,i,s,r,n;return{Indicators:this._studyMarket,Compare:this._chartWidgetCollection.getCompareDialogRenderer(),ObjectsTree:null,ChartProperties:this._chartWidgetCollection.getChartPropertiesDialogRenderer(),ChartLayoutSaveAs:null!==(t=null===(e=this._saveChartService)||void 0===e?void 0:e.getSaveAsController())&&void 0!==t?t:null,ChartLayoutRename:null!==(s=null===(i=this._saveChartService)||void 0===i?void 0:i.getRenameController())&&void 0!==s?s:null,ChartLayoutCreate:null!==(n=null===(r=this._saveChartService)||void 0===r?void 0:r.getCreateController())&&void 0!==n?n:null, +ChartLayoutLoad:this._loadChartLayoutDialog,Alerts:this._alertsWidgetDialog,Details:this._detailsDialogController,FinancialsCharts:null,Technicals:null,Forecast:null}}subscribe(e,t){n.subscribe(e,t,void 0)}unsubscribe(e,t){n.unsubscribe(e,t,void 0)}webview(){return U(),this._webview}studyTemplatesDrawerApi(){U()}fontIconsSettingsDrawer(){U()}intervalsService(){U()}supportedChartTypes(){return this._supportedChartStylesSpawn}setBrokerName(e){this._chartWidgetCollection.setBroker(e)}getDrawOnAllCharts(){return(0,m.drawOnAllCharts)().value()}drawOnAllCharts(e){return(0,m.drawOnAllCharts)().setValue(e)}drawOnAllChartsEnabled(){return this._drawOnAllCharts}getDrawOnAllChartsMode(){return(0,m.drawOnAllChartsMode)().value()}drawOnAllChartsMode(e){(0,m.drawOnAllChartsMode)().setValue(e)}disableTrackingEvents(){(0,c.disableTrackingEvents)()}getSaveChartService(){return this._saveChartService}symbolSync(){return this._symbolSync}intervalSync(){return this._intervalSync}dateRangeSync(){return this._dateRangeSync}crosshairSync(){return this._crosshairSync}timeSync(){return this._timeSync}setSymbolSearchUI(e){U()}chart(e=0){if(e<0||e>=this.chartsCount())throw Error("Incorrect index: "+e);return this._getChartWidgetApi(this._chartWidgetCollection.getAll()[e])}activeChart(){return this._getChartWidgetApi(this._activeChartWidget())}setActiveChart(e){if(e>=0&&e(this._favoriteDrawingsToolbar||(this._favoriteDrawingsToolbar=new e.FavoriteDrawingsApi),this._favoriteDrawingsToolbar)))}sharingChart(){return this._sharingChartService}watchlist(){U()}setWatchlistApiPromise(e){U()}news(){U()}setNewsApiPromise(e){U()}widgetbar(){U()}setWidgetbarApiPromise(e){U()}getChartStorage(){return getChartStorage()}setDebugMode(e){o.setEnabled("charting_library_debug_mode",e)}setFeatureEnabled(e,t){"chart_crosshair_menu"!==e?o.setEnabled(e,t):F.addPlusButtonProperty.setValue(t)}magnetEnabled(){return null===this._magnetEnabledWatchedValue&&(this._magnetEnabledWatchedValue=new g.WatchedValue((0,m.properties)().childs().magnet.value()),this._magnetEnabledWatchedValue.subscribe((e=>{(0,f.saveDefaultProperties)(!0),(0,m.properties)().childs().magnet.setValue(e),(0,f.saveDefaultProperties)(!1)})),(0,m.properties)().childs().magnet.subscribe(this,(()=>{(0,s.ensureNotNull)(this._magnetEnabledWatchedValue).setValue((0,m.properties)().childs().magnet.value())}))),this._magnetEnabledWatchedValue}magnetMode(){return null===this._magnetModeWatchedValue&&(this._magnetModeWatchedValue=new g.WatchedValue((0,m.properties)().childs().magnetMode.value()),this._magnetModeWatchedValue.subscribe((e=>{(0,f.saveDefaultProperties)(!0),(0,m.properties)().childs().magnetMode.setValue(e),(0,f.saveDefaultProperties)(!1)})),(0,m.properties)().childs().magnetMode.subscribe(this,(()=>{(0,s.ensureNotNull)(this._magnetModeWatchedValue).setValue((0,m.properties)().childs().magnetMode.value())}))),this._magnetModeWatchedValue}flushBufferedData(){b.fire()}chartWidgetCollectionState(...e){return this._chartWidgetCollection.state(...e)}chartWidgetCollectionSeriesStatuses(){return this._chartWidgetCollection.chartSeriesStatuses()}initAllLineTools(){return Promise.all(Object.keys(S).filter((e=>!S[e])).map((e=>(0,v.initLineTool)(e)))).then((()=>{}))}watermark(){{const e=O.WatermarkApi.getInstance();if(!e.ready())throw new Error("Watermark API is not initialised yet.");return e}}setContextMenuOptions(e){j.setContextMenuOptions(e)}changeSymbol(e,t,i){r.linking.interval.setValue((0,s.ensureNotNull)(N.Interval.normalize(t))),r.linking.setSymbolAndLogInitiator(e,"API"),i&&this.activeChart().onDataLoaded().subscribe(null,i,!0)}getSymbolInterval(e){const t={symbol:this.linking.proSymbol.value(),interval:this.linking.interval.value()};return null==e||e(t),t}hasChartChanges(){return this._chartHasChanged}setForceFullscreenMode(){U()}setMultichartMode(){U()}setDateRangeLinkingEnabled(e){this._chartWidgetCollection.lock.dateRange.setValue(e)}static setContextMenuOptions(e){void 0!==e.items_processor&&a.ContextMenuManager.setCustomItemsProcessor(e.items_processor),void 0!==e.renderer_factory&&a.ContextMenuManager.setCustomRendererFactory(e.renderer_factory)}_getChartWidgetApi(e){let t=this._chartWidgets.get(e);return void 0===t&&(t=new R(e,this._activateChart.bind(null,e)),this._chartWidgets.set(e,t)),t}_chartIndex(e){return this._chartWidgetCollection.getAll().indexOf(e)}_activeChartWidget(){ +return this._chartWidgetCollection.activeChartWidget.value()}}},75117:(e,t,i)=>{"use strict";var s=i(82992).linking,r=(i(51608).createDeferredPromise,i(76422)),n=i(10643).ContextMenuManager,o=i(88348),a=i(94025),l=i(61595).backend,c=i(59224),h=i(3615).showWarning,d=i(3615).showConfirm,u=i(88913),p=i(52092).CLOSE_POPUPS_AND_DIALOGS_COMMAND,_=i(96005).TradingViewApiBase,m=i(42856).StudyMetaInfo,g=i(152).getStudyInputsInfo,f=i(70120).getStudyStylesInfo,v=i(57898).Delegate,y=i(97145).WatchedValue;e.exports=class extends _{constructor(e){const{chartWidgetCollection:t,saveChartService:i,loadChartService:s,sharingChartService:r,alertsDispatcher:n,supportTicketData:o,favoriteServices:a,chartApiInstance:l=null,studyMarket:c=null,webview:h,alertsFacadeChannelPushApi:d}=e;super({chartApiInstance:l,chartWidgetCollection:t,studyMarket:c,saveChartService:i,loadChartService:s,sharingChartService:r,webview:h}),this._chartApiInstance=l,this._loadChartService=s,this._alertsDispatcher=n,this._supportTicketData=o,this._favoriteServices=a,this._alertsFacadeChannelPushApi=d,this._proxyWatchListChangedDelegate=null,this._lockDrawingsWatchedValue=null,this._hideDrawingsWatchedValue=null,this._hideIndicatorsWatchedValue=null,this._replayApi=null,this._getDataSourceHub=function(){return t.activeChartWidget.value().model().model()},this._alertService=this._alertsDispatcher&&this._alertsFacadeChannelPushApi?new undefined(this._alertsDispatcher,this._getDataSourceHub,this._alertsFacadeChannelPushApi):null,this._activeChangedChangedDelegate=new v,this._chartWidgetCollection.activeChartWidget.subscribe(function(){this._activeChangedChangedDelegate.fire()}.bind(this))}onContextMenu(e){r.subscribe("onContextMenu",(function(t){t.callback(e(t.unixtime,t.price))}))}onGrayedObjectClicked(e){r.subscribe("onGrayedObjectClicked",e)}onActiveChartChanged(){return this._activeChangedChangedDelegate}viewMode(){throw new Error("not implemented")}viewModeWatchedValue(){throw new Error("not implemented")}saveChart(e,t){if(this._saveChartService){var i=this._saveChartService.saveToJSON(t);return e&&e(JSON.parse(i.content))}}loadChart(e){this._chartApiInstance.disconnect(),e.extendedData&&(this._chartWidgetCollection.metaInfo.id.setValue(e.extendedData.uid),this._chartWidgetCollection.metaInfo.uid.setValue(e.extendedData.uid),this._chartWidgetCollection.metaInfo.name.setValue(e.extendedData.name)),this._chartWidgetCollection.loadContent(e.json),this._chartWidgetCollection.purgeUnusedWidgets(),this._chartApiInstance.connect(),s.setSymbolAndLogInitiator(this.activeChart().symbol(),"API"),r.emit("chart_loaded")}getStudiesList(){return this._chartApiInstance.allStudiesMetadata().filter((function(e){return!e.is_hidden_study})).map((function(e){return e.description}))}getStudyInputs(e){{const t=m.findStudyMetaInfoByDescription(this._chartApiInstance.allStudiesMetadata(),e);return g(t)}}getStudyStyles(e){{const t=m.findStudyMetaInfoByDescription(this._chartApiInstance.allStudiesMetadata(),e);return f(t)}}getSavedCharts(e){l.getCharts().then(e)}loadChartFromServer(e){ +l.loadChart(e)}saveChartToServer(e,t,i){this._saveChartService&&this._saveChartService.saveChartSilently(e,t,i)}setAutosave(e){this._saveChartService&&this._saveChartService.autoSaveEnabled().setValue(e)}removeChartFromServer(e,t){l.removeChart(e).then(t)}getIntervals(){var e=[],t=a.getCustomResolutions();return null!==this._chartApiInstance&&(e=this._chartApiInstance.defaultResolutions()),a.mergeResolutions(e,t)}closePopupsAndDialogs(){n.hideAll(),r.emit(p)}selectedLineTool(){for(var e=Object.keys(u.supportedLineTools),t=o.tool.value(),i=0;i{"use strict";i.d(t,{WatermarkApi:()=>o});var s=i(50151),r=i(63821),n=i(65632);class o{constructor(){this._widgets=null,this._provider=null,this._watermarkProperties=(0,n.watermarkProperty)();const e=(0,s.ensureDefined)(this._watermarkProperties.child("color")),t=(0,s.ensureDefined)(this._watermarkProperties.child("visibility"));this._colorWatchedValue=(0,r.convertPropertyToWatchedValue)(e),this._visibilityWatchedValue=(0,r.convertPropertyToWatchedValue)(t)}setWidgetCollection(e){this._widgets=e}setContentProvider(e){this._provider=e,this._widgets&&this._widgets.getAll().forEach((e=>{e.model().model().lightUpdate()}))}provider(){return this._provider}ready(){return null!==this._widgets}destroy(){this._colorWatchedValue.destroy(),this._visibilityWatchedValue.destroy()}visibility(){return this._visibilityWatchedValue}color(){return this._colorWatchedValue}static getInstance(){return null===this._instance&&(this._instance=new o),this._instance}}o._instance=null},85402:(e,t,i)=>{"use strict";i.d(t,{AbstractBarColorer:()=>s});class s{constructor(){this._backColorers=[]}barStyle(e,t,i){const s={};for(const r of this._backColorers)r.applyBarStyle(e,t,s,i);return this.applyBarStyle(e,t,s,i),s}pushBackBarColorer(e){this._backColorers.unshift(e)}firstColoredBar(e){return null}}},11095:(e,t,i)=>{"use strict";i.d(t,{addPlusButtonProperty:()=>_,restoreAddPlusButtonSettingsValue:()=>m,showPlusButtonOnCursor:()=>d});var s=i(4741),r=i(14483),n=i(56840),o=i(59680),a=i(97145);const l="add_plus_button";function c(){const e=s.keyboardPressedKeysState.value();return void 0!==e&&(Boolean(e.modifiers&s.Modifiers.Alt&&e.modifiers&s.Modifiers.Mod)&&(void 0===e.code||e.altOrOptionCode()||e.controlOrMetaCode()))}const h=new a.WatchedValue(c()) +;s.keyboardPressedKeysState.subscribe((()=>h.setValue(c())));const d=h.readonly();function u(){return r.enabled("chart_crosshair_menu")}function p(){return n.getBool(l,u())}const _=(0,o.createPrimitiveProperty)(p());function m(){_.setValue(u()),n.remove(l)}n.onSync.subscribe(null,(()=>_.setValue(p()))),_.subscribe(null,(()=>{n.setValue(l,_.value()),r.setEnabled("chart_crosshair_menu",!r.enabled("chart_crosshair_menu"))}))},83654:(e,t,i)=>{"use strict";i.d(t,{alignToStep:()=>n});var s=i(60521),r=i.n(s);function n(e,t){return r()(e).div(t).round(0,r().roundHalfUp).mul(t).toNumber()}},28640:(e,t,i)=>{"use strict";i.d(t,{AppliedTimeFrame:()=>r});var s=i(83669);class r{constructor(e){this._appliedTimeFrame=new s.WatchedObject(null),this._appliedTimeFrameInfo=null,this._appliedTimeFrameChangedBound=this._appliedTimeFrameChanged.bind(this),this._model=e,e.mainSeries().dataEvents().seriesTimeFrame().subscribe(this,this._onSeriesTimeFrame),this._appliedTimeFrame.subscribe(this._appliedTimeFrameChangedBound)}destroy(){this._appliedTimeFrame.unsubscribe(this._appliedTimeFrameChangedBound),this._model.timeScale().logicalRangeChanged().unsubscribeAll(this),this._model.mainSeries().dataEvents().seriesTimeFrame().unsubscribeAll(this)}appliedTimeFrame(){return this._appliedTimeFrame}_appliedTimeFrameChanged(){this._model.timeScale().logicalRangeChanged().unsubscribe(this,this._invalidateAppliedTimeFrame)}_onSeriesTimeFrame(e,t,i,s){if(s){const e=this._model.timeScale();this._appliedTimeFrameInfo={logicalRange:e.logicalRange(),baseIndex:e.baseIndex()},e.logicalRangeChanged().subscribe(this,this._invalidateAppliedTimeFrame)}}_invalidateAppliedTimeFrame(){if(null===this._appliedTimeFrameInfo)return;const e=this._model.timeScale(),t=e.logicalRange(),i=e.baseIndex(),s=this._appliedTimeFrameInfo.logicalRange,r=this._appliedTimeFrameInfo.baseIndex;(null===t||null===s||Math.abs(i-t.left()-(r-s.left()))>=.01||Math.abs(i-t.right()-(r-s.right()))>=.01)&&this._appliedTimeFrame.setValue(null)}}},12416:(e,t,i)=>{"use strict";i.d(t,{defaultsPreferencesByWhiteList:()=>x,preferencesByWhiteList:()=>P});var s=i(1722),r=i(67980),n=i(62615),o=i(59224),a=i(74304),l=i(85804),c=i(16776),h=i(30888),d=i(93613);const u=(0,o.getLogger)("Chart.ApplyPreferencesToAllCharts"),p={color:"",style:0},_={autoScale:!1,autoScaleDisabled:!1,lockScale:!1,percentage:!1,percentageDisabled:!1,log:!1,logDisabled:!1,alignLabels:!1,isInverted:!1,indexedTo100:!1},m={backgroundType:d.ColorType.Solid,background:"",backgroundGradientStartColor:"",backgroundGradientEndColor:"",topMargin:0,bottomMargin:0,rightOffset:0,gridLinesMode:"both",horzGridProperties:(0,h.deepExtend)({},p),vertGridProperties:(0,h.deepExtend)({},p),crossHairProperties:(0,h.deepExtend)({},{color:"",style:0,transparency:0,width:0}),legendProperties:(0,h.deepExtend)({},{showStudyArguments:!1,showStudyTitles:!1,showStudyValues:!1,showSeriesTitle:!1,showSeriesOHLC:!1,showLegend:!1,showLastDayChange:!1,showBarChange:!0,showVolume:!1,showPriceSource:!1,showBackground:!0,backgroundTransparency:0,showLogo:!0}), +axisProperties:(0,h.deepExtend)({},_),separatorColor:""},g={lineColor:"",textColor:"",fontSize:0,scaleSeriesOnly:!1,showSeriesLastValue:!1,seriesLastValueMode:a.PriceAxisLastValueMode.LastValueAccordingToScale,showSeriesPrevCloseValue:!1,showStudyLastValue:!1,showSymbolLabels:!1,showStudyPlotLabels:!1,showBidAskLabels:!1,showPrePostMarketPriceLabel:!0,showFundamentalLastValue:!1,showFundamentalNameLabel:!1,showPriceScaleCrosshairLabel:!0,showTimeScaleCrosshairLabel:!0},f={...g},v={visible:!1,futureOnly:!1,breaks:(0,h.deepExtend)({},{color:"",visible:!1,style:0,width:0})},y={style:0,minTick:"",showPriceLine:!1,priceLineWidth:0,priceLineColor:"",baseLineColor:"",showPrevClosePriceLine:!1,showCountdown:!0,prevClosePriceLineWidth:0,sessionId:"regular",prevClosePriceLineColor:"",esdShowDividends:!1,esdShowSplits:!1,esdShowEarnings:!1,esdShowBreaks:!1,showContinuousContractSwitches:!1,showContinuousContractSwitchesBreaks:!1,showFuturesContractExpiration:!1,showLastNews:!1,dividendsAdjustment:!1,backAdjustment:!1,settlementAsClose:!0,statusViewStyle:(0,h.deepExtend)({},{fontSize:16,showExchange:!0,showInterval:!0,symbolTextSource:"description"}),priceAxisProperties:(0,h.deepExtend)({},_),highLowAvgPrice:(0,h.deepExtend)({},{highLowPriceLinesVisible:!1,highLowPriceLabelsVisible:!1,averageClosePriceLabelVisible:!1,averageClosePriceLineVisible:!1,highLowPriceLinesColor:"",highLowPriceLinesWidth:0,averagePriceLineColor:"",averagePriceLineWidth:0}),candleStyle:(0,h.deepExtend)({},n.candleStylePreferencesDefault),hollowCandleStyle:(0,h.deepExtend)({},n.hollowCandlePreferencesStyleDefault),barStyle:(0,h.deepExtend)({},n.barStylePreferencesDefault),lineStyle:(0,h.deepExtend)({},n.lineStyleDefault),lineWithMarkersStyle:(0,h.deepExtend)({},n.lineStyleDefault),steplineStyle:(0,h.deepExtend)({},n.lineStyleDefault),areaStyle:(0,h.deepExtend)({},n.areaStylePreferencesDefault),hlcAreaStyle:(0,h.deepExtend)({},n.hlcAreaStylePreferencesDefault),baselineStyle:(0,h.deepExtend)({},n.baselineStylePreferencesDefault),hiloStyle:(0,h.deepExtend)({},n.hiloStylePreferencesDefault),haStyle:(0,h.deepExtend)({},n.haStylePreferencesDefault),renkoStyle:(0,h.deepExtend)({},n.renkoStylePreferencesDefault),pbStyle:(0,h.deepExtend)({},n.pbStylePreferencesDefault),kagiStyle:(0,h.deepExtend)({},n.kagiStylePreferencesDefault),pnfStyle:(0,h.deepExtend)({},n.pnfStylePreferencesDefault),rangeStyle:(0,h.deepExtend)({},n.rangeStylePreferencesDefault),columnStyle:(0,h.deepExtend)({},n.columnStylePreferencesDefault),useVolumeWeightBars:!1},S={priceScaleSelectionStrategyName:"auto",timeScale:(0,h.deepExtend)({},{defaultRightOffset:0,defaultRightOffsetPercentage:5,usePercentageRightOffset:!1}),mainSeries:(0,h.deepExtend)({},y),sessions:(0,h.deepExtend)({},c.sessionsPreferencesDefault),paneProperties:(0,h.deepExtend)({},m),chartEventsSourceProperties:(0,h.deepExtend)({},v),tradingProperties:(0,h.deepExtend)({},r.tradingPreferencesDefault)},b={timezone:"",scalesProperties:(0,h.deepExtend)({},f),...S},w={scalesProperties:(0,h.deepExtend)({},g),...S} +;function C(e,t,i,r,n=!0){if(void 0===t[e])return u.logDebug(`We haven't had this property ${r}.${e} yet, please, remove it from whiteList`),null;if((0,s.isObject)(i[e])){const s=Object.keys(i[e]);let o="";return s.map((s=>({[s]:C(s,t[e],i[e],`${r}.${e}`,n)}))).reduce(((e,t)=>(o=Object.keys(t)[0],e[o]=t[o],e)),{})}return n?t[e].value():t[e]}function P(e,t,i=b){const s={timezone:"",priceScaleSelectionStrategyName:"auto",timeScale:{defaultRightOffset:e.timeScale().defaultRightOffset().value(),defaultRightOffsetPercentage:e.timeScale().defaultRightOffsetPercentage().value(),usePercentageRightOffset:e.timeScale().usePercentageRightOffset().value()},mainSeries:{},sessions:{},paneProperties:{},scalesProperties:{},chartEventsSourceProperties:{},tradingProperties:{}},r=["timeScale","mainSeries","sessions"],n=i.mainSeries,o=Object.keys(i),a=Object.keys(n),l=t.properties(),c=e.properties(),h=i.sessions,d=Object.keys(h),u=e.sessions().properties();return a.forEach((e=>{s.mainSeries[e]=C(e,l,n,"mainSeries")})),d.forEach((e=>{s.sessions[e]=C(e,u,h,"sessions")})),o.forEach((e=>{r.includes(e)||(s[e]=C(e,c,i,"preferences"))})),s}function x(e,t,i=w,s=!0){const r={timeScale:{defaultRightOffset:e.timeScale().rightOffsetDefaultValue(),defaultRightOffsetPercentage:e.timeScale().defaultRightOffsetPercentage().value(),usePercentageRightOffset:e.timeScale().usePercentageRightOffset().value()},mainSeries:{},sessions:(0,h.deepExtend)({},c.sessionsPreferencesDefault),paneProperties:{},scalesProperties:{},chartEventsSourceProperties:{},tradingProperties:{},priceScaleSelectionStrategyName:"auto"},n=["timeScale","mainSeries","sessions"],o=i.mainSeries,a=Object.keys(i),d=Object.keys(o),u=(0,l.factoryDefaults)("chartproperties.mainSeriesProperties"),p=(0,l.factoryDefaults)("chartproperties");return d.forEach((e=>{s&&"style"===e||(r.mainSeries[e]=C(e,u,o,"mainSeries",!1))})),a.forEach((e=>{n.includes(e)||(r[e]=C(e,p,i,"preferences",!1))})),r}},39875:(e,t,i)=>{"use strict";i.d(t,{autoLogButtonsVisibilityOptions:()=>n,autoLogButtonsVisibilityProperty:()=>r,restoreAutoLogButtonsVisibilitySettingsValue:()=>o});var s=i(29542);const{property:r,availableValues:n,restoreDefaultValue:o}=(0,s.createVisibilityController)("PriceAxisAutoLogButtons.visibility")},81580:(e,t,i)=>{"use strict";i.d(t,{axisLabelBackgroundColor:()=>r});var s=i(33013);const r={common:s.colorsPalette["color-tv-blue-500"],active:s.colorsPalette["color-tv-blue-800"]}},77475:(e,t,i)=>{"use strict";i.d(t,{createDwmAligner:()=>c,createTimeToBarTimeAligner:()=>d,isAlignmentEnabled:()=>h});var s=i(41249),r=i(14483),n=i(36274),o=i(98829),a=i(60156);const l=new o.SessionInfo("Etc/UTC","0000-0000:1234567");function c(e,t){if(!h()||!n.Interval.isDWM(e))return null;const i=new o.SessionInfo(t.timezone,t.session,t.session_holidays,t.corrections),r=(0,a.newBarBuilder)(e,i,l);return{timeToSessionStart:e=>r.tradingDayToSessionStart(e),timeToExchangeTradingDay:e=>{const t=s.utc_to_cal(i.timezone,e),r=i.spec.correctTradingDay(t);return s.set_hms(r,0,0,0,0,s.get_timezone("Etc/UTC")),r.getTime()}}} +function h(){return!r.enabled("disable_resolution_rebuild")}function d(e,t){if(!h())return e=>e;const i=new o.SessionInfo(t.timezone,t.session,t.session_holidays,t.corrections),s=(0,a.newBarBuilder)(e,i,i,!1);return e=>s.alignTimeIfPossible(e)}},98829:(e,t,i)=>{"use strict";i.d(t,{BarBuilderBase:()=>a,SessionInfo:()=>o});var s=i(41249),r=i(60062),n=i(57333);class o{constructor(e,t,i,s){this.init(e,t,i,s),this._state={timezone:e,spec:t,holidays:i,corrections:s}}init(e,t,i,r){this.timezone=s.get_timezone(e),this.spec=new n.SessionSpec(e,t,i,r)}state(){return this._state}static fromState(e){return new o(e.timezone,e.spec,e.holidays,e.corrections)}}class a{alignTime(e){if(isNaN(e))return NaN;let t=this.indexOfBar(e);return t===r.SessionStage.POST_SESSION&&(this.moveTo(e),t=this.indexOfBar(e)),t<0?NaN:this.startOfBar(t)}}},60156:(e,t,i)=>{"use strict";i.r(t),i.d(t,{SessionInfo:()=>o.SessionInfo,alignExchangeTimeToSessionStartAndReturnUTC:()=>P,alignPeriodsBackForDataRequest:()=>S,alignPeriodsBackForVisibleRange:()=>b,getPeriodsBetweenDates:()=>C,isTradingNow:()=>x,newBarBuilder:()=>y});var s=i(41249),r=i(36274),n=i(37160),o=i(98829),a=i(60062);class l extends o.BarBuilderBase{constructor(e,t){super(),this._sessionStartMs=-Number.MAX_VALUE,this._sessionEndMs=-Number.MAX_VALUE,this._periodSec=e,this._session=t}alignTimeIfPossible(e){const t=this.alignTime(e);return isNaN(t)?e:t}indexOfBar(e){return e=this._sessionEndMs?a.SessionStage.POST_SESSION:(0,n.toInt)(s.time_seconds_diff(e,this._sessionStartMs)/this._periodSec)}startOfBar(e){if(e===a.SessionStage.PRE_SESSION){const e=s.get_cal_from_unix_timestamp_ms(this._session.timezone,this._sessionStartMs-1),t=this._session.spec.alignToNearestSessionEnd(e,-1);return s.cal_to_utc(this._session.timezone,t)}if(e===a.SessionStage.POST_SESSION)return this._sessionEndMs;if(e<0)throw new Error("Negative offset is not supported");return this._sessionStartMs+s.time_seconds(this._periodSec*e)}endOfBar(e){if(e<0)throw new Error("Index cannot be negative");const t=this.startOfBar(e)+1e3*this._periodSec;return t>this._sessionEndMs?this._sessionEndMs:t}isLastBar(e,t){return t>=this._sessionStartMs+s.time_seconds(this._periodSec*(e+1)-1)}moveTo(e){const t=this._session.timezone,i=s.utc_to_cal(t,e),r=this._session.spec.alignToSessionStart(i);this._sessionStartMs=s.cal_to_utc(t,i),s.add_minutes(i,r),this._sessionEndMs=s.cal_to_utc(t,i)}indexOfLastBarInSession(){return(0,n.toInt)((this._sessionEndMs-1-this._sessionStartMs)/1e3/this._periodSec)}moveNext(){this.moveTo(this._sessionEndMs)}}var c=i(54606);function h(e,t){const i=s.clone(t),r=e.businessDaysToCalendarDays(i,1);r>1&&s.add_date(i,r-1);const n=e.leftBorderOfDailyBar(i);if(null===n)throw new Error("Cannot calculate left border of daily bar");return s.cal_to_utc(s.get_timezone(e.timezone()),n)}class d extends o.BarBuilderBase{constructor(e,t,i,s,r=!1){super(),this._periodStart=-Number.MAX_VALUE,this._periodEnd=-Number.MAX_VALUE,this._periodLastBarStart=-Number.MAX_VALUE, +this._periodStartDay=new c.BusinessDay(0,0,0),this._periodEndDay=new c.BusinessDay(0,0,0),this._period=i,this._sessionTgt=e,this._builder=s,this._useBusinessDays=r,this._sessionSrc=r?new o.SessionInfo("Etc/UTC","24x7"):t||e}builder(){return this._builder}alignTimeIfPossible(e){return this.tradingDayToSessionStart(e)}tradingDayToSessionStart(e){return this.moveTo(e),this.startOfBar(0)}indexOfBar(e){if(this._useBusinessDays){const t=c.BusinessDay.fromCalendar(s.get_cal_from_unix_timestamp_ms(this._sessionSrc.timezone,e));return t.before(this._periodStartDay)?a.SessionStage.PRE_SESSION:this._periodEndDay.before(t)?a.SessionStage.POST_SESSION:0}return e=this._periodEnd?a.SessionStage.POST_SESSION:0}startOfBar(e){if(e===a.SessionStage.PRE_SESSION){const e=s.get_cal_from_unix_timestamp_ms(this._sessionTgt.timezone,this._periodStart-1),t=this._sessionTgt.spec.alignToNearestSessionEnd(e,-1);return s.cal_to_utc(this._sessionTgt.timezone,t)-1}return e===a.SessionStage.POST_SESSION||e>0?this._periodEnd:e===a.SessionStage.LASTBAR_SESSION?this._periodLastBarStart:this._periodStart}moveTo(e){const t=s.get_cal_from_unix_timestamp_ms(this._sessionSrc.timezone,e);this._sessionSrc.spec.correctTradingDay(t);const i=s.get_year(t),r=this._indexOfPeriodInYear(t),n=r+this._period,o=this._sessionTgt.spec,a=this._sessionTgt.timezone,l=this._builder.startOfPeriod(a,r,i);this._periodStart=h(o,l);const d=s.clone(l),u=o.businessDaysToCalendarDays(d,1);u>1&&s.add_date(d,u-1),this._periodStartDay=c.BusinessDay.fromCalendar(d);const p=this._builder.startOfPeriod(a,n,i);this._periodEnd=h(o,p);const _=s.clone(p);for(s.add_date(_,-1);o.isCalWeekEnd(_);)s.add_date(_,-1);this._periodEndDay=c.BusinessDay.fromCalendar(_),s.add_date(p,-1),function(e,t){for(;e.isCalWeekEnd(t);)s.add_date(t,-1)}(this._sessionTgt.spec,p),this._periodLastBarStart=h(o,p),(this._periodLastBarStart=this._periodLastBarStart}currentRange(){return{from:this._periodStartDay,to:this._periodEndDay}}indexOfBarInYear(e){const t=s.get_cal_from_unix_timestamp_ms(this._sessionSrc.timezone,e),i=s.get_year(t),r=this._builder.indexOfPeriod(t),o=this._sessionTgt.timezone;let a=this._builder.startOfPeriod(o,r,i),l=h(this._sessionTgt.spec,a);return a=s.get_cal_from_unix_timestamp_ms(s.get_timezone("Etc/UTC"),l),i=0&&(r-=7),(0,n.toInt)((r+i)/7))}class _{indexOfPeriod(e){return s.get_day_of_year(e)-1}startOfPeriod(e,t,i){const r=s.days_per_year(i);return s.get_cal(s.get_timezone("Etc/UTC"),i,s.JANUARY,1+Math.min(t,r))}}class m extends _{constructor(e){super(),this._sessionsSpec=e}indexOfPeriod(e){return super.indexOfPeriod(e)-function(e,t){const i=p(e,t),r=s.get_cal(s.get_timezone("Etc/UTC"),s.get_year(t),s.JANUARY,1);s.add_date(r,7*i);const n=i*e.weekEndsCount()+e.holidaysFromYearStart(r),o=s.get_day_of_year(t)-s.get_day_of_year(r);return n+o-e.calendarDaysToBusinessDays(r,o)}(this._sessionsSpec,e)}startOfPeriod(e,t,i){const r=7-this._sessionsSpec.weekEndsCount(),o=Math.max(0,(0,n.toInt)(t/r)-1),a=s.get_cal(s.get_timezone("Etc/UTC"),i,s.JANUARY,1),l=s.get_days_per_year(a);if(s.add_date(a,7*o),(t-=r*o-this._sessionsSpec.holidaysFromYearStart(a))>0){const e=this._sessionsSpec.businessDaysToCalendarDays(a,t);s.add_date(a,e)}let c=s.get_day_of_year(a)-1;return is.get_days_per_year(r)?this.startOfPeriod(e,0,i+1):(s.add_date(r,a),r)}}class v{indexOfPeriod(e){return s.get_month(e)}startOfPeriod(e,t,i){if(t<0){const e=(0,n.toInt)((11-t)/12);i-=e,t+=12*e}else t>s.DECEMBER&&(i++,t=s.JANUARY);return s.get_cal(s.get_timezone("Etc/UTC"),i,t,1)}}function y(e,t,i,s=!1){const n=r.Interval.parse(e),o=n.multiplier();return n.isMinutes()?new l(60*o,t):n.isSeconds()?new l(o,t):n.isTicks()?new l(1,t):n.isRange()?new l(60*o,t):new d(t,i,o,function(e,t){switch(e){case r.ResolutionKind.Days:return new g(t);case r.ResolutionKind.Weeks:return new f(t);case r.ResolutionKind.Months:return new v}throw new Error(`Unknown dwm resolution: ${e}`)}(n.kind(),t),s)}function S(e,t,i,s,r,n,o){return w(e,t,i,s,r,n,o,0)}function b(e,t,i,s,r,n,o){return w(e,t,i,s,r,n,o,1)}function w(e,t,i,s,n,a,l,c){const h=r.Interval.parse(n+s);if(h.isMonths()){const e=new Date(l);return 0===c&&e.setUTCDate(1),function(e,t){T(e,Math.floor(t/12));let i=e.getUTCMonth()-t%12;i<0&&(T(e,1),i+=12);e.setUTCMonth(i);for(;e.getUTCMonth()!==i;)I(e,1)}(e,a*h.multiplier()),e.getTime()} +const d=new o.SessionInfo("Etc/UTC",e,t,i),u=h.inMilliseconds(),p=h.isDWM();let _;_=p?864e5:60*d.spec.maxTradingDayLength()*1e3;let m=0;m=h.isWeeks()?7:7-d.spec.weekEndsCount();const g=_/u,f=m*g;let v;if(a=g&&(f=_/6048e5*g);return f%1<=Number.EPSILON*Math.ceil(f)?Math.round(f):Math.ceil(f)}function P(e,t){const i=s.clone(t);return e.alignToSessionStart(i),s.cal_to_utc(s.get_timezone(e.timezone()),i)}function x(e,t){const i=s.utc_to_cal(t.timezone,+e);let r=s.get_day_of_week(i),n=s.get_minutes_from_midnight(i);const o=t.spec.findSession(t.spec.getWeekIndex(i),r,n).getEntry();return o.isOvernight()&&n>o.startOffset()+o.length()&&r===o.dayOfWeek()-1&&(r++,n-=1440),r===o.dayOfWeek()&&n>=o.startOffset()&&n{"use strict";i.d(t,{BusinessDay:()=>r});var s=i(41249);class r{constructor(e,t,i){this.year=e,this.month=t,this.day=i}toString(){return`${this.year}-${this.month}-${this.day}`}compareTo(e){return this.year>e.year||this.year===e.year&&this.month>e.month||this.year===e.year&&this.month===e.month&&this.day>e.day?1:this.year===e.year&&this.month===e.month&&this.day===e.day?0:-1}before(e){return-1===this.compareTo(e)}toCalendar(e){return s.get_cal(s.get_timezone("Etc/UTC"),this.year,this.month-1,this.day)}addDays(e){const t=this.toCalendar(s.get_timezone("Etc/UTC"));return s.add_date(t,e),r.fromCalendar(t)}static fromCalendar(e){return new r(s.get_year(e),s.get_month(e)+1,s.get_day_of_month(e))}}},60062:(e,t,i)=>{"use strict";var s;i.d(t,{SessionStage:()=>s}),function(e){e[e.PRE_SESSION=-1]="PRE_SESSION",e[e.POST_SESSION=-2]="POST_SESSION",e[e.LASTBAR_SESSION=-3]="LASTBAR_SESSION"}(s||(s={}))},94421:(e,t,i)=>{"use strict";i.d(t,{extrapolateBarsFrontByCount:()=>n,extrapolateBarsFrontToTime:()=>r});var s=i(60062);function r(e,t,i,s,n=!1){if(t>i){const o=r(e,i,t,s,n);return o.count=-o.count,o}return o(e,t,1,((e,t)=>t>i||0!==s&&e>s),n)}function n(e,t,i,s=!1){const r=i<0?-1:1;return o(e,t,r,((e,t)=>e>=i*r),s)}function o(e,t,i,r,n){let o=0,a=t;e.moveTo(a);let l=0,c=Number.MAX_VALUE,h=!1,d=t;const u=[];for(;!r(o,a);){if(l>15)throw new Error("Internal error 0x10 while extrapolating.");const r=e.indexOfBar(a);if(r===s.SessionStage.PRE_SESSION&&1===i)a=e.startOfBar(0),e.moveTo(a);else if(r===s.SessionStage.PRE_SESSION&&-1===i)a=e.startOfBar(s.SessionStage.PRE_SESSION), +e.moveTo(a);else if(r===s.SessionStage.POST_SESSION&&1===i)a=e.startOfBar(s.SessionStage.POST_SESSION),e.moveTo(a);else{if(r===s.SessionStage.POST_SESSION&&-1===i)throw new Error("Internal error 0x12 while extrapolating.");{const p=e.startOfBar(r);if(p>t&&i>0||t>p&&i<0){if(h&&c===p)throw new Error("Internal error 0x11 while extrapolating.");h=!0,c=p,l=0,o++,d=p,n&&u.push(d)}if(0===r&&-1===i)a=p-1;else{a=e.startOfBar(r+i);const t=e.startOfBar(s.SessionStage.POST_SESSION);a>t&&(e.moveTo(t),a=e.startOfBar(0))}}}l++}return{time:d,times:u,count:o}}},57333:(e,t,i)=>{"use strict";i.d(t,{SessionSpec:()=>v});var s=i(41249),r=i(78071),n=i(54606);function o(e,t){return e.compareTo(t)}class a{constructor(e,t,i){this._dayOfWeek=e,this._start=t,this._length=i}start(){return this._start+s.minutesPerDay*this.sessionStartDaysOffset()}startOffset(){return this._start}sessionStartDaysOffset(){return this._start>=0?0:this._start%s.minutesPerDay==0?-Math.ceil(this._start/s.minutesPerDay):-Math.floor(this._start/s.minutesPerDay)}sessionEndDaysOffset(){const e=this._start+this._length;return e>=0?0:e%s.minutesPerDay==0?-Math.ceil(e/s.minutesPerDay):-Math.floor(e/s.minutesPerDay)}isOvernight(){return this._start<0}dayOfWeek(){return this._dayOfWeek}sessionStartDayOfWeek(){let e=this._dayOfWeek-this.sessionStartDaysOffset();return es.SATURDAY&&(e=1),e}length(){return this._length}weight(){return this._dayOfWeek*s.minutesPerDay+this._start}compareTo(e){const t=this.weight(),i=t+this._length,s=e.weight(),r=s+e._length;return t<=s&&ss?1:-1}contains(e){const t=60*s.get_hours(e)+s.get_minutes(e);let i=s.get_day_of_week(e)-this._dayOfWeek;i>0&&(i-=7);const r=i*s.minutesPerDay+t;return r>=this._start&&r=48&&e<=57}class _{constructor(){this.entries=[],this.firstDayOfWeek=s.MONDAY,this.weekEndsCount=-1,this.maxTradingDayLength=0}parseSessions(e,t){var i;let s=!1;this._clear(),this.timezone=e;const{hasErrors:r,spec:n}=this._parseFirstDayOfWeek(t);if("24x7"===n.toLowerCase())for(const e of d)this.entries.push(_._createSessionEntry(e,0,0,0,0));else{let e=!1;const t=new Map;for(const i of n.split("|")){const r=i.split(":");if(1!==r.length&&2!==r.length){s=!0,u.logError(`Bad session section: ${i}`);continue}const n=1===r.length;if(n){if(e){s=!0,u.logError(`Duplicated default section: ${i}`);continue}e=!0}const o=n?h:_._parseWorkingDays(r[1]);for(const e of o)n&&t.has(e)||t.set(e,r[0])}for(const e of d){const i=t.get(e);if(void 0!==i)for(const t of i.split(",")){const{hasErrors:i,sessionEntry:r}=_._parseSessionEntry(e,t);i&&(s=i),this.entries.push(r)}}} +this.entries.sort(o);const a=new Map;for(const e of this.entries){const t=e.dayOfWeek();a.set(t,e.length()+(null!==(i=a.get(t))&&void 0!==i?i:0))}return this.maxTradingDayLength=0,a.forEach((e=>{this.maxTradingDayLength=Math.max(this.maxTradingDayLength,e)})),this.weekEndsCount=7-a.size,s||r}static parseHolidaysAndCorrections(e,t,i){const r=new Map,n=new Map,o=e=>{const t=this._parseDay(e),i=t.toString(),s=n.get(i);return void 0!==s?s:(n.set(i,t),t)};if(""!==t){const e=[];for(const i of t.split(",")){if(8!==i.length)throw new Error(`bad holiday date: ${i}`);const t=o(i);r.set(t,e)}}if(""===i)return r;const l=s.get_timezone("Etc/UTC");for(const e of i.split(";")){const t=e.split(":");if(2!==t.length)throw new Error(`bad correction section: ${e}`);const i=[];if("dayoff"!==t[0])for(const e of t[0].split(","))i.push(this._parseSessionEntry(1,e).sessionEntry);for(const e of t[1].split(",")){if(8!==e.length)throw new Error(`bad correction date: ${e}`);const t=o(e),n=s.get_day_of_week(s.get_cal(l,t.year,t.month-1,t.day)),c=[];for(const e of i)c.push(new a(n,e.startOffset(),e.length()));r.set(t,c)}}return r}_clear(){this.entries=[],this.timezone="",this.firstDayOfWeek=s.MONDAY,this.weekEndsCount=-1}_parseFirstDayOfWeek(e){const t=e.split(";");if(t.length>2)return u.logError(`Only one \`first day\` specification expected @ session ${e}`),{hasErrors:!0,spec:e};if(1===t.length)return{hasErrors:!1,spec:e};let i=1;let r=t[0].indexOf("-")>=0?NaN:parseInt(t[0]);return isNaN(r)&&(i=0,r=parseInt(t[1])),rs.SATURDAY?(u.logError(`Unexpected day index @ session: ${e}; day index ${r}`),{hasErrors:!0,spec:e}):(this.firstDayOfWeek=r,{hasErrors:!1,spec:t[i]})}static _parseDay(e){const t=parseInt(e.substring(0,4)),i=parseInt(e.substring(4,6)),s=parseInt(e.substring(6,8));return new n.BusinessDay(t,i,s)}static _parseSessionEntry(e,t){let i=!1,s=t.split("-");2!==s.length&&(i=!0,u.logError(`Bad sessions entry: ${t}`),s=["0000","0000"]);let r=0,n=s[0];if(n.includes("F")){const e=n.split("F");n=e[0],r=""!==e[1]?parseInt(e[1]):1}let o=0,a=s[1];if(a.includes("F")){const e=a.split("F");a=e[0],o=""!==e[1]?parseInt(e[1]):1}if(!this._isCorrectSession(n)||!this._isCorrectSession(a))throw new Error(`Incorrect entry syntax: ${t}`);const l=n,c=a;return{hasErrors:i,sessionEntry:this._createSessionEntry(e,_._minutesFromHHMM(l),_._minutesFromHHMM(c),r,o)}}static _isCorrectSession(e){return 4===e.length&&p(e.charCodeAt(0))&&p(e.charCodeAt(1))&&p(e.charCodeAt(2))&&p(e.charCodeAt(3))}static _parseWorkingDays(e){const t=[];for(let i=0;i0&&(t-=r*s.minutesPerDay),n>0&&(i-=n*s.minutesPerDay);return new a(e,t,i-t)}}function m(e,t){return e.compareTo(t)<0}function g(e,t){const i=(0,r.lowerbound)(e,t,((e,t)=>-1===e.day.compareTo(t)));return i===e.length?null:e[i]}const f=621672192e5;class v{constructor(e="Etc/UTC",t="0000-0000",i="",r=""){ +this._entries=[],this._firstDayOfWeek=s.MONDAY,this._entriesHash=new Map,this._holidayAndCorrectionMap=new Map,this._holidaySessions=[],t=function(e){const t=e.lastIndexOf("/");return-1===t?e:e.slice(t+1)}(t);const n=new _;n.parseSessions(e,t),this._entries=n.entries,this._timezone=n.timezone,this._spec=t,this._firstDayOfWeek=n.firstDayOfWeek,this._weekEndsCount=n.weekEndsCount,this._maxTradingDayLength=n.maxTradingDayLength;const o=_.parseHolidaysAndCorrections(e,i,r),a=s.get_timezone(e);this._isThereCorrections=""!==i||""!==r,o.forEach(((e,t)=>{this._holidayAndCorrectionMap.set(t.toString(),e),this._holidaySessions.push({day:t,sessions:e});const i=this.getWeekIndex(t.toCalendar(a));this._entriesHash.set(i,null)})),this._holidaySessions.sort(((e,t)=>e.day.compareTo(t.day)))}entries(){return this._entries}timezone(){return this._timezone}spec(){return this._spec}firstDayOfWeek(){return this._firstDayOfWeek}addSessionEntry(e,t,i,r,n){0===i&&(i=s.minutesPerDay),r===n&&i<=t&&(r+=1),r>0&&(t-=r*s.minutesPerDay),n>0&&(i-=n*s.minutesPerDay);const o=i-t;this._entries.push(new a(e,t,o))}longestSessionLength(){let e=0,t=0;for(const t of this._holidaySessions)t.sessions.forEach((t=>{e=Math.max(e,t.length())}));return this._entries.forEach((e=>{t=Math.max(t,e.length())})),Math.max(e,t)}isWeekEnd(e){const t=(0,r.lowerbound)(this._entries,new a(e,0,0),((e,t)=>e.dayOfWeek()this._entries.length-1||this._entries[t].dayOfWeek()!==e}isCalWeekEnd(e){const t=s.get_day_of_week(e);if(!this._isThereCorrections)return this.isWeekEnd(t);const i=n.BusinessDay.fromCalendar(e),r=this._holidayAndCorrectionMap.get(i.toString());return void 0===r?this.isWeekEnd(t):0===r.length}hasWeekEnds(){return this.weekEndsCount()>0}weekEndsCount(){return this._weekEndsCount}maxTradingDayLength(){return this._maxTradingDayLength}holidaysFromYearStart(e){if(!this._isThereCorrections)return 0;const t=s.get_timezone(this._timezone),i=new n.BusinessDay(s.get_year(e),s.JANUARY,1),r=n.BusinessDay.fromCalendar(e);let o=0;const a=this._selectHolidays(i,r);for(let e=0;et.start()%e==0&&t.length()%e==0))}indexOfSession(e,t,i){const n=this._getEntriesForWeek(e);let o=(0,r.lowerbound)(n,new a(t,i,0),m);if(o!==n.length)return new l(e,o,n);let c=e;const h=7-t+this._firstDayOfWeek-1;for(i=-(s.minutesPerDay-i+h*s.minutesPerDay);;){c++;const e=this._getEntriesForWeek(c);if(0!==e.length)return o=(0,r.lowerbound)(e,new a(this._firstDayOfWeek,i,0),m),new l(c,o,e)}}findSession(e,t,i,s=0){const r=this.indexOfSession(e,t,i),n=r.entries;let o=r.entryIndex;if(0!==s){const e=n[o].dayOfWeek(),t=s>0?1:-1;for(;;){const i=o+t;if(i<0||i>=n.length||n[i].dayOfWeek()!==e)break;o=i}}return new l(r.weekIndex,o,n)}getWeekIndex(e){if(!this._isThereCorrections)return 0 +;const t=s.get_day_of_week(e)-s.SUNDAY,i=s.get_timezone("Etc/UTC"),r=s.get_cal(i,s.get_year(e),s.get_month(e),s.get_day_of_month(e)-t);return Math.floor((r.getTime()+f)/1e3/86400/7)}correctTradingDay(e){const t=s.get_day_of_week(e),i=60*s.get_hours(e)+s.get_minutes(e),r=this.getWeekIndex(e),n=this.findSession(r,t,i,0),o=n.getEntry().dayOfWeek()-t+7*(n.weekIndex-r);return 0!==o&&s.add_date(e,o),e}alignToSessionStart(e,t=0){const i=s.get_day_of_week(e),r=60*s.get_hours(e)+s.get_minutes(e),n=this.getWeekIndex(e),o=this.findSession(n,i,r,t),a=o.getEntry(),l=a.dayOfWeek()-i+7*(o.weekIndex-n);0!==l&&s.add_date(e,l);const c=a.startOffset();return s.set_hms(e,c/60,c%60,0,0,s.get_timezone(this._timezone)),a.length()}businessDaysToCalendarDays(e,t){let i=this.getWeekIndex(e),r=s.get_day_of_week(e),n=0,o=0;for(;oi);)e[a].dayOfWeek()=t)return n}i++,r=s.SUNDAY}return n}calendarDaysToBusinessDays(e,t){let i=this.getWeekIndex(e),r=s.get_day_of_week(e),n=0,o=0;for(;ni);)e[a].dayOfWeek()=t)return o}i++,r=s.SUNDAY}return o}alignToNearestSessionStart(e,t){return this._alignToNearestSessionValue(e,t,this._entrySessionStart.bind(this))}alignToNearestSessionEnd(e,t){return this._alignToNearestSessionValue(e,t,this._entrySessionEnd.bind(this))}leftBorderOfDailyBar(e){const t=this._getEntriesForDay(e);return 0===t.length?null:(t.sort(o),this._getLeftEntryBorder(e,t[0]))}bordersOfDailyBar(e){const t=this._getEntriesForDay(e);if(0===t.length)return null;t.sort(o);const i=this._getLeftEntryBorder(e,t[0]),r=t[t.length-1],n=s.clone(e);let a=60*(r.startOffset()+r.length())-1;const l=Math.floor(a/3600);return a-=3600*l,s.set_hms(n,l,a/60,a%60,0,s.get_timezone(this._timezone)),{from:i,to:n}}getEntriesForWeekByCalendar(e){const t=this.getWeekIndex(e);return this._getEntriesForWeek(t)}_getEntriesForWeek(e){let t=this._entriesHash.get(e);if(void 0===t)return this._entries;if(null!==t)return t;const i=s.get_timezone(this._timezone);t=this._entries.slice();const r=this._weekIndexToCalendar(e),a=this._weekIndexToCalendar(e+1),l=n.BusinessDay.fromCalendar(r),c=n.BusinessDay.fromCalendar(a),h=this._selectHolidays(l,c);for(const e of h){const r=e.day.toCalendar(i),n=s.get_day_of_week(r);t=t.filter((e=>e.dayOfWeek()!==n)),t=t.concat(e.sessions)}return t.sort(o),this._entriesHash.set(e,t),t}_selectHolidays(e,t){const i=[];let s=e;for(;;){const e=g(this._holidaySessions,s);if(null===e)return i;if(!e.day.before(t))return i;i.push(e),s=e.day.addDays(1)}}_weekIndexToCalendar(e){const t=1e3*(86400*e*7+86400)-f,i=s.get_cal_from_unix_timestamp_ms(s.get_timezone("Etc/UTC"),t),r=s.get_timezone("Etc/UTC");return s.get_cal(r,s.get_year(i),s.get_month(i),s.get_day_of_month(i))}_alignToNearestSessionValue(e,t,i){ +const r=s.get_day_of_week(e),n=60*s.get_hours(e)+s.get_minutes(e),o=this.getWeekIndex(e);let a=this.findSession(o,r,n);if(a.getEntry().contains(e)&&o===a.weekIndex||1===t)return i(a,s.clone(e),t);const c=a.getEntry(),h=c.contains(e),d=o===a.weekIndex,u=c.sessionStartDaysOffset()-c.dayOfWeek()>=0;if(h&&(d||u))return i(a,s.clone(e),t);let p=a.entryIndex-1;if(p<0){let e=a.weekIndex,t=a.entries;for(;p<0;)e--,t=this._getEntriesForWeek(e),p+=t.length;a=new l(e,p,t)}else a=new l(a.weekIndex,p,a.entries);return i(a,s.clone(e),t)}_entrySessionStart(e,t,i){return this._entrySessionValue(e,t,i,(e=>60*e.start()))}_entrySessionEnd(e,t,i){return this._entrySessionValue(e,t,i,(e=>60*(e.start()+e.length())-1))}_entrySessionValue(e,t,i,r){let n=s.get_day_of_week(t);const o=e.getEntry();let a=o.dayOfWeek()-o.sessionStartDaysOffset();const l=this.getWeekIndex(t);let c=e.weekIndex-l,h=!1;if(a0&&i>=0||c<0&&i<0)&&s.add_date(t,7*c),!o.contains(t)){let e=a-n;h&&i<0&&(e=-(7-a+n)),s.add_date(t,e),n=s.get_day_of_week(t)}o.isOvernight()&&n===o.dayOfWeek()&&s.add_date(t,-o.sessionStartDaysOffset());let d=r(o);const u=Math.floor(d/3600);return d-=3600*u,s.set_hms(t,u,d/60,d%60,0,s.get_timezone(this._timezone)),t}_getEntriesForDay(e){const t=s.get_day_of_week(e);return this._getEntriesForWeek(this.getWeekIndex(e)).filter((e=>e.dayOfWeek()===t))}_getLeftEntryBorder(e,t){const i=s.clone(e),r=t.startOffset();return s.set_hms(i,r/60,r%60,0,0,s.get_timezone(this._timezone)),i}}},81049:(e,t,i)=>{"use strict";i.d(t,{barFunctionByStyle:()=>r});var s=i(13497);function r(e,t){switch(e){case 12:return(0,s.barFunction)("low","low","close");case 2:case 14:case 15:case 3:case 10:case 13:return(0,s.barFunction)(null!=t?t:"close");default:return(0,s.barFunction)("close","open")}}},36112:(e,t,i)=>{"use strict";i.d(t,{BarsMarksContainer:()=>m});var s=i(50151),r=i(59224),n=i(56840),o=i.n(n),a=i(14483),l=i(36274),c=i(1722),h=i(42960),d=i(14292),u=i(28558);const p=(0,r.getLogger)("Chart.BarsMarksContainer"),_=Math.round(new Date(2037,0,1).getTime()/1e3);class m extends d.DataSource{constructor(e,t,i){const r=e.onWidget();let n;n=r?!e.hideIdeas():!!a.enabled("bars_marks")&&o().getBool("BarsMarksContainer.visibile",!1),t.merge({visible:n}),t.childs().visible.subscribe(null,(t=>{r||e.isSnapshot()||!a.enabled("bars_marks")||o().setValue("BarsMarksContainer.visibile",!!t.value())})),super(i),this._paneViews=[],this._model=e,this._properties=t,this._requests=[],this._marks={},this._loadedRange=null,this._getDataTimeout=null,this._collectedRange=null,this._lastRange=null;const l=this._model.mainSeries();l.onSymbolIntervalChanged().subscribe(this,this.clearMarks),l.dataEvents().symbolResolved().subscribe(this,this.clearMarks),l.dataEvents().completed().subscribe(this,(()=>{var e,t;const i=l.data();if(0===i.size())return;const r=(0,s.ensureNotNull)(i.first()).index,n=(0,s.ensureNotNull)(i.last()).index,o=this.timeScale();this.getData({start:null!==(e=o.indexToTimePoint(r))&&void 0!==e?e:1/0, +end:null!==(t=o.indexToTimePoint(n))&&void 0!==t?t:-1/0})})),this._initialize(),this._pinnedTooltips={}}destroy(){const e=this._model.mainSeries();e.onSymbolIntervalChanged().unsubscribeAll(this),e.dataEvents().symbolResolved().unsubscribeAll(this),e.dataEvents().completed().unsubscribeAll(this),super.destroy()}properties(){return this._properties}marks(){return this._marks}pinTooltip(e,t){this._pinnedTooltips[e]=t}timeScale(){return this._model.timeScale()}getIntervalInTicks(){const e=this._model.mainSeries().properties().childs().interval.value(),t=l.Interval.parse(e);if(!t.isValid())throw new TypeError("Unexpected interval");return t.isRange()?60:t.inMilliseconds()/1e3}getVisibleTickMarksRange(){var e,t;if(this.timeScale().isEmpty())return{start:0,end:0};const i=(0,s.ensureNotNull)(this.timeScale().visibleBarsStrictRange()),{firstIndex:r,lastIndex:n}=(0,s.ensureNotNull)(this.timeScale().points().range().value());if(!(i.lastBar()>r&&i.firstBar(){var r,n;const o=this._marks[s],a=o.tickmark;a>=(null!==(r=t.start)&&void 0!==r?r:1/0)&&a<=(null!==(n=t.end)&&void 0!==n?n:-1/0)+i&&e.push(o)})),e}getPublishedPlates(){const e={};return window.is_authenticated?(this.getVisibleRangePlates().forEach((t=>{t.is_public&&(this._pinnedTooltips[t.id]||t.user__id===window.user.id)&&(e[t.id]=t)})),e):e}filterDisplayedPlates(e){const t=e.reduce(((e,t)=>{const i=this._getIndex(t.tickmark);return null!==i&&(e[i]=e[i]||[],e[i].push(t)),e}),{});return Object.keys(t).reduce(((e,i)=>{let s=t[i];return s=s.sort(((e,t)=>t.views_count-e.views_count)),s=s.slice(0,10),e.concat(s)}),[])}getPlatesViewData(){var e,t,i;const r=this._model.mainSeries();if(r.data().isEmpty())return[];const n=(0,h.isPriceSourceStyle)(r.style())?r.barFunction():null,o=this.filterDisplayedPlates(this.getVisibleRangePlates()),a={},l=null!==(e=this._model.lastHittestData())&&void 0!==e?e:this._model.lastSelectedHittestData();let c=null;null!==l&&this._model.hoveredSource()===this&&(c=null!==(t=l.activeItem)&&void 0!==t?t:null);const d=[];for(const e of o){const t=(0,s.ensureNotNull)(this._getIndex(e.tickmark)),i=this._getBar(t);if(null===i)continue;const r=this._layout(e.direction),o=this._theme(e.direction),l=c===e.id,h=this.timeScale().indexToCoordinate(t),u=this._offset(r,i,n),p=(0,s.ensureNotNull)(this.priceScale()).isInverted();let _=0;t in a||(a[t]={up:0,down:0}),_=a[t][r]++,d.push({id:e.id,x:h,y:u,yInverted:p,order:_,direction:r,theme:o,hovered:l,pinned:!0===this._pinnedTooltips[e.id],user__id:e.user__id,label:e.label,labelFontColor:e.labelFontColor||"#444",minSize:e.minSize||5,...this._plateViewData(e)})}const u=d.filter((e=>!0===e.hovered)) +;for(let e=0;ee.hovered&&!t.hovered?1:0)),d}priceAxisViews(){return null}updateAllViews(e){for(const t of this._paneViews)t.update(e)}updateAllViewsAndRepaint(){this.updateAllViews((0,u.sourceChangeEvent)(this.id())),this._model.updateSource(this)}roundRange(e){return{start:Math.round(e.start),end:Math.round(e.end)}}refreshData(){null!==this._lastRange&&this.getData(this._lastRange)}getData(e){(0,c.isNumber)(e.start)&&(0,c.isNumber)(e.end)?(this._lastRange=e,e.end=_,this._pushGetDataStack(Object.assign({},e))):p.logError("Wrong range")}clearMarks(){this._abortAllRequests(),this._marks={},this._loadedRange=null}isUserDeletable(){return!1}isSavedInChart(e){return!1}isSpeciallyZOrderedSource(){return!0}showInObjectTree(){return!1}_plateViewData(e){return{}}_layout(e){switch(e){default:case 0:case 2:case 3:case 4:case 5:case 6:return"up";case 1:return"down"}}_theme(e){switch(e){default:case 0:return"neutral";case 1:case 5:return"green";case 2:case 6:return"red";case 3:return"yellow";case 4:return"blue"}}_offset(e,t,i){let r;switch(e){default:case"up":r=null===i?t[2]:i(t);break;case"down":r=null===i?t[3]:i(t)}return(0,s.ensureNotNull)(this.priceScale()).priceToCoordinate(r,(0,s.ensureNotNull)((0,s.ensureNotNull)(this.ownerSource()).firstValue()))}_getIndex(e){return this.timeScale().timePointToIndex(e)}_getBar(e){return this._model.mainSeries().data().valueAt(e)}_rangeDifference(e){return e=Object.assign({start:1/0,end:-1/0},e),this._loadedRange&&(e.startthis._loadedRange.end&&(e.start=this._loadedRange.end)),e}_rangeUnion(e,t){return e=Object.assign({start:1/0,end:-1/0},e),t&&(e.start=Math.min(t.start,e.start),e.end=Math.max(t.end,e.end)),e}_pushGetDataStack(e){(0,c.isNumber)(e.start)&&(0,c.isNumber)(e.end)?(this._getDataTimeout&&clearTimeout(this._getDataTimeout),this._collectedRange=this._rangeUnion(e,this._collectedRange),this._getDataTimeout=setTimeout((()=>{this._getData(this._collectedRange),this._getDataTimeout=this._collectedRange=null}),300)):p.logError("Wrong tickmark range")}_abortAllRequests(){this._requests.forEach((e=>{e.cancel()})),this._requests=[],this._getDataTimeout&&clearTimeout(this._getDataTimeout),this._getDataTimeout=this._collectedRange=null}}},12500:(e,t,i)=>{"use strict";i.d(t,{BarsRange:()=>r});var s=i(50151);class r{constructor(e,t){(0,s.assert)(e<=t,"The last bar in the bars range should be greater than or equal to the first bar"),this._firstBar=e,this._lastBar=t}firstBar(){return this._firstBar}lastBar(){return this._lastBar}count(){return this._lastBar-this._firstBar+1}contains(e){return this._firstBar<=e&&e<=this._lastBar}equals(e){return this._firstBar===e.firstBar()&&this._lastBar===e.lastBar()}static compare(e,t){return null===e||null===t?e===t:e.equals(t)}}},31281:(e,t,i)=>{"use strict";i.d(t,{ChartModelBase:()=>ys}) +;var s=i(12481),r=i(27788),n=i(50151),o=i(86441),a=i(24377),l=i(33013),c=i(11542),h=i(45345),d=i(11014),u=i(51768),p=i(51608),_=i(76422),m=i(11417),g=i(67980),f=i(3587),v=i(78071),y=i(92249);function S(e){return(0,y.isLineTool)(e)&&e.boundToSymbol()||!1}class b{constructor(){this._items=[],this._set=new Set,this._dataSourcesCache=null,this._customSourcesCache=null,this._lineSourcesCache=null}isEmpty(){return 0===this._items.length}add(e){if(this._items.length>0&&!S(this._items[0])&&this.clear(),S(e)){const t=(0,v.lowerbound)(this._items,e,((e,t)=>e.zorder()!(0,f.isDataSource)(e)))),this._customSourcesCache}checkLineToolSelection(){this._items.forEach((e=>(0,y.isLineTool)(e)&&e.calcIsActualSymbol())),this._items=this._items.filter((e=>!(0,y.isLineTool)(e)||e.isActualSymbol())),this._invalidateCache()}remove(e){this._items=this._items.filter((t=>t!==e)),this._set.delete(e),this._invalidateCache()}clear(){this._items=[],this._set.clear(),this._invalidateCache()}_invalidateCache(){this._customSourcesCache=null,this._dataSourcesCache=null,this._lineSourcesCache=null}}var w=i(6674),C=i(33703),P=i(52329),x=i(56827),T=i(36274),I=i(46100),M=i(88640),A=i(29764),L=i(46501);class k{constructor(e){this._rendererOptions={borderSize:1,additionalPaddingInner:0,fontSize:NaN,font:"",color:"",paneBackgroundColor:"",paddingBottom:0,paddingInner:0,paddingOuter:0,paddingTop:0,lineSpacing:0},this._chartModel=e}options(){const e=this._rendererOptions,t=this._chartModel.properties().childs(),i=t.scalesProperties.childs().fontSize.value();return e.fontSize!==i&&(e.fontSize=i,e.font=(0,A.makeFont)(i,L.CHART_FONT_FAMILY,""),e.paddingTop=i/12*2.5,e.paddingBottom=i/12*2.5,e.paddingInner=i/12*4,e.additionalPaddingInner=i/12*4,e.paddingOuter=i/12*4,e.lineSpacing=i/12*2),e.color=t.scalesProperties.childs().textColor.value(),e.paneBackgroundColor=t.paneProperties.childs().background.value(),this._rendererOptions}}var D=i(74970),E=i(94739),V=i(12442),B=i(71766),R=i(85804),N=i(15742),O=i(14483),F=i(42960),W=i(16776),H=i(28558);const z=new B.PriceFormatter,U="sessions";class j extends N.CustomSourceBase{constructor(e,t,i){super(e,t),this._studySource=null,this._paneViews=[],this._metaInfo=null,this._destroyed=!1,this._isStarted=!1,this._loadedGraphics=null,this._doubleClickHandler=i,this._properties=new I.DefaultProperty("sessions"),(0,R.applyDefaultsOverrides)(this._properties.childs().graphics,void 0,!1,U), +this._removeDuplicateProperties(),this._properties.subscribe(this,this._onPropertiesChanged),this._requestAndProcessMetaInfo(),t.timeScale().onReset().subscribe(this,this._clearData),t.timeScale().logicalRangeChanged().subscribe(this,this.updateAllViews.bind(this,(0,H.viewportChangeEvent)())),t.mainSeries().sessionIdProxyProperty().subscribe(this,this._updateVisibleOfPreAndPostMarketBackground),t.mainSeries().properties().childs().interval.subscribe(this,this._processHibernate),this._updateVisibleOfPreAndPostMarketBackground(t.mainSeries().properties().childs().sessionId)}applyOverrides(e){(0,R.applyPropertiesOverrides)(this._properties.childs().graphics,void 0,!1,e,U),this._model.updateSource(this)}start(){this._isStarted=!0,this._processHibernate()}restart(){this._clearData(),O.enabled("stop_study_on_restart")&&this.stop(),this.start()}isStarted(){return this._isStarted}stop(){this._isStarted=!1,null!==this._studySource&&this._studySource.stop()}isHoveredEnabled(){return!1}paneViews(e){return this._paneViews}updateAllViews(e){this._paneViews.forEach((t=>t.update(e)))}updateViewsForPane(e,t){this.updateAllViews(t)}destroy(){this._destroyed=!0,null!==this._studySource&&(this._studySource.dataCleared().unsubscribeAll(this),this._studySource.dataUpdated().unsubscribeAll(this),this._studySource.destroy(),this._studySource=null),this._model.timeScale().logicalRangeChanged().unsubscribeAll(this),this._model.timeScale().onReset().unsubscribeAll(this),this._model.mainSeries().sessionIdProxyProperty().unsubscribeAll(this),this._model.mainSeries().properties().childs().interval.unsubscribeAll(this),this._properties.unsubscribeAll(this)}series(){return this._model.mainSeries()}priceScale(){return this.series().priceScale()}graphics(){return this._loadedGraphics||(0,n.ensureNotNull)(this._studySource).graphics()}valueAt(e,t){return null}properties(){return this._properties}graphicsInfo(){return(0,n.ensureNotNull)(this._metaInfo).graphics}firstValue(e){return this._model.mainSeries().firstValue()}formatter(){return z}state(e){const t={properties:this._properties.state()};return e&&null!==this._metaInfo&&(t.data={graphics:(0,V.saveStudyGraphics)(this.graphics(),this._model.timeScale().visibleBarsStrictRange()),metaInfo:this._metaInfo}),t}restoreState(e,t){const i=e.properties;this._migrateOutOfSessionProperty(i),this._properties.mergeAndFire(i),this._removeDuplicateProperties(),this._updateVisibleOfPreAndPostMarketBackground(this._model.mainSeries().properties().childs().sessionId),void 0!==e.data&&t&&(this._loadStudyGraphics(e.data.graphics),this._setMetaInfo(e.data.metaInfo),this._createPaneViews())}restoreOldState(e,t){const i={properties:{graphics:e.state.graphics}};void 0!==e.data&&void 0!==e.metaInfo&&t&&(i.data={metaInfo:e.metaInfo,graphics:e.data.graphics}),this.restoreState(i,t)}applyPreferences(e){this._properties.mergePreferences(e)}metaInfo(){return(0,n.ensureNotNull)(this._metaInfo)}async _requestAndProcessMetaInfo(){if(this._model.isSnapshot())return;const e=await(0,D.studyMetaInfoRepository)().findById({ +type:"java",studyId:"Sessions@tv-basicstudies"});this._destroyed||null===this._loadedGraphics&&(this._setMetaInfo(e),null!==this._metaInfo&&(this._studySource=new E.StudyDataSource(this._model.chartApi(),this._model.mainSeries().seriesSource(),"sessions_",this._metaInfo),this._createPaneViews(),this._studySource.dataCleared().subscribe(this,this.updateAllViews.bind(this,(0,H.sourceChangeEvent)(this.id()))),this._studySource.dataUpdated().subscribe(this,this.updateAllViews.bind(this,(0,H.sourceChangeEvent)(this.id()))),this._studySource.setInputs({}),this._processHibernate()))}_loadStudyGraphics(e){const t=e.backgrounds;if(void 0!==t){const e=t.findIndex((e=>"inSession"===e.styleId));-1!==e&&t.splice(e,1)}this._loadedGraphics=(0,V.loadStudyGraphics)(e)}_setMetaInfo(e){const t=e.graphics.backgrounds;void 0!==t&&void 0!==t.inSession&&delete t.inSession,this._metaInfo=e}_updateVisibleOfPreAndPostMarketBackground(e){const t=!(0,F.isRegularSessionId)(e.value());this._outOfSessionVisibilityProperty().setValue(t),this._preMarketVisibilityProperty().setValue(t),this._postMarketVisibilityProperty().setValue(t)}_clearData(){null!==this._studySource&&this._studySource.clearData()}_createPaneViews(){const e={doubleClickHandler:this._doubleClickHandler};(0,V.createGraphicsPaneViews)(this,this._model,e).then((e=>{this._paneViews=e,this._model.lightUpdate()}))}_onPropertiesChanged(){this._processHibernate(),this.updateAllViews((0,H.sourceChangeEvent)(this.id()))}_processHibernate(){if(null!==this._studySource){const e=this._canBeHibernated(),t=this._isHibernated(),i=this._studySource.isStarted();!t&&e&&i?this._studySource.stop():!t||e||i||this._studySource.start()}}_canBeHibernated(){const e=this._model.mainSeries(),t=this._preMarketVisibilityProperty().value()&&this._postMarketVisibilityProperty().value()&&this._outOfSessionVisibilityProperty().value();return e.isDWM()||!t&&!this._vertLinesVisibleProperty().value()}_isHibernated(){return this._isStarted&&(null===this._studySource||!this._studySource.isStarted())}_outOfSessionVisibilityProperty(){return this._properties.childs().graphics.childs().backgrounds.childs().outOfSession.childs().visible}_preMarketVisibilityProperty(){return this._properties.childs().graphics.childs().backgrounds.childs().preMarket.childs().visible}_postMarketVisibilityProperty(){return this._properties.childs().graphics.childs().backgrounds.childs().postMarket.childs().visible}_vertLinesVisibleProperty(){return this._properties.childs().graphics.childs().vertlines.childs().sessBreaks.childs().visible}_removeDuplicateProperties(){this._properties.hasChild("properties")&&(this._properties.removeProperty("properties"),(0,I.saveDefaultProperties)(!0),this._properties.childChanged(null,""),(0,I.saveDefaultProperties)(!1))}_migrateOutOfSessionProperty(e){const t=e.graphics.backgrounds;if(void 0!==t){const i=t.outOfSession;i.color===(0,n.ensureDefined)(W.sessionsPreferencesDefault.graphics.backgrounds).outOfSession.color||"postMarket"in t||(e.graphics.backgrounds={...t,postMarket:{color:i.color, +transparency:i.transparency,visible:i.visible},preMarket:{color:i.color,transparency:i.transparency,visible:i.visible}})}}}var G=i(28853),q=i(57898),$=i(97145),Y=i(83669),K=i(91280),Z=i(42226),X=i(39875),J=i(59224),Q=i(36174),ee=i(12812),te=i(49535),ie=i(42856),se=i(1722),re=i(29921),ne=i(80842),oe=i(98517);const ae=new Map([["price",e=>(0,ne.isPriceDataSource)(e)],["trading",e=>(0,y.isTrading)(e)],["drawing",e=>(0,y.isLineTool)(e)&&!(0,y.isTrading)(e)&&!e.isPhantom()],["drawingsForAllSymbols",e=>(0,y.isLineTool)(e)&&!(0,y.isTrading)(e)&&!e.isPhantom()],["phantom",e=>(0,y.isLineTool)(e)&&e.isPhantom()],["restRowSources",e=>!(0,y.isLineTool)(e)&&!(0,y.isTrading)(e)],["legendViewSources",e=>(0,ne.isPriceDataSource)(e)||(0,y.isStudyLineTool)(e)],["leftPriceScale",(e,t)=>"left"===ce(e,t)],["rightPriceScale",(e,t)=>"right"===ce(e,t)],["overlayPriceScale",(e,t)=>"overlay"===ce(e,t)]]),le=new Map([["price","visibleSorted"],["trading","visibleSorted"],["drawing","visibleSorted"],["drawingsForAllSymbols","allSorted"],["phantom","visibleSorted"],["restRowSources","visibleSorted"],["legendViewSources","visibleSorted"],["leftPriceScale","visibleSorted"],["rightPriceScale","visibleSorted"],["overlayPriceScale","visibleSorted"]]);function ce(e,t){const i=e.priceScale();return null===i?"overlay":t.priceScalePosition(i)}class he{constructor(e){this._groupedSources=new Map,this._sources=null,this._pane=e}clear(){this._groupedSources.clear(),this._sources=null}destroy(){this.clear()}all(){return this._groupedSources.has("visibleSorted")||this._sortSources(),(0,n.ensureDefined)(this._groupedSources.get("visibleSorted"))}allIncludingHidden(){return this._groupedSources.has("allSorted")||this._sortSources(),(0,n.ensureDefined)(this._groupedSources.get("allSorted"))}allExceptSpecialSources(){if(!this._groupedSources.has("exceptSpecial")){const e=this.allIncludingHidden().filter((e=>!e.isSpeciallyZOrderedSource()));this._groupedSources.set("exceptSpecial",e)}return(0,n.ensureDefined)(this._groupedSources.get("exceptSpecial"))}tradingSources(){return this._getSourcesByGroupType("trading")}priceSources(){return this._getSourcesByGroupType("price")}lineSources(){return this._getSourcesByGroupType("drawing")}lineSourcesForAllSymbols(){return this._getSourcesByGroupType("drawingsForAllSymbols")}phantomSources(){return this._getSourcesByGroupType("phantom")}allExceptLineAndTradingSources(){return this._getSourcesByGroupType("restRowSources")}hitTestSources(){if(!this._groupedSources.has("hitTest")){const e=this.allExceptLineAndTradingSources().concat(this.lineSources());this._groupedSources.set("hitTest",e)}return(0,n.ensureDefined)(this._groupedSources.get("hitTest"))}generalSources(){if(!this._groupedSources.has("general")){const e=this.allExceptLineAndTradingSources().concat(this.lineSources());this._groupedSources.set("general",(0,oe.sortSources)(e))}return(0,n.ensureDefined)(this._groupedSources.get("general"))}leftPriceScalesSources(){return this._getSourcesByGroupType("leftPriceScale")}rightPriceScalesSources(){ +return this._getSourcesByGroupType("rightPriceScale")}overlayPriceScaleSources(){return this._getSourcesByGroupType("overlayPriceScale")}legendViewSources(){return this._getSourcesByGroupType("legendViewSources")}_getSourcesByGroupType(e){const t=(0,n.ensureDefined)(le.get(e));return this._groupedSources.has(t)?this._groupedSources.has(e)||this._groupSources(e):(this._sortSources(),this._groupSources(e)),(0,n.ensureDefined)(this._groupedSources.get(e))}_sortSources(){null===this._sources&&(this._sources=this._pane.dataSources());const e=(0,oe.sortSources)(this._sources),t=e.filter((e=>!(0,y.isLineTool)(e)||e.isActualSymbol()&&e.isActualCurrency()&&e.isActualUnit()));this._groupedSources.set("allSorted",e),this._groupedSources.set("visibleSorted",t)}_groupSources(e){const t=(0,n.ensureDefined)(le.get(e)),i=ae.get(e);if(void 0!==i){const s=(0,n.ensureDefined)(this._groupedSources.get(t)).filter((e=>i(e,this._pane)));this._groupedSources.set(e,s)}}}var de=i(15367),ue=i(34256),pe=i(78211),_e=i(76544),me=i(18611),ge=i(26512),fe=i(60521),ve=i(37160);function ye(e,t,i){const s=e.div(t).toNumber();return Math.abs(Math.round(s)-s)100)throw new Error("something wrong with base")}}}tickSpan(e,t,i){const s=0===this._base?0:1/this._base,r=Math.min(1e-14,(e-t)/1e3);let n=Math.pow(10,Math.max(0,Math.ceil((0,ve.log10)(e-t)))),o=0,a=this._integralDividers[0];for(;;){const e=(0,ve.greaterOrEqual)(n,s,r)&&n>s+r,t=(0,ve.greaterOrEqual)(n,i*a,r),l=(0,ve.greaterOrEqual)(n,1,r),c=new fe.Big(n).div(a),h=0===s||ye(c,s,r);if(!(e&&t&&l&&h))break;n=c.toNumber(),a=this._integralDividers[++o%this._integralDividers.length]}if(n<=s+r&&(n=s),n=Math.max(1,n),this._fractionalDividers.length>0&&(0,ve.equal)(n,1,r))for(o=0,a=this._fractionalDividers[0];;){const e=(0,ve.greaterOrEqual)(n,i*a,r)&&n>s+r,t=new fe.Big(n).div(a),l=0===s||ye(t,s,r);if(!e||!l)break;n=t.toNumber(),a=this._fractionalDividers[++o%this._fractionalDividers.length]}return n}}class Ce{constructor(e,t,i,s){this._marks=null,this._priceScale=e,this._base=t,this._coordinateToLogicalFunc=i,this._logicalToCoordinateFunc=s}base(){return this._base}setBase(e){if(e<0)throw new Error("base < 0");this._base=e}tickSpan(e,t,i=0){if(e{const o=r.tickSpan(e,t,n);return o>i?Math.min(o,s):s}),1/0);return o>0&&isFinite(o)?o:e-t}rebuildTickMarks(){this._marks=null}marks(){ +return null===this._marks&&(this._marks=this._rebuildTickMarksImpl()),this._marks}_fontHeight(){return this._priceScale.fontSize()}_tickMarkHeight(){return Math.ceil(2.5*this._fontHeight())}_rebuildTickMarksImpl(){const e=this._priceScale,t=[],i=e.mainSource();if(e.isEmpty()||null===i)return t;let s=i.firstValue();null===s&&(s=0);const r=e.height(),n=this._coordinateToLogicalFunc(r-1,s),o=this._coordinateToLogicalFunc(0,s),a=Math.max(n,o),l=Math.min(n,o);if(a===l)return t;let c=this.tickSpan(a,l),h=a%c;h+=h<0?c:0;const d=a>=l?1:-1;let u=null;const p=e.formatter();let _=NaN;for(let i=a-h;i>l;i-=c){i===_&&(c=this.tickSpan(a,l,c)),_=i;const r=this._logicalToCoordinateFunc(i,s);null!==u&&Math.abs(r-u){const e=this.mainSource();if(e&&e.model()){const t=e.model().paneForSource(e);t&&e.model().updatePane(t)}})),this._scalesProperties.subscribe(this,(()=>{this._marksCache=null})),this._properties.childs().lockScale.subscribe(this,this._updateResetAvailableValue), +this._properties.childs().autoScale.subscribe(this,this._updateResetAvailableValue),this._updateResetAvailableValue(),this.setId((0,Q.randomHash)())}id(){return this._id}setId(e){this._id=e}isLog(){return this._properties.childs().log.value()}isPercentage(){return this._properties.childs().percentage.value()}isInverted(){return this._properties.childs().isInverted.value()}isIndexedTo100(){return this._properties.childs().indexedTo100.value()}isAutoScale(){return this._properties.childs().autoScale.value()&&!this.isLockScale()}isLockScale(){return this._properties.childs().lockScale.value()}isRegular(){return!this.isPercentage()&&!this.isLog()&&!this.isIndexedTo100()}properties(){return this._properties}height(){return this.m_height}setHeight(e){this.m_height!==e&&(this.m_height=e,this._invalidateInternalHeightCache(),this._marksCache=null)}internalHeight(){if(this._internalHeightCache)return this._internalHeightCache;const e=this.height()-this.topPixelMargin()-this.bottomPixelMargin();return this._internalHeightCache=e,e}fontSize(){return this._scalesProperties.childs().fontSize.value()}priceRange(){return this._makeSureItIsValid(),this.m_priceRange}setPriceRange(e,t,i){if(!(e instanceof ue.PriceRange))throw new TypeError("incorrect price range");const s=this.m_priceRange;if(!t&&ue.PriceRange.compare(s,e))return;const r=null!==this._maxPriceRange&&this._maxPriceRange.containsStrictly(e),n=null!==this._minPriceRange&&e.containsStrictly(this._minPriceRange);this.isLockScale()&&!t&&(r||n)||(this._marksCache=null,this.m_priceRange=e,i||this._priceRangeChanged.fire(s,e))}setMinPriceRange(e){this._minPriceRange=e}setMaxPriceRange(e){this._maxPriceRange=e}recalculatePriceRangeOnce(){this._recalculatePriceRangeOnce=!0}priceRangeShouldBeRecalculatedOnce(){if(!this._recalculatePriceRangeOnce||this.isLockScale())return!1;const e=this.mainSource();return null!==e&&e.priceRangeReady()}priceRangeChanged(){return this._priceRangeChanged}mode(){const e=this._properties.childs();return{autoScale:e.autoScale.value(),lockScale:e.lockScale.value(),percentage:e.percentage.value(),indexedTo100:e.indexedTo100.value(),log:e.log.value()}}setMode(e){const t={},i=this.mode(),s=this._properties.state();let r=null;void 0!==e.autoScale&&e.autoScale!==s.autoScale&&(t.autoScale=e.autoScale,this._setAutoScaleValueWithDependentProperties(e.autoScale)),void 0!==e.lockScale&&e.lockScale!==s.lockScale&&(t.lockScale=e.lockScale,this._setLockScaleValueWithDependentProperties(e.lockScale)),void 0!==e.percentage&&e.percentage!==s.percentage&&(t.percentage=e.percentage,this._setPercentageValueWithDependentProperties(e.percentage),this._invalidatedForRange.isValid=!1),void 0!==e.indexedTo100&&e.indexedTo100!==s.indexedTo100&&(t.indexedTo100=e.indexedTo100,this._setIndexedTo100ValueWithDependentProperties(e.indexedTo100),this._invalidatedForRange.isValid=!1),void 0!==e.log&&e.log!==s.log&&(t.log=e.log,this._setLogValueWithDependentProperties(e.log));const n=this._properties.childs() +;s.log&&!n.log.value()&&(this._canConvertPriceRangeFromLog(this.m_priceRange)?(r=this._convertPriceRangeFromLog(this.m_priceRange),null!==r&&this.setPriceRange(r)):n.autoScale.setValue(!0)),!s.log&&n.log.value()&&(r=this._convertPriceRangeToLog(this.m_priceRange),null!==r&&this.setPriceRange(r)),s.autoScale!==n.autoScale.value()&&n.autoScale.listeners().fire(n.autoScale,""),s.autoScaleDisabled!==n.autoScaleDisabled.value()&&n.autoScaleDisabled.listeners().fire(n.autoScaleDisabled,""),s.lockScale!==n.lockScale.value()&&n.lockScale.listeners().fire(n.lockScale,""),s.percentage!==n.percentage.value()&&(n.percentage.listeners().fire(n.percentage,""),this.updateFormatter()),s.indexedTo100!==n.indexedTo100.value()&&(n.indexedTo100.listeners().fire(n.indexedTo100,""),this.updateFormatter()),s.percentageDisabled!==n.percentageDisabled.value()&&n.percentageDisabled.listeners().fire(n.percentageDisabled,""),s.log!==n.log.value()&&n.log.listeners().fire(n.log,""),s.logDisabled!==n.logDisabled.value()&&n.logDisabled.listeners().fire(n.logDisabled,""),void 0===t.log&&void 0===t.percentage&&void 0===t.lockScale&&void 0===t.autoScale&&void 0===t.indexedTo100||this._modeChanged.fire(i,this.mode())}modeChanged(){return this._modeChanged}isEmpty(){return this._makeSureItIsValid(),0===this.m_height||!this.m_priceRange||this.m_priceRange.isEmpty()}canDetachSource(e){return this.m_dataSources.some((t=>t!==e&&(0,ne.isPriceDataSource)(t)&&!((0,G.isStudy)(t)&&t.isLinkedToSeries())))}updateAllViews(e){const t=this._getSourcesToUpdateViews();for(const i of t)i.updateAllViews(e)}logFormula(){return this._logFormula}state(){var e;const t=this._properties.childs();return{id:this._id,m_priceRange:this.isAutoScale()?null:(null===(e=this.priceRange())||void 0===e?void 0:e.serialize())||null,m_isAutoScale:this.isAutoScale(),m_isPercentage:t.percentage.value(),m_isIndexedTo100:t.indexedTo100.value(),m_isLog:t.log.value(),m_isLockScale:this.isLockScale(),m_isInverted:this.isInverted(),m_topMargin:this._margins.top,m_bottomMargin:this._margins.bottom,alignLabels:t.alignLabels.value(),logFormula:(0,se.clone)(this._logFormula)}}restoreState(e){let t=e.m_priceRange;if(void 0===t)throw new TypeError("invalid state");if(void 0===e.m_isAutoScale)throw new TypeError("invalid state");void 0!==e.id&&(this._id=e.id);const i={autoScale:e.m_isAutoScale};void 0!==e.m_isPercentage&&(i.percentage=e.m_isPercentage),void 0!==e.m_isIndexedTo100&&(i.indexedTo100=e.m_isIndexedTo100),void 0!==e.m_isLog&&(i.log=e.m_isLog),void 0!==e.m_isLockScale&&(i.lockScale=e.m_isLockScale),void 0!==e.m_isInverted&&this._properties.childs().isInverted.setValue(e.m_isInverted),this.setMode(i),t?(t instanceof ue.PriceRange||(t=new ue.PriceRange(t)),this.setPriceRange(t,!0)):this.clearPriceRange(),e.logFormula&&(this._logFormula=e.logFormula),void 0!==e.m_topMargin&&(this._margins.top=e.m_topMargin),void 0!==e.m_bottomMargin&&(this._margins.bottom=e.m_bottomMargin),void 0!==e.alignLabels&&this._properties.childs().alignLabels.setValue(e.alignLabels),this._mainSource=null, +this._scaleSeriesOnly=!1}priceToLogical(e){return this.isLog()&&e?(0,pe.toLog)(e,this._logFormula):e}logicalToPrice(e){return this.isLog()?(0,pe.fromLog)(e,this._logFormula):e}priceToCoordinate(e,t){const i=this._priceToPercentOrIndexedTo100IfNeeded(e,t);return this._logicalToCoordinate(i)}coordinateToPrice(e,t){let i=this._coordinateToLogical(e);return this.isPercentage()?i=(0,pe.fromPercent)(i,t):this.isIndexedTo100()&&(i=(0,pe.fromIndexedTo100)(i,t)),i}mainSource(){if(null!==this._mainSource)return this._mainSource;let e;for(const t of this._priceDataSources){if(t instanceof _e.Series){e=t;break}e||(e=t)}return this._mainSource=e||null,this._correctedMarginsCache=null,this._mainSource}priceToCoordinateFn(e){this._makeSureItIsValid();const t=this.bottomPixelMargin(),i=(0,n.ensureNotNull)(this.priceRange()),s=i.minValue(),r=i.maxValue(),o=this.internalHeight()-1,a=this.isInverted(),l=o/(r-s),c=this.m_height,h=e=>{const i=t+l*(e-s);return a?i:c-1-i};return this.isPercentage()?t=>h((0,pe.toPercent)(t,e)):this.isIndexedTo100()?t=>h((0,pe.toIndexedTo100)(t,e)):this.isLog()?e=>h((0,pe.toLog)(e,this._logFormula)):e=>h(e)}pricesArrayToCoordinates(e,t,i){this._makeSureItIsValid();const s=this.bottomPixelMargin(),r=(0,n.ensureNotNull)(this.priceRange()),o=r.minValue(),a=r.maxValue(),l=this.internalHeight()-1,c=this.isInverted(),h=l/(a-o);void 0===i&&(i=e.length);const d=this.isPercentage(),u=this.isIndexedTo100(),p=this.isLog(),_=this.m_height;let m,g;for(let r=0;re?(0,pe.toLog)(e,this._logFormula):e),0===s.length)return;const h="open"in s[0],d="close"in s[0];if(null!==c)for(let e=0;e0){const t=(0,ge.unitConvertibleGroups)(d,p,e);l=(0,v.intersect)(l,new Set(t))}h+=1}if(null!==t)for(const i of this._priceDataSources){ +if(u.includes(i))continue;const c=i;if(!c.isUnitSource()||!c.isVisible())continue;const h=c.unit();if(null===h){t=null;break}s.add(h),d+=1;const p=(0,n.ensureNotNull)(c.symbolSource()),_=p.symbolInfo();if(null===_){t=null;break}if(l.size>0){const t=(0,ge.unitConvertibleGroups)(_,h,e);l=(0,v.intersect)(l,new Set(t))}if(r.set(h,e.name(h)),o.set(h,e.description(h)),u.includes(p)||(l=new Set),void 0===a)a=h;else if(null!==a&&a!==h){a=null;break}}if(void 0===t)if(0===h&&0===d)t=null;else{t={availableGroups:l,selectedUnit:a||null,units:s,originalUnits:i,symbolSourceCount:h,allUnitsAreOriginal:c,names:r,descriptions:o}}return this._unitCache={value:t,availableUnitsCount:e.size()},t}measureUnitId(e){if(null!==this._measureUnitIdCache&&e.size()===this._measureUnitIdCache.availableUnitsCount)return this._measureUnitIdCache.value;let t,i;const s=new Map,r=new Map,n=new Set;let o=0;const a=this._seriesLikeSources.filter(me.isActingAsSymbolSource);for(const l of a){if(!l.isVisible())continue;const a=l.measureUnitId();if(null===a){t=null;break}n.add(a),s.set(a,e.name(a)),r.set(a,e.description(a)),void 0===i?i=a:null!==i&&i!==a&&(i=null),o+=1}return void 0===t&&(t=0===o?null:{selectedMeasureUnitId:i||null,measureUnitIds:n,names:s,descriptions:r,symbolSourceCount:o}),this._measureUnitIdCache={value:t,availableUnitsCount:e.size()},t}setMargins(e){if(!(0,se.isNumber)(e.top)||!(0,se.isNumber)(e.bottom))throw new TypeError("invalid margin");if(e.top<0||e.top>30||e.bottom<0||e.bottom>30)throw new RangeError("invalid margin");this._margins.top===e.top&&this._margins.bottom===e.bottom||(this._margins=e,this._correctedMarginsCache=null,this._invalidateInternalHeightCache(),this._marksCache=null)}topMargin(){return this._correctedMargins().top}bottomMargin(){return this._correctedMargins().bottom}invalidateMargins(){this._correctedMarginsCache=null}topPixelMargin(){return this.isInverted()?this.bottomMargin()*this.height()+this._bottomPixelMargin:this.topMargin()*this.height()+this._topPixelMargin}bottomPixelMargin(){return this.isInverted()?this.topMargin()*this.height()+this._topPixelMargin:this.bottomMargin()*this.height()+this._bottomPixelMargin}marks(){return this.isEmpty()?(this._marksCache=null,[]):(null===this._marksCache&&(this._markBuilder.rebuildTickMarks(),this._marksCache=this._markBuilder.marks(),this._onMarksChanged.fire()),this._marksCache)}onMarksChanged(){return this._onMarksChanged}priceRangeInPrice(){if(this.isEmpty())return null;const e=this.mainSource();if(null===e)return null;const t=(0,n.ensureNotNull)(e.firstValue()),i=this.height();return{from:this.coordinateToPrice(i-1,t),to:this.coordinateToPrice(0,t)}}setPriceRangeInPrice(e){if(this.isPercentage()||this.isIndexedTo100())return;const t=this.isInverted(),i=t?this.bottomMargin():this.topMargin(),s=t?this.topMargin():this.bottomMargin(),r=this.isLog();let n=r?(0,pe.toLog)(e.from,this._logFormula):e.from,o=r?(0,pe.toLog)(e.to,this._logFormula):e.to;const a=o-n;n+=s*a,o-=i*a,this.setMode({autoScale:!1}),this.setPriceRange(new ue.PriceRange(n,o)),this._marksCache=null, +this._onMarksChanged.fire()}hasMainSeries(){return this._hasSeries}getStudies(){return this.dataSources().filter(G.isStudy)}lastSourceRemoved(){return this._lastSourceRemoved}sourcesForAutoscale(){return this._mainSource&&this._scaleSeriesOnly!==this._scalesProperties.childs().scaleSeriesOnly.value()&&(this._sourcesForAutoscale=null),this._sourcesForAutoscale||(this._sourcesForAutoscale=this._recalculateSourcesForAutoscale()),this._sourcesForAutoscale}recalculatePriceRange(e){this._invalidatedForRange={visibleBars:e,isValid:!1}}internalHeightChanged(){return this._internalHeightChanged}orderedSources(){if(this._cachedOrderedSoruces)return this._cachedOrderedSoruces;let e=this.m_dataSources.slice();return e=(0,oe.sortSources)(e),this._cachedOrderedSoruces=e,this._cachedOrderedSoruces}invalidateSourcesCache(){this._cachedOrderedSoruces=null,this._sourcesToUpdateViews=null}startScale(e){var t,i;this.isEmpty()||this.isPercentage()||this.isIndexedTo100()||null!==this._scaleStartPoint||null!==this._priceRangeSnapshot||(this._scaleStartPoint=this.m_height-e,this._priceRangeSnapshot=null!==(i=null===(t=this.priceRange())||void 0===t?void 0:t.clone())&&void 0!==i?i:null)}scaleTo(e){if(this.isPercentage()||this.isIndexedTo100()||null===this._scaleStartPoint)return;this.setMode({autoScale:!1}),(e=this.m_height-e)<0&&(e=0);let t=(this._scaleStartPoint+.2*(this.m_height-1))/(e+.2*(this.m_height-1));const i=(0,n.ensureNotNull)(this._priceRangeSnapshot).clone();t=Math.max(t,.1),i.scaleAroundCenter(t),this.setPriceRange(i)}endScale(){this.isPercentage()||this.isIndexedTo100()||null!==this._scaleStartPoint&&(this._scaleStartPoint=null,this._priceRangeSnapshot=null)}startTwoPointsScale(e,t){if(this.isEmpty()||this.isPercentage()||this.isIndexedTo100()||null!==this._twoPointsScaleStartPosition)return;const i=Math.min(e,t),s=Math.max(e,t);this._twoPointsScaleStartPosition={topLogical:this._coordinateToLogical(i),bottomLogical:this._coordinateToLogical(s)}}twoPointsScale(e,t){if(this.isPercentage()||this.isIndexedTo100()||null===this._twoPointsScaleStartPosition)return;this.setMode({autoScale:!1});const i=Math.min(e,t),s=Math.max(e,t),{topLogical:r,bottomLogical:n}=this._twoPointsScaleStartPosition,o=this.bottomPixelMargin(),a=this.internalHeight()-1,l=(this._invertedCoordinate(i)-o)/a,c=(n-r)/((this._invertedCoordinate(s)-o)/a-l);if(!Number.isFinite(c))return;const h=r-c*l,d=h+c;this.setPriceRange(new ue.PriceRange(this.priceToLogical(h),this.priceToLogical(d)))}endTwoPointsScale(){this._twoPointsScaleStartPosition=null}startScroll(e){var t,i;this.isAutoScale()||null===this._scrollStartPoint&&null===this._priceRangeSnapshot&&(this.isEmpty()||(this._scrollStartPoint=e,this._priceRangeSnapshot=null!==(i=null===(t=this.priceRange())||void 0===t?void 0:t.clone())&&void 0!==i?i:null))}scrollTo(e){if(this.isAutoScale())return;if(null===this._scrollStartPoint||null===this._priceRangeSnapshot)return;const t=this.priceRange();if(null===t)return;let i=e-this._scrollStartPoint;this.isInverted()&&(i*=-1) +;const s=i*(t.length()/(this.internalHeight()-1)),r=this._priceRangeSnapshot.clone();r.shift(s),this.setPriceRange(r,!0),this._marksCache=null}endScroll(){this.isAutoScale()||null!==this._scrollStartPoint&&(this._scrollStartPoint=null,this._priceRangeSnapshot=null)}clearPriceRange(){this.m_priceRange=null,this.recalculatePriceRangeOnce()}isVisible(){return this._isVisible}_addDataSourceImpl(e,t,i){if(t||-1===this.m_dataSources.indexOf(e)){if((0,ne.isPriceDataSource)(e)){if(void 0===i?this._priceDataSources.push(e):this._priceDataSources.splice(i,0,e),e.currencyChanged().subscribe(this,(()=>this._currencyCache=null)),e.unitChanged().subscribe(this,(()=>this._unitCache=null)),(0,me.isSymbolSource)(e)&&(this._seriesLikeSources.push(e),e.symbolResolved().subscribe(this,(()=>{this._currencyCache=null,this._unitCache=null,this._measureUnitIdCache=null})),e.isActingAsSymbolSource().subscribe(this._boundOnSourceIsActingAsSymbolSourceChanged),e instanceof _e.Series)){const t=e.properties();this._hasSeries||(t.childs().lockScale&&(this.setMode({lockScale:t.childs().lockScale.value()}),t.removeProperty("lockScale")),t.childs().pnfStyle.child("lockScale")&&t.childs().pnfStyle.removeProperty("lockScale")),this._hasSeries=!0}e.isSpeciallyZOrderedSource()||(this._sourcesThatAffectVisibility.push(e),e.properties().childs().visible.listeners().subscribe(this,this._onSourceVisibilityChanged))}(0,G.isStudy)(e)&&(e.onIsActualIntervalChange().subscribe(this,this._dropScaleCache),e.onHibernationStateChange().subscribe(this,this._dropScaleCache),0===this._studiesCount&&(0,Pe.hideAllIndicators)().subscribe(this,this._dropScaleCache),this._studiesCount++),(0,y.isLineTool)(e)&&(0===this._drawingCount&&(0,Pe.hideAllDrawings)().subscribe(this,this._dropScaleCache),this._drawingCount++),this.m_dataSources.push(e),this._mainSource=null,this.mainSource()===e&&(this._correctedMarginsCache=null,this._internalHeightCache=null,this._marksCache=null),this._dropScaleCache(),this.updateFormatter(),this._initScaleProperties(),this.invalidateSourcesCache(),this._updateIsVisible()}}_recalculateSourcesForAutoscale(){this._mainSource&&(this._scaleSeriesOnly=this._scalesProperties.childs().scaleSeriesOnly.value());const e=this._scaleSeriesOnly&&this._hasSeries;return this.m_dataSources.filter((t=>!!(t.properties().visible.value()||t instanceof _e.Series)&&(e?t instanceof _e.Series:(0,G.isStudy)(t)?!t.isSourceHidden()&&t.isIncludedInAutoScale():t.isIncludedInAutoScale())))}_updateAutoScaleDisabledProperty(e){const t=this._properties.childs(),i=t.indexedTo100.value()||t.percentage.value()||t.lockScale.value();e?t.autoScaleDisabled.setValueSilently(i):t.autoScaleDisabled.setValue(i)}_setAutoScaleValueWithDependentProperties(e){const t=this._properties.childs();t.autoScale.setValueSilently(e),e&&(t.percentage.setValueSilently(!1),t.indexedTo100.setValueSilently(!1),t.lockScale.setValueSilently(!1),t.logDisabled.setValueSilently(!1)),this._updateAutoScaleDisabledProperty(!0)}_setLockScaleValueWithDependentProperties(e){const t=this._properties.childs() +;t.lockScale.setValueSilently(e),e&&(t.autoScale.setValueSilently(!1),t.percentage.setValueSilently(!1),t.indexedTo100.setValueSilently(!1),t.log.setValueSilently(!1)),t.percentageDisabled.setValueSilently(e),t.logDisabled.setValueSilently(e),this._updateAutoScaleDisabledProperty(!0)}_setPercentageValueWithDependentProperties(e){const t=this._properties.childs();t.percentage.setValueSilently(e),e&&(t.autoScale.setValueSilently(!0),t.log.setValueSilently(!1),t.lockScale.setValueSilently(!1),t.indexedTo100.setValueSilently(!1)),this._updateAutoScaleDisabledProperty(!0)}_setIndexedTo100ValueWithDependentProperties(e){const t=this._properties.childs();t.indexedTo100.setValueSilently(e),e&&(t.autoScale.setValueSilently(!0),t.log.setValueSilently(!1),t.lockScale.setValueSilently(!1),t.percentage.setValueSilently(!1)),this._updateAutoScaleDisabledProperty(!0)}_setLogValueWithDependentProperties(e){const t=this._properties.childs();t.log.setValueSilently(e),e&&(t.lockScale.setValueSilently(!1),t.percentage.setValueSilently(!1),t.indexedTo100.setValueSilently(!1)),this._updateAutoScaleDisabledProperty(!0)}_recalculatePriceRangeImpl(){const e=this._invalidatedForRange.visibleBars;if(null===e)return;let t=null;const i=this.sourcesForAutoscale(),s=this.isPercentage(),r=this.isIndexedTo100();let n=0,o=0;for(const a of i){if(!a.properties().visible.value())continue;const i=a.firstValue();if(null===i||s&&0===i)continue;const l=e.firstBar(),c=e.lastBar(),h=a.autoScaleInfo(l,c);let d=h.range;d&&(s?d=(0,pe.toPercentRange)(d,i):r&&(d=(0,pe.toIndexedTo100Range)(d,i)),t=null===t?d:t.merge(d)),void 0!==h.topPixelMargin&&(n=Math.max(n,h.topPixelMargin)),void 0!==h.bottomPixelMargin&&(o=Math.max(o,h.bottomPixelMargin))}if((Math.abs(n-this._topPixelMargin)>0||Math.abs(o-this._bottomPixelMargin)>0)&&(this._bottomPixelMargin=o,this._topPixelMargin=n,this._marksCache=null,this._invalidateInternalHeightCache()),t){if(t.minValue()===t.maxValue()&&(t=new ue.PriceRange(t.minValue()-.5,t.maxValue()+.5)),this.isLog()){const e=this._convertPriceRangeFromLog(t),i=(0,pe.logFormulaForPriceRange)(e);if(!(0,pe.logFormulasAreSame)(i,this._logFormula)){const s=this._priceRangeSnapshot?this._convertPriceRangeFromLog(this._priceRangeSnapshot):null;this._logFormula=i,t=this._convertPriceRangeToLog(e),s&&(this._priceRangeSnapshot=this._convertPriceRangeToLog(s))}}this.setPriceRange(t)}else this.m_priceRange||(this.setPriceRange(new ue.PriceRange(-.5,.5)),this._logFormula=(0,pe.logFormulaForPriceRange)(null));this._invalidatedForRange.isValid=!0;const a=this.mainSource();null!==a&&this._recalculatePriceRangeOnce&&(this._recalculatePriceRangeOnce=!a.priceRangeReady())}_makeSureItIsValid(){this._invalidatedForRange.isValid||(this._invalidatedForRange.isValid=!0,this._recalculatePriceRangeImpl())}_invalidateInternalHeightCache(){this._internalHeightCache=null,this._internalHeightChanged.fire()}_coordinateToLogical(e){if(this._makeSureItIsValid(),this.isEmpty())return 0;const t=this._invertedCoordinate(e),i=(0, +n.ensureNotNull)(this.priceRange()),s=i.minValue()+(i.maxValue()-i.minValue())*((t-this.bottomPixelMargin())/(this.internalHeight()-1));return this.logicalToPrice(s)}_logicalToCoordinate(e){if(this._makeSureItIsValid(),this.isEmpty())return 0;e=this.priceToLogical(e);const t=(0,n.ensureNotNull)(this.priceRange()),i=this.bottomPixelMargin()+(this.internalHeight()-1)*(e-t.minValue())/(t.maxValue()-t.minValue());return this._invertedCoordinate(i)}_convertPriceRangeFromLog(e){if(null===e)return null;const t=(0,pe.fromLog)(e.minValue(),this._logFormula),i=(0,pe.fromLog)(e.maxValue(),this._logFormula);return new ue.PriceRange(t,i)}_convertPriceRangeToLog(e){if(null===e)return null;const t=(0,pe.toLog)(e.minValue(),this._logFormula),i=(0,pe.toLog)(e.maxValue(),this._logFormula);return new ue.PriceRange(t,i)}_canConvertPriceRangeFromLog(e){if(null===e)return!1;const t=(0,pe.fromLog)(e.minValue(),this._logFormula),i=(0,pe.fromLog)(e.maxValue(),this._logFormula);return isFinite(t)&&isFinite(i)}_onSourceVisibilityChanged(){this._dropScaleCache(),this._updateIsVisible()}_dropScaleCache(){this._sourcesForAutoscale=null,this._currencyCache=null,this._unitCache=null,this._measureUnitIdCache=null}_updateIsVisible(){if(!Te)return void this._isVisible.setValue(!0);const e=this._sourcesThatAffectVisibility.some((e=>e.isVisible()));this._isVisible.setValue(e)}_invertedCoordinate(e){return this.isInverted()?e:this.height()-1-e}_initScaleProperties(){const e=this.isLockScale(),t=this.properties().childs();e&&(t.percentage.setValue(!1),t.indexedTo100.setValue(!1),t.log.setValue(!1),t.autoScale.setValue(!1)),t.percentageDisabled.setValue(e),t.logDisabled.setValue(e),this._updateAutoScaleDisabledProperty(!1),t.percentage.value()&&(t.log.setValue(!1),t.indexedTo100.setValue(!1)),t.indexedTo100.value()&&(t.log.setValue(!1),t.percentage.setValue(!1))}_correctedMargins(){if(null===this._correctedMarginsCache){const e=this.mainSource();this._correctedMarginsCache=null!==e?e.correctScaleMargins(this._margins):this._margins}return this._correctedMarginsCache}_getSourcesToUpdateViews(){return this._sourcesToUpdateViews||(this._sourcesToUpdateViews=this.m_dataSources.filter((e=>!(0,y.isLineTool)(e)||e.isActualSymbol()&&e.isActualCurrency()))),this._sourcesToUpdateViews}_mainSourceFormatter(){const e=this.mainSource();return(null==e?void 0:e.formatter())||Me}_priceToPercentOrIndexedTo100IfNeeded(e,t){return this.isPercentage()?(0,pe.toPercent)(e,t):this.isIndexedTo100()?(0,pe.toIndexedTo100)(e,t):e}_onSourceIsActingAsSymbolSourceChanged(){this._dropScaleCache()}_onIsInvertedChanged(){this._marksCache=null,this._markBuilder.rebuildTickMarks()}_updateResetAvailableValue(){this._resetScaleAvailable.setValue(!this.isLockScale()&&!this.isAutoScale())}}var ke=i(29541),De=i(63009),Ee=i(53588),Ve=i(88732),Be=i(13333);const Re=[],Ne=[];class Oe{constructor(e){this._studies={},this._deferreds={},this._container=e,Re.push(e),Ne.push(this)}add(e,t){this._deferreds[e]&&(this._deferreds[e].resolve(t),delete this._deferreds[e]),this._studies[e]=t}get(e){ +return this._studies[e]?Promise.resolve(this._studies[e]):(this._deferreds[e]||(this._deferreds[e]=(0,p.createDeferredPromise)()),this._deferreds[e].promise)}reset(){const e=Re.indexOf(this._container);~e&&(Re.splice(e,1),Ne.splice(e,1))}static instance(e){const t=Re.indexOf(e);return~t?Ne[t]:new Oe(e)}}var Fe=i(99366);var We=i(4949),He=i(2823),ze=i(53086),Ue=i(78856),je=i(44010),Ge=i(87440),qe=i(16410);const $e=O.enabled("clear_price_scale_on_error_or_empty_bars"),Ye=(0,J.getLogger)("Chart.Pane");function Ke(e,t,i){e.setMargins({top:t,bottom:i})}const Ze="chart.pane";class Xe{constructor(e,t,i,s){this.m_dataSources=[],this._sourceWatchedValuesSubscriptions=new Map,this.m_mainDataSource=null,this._cachedOrderedSources=new he(this),this._sourcesById=new Map,this._priceSourcesById=new Map,this._sourcePropertiesChanged=new q.Delegate,this._sourcesZOrderChanged=new q.Delegate,this._tagsChanged=new q.Delegate,this._stretchFactor=1e3,this._isInInsertManyDataSourcesState=!1,this._lastLineDataSourceZOrder=null,this._rightPriceScales=[],this._leftPriceScales=[],this._lockedPriceScale=null,this._currentPriceScaleRatio=null,this._onPriceScalesChanged=new q.Delegate,this._isRecalculatingScales=!1,this._priceDataSources=[],this._symbolSources=[],this._lollipopDataSources=[],this._symbolSourceResolved=new q.Delegate,this._symbolSourceResolvingActive=new $.WatchedValue(!1),this._bulkActions={activeCounter:0},this._height=0,this._width=0,this._sizeChanged=new q.Delegate,this._dataSourcesCollectionChanged=new q.Delegate,this._symbolSourceCollectionChanged=new q.Delegate,this._priceSourcesCollectionChanged=new q.Delegate,this._maximized=new $.WatchedValue(!1),this._collapsed=new $.WatchedValue(!1),this._resetPriceScalesAvailable=new $.WatchedValue(!1),this._destroyed=new q.Delegate,this._executionsPositionController=null,this._seriesDisplayError=null,this._onPriceScaleIsVisibleChanged=()=>{this._model.fullUpdate()},this._recalcSymbolSourceResolvingActive=()=>{for(const e of this._symbolSources)if(e.symbolResolvingActive().value())return void this._symbolSourceResolvingActive.setValue(!0);this._symbolSourceResolvingActive.setValue(!1)},this._onSymbolSourceCollectionChanged=()=>{0===this._bulkActions.activeCounter?this._symbolSourceCollectionChanged.fire():this._bulkActions.symbolSourceCollectionChanged=!0},this._onSeriesDisplayError=e=>{if(null!==e){for(const e of this._leftPriceScales)e.clearPriceRange();for(const e of this._rightPriceScales)e.clearPriceRange()}},this._updateResetPriceScalesAvailableValue=()=>{const e=e=>e.resetScaleAvailable().value(),t=this._leftPriceScales.some(e)||this._rightPriceScales.some(e);this._resetPriceScalesAvailable.setValue(t)},this._priceScaleSelectionStrategy=(0,te.createPriceScaleSelectionStrategy)(i.properties().childs().priceScaleSelectionStrategyName.value()),this._id=null!=s?s:(0,Q.randomHashN)(6),this._timeScale=e,this.m_mainDataSource=null,this._properties=t,this._model=i,i.properties().childs().priceScaleSelectionStrategyName.subscribe(null,(e=>{this._priceScaleSelectionStrategy=(0, +te.createPriceScaleSelectionStrategy)(e.value()),this._priceScaleSelectionStrategy.apply(this)})),this._timeScale.barSpacingChanged().subscribe(this,(()=>{this.m_mainDataSource===this._model.mainSeries()&&this._recalculatePriceScaleByScaleRatio(this.m_mainDataSource.priceScale())})),$e&&(this._seriesDisplayError=(0,F.getSeriesDisplayErrorWV)(this._model.mainSeries()),this._seriesDisplayError.subscribe(this._onSeriesDisplayError)),t.childs().topMargin.subscribe(this,this._updateMargins),t.childs().bottomMargin.subscribe(this,this._updateMargins),this._updateMargins()}destroy(){var e;this._properties.childs().topMargin.unsubscribeAll(this),this._properties.childs().bottomMargin.unsubscribeAll(this),this._model.properties().childs().priceScaleSelectionStrategyName.unsubscribeAll(this),this._timeScale.barSpacingChanged().unsubscribeAll(this),this._leftPriceScales.concat(this._rightPriceScales).forEach((e=>{e.modeChanged().unsubscribeAll(this),e.priceRangeChanged().unsubscribeAll(this),e.internalHeightChanged().unsubscribeAll(this),e.isVisible().unsubscribe(this._onPriceScaleIsVisibleChanged),e.resetScaleAvailable().unsubscribe(this._updateResetPriceScalesAvailableValue)}));for(const e of this.m_dataSources)this.removeSourceFromPriceScale(e),e.destroy&&e.destroy();null===(e=this._seriesDisplayError)||void 0===e||e.destroy(),this._destroyed.fire()}id(){return this._id}bulkActionMacro(e){const t=this._bulkActions;t.activeCounter+=1,e(),t.activeCounter-=1,0===t.activeCounter&&(this._dataSourcesCollectionChanged.fire(),t.symbolSourceCollectionChanged&&(this._symbolSourceCollectionChanged.fire(),t.symbolSourceCollectionChanged=!1),t.priceSourcesCollectionChanged&&(this._priceSourcesCollectionChanged.fire(),t.priceSourcesCollectionChanged=!1))}defaultPriceScale(){var e,t;const i=null!==(t=null===(e=this.m_mainDataSource)||void 0===e?void 0:e.priceScale())&&void 0!==t?t:null;if(null!==i)return i;const s=this.properties().childs().axisProperties.state();return s.autoScale=!0,new Le(this._model.properties().childs().scalesProperties,s)}leftPriceScales(){return this._leftPriceScales}rightPriceScales(){return this._rightPriceScales}visibleLeftPriceScales(){var e;const t=this._model.priceScaleSlotsCount(),i=this._leftPriceScales.filter((e=>e.isVisible().value())),s=null===(e=this.mainDataSource())||void 0===e?void 0:e.priceScale();if(i.length>t.left&&(null==s?void 0:s.isVisible().value())){const e=(0,v.moveToHead)(i,s);return e.splice(t.left),e}return i}visibleRightPriceScales(){var e;const t=this._model.priceScaleSlotsCount(),i=this._rightPriceScales.filter((e=>e.isVisible().value())),s=null===(e=this.mainDataSource())||void 0===e?void 0:e.priceScale();if(i.length>t.right&&(null==s?void 0:s.isVisible().value())){const e=(0,v.moveToHead)(i,s);return e.splice(t.right),e}return i}clearSeries(e){const t=this._model.mainSeries();for(let i=this.m_dataSources.length-1;i>=0;i--)this.m_dataSources[i]===t&&this._removeSourceFromCollections(i,e)}sourcesByGroup(){return this._cachedOrderedSources}dataSourceForId(e){ +return this._sourcesById.get(e)||null}changeSourceId(e,t){var i;e===this._model.mainSeries()&&(null===(i=(0,ee.getPersistentLogger)())||void 0===i||i.addPersistentLogEntry(`changeSourceId for series from ${e.id()} to ${t}`,J.LOGLEVEL.INFO,Ze)),(0,n.assert)(this.hasDataSource(e));const s=e.id();e.setId(t),this._sourcesById.delete(s),this._sourcesById.set(t,e),(0,ne.isPriceDataSource)(e)&&(this._priceSourcesById.delete(s),this._priceSourcesById.set(t,e))}movePriceScale(e,t,i){const s=this.priceScalePosition(e);if(s!==t)this.removePriceScale(e),this._placePriceScale(e,t,i),e.invalidateMargins(),this._invalidateSourcesCache();else if(void 0!==i&&"overlay"!==s){const t="left"===s?this._leftPriceScales:this._rightPriceScales,r=t.indexOf(e);t.splice(r,1),t.splice(i,0,e)}}mainDataSource(){return this.m_mainDataSource}isEmpty(){return null===this.m_mainDataSource}recalculatePriceScale(e,t){if(!e)return;const i=e.sourcesForAutoscale();if((e.isAutoScale()||e.priceRangeShouldBeRecalculatedOnce())&&i&&i.length>0&&!this.timeScale().isEmpty()){const t=this.timeScale().visibleBarsStrictRange();e.recalculatePriceRange(t)}e.updateAllViews(t)}onSourceTagsChanged(){this._tagsChanged.fire()}insertDataSource(e,t,i,s){e.setZorder(i),t||(s=!1,t=this.findSuitableScale(e)),this._addSourceToCollections(e);let r=!1;e===this.model().mainSeries()?(this.m_mainDataSource=this.model().mainSeries(),r=!0):null===this.m_mainDataSource&&(0,ne.isPriceDataSource)(e)&&(this.m_mainDataSource=e,r=!0),s||t.addDataSource(e,this._isInInsertManyDataSourcesState),e.setPriceScale(t),t.invalidateMargins(),e.onTagsChanged&&e.onTagsChanged().subscribe(this,this.onSourceTagsChanged),r&&this._processMainSourceChange(),this._tagsChanged.fire(),(0,ne.isPriceDataSource)(e)&&this.recalculatePriceScale(t,(0,H.sourceChangeEvent)(e.id())),this._invalidateSourcesCache()}addDataSource(e,t,i){let s=e.zorder();i||((0,y.isLineTool)(e)&&!e.isSpeciallyZOrderedSource()?(s=null!==this._lastLineDataSourceZOrder?this._lastLineDataSourceZOrder+1:this.newLineToolZOrder(),this._isInInsertManyDataSourcesState&&(this._lastLineDataSourceZOrder=s)):(0,G.isStudy)(e)&&!e.isSpeciallyZOrderedSource()&&(s=this.newStudyZOrder())),this.insertDataSource(e,t,s)}removeDataSource(e,t,i,s){const r=this.m_dataSources.indexOf(e);if(-1===r)return void Ye.logDebug("removeDataSource: invalid data source");this._removeSourceFromCollections(r,!!i),e!==this.m_mainDataSource||t||(this.m_mainDataSource=null);const n=e.priceScale();s||this.removeSourceFromPriceScale(e),e.onTagsChanged&&e.onTagsChanged().unsubscribe(this,this.onSourceTagsChanged),(0,ne.isPriceDataSource)(e)&&!t&&this._processMainSourceChange(),this._tagsChanged.fire(),n&&(0,ne.isPriceDataSource)(e)&&this.recalculatePriceScale(n,(0,H.sourceChangeEvent)(e.id())),this._invalidateSourcesCache()}hasDataSource(e){return this._sourcesById.has(e.id())}hasPriceDataSource(e){return this._priceSourcesById.has(e.id())}dataSources(){return this.m_dataSources}priceDataSources(){return this._priceDataSources}lollipopDataSources(){return this._lollipopDataSources} +symbolSources(){return this._symbolSources}replaceSource(e,t,i){const s=this.m_mainDataSource===e,r=e.zorder(),n=null==i?void 0:i.replaceSource(e,t);this.insertDataSource(t,i,r,n),this.removeDataSource(e,s,void 0,n),this._sourcesById.set(t.id(),t),(0,ne.isPriceDataSource)(t)&&this._priceSourcesById.set(t.id(),t),s&&(this.m_mainDataSource=t,this._processMainSourceChange())}findSuitableScale(e,t,i){return this._priceScaleSelectionStrategy.findSuitableScale(this,e,t,i)}createNewPriceScaleIfPossible(){return this._priceScaleSelectionStrategy.createNewPriceScaleIfPossible(this)}canCreateNewPriceScale(){return this._priceScaleSelectionStrategy.canCreateNewPriceScale(this)}isOverlay(e){const t=e.priceScale();return null===t||"overlay"===this.priceScalePosition(t)}recalculate(e){this._leftPriceScales.forEach((t=>this.recalculatePriceScale(t,e))),this._rightPriceScales.forEach((t=>this.recalculatePriceScale(t,e)));for(const t of this.m_dataSources)this.isOverlay(t)&&!(0,y.isLineTool)(t)&&this.recalculatePriceScale(t.priceScale(),e);this.updateAllViews(e),this._model.updatePane(this)}updateAllViews(e){for(const t of this.m_dataSources)t.updateAllViews(e);for(const t of this.model().customSources())t.updateViewsForPane(this,e)}updateLollipopViews(e){}priceScalePosition(e){return this._leftPriceScales.includes(e)?"left":this._rightPriceScales.includes(e)?"right":"overlay"}createPriceScaleAtPosition(e,t){const i=this.properties().childs().axisProperties.state();i.autoScale=!0;const s=new Le(this.model().properties().childs().scalesProperties,i);return s.setHeight(this.height()),Ke(s,this._defaultTopMargin(),this._defaultBottomMargin()),this._placePriceScale(s,e,t),s}removePriceScale(e){e.modeChanged().unsubscribeAll(this),e.priceRangeChanged().unsubscribeAll(this),e.internalHeightChanged().unsubscribeAll(this),e.isVisible().unsubscribe(this._onPriceScaleIsVisibleChanged),e.resetScaleAvailable().unsubscribe(this._updateResetPriceScalesAvailableValue),e===this._lockedPriceScale&&(this._lockedPriceScale=null,this._currentPriceScaleRatio=null);const t=this._leftPriceScales.indexOf(e);-1!==t&&(this._leftPriceScales[t].invalidateMargins(),this._leftPriceScales.splice(t,1));const i=this._rightPriceScales.indexOf(e);if(-1!==i&&(this._rightPriceScales[i].invalidateMargins(),this._rightPriceScales.splice(i,1)),null===e.mainSource()){const t=e.dataSources().length;0!==t&&Ye.logError("Invalid priceScale state: empty mainSource but non-empty data sources="+t)}this._onPriceScalesChanged.fire(),this._updateResetPriceScalesAvailableValue()}priceScaleIndex(e,t){switch(t){case"left":return this.leftPriceScales().indexOf(e);case"right":return this.rightPriceScales().indexOf(e)}}move(e,t,i){const s=e.priceScale();this.removeSourceFromPriceScale(e),t.addDataSource(e),e.setPriceScale(t),t.invalidateMargins(),this._processMainSourceChange(),this._invalidateSourcesCache(),e.isIncludedInAutoScale()&&(null!==s&&this.recalculatePriceScale(s,(0,H.sourceChangeEvent)(e.id())),this.recalculatePriceScale(t,(0,H.sourceChangeEvent)(e.id()))), +this._onPriceScalesChanged.fire()}setZOrders(e){e.forEach(((e,t)=>{t.setZorder(e)})),this._invalidateSourcesCache(),0===this._bulkActions.activeCounter&&this._dataSourcesCollectionChanged.fire(),this.model().lightUpdate()}isMainPane(){return this.hasDataSource(this.model().mainSeries())}isLast(){const e=this.model().panes();return e[e.length-1]===this}newStudyZOrder(){return(0,De.newStudyZOrder)(this._priceDataSources)}newLineToolZOrder(e){return(0,De.newLineToolZOrder)(this.m_dataSources,e)}model(){return this._model}containsMainSeries(){return this._sourcesById.has(this.model().mainSeries().id())}applyPriceScaleRatio(e,t){var i;null!==this._lockedPriceScale&&this._lockedPriceScale!==e||this._currentPriceScaleRatio===t||!this.isMainPane()||null===this._lockedPriceScale&&e!==(null===(i=this.mainDataSource())||void 0===i?void 0:i.priceScale())||(this._setNewPriceRangeByScaleRatio(e,t,this._mainSourceVisiblePriceRange(e),!0,!0),null!==this._lockedPriceScale?this._tryToApplyNewPriceScaleRatio():e.isLog()||this.model().mainSeriesScaleRatioPropertyOnChanged())}sendToBack(e){const t=this.sourcesByGroup().allExceptSpecialSources();this._batchReorder(e,t[0],De.moveBeforeSource)}bringToFront(e){const t=this.sourcesByGroup().allExceptSpecialSources();this._batchReorder(e,t[t.length-1],De.moveAfterSource)}sendBackward(e){const t=this.sourcesByGroup().allIncludingHidden(),i=t.indexOf(e[0]);if(0===i)this.bringToFront(e);else{const s=t[i-1];this.insertBefore(e,s)}}bringForward(e){const t=this.sourcesByGroup().allExceptSpecialSources(),i=t.indexOf(e[e.length-1]);if(i===t.length-1)this.sendToBack(e);else{const s=t[i+1];this.insertAfter(e,s)}}insertAfter(e,t){this._batchReorder(e,t,De.moveAfterSource)}insertBefore(e,t){this._batchReorder(e,t,De.moveBeforeSource)}maximized(){return this._maximized}collapsed(){return this._collapsed}getPriceScaleById(e){const t=this.m_dataSources.find((t=>{var i;return(null===(i=t.priceScale())||void 0===i?void 0:i.id())===e}));return void 0===t?null:t.priceScale()}priceScaleSelectionStrategy(){return this._priceScaleSelectionStrategy}setPriceScaleSelectionStrategy(e){this._priceScaleSelectionStrategy=e,e.apply(this)}findTargetPriceAxisViews(e,t,i,s){if((0,f.isDataSource)(e)&&this.model().paneForSource(e)!==this)return[];const r=e.priceScale();if(t===r)return i;if(null===r)return[];if("overlay"===this.priceScalePosition(r))return t===this.defaultPriceScale()?i:[];const n=this.priceScalePosition(t);if(n!==this.priceScalePosition(r))return[];const o="left"===n?this.leftPriceScales():this.rightPriceScales();return o.indexOf(t)1}properties(){return this._properties}setPriceAutoScale(e,t){e.setMode({autoScale:t}),this.timeScale().isEmpty()||this.recalculatePriceScale(e,(0,H.viewportChangeEvent)())}state(e,t,i,s,r,n){var o,a;const l={sources:[],mainSourceId:null===(o=this.m_mainDataSource)||void 0===o?void 0:o.id(),stretchFactor:this._stretchFactor,leftAxisesState:[], +rightAxisesState:[],overlayPriceScales:{},priceScaleRatio:this._currentPriceScaleRatio,isCollapsed:this._collapsed.value()},c=new Map,h=e=>{if(c.has(e))return c.get(e);let o=null;const a=i&&!e.isSavedInStudyTemplates()||!e.state||(0,y.isLineTool)(e)&&n||!e.isSavedInChart(Boolean(t))||!(o=e.state(t,r))||s&&(0,y.isLineTool)(e)&&e.isActualSymbol&&!e.isActualSymbol()||e.isPhantom()?null:o;return c.set(e,a),a};if(e){l.sources=[];for(let e=0;enull!==c.get(e),u=e=>!n||!(0,y.isLineTool)(e);l.leftAxisesState=this._leftPriceScales.map((e=>({state:e.state(),sources:e.dataSources().filter(d).filter(u).map((e=>e.id()))}))),l.rightAxisesState=this._rightPriceScales.map((e=>({state:e.state(),sources:e.dataSources().filter(d).filter(u).map((e=>e.id()))}))),l.overlayPriceScales={};for(const e of this.m_dataSources)if(this.isOverlay(e)&&e.isSavedInChart(Boolean(t))){const t=e.priceScale();l.overlayPriceScales[e.id()]=null!==(a=null==t?void 0:t.state())&&void 0!==a?a:null}return l}restoreState(e){var t;const{state:i,withData:s,version:r,seriesId:o=this._model.mainSeries().id(),settingsMigration:a={},contentOverrides:l,restoreSilently:c,reason:h=0}=e;null===(t=(0,ee.getPersistentLogger)())||void 0===t||t.addPersistentLogEntry(`Restoring pane with seriesId ${o}`,J.LOGLEVEL.INFO,Ze),i.stretchFactor&&(this._stretchFactor=i.stretchFactor);const d={};if(i.sources){const e=i.sources.filter((e=>{var t;return!!e&&("MainSeries"===e.type||(!(null===(t=e.points)||void 0===t?void 0:t.some((e=>null===e.time_t||!isFinite(e.time_t))))||(Ye.logNormal("Dropped invalid "+e.type+". Reason: non-numeric point time"),!1)))})),t=e.findIndex(Ee.isMainSeriesState);-1!==t&&this.model().mainSeries().setObsoleteZOrder(e[t].zorder),r<3&&(0,De.reorderDataSourcesStateZOrder)(e);const n=-1!==this.m_dataSources.indexOf(this._model.mainSeries());this.clearSeries(Boolean(c)),this.m_mainDataSource=null,n&&this._addSourceToCollections(this._model.mainSeries(),c),(()=>{const t=e.find((e=>e.id===i.mainSourceId));if(void 0===t)return void Ye.logWarn("There is no main source with id "+i.mainSourceId+", total sources="+e.length);if(!window.TradingView[t.type]||!(0,de.isLineToolName)(t.type))return void Ye.logNormal("The type of main source is not line tool - fix is unnecessary");let s=null;for(const i of e)if(!window.TradingView[t.type]||!(0,de.isLineToolName)(i.type)){if(null!==s)return void Ye.logWarn("Pane contains more than 1 possibly main sources - auto fix cannot be applied");s=i}if(null===s)return void Ye.logWarn("Pane contains only line tools - possible we need to remove this pane?");const r=i.mainSourceId;let n=0;i.mainSourceId=s.id,e.forEach((e=>{e.ownerSource===r&&(e.ownerSource=null==s?void 0:s.id,n+=1)})),Ye.logNormal("Auto fix broken pane is applied, changed line tools="+n+", changed from="+r+" to="+s.id)})();for(const t of e)if("study_Sessions"===t.type){this.model().sessions().restoreOldState(t,s);break} +for(const t of e)"study_Sessions"!==t.type&&(null===this._model.dataSourceForId(t.id)||"MainSeries"===t.type?(d[t.id]=t.ownerSource,(0,Ee.isMainSeriesState)(t)?this._restoreMainSeries(t,s,n,a,l,c):(0,Ee.isStudyState)(t)?this.restoreStudy(t,s,o,a,c,h):(0,Ee.isLineToolState)(t)?(t.state&&(t.state.zOrderVersion=2),this.restoreLineTool(t,s,void 0,c)):"ChartEventsSource"===t.type&&this._restoreSpecialSource(t,s,c)):Ye.logError("Duplicate id while restoring pane: "+t.type+","+t.id))}const u=new Set,p=(e,t)=>{e.priceScale()!==t&&(this.removeSourceFromPriceScale(e),e.setPriceScale(t),t.addDataSource(e))},_=(e,t,i)=>{if(u.has(e))return;u.add(e);const s=i.m_showSymbolLabels;void 0!==s&&e===this.model().mainSeries()&&this.model().properties().childs().scalesProperties.childs().showSymbolLabels.setValue(s),this._model.children(e,!0).forEach((e=>_(e,t,i))),p(e,t)},m=e=>{const t=(0,R.defaults)("chartproperties").paneProperties.axisProperties,i=new Le(this.model().properties().childs().scalesProperties,t);return i.restoreState(e.state),i.setHeight(this._height),e.sources.forEach((e=>{const s=this.dataSourceForId(e);s&&_(s,i,t)})),0===i.dataSources().length?null:i},g=e=>e.map(m).filter((e=>null!==e));let f;if(i.leftAxisesState)f=g(i.leftAxisesState);else{const e=m({state:i.leftAxisState,sources:i.leftAxisSources});f=null!==e?[e]:[]}let v;if(this._leftPriceScales.slice().forEach((e=>this.removePriceScale(e))),this._leftPriceScales=[],f.forEach((e=>this._placePriceScale(e,"left"))),i.rightAxisesState)v=g(i.rightAxisesState);else{const e=m({state:i.rightAxisState,sources:i.rightAxisSources});v=null!==e?[e]:[]}this._rightPriceScales.slice().forEach((e=>this.removePriceScale(e))),this._rightPriceScales=[],v.forEach((e=>this._placePriceScale(e,"right"))),this._currentPriceScaleRatio=i.priceScaleRatio||i.leftPriceScaleRatio||i.rightPriceScaleRatio||null;const S=new Map;for(const e of this.m_dataSources){if(u.has(e))continue;let t;if(i.overlayPriceScales&&i.overlayPriceScales[e.id()]){let s=i.overlayPriceScales[e.id()];S.has(null==s?void 0:s.id)?t=S.get(null==s?void 0:s.id):(s=(0,n.ensure)(s),t=new Le(this._model.properties().childs().scalesProperties),t.setHeight(this._height),s.m_isAutoScale=!0,s.m_isLog=!1,s.m_isPercentage=!1,s.m_isLockScale=!1,t.restoreState(s),S.set(s.id,t))}else t=new Le(this._model.properties().childs().scalesProperties),t.setHeight(this._height);p(e,t)}for(const e of Object.keys(d)){const t=d[e],i=this.dataSourceForId(e);t&&i&&null===i.ownerSource()&&i.setOwnerSource(this.dataSourceForId(t))}if(i.mainSourceId&&!this.containsMainSeries()&&(this.m_mainDataSource=this.dataSourceForId(i.mainSourceId)),!this.m_mainDataSource)for(const e of this.m_dataSources)if((0,ne.isPriceDataSource)(e)){this.m_mainDataSource=e;break}for(const e of this.m_dataSources)(0,y.isLineTool)(e)?(e.ownerSource()||e.setOwnerSource(this.mainDataSource()),e.isFixed()&&e.restoreFixedPoint()):(0,G.isStudy)(e)&&!e.ownerSource()&&e.isLinkedToSeries()&&e.setOwnerSource(this.model().mainSeries());this._updateMargins(),this._cachedOrderedSources.clear()} +onPriceScalesChanged(){return this._onPriceScalesChanged}setPaneSize(e){let t;switch(e){case"large":t=1;break;case"medium":t=.6;break;case"small":t=.3;break;case"tiny":t=.15;break;default:throw new Error("Unknown size enum value: "+e)}this._stretchFactor=1e3*t}stretchFactor(){return this._stretchFactor}setStretchFactor(e){this._stretchFactor=e}customSources(e){return this.model().customSources(e)}createDrawingsCaches(){re.ExecutionsPositionController.recreateOrderedByBarsSourcesCache(this)}clearDrawingCaches(){re.ExecutionsPositionController.clearOrderedByBarsSourcesCache()}executionsPositionController(){return this._executionsPositionController||(this._executionsPositionController=new re.ExecutionsPositionController(this)),this._executionsPositionController}width(){return this._width}height(){return this._height}setHeight(e){if(this._height!==e){this._height=e,this._leftPriceScales.forEach((t=>t.setHeight(e))),this._rightPriceScales.forEach((t=>t.setHeight(e)));for(let t=0;t(e.paneViews(this)||[]).some((e=>{const r=e.renderer(t,i);return r&&r.doesIntersectWithBox&&r.doesIntersectWithBox(s)}))))}logicalRectToPixels(e){const t=this.defaultPriceScale(),i=this.timeScale(),s=(0,n.ensureNotNull)((0,n.ensureNotNull)(t.mainSource()).firstValue()),r=t.priceToCoordinate(e.p1.price,s),a=i.indexToCoordinate(e.p1.index),l=t.priceToCoordinate(e.p2.price,s),c=i.indexToCoordinate(e.p2.index),h=new o.Point(Math.min(a,c),Math.min(r,l)),d=new o.Point(Math.max(a,c),Math.max(r,l));return(0,o.box)(h,d)}timeScale(){return this._timeScale}restoreLineTool(e,t,i,s,r){var o,a,l,c,h,d,u,p,_,m,g;delete e.state.lastUpdateTime,e.state.intervalsVisibilities=(0,We.mergeIntervalVisibilitiesDefaults)(e.state.intervalsVisibilities),i=void 0===i||i,Fe.LineToolElliott.migrateState(e),"LineToolGannComplex"!==(g=e).type||void 0!==g.version&&1!==g.version||(g.type="LineToolGannFixed"),Array.isArray(e.positionPercents)&&(e.positionPercents=e.positionPercents[0]) +;const f=e.type,v=e.id,S=e.state,b=i?e.zorder:this.newLineToolZOrder();(0,n.assert)((0,de.isLineToolName)(f),"invalid data source type:"+f+" (expected to be a Line Tool)");let w,C,P=null;if((0,Ee.isStudyLineToolState)(e)){P=this._model.studyVersioning();const t=P.patchPointsBasedStudyState(e);e=t;const i=t.metaInfo;Object.assign(i,ie.StudyMetaInfo.parseIdString(null==i?void 0:i.fullId));const s=P.updateMetaInfo(i)||i;C=(0,y.createStudyLineToolProperties)(f,i,s,S,P),w=(0,y.createLineTool)(f,this._model,C,s,!0)}else C=(0,y.createLineToolProperties)(f,S,this._model,!1),t?null===(o=C.child("fixedSize"))||void 0===o||o.setValue(!1):null===(a=C.child("fixedSize"))||void 0===a||a.setValue(!0),w=(0,y.createLineTool)(f,this._model,C,null,!0);w.setId(v),w.linkKey().setValue(e.linkKey||null);e.alertId&&w.canHasAlert();let x=null!==(l=e.indexes)&&void 0!==l?l:[];if(x=x.slice(0,null!==(h=null===(c=e.points)||void 0===c?void 0:c.length)&&void 0!==h?h:x.length),w.isFixed()?void 0!==e.positionPercents?w.restorePositionPercents(e.positionPercents):w.restorePositionPercents({x:.5,y:.5}):e.points&&w.restorePoints(e.points,x,t),w instanceof He.LineToolBarsPattern||w instanceof ze.LineToolCallout||w instanceof Ue.LineToolTrendAngle||w instanceof je.LineToolGhostFeed||w instanceof Ge.LineToolParallelChannel)null===(u=(d=w).restoreData)||void 0===u||u.call(d,e);else if(t&&(0,Ee.isStudyLineToolState)(e)&&w.restoreData){const t=e;P&&(t.graphics=P.patchPointsBasedStudyData(t.metaInfo,t.graphics)),null===(p=w.restoreData)||void 0===p||p.call(w,t)}const T=null==e.version?1:e.version,I=null==w.version?1:w.version;if(T!==I&&(null===(m=(_=w).migrateVersion)||void 0===m||m.call(_,T,I,{pane:this,model:this._model,properties:C})),void 0!==b&&w.setZorder(b),r)(0,y.prepareLineToolPropertiesByOwnerSource)(w.properties(),r),w.setOwnerSource(r);else{const t=e.ownerSource?this.dataSourceForId(e.ownerSource):null;w.setOwnerSource(t)}return w.isFixed()&&w.restoreFixedPoint(),void 0!==e.userEditEnabled&&w.setUserEditEnabled(e.userEditEnabled),void 0!==e.isSelectionEnabled&&w.setSelectionEnabled(e.isSelectionEnabled),this._addSourceToCollections(w,s),this._cachedOrderedSources.clear(),w}restoreStudy(e,t,s,r,n,o){var a;if(t&&void 0===e.data&&void 0===e.nonSeriesData&&void 0===e.indexes)return Ye.logError("Cannot restore (skipping) study without data "+e.id+", "+e.metaInfo.id),null;const l=e.id,h=e.state,d=e.zorder;s=null!=s?s:this._model.mainSeries().id();const u=(null!==(a=e.parentSources)&&void 0!==a?a:e.ownerSource?[e.ownerSource]:[]).filter((e=>e!==s));let p=(0,se.clone)(e.metaInfo);if(Object.assign(p,ie.StudyMetaInfo.parseIdString(p.id)),function(e){return"Script$TV_EARNINGS@tv-scripting"===e||"Script$TV_DIVIDENDS@tv-scripting"===e||"Script$TV_SPLITS@tv-scripting"===e||"ESD$TV_EARNINGS@tv-scripting"===e||"ESD$TV_DIVIDENDS@tv-scripting"===e||"ESD$TV_SPLITS@tv-scripting"===e||"Earnings@tv-basicstudies"===e||"Dividends@tv-basicstudies"===e||"Splits@tv-basicstudies"===e||"BarSetContinuousRollDates@tv-corestudies"===e +}(p.id)&&!t)return Ye.logNormal("Skipping study "+p.id),null;let _=h;const m=this._model.studyVersioning(),g=m.patchPropsStateAndMetaInfo(_,p,{oldShowStudyLastValueProperty:t&&!(null==r?void 0:r.showStudyLastValueProperty)});_=g.propsState,p=g.metaInfo;const f=new P.StudyStub(this._model,e,p.shortDescription);let v;f.setId(l),f.setZorder(d);let y=!1;const S=i=>{if(y&&this._model.dataSourceForId(l)!==f)return;f.setStatus({type:Be.StudyStatusType.Undefined});const s=i||new ie.StudyMetaInfo(p),r=Oe.instance(this._model),n=n=>{var a;const c=(0,x.prepareStudyPropertiesForLoadChart)(p,i,_,m),h=(0,G.createStudy)(this._model,c,n,s,void 0,o);if(h.setId(l),h.setOwnFirstValue(null!==(a=e.ownFirstValue)&&void 0!==a?a:null),e.customFields&&h.restoreStateCustomFields(e.customFields),t){const t=e,{data:i,nsData:s,indexes:r}=m.patchStudyData(p,t.data,t.nonSeriesData,t.indexes);h.restoreData(i,s,r)}this._model.replaceStudyStub(f,h)||(v=h),r.add(l,h)};if(u.length>0){const e=u.map((e=>r.get(e)));Promise.all(e).then(n)}else n([])};if(t)S(null);else{let e=null;0;const t=e=>{const t=m.updateMetaInfoAsync(e);t.sync?S(t.result):t.result.then(S).catch((e=>f.setFailed("error: "+e)))};e?e.then(t).catch((()=>f.setFailed(c.t(null,void 0,i(28523))))):t(p)}const b=null!=v?v:f;if(b){b.setZorder(d);const t=e.metaInfo.linkedToSeries?this._model.mainSeries():u.length?this.dataSourceForId(u[0]):null;b.setOwnerSource(t),this._addSourceToCollections(b,n),this._processMainSourceChange(),y=b===f}return this._cachedOrderedSources.clear(),b}clipboardLineToolOwnerSource(e){const t=this.dataSourceForId(e);if(null!==t){const e=t.ownerSource();if(null!==e&&null!==e.firstValue())return e}const i=this.mainDataSource();if(null!==i&&null!==i.firstValue())return i;for(const e of this.dataSources())if((0,ne.isPriceDataSource)(e)&&null!==e.firstValue())return e;return null}realignLineTools(e){var t;let i=!1;for(const s of this.m_dataSources)!(0,y.isLineTool)(s)||void 0!==e&&(null===(t=null==s?void 0:s.ownerSource())||void 0===t?void 0:t.symbolSource())!==e&&(0,me.isActingAsSymbolSource)(e)||(s.realign(),s.updateAllViews((0,H.sourceChangeEvent)(s.id())),i=!0);return i&&this._invalidateSourcesCache(),i}startScalePrice(e,t){e.startScale(t)}scalePriceTo(e,t){e.scaleTo(t),this.updateAllViews((0,H.viewportChangeEvent)())}endScalePrice(e){e.endScale()}startScrollPrice(e,t){e.startScroll(t)}scrollPriceTo(e,t){e.scrollTo(t),this.updateAllViews((0,H.viewportChangeEvent)())}endScrollPrice(e){e.endScroll()}resetPriceScale(e){const t=this.timeScale().visibleBarsStrictRange();e.resetScaleAvailable().value()&&e.resetScale(),e.recalculatePriceRange(t),this.updateAllViews((0,H.viewportChangeEvent)())}resetPriceScalesAvailable(){return this._resetPriceScalesAvailable.readonly()}restorePriceScaleState(e,t){e.restoreState(t),this.updateAllViews((0,H.viewportChangeEvent)())}beginInsertManyLineDataSources(){this._isInInsertManyDataSourcesState=!0,this._lastLineDataSourceZOrder=null}endInsertManyLineDataSources(){this._isInInsertManyDataSourcesState=!1,this._lastLineDataSourceZOrder=null} +removeSourceFromPriceScale(e){const t=e.priceScale();if(null!==t){const i=t.dataSources();i.indexOf(e)>=0&&t.removeDataSource(e),0===i.length&&this.removePriceScale(t)}}_invalidateSourcesCache(){this._cachedOrderedSources.clear(),this._leftPriceScales.forEach((e=>e.invalidateSourcesCache())),this._rightPriceScales.forEach((e=>e.invalidateSourcesCache()))}_processMainSourceChange(){let e=!1;if(null===this.m_mainDataSource)for(const t of this.m_dataSources)if((0,ne.isPriceDataSource)(t)&&!this.isOverlay(t)&&(!(0,G.isStudy)(t)||!t.isLinkedToSeries())){this.m_mainDataSource=t,e=!0;break}if(this.m_mainDataSource&&e){let e=this.m_dataSources.filter(y.isLineTool);e=(0,oe.sortSources)(e);for(const t of e)this.move(t,(0,n.ensureNotNull)(this.m_mainDataSource.priceScale()),!0)}else if(!this.m_mainDataSource||this.isOverlay(this.m_mainDataSource)&&0===this._nonOverlayPricesSourcesCount()){let e=null;if(this.m_dataSources.includes(this._model.mainSeries()))e=this._model.mainSeries();else for(const t of this.m_dataSources)if((0,ne.isPriceDataSource)(t)&&this.isOverlay(t)&&t.showInObjectTree()){e=t;break}if(null!==e){const t=this.m_mainDataSource===e;this.m_mainDataSource=e;const i=this.createNewPriceScaleIfPossible();if(t&&e===this._model.mainSeries()){const t=(0,n.ensureNotNull)(e.priceScale());this._model.children(e,!0).forEach((e=>{this.removeSourceFromPriceScale(e),i.addDataSource(e),e.setPriceScale(i)})),this.removePriceScale(t)}this.move(e,i,!0),this.recalculatePriceScale(e.priceScale(),(0,H.globalChangeEvent)())}}}_addSourceToCollections(e,t){this.m_dataSources.push(e),this._sourcesById.set(e.id(),e),this._invalidateSourcesCache();const i=()=>{this._sourcePropertiesChanged.fire(e)};e.properties().subscribe(this,i),e.zOrderChanged().subscribe(this,(t=>this._sourcesZOrderChanged.fire(e,t))),(0,y.isLineTool)(e)&&(e.normalizedPointsChanged().subscribe(this,i),e.fixedPointChanged().subscribe(this,i),e.hasAlert().subscribe(i),e.sharingMode().subscribe(i),e.linkKey().subscribe(i),this._sourceWatchedValuesSubscriptions.set(e.id(),i));const s=(0,me.isSymbolSource)(e)?e:null;(0,ne.isPriceDataSource)(e)&&(this._priceSourcesById.set(e.id(),e),e.currencyChanged().subscribe(this,(()=>this._invalidateSourcesCache())),e.unitChanged().subscribe(this,(()=>this._invalidateSourcesCache())),this._priceDataSources.push(e),this._onPriceSourcesCollectionChanged(),null!==s&&(this._symbolSources.push(s),s.symbolResolved().subscribe(this,(()=>this._symbolSourceResolved.fire(e))),s.symbolResolvingActive().subscribe(this._recalcSymbolSourceResolvingActive),s.symbolHibernated().subscribe(this._onSymbolSourceCollectionChanged),this._recalcSymbolSourceResolvingActive(),this._onSymbolSourceCollectionChanged())),e.isMultiPaneAvailable()&&this.model().addMultiPaneSource(e),t||0!==this._bulkActions.activeCounter||this._dataSourcesCollectionChanged.fire()}_removeSourceFromCollections(e,t){const i=this.m_dataSources[e];i.properties().unsubscribeAll(this),i.zOrderChanged().unsubscribeAll(this),this.m_dataSources.splice(e,1),this._sourcesById.delete(i.id()) +;const s=i.id();if((0,y.isLineTool)(i)&&(i.normalizedPointsChanged().unsubscribeAll(this),i.fixedPointChanged().unsubscribeAll(this),this._sourceWatchedValuesSubscriptions.has(s))){const e=this._sourceWatchedValuesSubscriptions.get(s);i.hasAlert().unsubscribe(e),i.linkKey().unsubscribe(e)}this._invalidateSourcesCache();const r=(0,me.isSymbolSource)(i)?i:null;(0,ne.isPriceDataSource)(i)&&(this._priceSourcesById.delete(i.id()),i.currencyChanged().unsubscribeAll(this),i.unitChanged().unsubscribeAll(this),(0,v.removeItemFromArray)(this._priceDataSources,i),this._onPriceSourcesCollectionChanged(),null!==r&&((0,v.removeItemFromArray)(this._symbolSources,r),r.symbolResolved().unsubscribeAll(this),r.symbolResolvingActive().unsubscribe(this._recalcSymbolSourceResolvingActive),r.symbolHibernated().unsubscribe(this._onSymbolSourceCollectionChanged),this._recalcSymbolSourceResolvingActive(),this._onSymbolSourceCollectionChanged())),i.isMultiPaneAvailable()&&this.model().removeMultiPaneSource(i),t||0!==this._bulkActions.activeCounter||this._dataSourcesCollectionChanged.fire()}_recalculatePriceScaleByScaleRatio(e){this.isMainPane()&&e===this._lockedPriceScale&&(null!==this._currentPriceScaleRatio?this._applyOldScaleRatioToPriceScale():this._tryToApplyNewPriceScaleRatio())}_defaultBottomMargin(){return.01*this.properties().childs().bottomMargin.value()}_defaultTopMargin(){return.01*this.properties().childs().topMargin.value()}_updateMargins(){const e=this._defaultTopMargin(),t=this._defaultBottomMargin();for(const i of this._leftPriceScales)Ke(i,e,t);for(const i of this._rightPriceScales)Ke(i,e,t);for(const i of this.m_dataSources)if(this.isOverlay(i)){const s=i.priceScale();null!==s&&(Ke(s,e,t),this.recalculatePriceScale(s,(0,H.viewportChangeEvent)()))}for(const e of this._leftPriceScales)this.recalculatePriceScale(e,(0,H.viewportChangeEvent)());for(const e of this._rightPriceScales)this.recalculatePriceScale(e,(0,H.viewportChangeEvent)());this.updateAllViews((0,H.viewportChangeEvent)())}_batchReorder(e,t,i){i(this.sourcesByGroup().allExceptSpecialSources(),e,t),this._invalidateSourcesCache(),this._dataSourcesCollectionChanged.fire(),this.model().fullUpdate()}_placePriceScale(e,t,i){if("overlay"===t)return void e.invalidateMargins();const s="left"===t?this._leftPriceScales:this._rightPriceScales,r=void 0===i?s.length:i;s.splice(r,0,e),e.modeChanged().subscribe(this,this._onPriceScaleModeChanged.bind(this,e)),e.internalHeightChanged().subscribe(this,this._recalculatePriceScaleByScaleRatio.bind(this,e)),e.priceRangeChanged().subscribe(this,this._recalculateTimeScaleByScaleRatio.bind(this,e)),e.priceRangeChanged().subscribe(this,this._onPriceScaleSetMinMaxPriceRange.bind(this,e)),e.isVisible().subscribe(this._onPriceScaleIsVisibleChanged),e.resetScaleAvailable().subscribe(this._updateResetPriceScalesAvailableValue),e.isLockScale()&&((0,n.assert)(null===this._lockedPriceScale),this._lockedPriceScale=e,this._currentPriceScaleRatio=null),e.invalidateMargins(),this._onPriceScalesChanged.fire(),this._updateResetPriceScalesAvailableValue() +}_onPriceScaleModeChanged(e,t,i){if(i.lockScale&&(this._lockedPriceScale!==e&&null!==this._lockedPriceScale&&this._lockedPriceScale.setMode({lockScale:!1}),this._lockedPriceScale=e,this._currentPriceScaleRatio=(0,ke.scaleRatio)(this.timeScale(),e)),t.lockScale&&!i.lockScale&&(this._lockedPriceScale=null,this._currentPriceScaleRatio=null),t.percentage===i.percentage&&t.indexedTo100===i.indexedTo100)return;const s=this.timeScale().visibleBarsStrictRange();null!==s&&(e.recalculatePriceRange(s),e.updateAllViews((0,H.viewportChangeEvent)()))}_applyOldScaleRatioToPriceScale(){this._isRecalculatingScales||null===this._currentPriceScaleRatio||null===this._lockedPriceScale||(this._isRecalculatingScales=!0,this._setNewPriceRangeByScaleRatio(this._lockedPriceScale,this._currentPriceScaleRatio,this._mainSourceVisiblePriceRange(this._lockedPriceScale)),this._isRecalculatingScales=!1)}_setNewPriceRangeByScaleRatio(e,t,i,s,r){const n=(0,ke.priceRangeByScaleRatio)(e,this.timeScale().barSpacing(),t);e.setPriceRange(null!==n?n:i,s,r)}_applyOldScaleRatioToTimeScale(){this._isRecalculatingScales||null===this._currentPriceScaleRatio||(this._isRecalculatingScales=!0,this._setNewBarSpacingByScaleRatio(),this._isRecalculatingScales=!1)}_tryToApplyNewPriceScaleRatio(){const e=(0,n.ensureNotNull)(this._lockedPriceScale),t=(0,ke.scaleRatio)(this.timeScale(),e);this._currentPriceScaleRatio===t||e.isLog()||(this._currentPriceScaleRatio=t,this.model().mainSeriesScaleRatioPropertyOnChanged())}_recalculateTimeScaleByScaleRatio(e){e===this._lockedPriceScale&&(null!==this._currentPriceScaleRatio?this._applyOldScaleRatioToTimeScale():this._tryToApplyNewPriceScaleRatio())}_setNewBarSpacingByScaleRatio(){const e=this.timeScale().getValidBarSpacing((0,ke.barSpacingByScaleRatio)((0,n.ensureNotNull)(this._lockedPriceScale),this._currentPriceScaleRatio));this.timeScale().isValidBarSpacing(e)&&this.timeScale().setBarSpacing(e)}_mainSourceVisiblePriceRange(e){const t=this.timeScale().visibleBarsStrictRange();return null!==t?(0,n.ensureNotNull)((0,n.ensureNotNull)(e.mainSource()).priceRange(t.firstBar(),t.lastBar())):new ue.PriceRange(-.5,.5)}_setMinMaxPriceRange(){const e=(0,n.ensureNotNull)(this._lockedPriceScale),t=(0,ke.priceRangeByScaleRatio)(e,this.timeScale().maxBarSpacing(),this._currentPriceScaleRatio),i=(0,ke.priceRangeByScaleRatio)(e,this.timeScale().minBarSpacing(),this._currentPriceScaleRatio);null!==t&&e.setMaxPriceRange(t),null!==i&&e.setMinPriceRange(i)}_onPriceScaleSetMinMaxPriceRange(e){e===this._lockedPriceScale&&this._setMinMaxPriceRange()}_onPriceSourcesCollectionChanged(){0===this._bulkActions.activeCounter?this._priceSourcesCollectionChanged.fire():this._bulkActions.priceSourcesCollectionChanged=!0}_nonOverlayPricesSourcesCount(){return this.m_dataSources.filter((e=>(!(0,G.isStudy)(e)||!e.isLinkedToSeries())&&((0,ne.isPriceDataSource)(e)&&e.showInObjectTree()&&!this.isOverlay(e)))).length}_restoreMainSeries(e,t,i,s,r,n){var o,a,l;const c=e.id,h=e.state;if(h&&r&&(h.style=null!==(o=r.style)&&void 0!==o?o:h.style, h.interval=r.interval||h.interval,r.symbol&&r.symbol!==h.symbol&&(h.symbol=r.symbol,delete h.currencyId,delete h.unitId)),h&&["candleStyle","hollowCandleStyle","haStyle"].forEach((e=>{h[e]&&(h[e].wickUpColor=h[e].wickUpColor||h[e].wickColor,h[e].wickDownColor=h[e].wickDownColor||h[e].wickColor)})),h&&(h.statusViewStyle=h.statusViewStyle||{},!h.statusViewStyle.symbolTextSource)){const e=!!h.statusViewStyle.showSymbolAsDescription;h.statusViewStyle.symbolTextSource=e?"ticker":"description"}if(h){h.extendedHours?h.sessionId="extended":h.sessionId||(h.sessionId="regular"),delete h.extendedHours,(0,qe.allChartStyles)().includes(h.style)||(h.style=2);const e=h.lineStyle.styleType;let t;delete h.lineStyle.styleType,0===e&&(t=14,h.lineWithMarkersStyle=(0,se.clone)(h.lineStyle)),1===e&&(t=15,h.steplineStyle=(0,se.clone)(h.lineStyle)),void 0!==t&&2===h.style&&(h.style=t)}if(!i){const e=this._model.mainSeries();this._model.mainPane().removeDataSource(e,!1,n),this._addSourceToCollections(e,n)}const d=this.model().mainSeries(),u=d.properties().childs();this.m_mainDataSource=d;const p=h&&h.style?h.style:void 0;if(6===p&&"ATR"===u.pnfStyle.childs().inputs.childs().style.value()?u.pnfStyle.childs().inputs.childs().style.setValueSilently("Traditional"):4===p&&"ATR"===u.renkoStyle.childs().inputs.childs().style.value()&&u.renkoStyle.childs().inputs.childs().style.setValueSilently("Traditional"),h&&!h.hasOwnProperty("showSessions")&&(h.showSessions=!1),h&&void 0===h.settlementAsClose&&(h.settlementAsClose=!1),h&&t&&(h.showCountdown=!1),h&&(t&&!("showSeriesLastValueProperty"in s)&&"showLastValue"in h&&this._model.properties().childs().scalesProperties.childs().showSeriesLastValue.setValue(h.showLastValue),delete h.showLastValue),h){const t={haStyle:(0,F.chartStyleStudyId)(8,!0),renkoStyle:(0,F.chartStyleStudyId)(4,!0),pbStyle:(0,F.chartStyleStudyId)(7,!0),kagiStyle:(0,F.chartStyleStudyId)(5,!0),pnfStyle:(0,F.chartStyleStudyId)(6,!0),rangeStyle:(0,F.chartStyleStudyId)(11,!0),volFootprintStyle:(0,F.chartStyleStudyId)(17,!0)},i=this._model.studyVersioning(),s=d.styleStudyInfos(),r=Object.keys(Ve.SYMBOL_STRING_DATA);for(let n=0;nthis._right+.5?!0===t&&2:!0!==t||0}before(e){return ethis._right+.5}intersects(e){return!(this.after(e.left())||this.before(e.right()))}equals(e){return this._left===e.left()&&this._right===e.right()}static compare(e,t){return null===e||null===t?e===t:e.equals(t)}}const it=(0,J.getLogger)("Chart.TimePoints");function st(e,t){return null===e||null===t?e===t:e.firstIndex===t.firstIndex&&e.lastIndex===t.lastIndex}class rt{constructor(){this._zoffset=0,this._items=[],this._range=new Y.WatchedObject(null,st)}clear(){this._zoffset=0,this._items=[],this._range.setValue(null)}size(){return this._items.length}range(){return this._range.readonly()}merge(e,t,i){const s=this._mergeImpl(e,t,i);return this._updateFirstAndLastIndex(),s}addTail(e,t){for(let i=t?1:0;ithis._items[this._items.length-1])return t?this._validOffsetToIndex(this._items.length-1):null;for(let i=0;io){const i=e-o;if(i<500&&null!=t)return t(l,i);return l+i*c}return null}roughIndex(e,t=null){const i=this._items;if(!i.length||i.length<2)return null;const s=i.length-1,r=this._validOffsetToIndex(0),n=this._validOffsetToIndex(s),o=i[0],a=i[s];if(e>=o&&e<=a)return this.closestIndexLeft(e);const l=(a-o)/(n-r);if(ea){const i=e-a;let s=Math.trunc(i/l);if(s<500&&null!==t){const i=t(a,e);i.success&&(s=i.result)}return n+s}return null}closestIndexLeft(e){const t=this._items;if(!t.length)return null;if(Number.isNaN(e))return null;let i=t.length-1;if(e>=t[i])return this._validOffsetToIndex(i);let s=0;const r=t[s];if(es+1;){const r=s+i>>1,n=t[r];if(n>e)i=r;else{if(!(nthis._zoffset&&e+t>0)return it.logError("merge: when the first time point index is updated, we should fill the time points starting from the first one"),[];if(0===this._items.length)return this._items=i.slice(),this._zoffset=t,[{change:"rebuild",index:this._validOffsetToIndex(0)}];const s=e+this._zoffset;if(s<0){const r=Math.abs(s);if(i.lengththis._items.length){const e=o-this._items.length;for(let t=n;t0}update(e,t,i,s){this._visibleBarsInvalidated=!0,i.length>0&&this._points.merge(e,t,i),this._tickMarks.merge(s),this.correctOffset()}addTail(e,t,i){this._tickMarks.removeTail(t);const s=e.params,r=(0,n.ensureDefined)(this._tickMarks.maxIndex)+(i?0:1);for(let e=0;e0&&(i*=this._width/e.width)),this._tryToUpdateBarSpacing(this._barSpacing,i),this.correctOffset(),this._usePercentageRightOffset.value()&&(this._rightOffset=this.percentsToBarIndexLength(this._defaultRightOffsetPercentage.value())),this._rightOffsetChanged.fire(this._rightOffset)}marks(){if(this.isEmpty())return null;const e=this._barSpacing,t=5*((this._scalesProperties.childs().fontSize.value()||0)+4),i=Math.round(t/e),s=(0,n.ensureNotNull)(this.visibleBarsStrictRange()),r=Math.max(s.firstBar(),s.firstBar()-i),o=Math.max(s.lastBar(),s.lastBar()-i),a=this._tickMarks.build(e,t),l=[];for(const e of a){if(!(r<=e.index&&e.index<=o))continue;const t=this._tickMarks.indexToTime(e.index);null!==t&&l.push({ coord:this.indexToCoordinate(e.index),label:this.formatLabel(t,e.span),span:e.span,major:e.label>=ct.DAY_SPAN})}return l}visibleBarsStrictRange(){return this._visibleBarsInvalidated&&(this._visibleBarsInvalidated=!1,this._updateVisibleBars()),this._visibleBars.strictRange()}visibleBarsStrictRangeChanged(){return this._visibleBarsChanged}visibleStrictDataRange(e){const t=this.visibleBarsStrictRange();if(null===t)return null;const i=e.search(t.firstBar(),gt.PlotRowSearchMode.NearestRight),s=e.search(t.lastBar(),gt.PlotRowSearchMode.NearestLeft);return null===i||null===s?null:new et.BarsRange(i.index,s.index)}visibleExtendedDataRange(e,t){const i=this.visibleBarsStrictRange();if(null===i)return null;let s=1===t?null:e.search(i.firstBar()-1,gt.PlotRowSearchMode.NearestLeft),r=0===t?null:e.search(i.lastBar()+1,gt.PlotRowSearchMode.NearestRight);return null===s&&(s=e.search(i.firstBar(),gt.PlotRowSearchMode.NearestRight)),null===r&&(r=e.search(i.lastBar(),gt.PlotRowSearchMode.NearestLeft)),null===s||null===r?null:new et.BarsRange(s.index,r.index)}logicalRangeChanged(){return this._logicalRangeChanged}tickMarks(){return this._tickMarks}points(){return this._points}width(){return this._width}setWidth(e,t){if(!Number.isFinite(e)||e<=0)return void Pt.logWarn(`setWidth: invalid argument: ${e}`);if(this._width===e)return;const i=this._usePercentageRightOffset.value()&&this._rightOffset>0?this.barIndexLengthToPercents(this._rightOffset):-1;if(this._visibleBarsInvalidated=!0,(t||this._options.lockVisibleTimeRangeOnResize)&&this._width){const t=this._barSpacing*e/this._width;this._tryToUpdateBarSpacing(this._barSpacing,t)}else this._width&&this.setBarSpacing(this._barSpacing);if(null!==this._leftEdgeIndex){if((0,n.ensureNotNull)(this.visibleBarsStrictRange()).firstBar()<=this._leftEdgeIndex){const t=this._width-e;this._rightOffset-=Math.round(t/this._barSpacing)+1}}this._width=e,this._widthChanged.fire(e);const s=this._rightOffset;i>0?this._rightOffset=this.percentsToBarIndexLength(i):this.correctOffset(),this._rightOffset!==s&&this._rightOffsetChanged.fire(this._rightOffset),this._requestMoreData()}setLeftEdgeFix(e){this._leftEdgeIndex=e;const t=this.visibleBarsStrictRange();if(null===t)return;const i=t.firstBar()-e;if(i<0){const e=this._rightOffset-i-1;this.scrollToOffsetAnimated(e,500)}}indexToCoordinate(e){if(this.isEmpty())return 0;const t=this.baseIndex(),i=this._pointWeights.indexToTotalWeight(t+this._rightOffset+.5)-this._pointWeights.indexToTotalWeight(e);return this._width-i*this._barSpacing}indexToUserTime(e){return this._tickMarks.indexToTime(e)}timePointToIndex(e,t){switch(t){case 0:return this._points.indexOf(e,!1);case 1:return this._points.closestIndexLeft(e);default:return this._points.indexOf(e,!0)}}indexToTimePoint(e){return this._points.valueAt(e)}timeToCoordinate(e){const t=this._points.closestIndexLeft(e);if(null===t)return null;const i=(0,n.ensureNotNull)(this._points.valueAt(t)),s=this.indexToCoordinate(t);if(s<=0||s>=this._width)return null;const r=this.barSpacing(),o=this.baseIndex(),a=s+(e-i)/((0, n.ensureNotNull)(this._points.valueAt(o))-(0,n.ensureNotNull)(this._points.valueAt(o-1)))*r+1;return a<=0||a>=this._width?null:a}barIndexesToCoordinates(e){const t=this._pointWeights.indexToTotalWeight(this.baseIndex()+this._rightOffset+.5);for(const i of e){const e=i.time,s=t-this._pointWeights.indexToTotalWeight(e);i.time=this._width-s*this._barSpacing}}fillBarBorders(e,t,i){var s,r;if(0===e.length)return;let o=null!==(s=null==t?void 0:t.startItemIndex)&&void 0!==s?s:0;const a=(null!==(r=null==t?void 0:t.endItemIndex)&&void 0!==r?r:e.length)-1;!0===i&&(o=(0,v.upperbound)(e,nt.UNPLOTTABLE_TIME_POINT_INDEX,((e,t)=>ep.timePointIndex)g=p.right+(i.timePointIndex-p.timePointIndex),m=g-.5,_=g-1;else for(f&&(_=d.left,m=d.center,g=d.right,f=!1);d.timePointIndexe{void 0!==t&&t(),this._requestMoreData()};if(e){const e=this._rightOffset,t=this.maxRightOffset();return t>0&&i>t&&(i=t),void this._model.setTimeScaleAnimation(new yt({from:e,to:i,duration:1e3,easing:Je.easingFunc.easeInOutQuint,onFinish:s}))}this._visibleBarsInvalidated=!0,this._updateRightOffset(i),this._onScroll.fire(),s()}scrollToFirstBar(e=(()=>{})){this._model.gotoTime(new Date("1800-01-01").getTime()).then(e),this._onScroll.fire()}scrollToOffsetAnimated(e,t){if(!isFinite(e))throw new RangeError("offset is required and must be finite number");const i=void 0===t?400:t;if(!isFinite(i)||i<=0)throw new RangeError("animationDuration (optional) must be finite positive number");const s=this._rightOffset,r=Date.now(),n=()=>{this._visibleBarsInvalidated=!0;const t=(Date.now()-r)/i -;if(t>=1)return this._updateRightOffset(e),this._visibleBarsInvalidated=!0,this._model.recalculateAllPanes((0,H.viewportChangeEvent)()),void this._model.lightUpdate();const o=s+(e-s)*t;this._updateRightOffset(o),this._model.recalculateAllPanes((0,H.viewportChangeEvent)()),setTimeout(n,20)};n()}defaultRightOffset(){return this._defaultRightOffset}rightOffsetDefaultValue(){return 10}defaultRightOffsetPercentage(){return this._defaultRightOffsetPercentage}usePercentageRightOffset(){return this._usePercentageRightOffset}barSpacing(){return this._barSpacing}setBarSpacing(e){Number.isFinite(e)?(e=this.getValidBarSpacing(e),this._tryToUpdateBarSpacing(this._barSpacing,e)&&(this.correctOffset(),this._options.preserveBarSpacing&&((0,I.saveDefaultProperties)(!0),this._scalesProperties.childs().barSpacing.setValue(this._barSpacing),(0,I.saveDefaultProperties)(!1)),this._model.recalculateAllPanes((0,H.viewportChangeEvent)()),this._model.lightUpdate())):Pt.logWarn(`setBarSpacing: invalid argument: ${e}`)}barSpacingChanged(){return this._barSpacingChanged}getValidBarSpacing(e){return null==e&&(e=this.barSpacing()),ethis.maxBarSpacing()?this.maxBarSpacing():e}isValidBarSpacing(e){return e>=this.minBarSpacing()&&e<=this.maxBarSpacing()}preserveBarSpacing(){return this._options.preserveBarSpacing}normalizeBarIndex(e){let t=0,i=0;const s=this.baseIndex(),r=(0,n.ensureNotNull)(this._points.range().value()).firstIndex;return es?(t=(0,n.ensureNotNull)(this._points.valueAt(s)),i=e-s):(t=(0,n.ensureNotNull)(this._points.valueAt(e)),i=0),{time_t:t,offset:i}}denormalizeTimePoint(e){const t=this._points.indexOf(e.time_t,!1);if(null!==t)return t+e.offset}rightOffset(){return this._rightOffset}rightOffsetChanged(){return this._rightOffsetChanged}minRightOffset(){var e;const t=null===(e=this.points().range().value())||void 0===e?void 0:e.firstIndex,i=this._baseIndex;if(void 0===t||null===i)return null;if(null!==this._leftEdgeIndex){const e=this.width()/this._barSpacing;return this._leftEdgeIndex-i+e-1}return t-i-1+Ct}maxRightOffset(){return this.width()/this._barSpacing-Ct}maxRightOffsetChanged(){return this._maxRightOffsetChanged}onReset(){return this._resetDelegate}scrollStartPoint(){return this._scrollStartPoint}baseIndex(){return this._baseIndex||0}zoom(e,t,i){if(!Number.isFinite(e)||!Number.isFinite(t))return void Pt.logWarn(`zoom: invalid arguments: ${e}, ${t}, ${i}`);const s=this.rightOffset(),r=void 0!==i?!i:this._options.rightBarStaysOnScroll,n=r&&this.usePercentageRightOffset().value()&&s>=0,o=n?this.barIndexLengthToPercents(s):void 0,a=this.coordinateToIndex(e),l=this.barSpacing(),c=l+t*(l/10);this.setBarSpacing(c),r||this.setRightOffset(s-.5+(a-this.coordinateToFloatIndex(e))),n&&void 0!==o&&this.setRightOffset(this.percentsToBarIndexLength(o)),this._requestMoreData()}zoomToBarsRange(e,t){if(null!==this._leftEdgeIndex&&(e=Math.max(e,this._leftEdgeIndex)),t<=e)return;const i=this.baseIndex(),s=this._rightOffset -;this._rightOffset=t-i;const r=e-.5,n=t+.5,o=Math.max(this._pointWeights.indexToTotalWeight(n)-this._pointWeights.indexToTotalWeight(r),Ct);this.setBarSpacing(this.width()/o),this._visibleBarsInvalidated=!0,this.correctOffset(),this._rightOffset!==s&&this._rightOffsetChanged.fire(this._rightOffset),this._requestMoreData()}coordinateToIndex(e){return Math.round(this.coordinateToFloatIndex(e))}coordinateToFloatIndex(e){const t=(e-this._baseIndexBarCenterCoordinate())/this._barSpacing,i=this._pointWeights.totalWeightToIndex(t);return Math.round(1e6*i)/1e6}coordinateToVisibleIndex(e){let t=this.coordinateToIndex(e);const i=this.visibleBarsStrictRange();return null===i||i.contains(t)||(t=Math.min(Math.max(i.firstBar(),t),i.lastBar())),t}canZoomIn(){return this.barSpacing()this._options.minBarSpacing}minBarSpacing(){return this._options.minBarSpacing}maxBarSpacing(){const e=this.width();return wt?e:e/Ct}minVisibleBarCount(){return Ct}resetRightOffset(){this.setRightOffset(this.targetDefaultRightOffset())}reset(){this._visibleBarsInvalidated=!0,this._points.clear(),this._scrollStartPoint=null,this._scaleStartPoint=null,this._clearCommonTransitionsStartState(),this._tickMarks.reset(),this._leftEdgeIndex=null,this._resetDelegate.fire(),this.disconnect()}resetAvailable(){return this._resetAvailable.readonly()}disconnect(){this._requestingMoreData=!1,this._requestedTickmarksCount=0,this._endOfData=!1}setBaseIndex(e){Number.isFinite(e)?(this._visibleBarsInvalidated=!0,this._baseIndex=e,this._pointWeights.setBaseIndex(this._baseIndex),this.correctOffset()):Pt.logDebug(`setBaseIndex: invalid argument: ${e}`)}resetBaseIndex(){this._visibleBarsInvalidated=!0,this._baseIndex=null}setRightOffset(e){Number.isFinite(e)?(this._visibleBarsInvalidated=!0,this._updateRightOffset(e)):Pt.logWarn(`setRightOffset: invalid argument: ${e}`)}correctBarSpacing(){this.isEmpty()||this.points().size()e&&(this._rightOffset=e,this._visibleBarsInvalidated=!0);const t=this.minRightOffset();null!==t&&this._rightOffset=1)return this._updateRightOffset(e),this._visibleBarsInvalidated=!0,this._model.recalculateAllPanes((0,H.viewportChangeEvent)()),void this._model.lightUpdate();const o=s+(e-s)*t;this._updateRightOffset(o),this._model.recalculateAllPanes((0,H.viewportChangeEvent)()),setTimeout(n,20)};n()}defaultRightOffset(){return this._defaultRightOffset}rightOffsetDefaultValue(){return 10}defaultRightOffsetPercentage(){return this._defaultRightOffsetPercentage}usePercentageRightOffset(){return this._usePercentageRightOffset}barSpacing(){return this._barSpacing}setBarSpacing(e){Number.isFinite(e)?(e=this.getValidBarSpacing(e),this._tryToUpdateBarSpacing(this._barSpacing,e)&&(this.correctOffset(),this._options.preserveBarSpacing&&((0,I.saveDefaultProperties)(!0),this._scalesProperties.childs().barSpacing.setValue(this._barSpacing),(0,I.saveDefaultProperties)(!1)),this._model.recalculateAllPanes((0,H.viewportChangeEvent)()),this._model.lightUpdate())):Pt.logWarn(`setBarSpacing: invalid argument: ${e}`)}barSpacingChanged(){return this._barSpacingChanged}getValidBarSpacing(e){return null==e&&(e=this.barSpacing()),ethis.maxBarSpacing()?this.maxBarSpacing():e}isValidBarSpacing(e){return e>=this.minBarSpacing()&&e<=this.maxBarSpacing()}preserveBarSpacing(){return this._options.preserveBarSpacing}normalizeBarIndex(e){let t=0,i=0;const s=this.baseIndex(),r=(0,n.ensureNotNull)(this._points.range().value()).firstIndex;return es?(t=(0,n.ensureNotNull)(this._points.valueAt(s)),i=e-s):(t=(0,n.ensureNotNull)(this._points.valueAt(e)),i=0),{time_t:t,offset:i}}denormalizeTimePoint(e){const t=this._points.indexOf(e.time_t,!1);if(null!==t)return t+e.offset}rightOffset(){return this._rightOffset}rightOffsetChanged(){return this._rightOffsetChanged}minRightOffset(){var e;const t=null===(e=this.points().range().value())||void 0===e?void 0:e.firstIndex,i=this._baseIndex;if(void 0===t||null===i)return null;if(null!==this._leftEdgeIndex){const e=this.width()/this._barSpacing;return this._leftEdgeIndex-i+e-1}return t-i-1+Ct}maxRightOffset(){return this.width()/this._barSpacing-Ct}maxRightOffsetChanged(){return this._maxRightOffsetChanged}onReset(){return this._resetDelegate}scrollStartPoint(){return this._scrollStartPoint}baseIndex(){return this._baseIndex||0}zoom(e,t,i){if(!Number.isFinite(e)||!Number.isFinite(t))return void Pt.logWarn(`zoom: invalid arguments: ${e}, ${t}, ${i}`);const s=this.rightOffset(),r=void 0!==i?!i:this._options.rightBarStaysOnScroll,n=r&&this.usePercentageRightOffset().value()&&s>=0,o=n?this.barIndexLengthToPercents(s):void 0,a=this.coordinateToIndex(e),l=this.barSpacing(),c=l+t*(l/10);this.setBarSpacing(c),r||this.setRightOffset(s-.5+(a-this.coordinateToFloatIndex(e))),n&&void 0!==o&&this.setRightOffset(this.percentsToBarIndexLength(o)),this._requestMoreData()}zoomToBarsRange(e,t){if(null!==this._leftEdgeIndex&&(e=Math.max(e,this._leftEdgeIndex)),tthis._options.minBarSpacing}minBarSpacing(){return this._options.minBarSpacing}maxBarSpacing(){const e=this.width();return wt?e:e/Ct}minVisibleBarCount(){return Ct}resetRightOffset(){this.setRightOffset(this.targetDefaultRightOffset())}reset(){this._visibleBarsInvalidated=!0,this._points.clear(),this._scrollStartPoint=null,this._scaleStartPoint=null,this._clearCommonTransitionsStartState(),this._tickMarks.reset(),this._leftEdgeIndex=null,this._resetDelegate.fire(),this.disconnect()}resetAvailable(){return this._resetAvailable.readonly()}disconnect(){this._requestingMoreData=!1,this._requestedTickmarksCount=0,this._endOfData=!1}setBaseIndex(e){Number.isFinite(e)?(this._visibleBarsInvalidated=!0,this._baseIndex=e,this._pointWeights.setBaseIndex(this._baseIndex),this.correctOffset()):Pt.logDebug(`setBaseIndex: invalid argument: ${e}`)}resetBaseIndex(){this._visibleBarsInvalidated=!0,this._baseIndex=null}setRightOffset(e){Number.isFinite(e)?(this._visibleBarsInvalidated=!0,this._updateRightOffset(e)):Pt.logWarn(`setRightOffset: invalid argument: ${e}`)}correctBarSpacing(){this.isEmpty()||this.points().size()e&&(this._rightOffset=e,this._visibleBarsInvalidated=!0);const t=this.minRightOffset();null!==t&&this._rightOffset=0&&this.setRightOffset(this.percentsToBarIndexLength(s))}endScale(){null!==this._scaleStartPoint&&(this._scaleStartPoint=null,this._clearCommonTransitionsStartState(),this._requestMoreData())}startScroll(e){null===this._scrollStartPoint&&null===this._commonTransitionStartState&&(this.isEmpty()||(this._scrollStartPoint=e,this._saveCommonTransitionsStartState()))}scrollTo(e){if(this._visibleBarsInvalidated=!0,null===this._scrollStartPoint)return;const t=(this._scrollStartPoint-e)/this.barSpacing(),i=(0,n.ensureNotNull)(this._commonTransitionStartState).rightOffset+t;this._updateRightOffset(i),this._onScroll.fire()}endScroll(){if(null===this._scrollStartPoint)return clearInterval(this._timeout),void(this._prevRO=void 0);this._scrollStartPoint=null,this._clearCommonTransitionsStartState(),this._requestMoreData(),this._timeout=setInterval((()=>{this._prevRO!==this.rightOffset()&&(this._prevRO=this.rightOffset(),this._requestMoreData())}),100)}formatLabel(e,t){const i="24-hours"===pt.timeHoursFormatProperty.value()?t.toString():`${t}_ampm`;let s=this._formattedBySpan.get(i);return void 0===s&&(s=new ht((e=>this.formatLabelImpl(e,t))),this._formattedBySpan.set(i,s)),s.format(new Date(e))}formatLabelImpl(e,t){if(!(e&&e instanceof Date))return"incorrect time";const s=function(e,t){if(e===ct.MILLISECOND_SPAN&&t)return"TimeWithMilliseconds";if(e=0){const e=this._defaultRightOffsetPercentage.value(),t=this._usePercentageRightOffset.value()&&this._rightOffset>=0?Math.round(this.barIndexLengthToPercents(this._rightOffset)):-1;if(this._lastDefaultRightOffset!==e&&t===this._lastDefaultRightOffset){const t=this._barSpacing*(100-e)/(100-this._lastDefaultRightOffset);this._tryToUpdateBarSpacing(this._barSpacing,t)}}this.setRightOffset(this.targetDefaultRightOffset()),this._updateResetAvailableValue(),this._lastDefaultRightOffset=this._defaultRightOffsetPercentage.value()}_updateResetAvailableValue(){this._resetAvailable.setValue(6!==this.barSpacing()||this.rightOffset()!==this.targetDefaultRightOffset())}}var Tt,It=i(34928),Mt=i(53741),At=i(83407),Lt=i(35588);class kt{constructor(e){this._onChanged=new q.Delegate,this._groups=[],this._groups=e||[],this._groups.forEach((e=>{e.onChanged().subscribe(null,(t=>this._onChanged.fire(e.id,t)))}))}groups(){return this._groups.filter((e=>e.isActualSymbol()))}groupsForAllSymbols(){return this._groups}createGroup(e,t,i){t=t||this._generateNextName();const s=new Lt.LineToolsGroup(e,t,i);this._groups.push(s),s.onChanged().subscribe(null,(e=>this._onChanged.fire(s.id,e)));const r={visibilityChanged:!1,lockedChanged:!1,isActualIntervalChanged:!1,affectedLineTools:e.map((e=>e.id()))};return this._onChanged.fire(s.id,r),s}addGroup(e){this._groups.push(e),e.onChanged().subscribe(null,(t=>this._onChanged.fire(e.id,t))),this._onChanged.fire(e.id)}removeGroup(e){const t=this._groups.findIndex((t=>t.id===e.id));this._groups.splice(t,1),this._onChanged.fire(e.id)}groupForId(e){return this._groups.find((t=>t.id===e))||null}groupForLineTool(e){return this._groups.find((t=>t.containsLineTool(e)))||null}removeLineTools(e){const t=new Set;this._groups.forEach((i=>{const s=e.filter(i.containsLineTool.bind(i));s.length&&(i.excludeLineTools(s),t.add(i.id))}));return this._groups.filter((e=>0===e.lineTools().length)).forEach((e=>this.removeGroup(e))),Array.from(t)}state(e){return{groups:(e?this._groups.filter((e=>e.isActualSymbol())):this._groups).map((e=>e.state()))}}onChanged(){return this._onChanged}fireChangedAll(){this._groups.forEach((e=>{this._onChanged.fire(e.id)}))}static fromState(e,t){const i=[];for(const s of t.groups){const t=Lt.LineToolsGroup.fromState(e,s) @@ -464,20 +464,20 @@ null!==this._alertsWatcher&&this._alertsWatcher.destroy(),this._properties.child canZoomIn(){return this._timeScale.canZoomIn()&&this._zoomEnabled}canZoomOut(){return this._timeScale.canZoomOut()&&this._zoomEnabled}onPaneTagsChanged(){this._tagsChanged.fire()}panesCollectionChanged(){return this._panesCollectionChanged}dataSourceCollectionChanged(){return this._dataSourceCollectionChanged}symbolSourceCollectionChanged(){return this._symbolSourceCollectionChanged}symbolSourceResolved(){return this._symbolSourceResolved}symbolSourceResolvingActive(){return this._symbolSourceResolvingActive}adjustForDividendsAvailability(){return this._adjustForDividendsAvailability}adjustForDividendsEnabled(){return this._adjustForDividendsEnabled}paneCollapsingAvailable(){return this._paneCollapsingAvailable}sourcePropertiesChanged(){return this._sourceProperitesChanged}sourceZOrderChanged(){return this._sourceZOrderChanged}zoomTime(e,t,i){if(!this._zoomEnabled)return;const s=this.timeScale();if(s.isEmpty()||0===t)return;const r=s.width();e=Math.max(1,Math.min(e,r-2)),s.zoom(e,t,i),this.recalculateAllPanes((0,H.viewportChangeEvent)()),this.lightUpdate(),this.recalcVisibleRangeStudies()}lineBeingEdited(){return this._lineBeingEdited}linePointBeingEdited(){return this._linePointBeingEdited}activeItemBeingMoved(){return this._activeItemBeingMoved}linePointBeingChanged(){return this._linePointBeingChanged}updateAllPaneViews(e){for(const t of this._panes)t.updateAllViews(e)}dataSources(){const e=[this.crossHairSource()];for(const t of this._panes)for(const i of t.dataSources())e.push(i);return e}priceDataSources(){const e=[];for(const t of this._panes)for(const i of t.priceDataSources())e.push(i);return e}symbolSources(){const e=[];for(const t of this._panes)for(const i of t.symbolSources())e.push(i);return e}selection(){return this._selection}selectionMacro(e,t=!1){const i=this.selection().allSources();e({removeSourceFromSelection:this._removeSourceFromSelection,addSourceToSelection:this._addSourceToSelection,clearSelection:this._clearSelection,selection:this.selection.bind(this)});const s=(0,v.subtract)(i,this.selection().allSources()),r=(0,v.subtract)(this.selection().allSources(),i);r.concat(i).forEach((e=>e.updateAllViews((0,H.selectionChangeEvent)())));let n=[];s.forEach((e=>{if((0,y.isLineTool)(e)){const i=e.hasAlert().value()&&e.getAlertSync();i&&!i.isPrice()&&i.setSelected(!1),!t&&e.shouldBeRemovedOnDeselect()&&n.push(e)}})),r.forEach((e=>{const t=(0,y.isLineTool)(e)&&e.hasAlert&&e.hasAlert().value()&&e.getAlertSync();t&&t.setSelected(!0)})),n=n.filter((e=>null!==this.dataSourceForId(e.id()))),n.length>0&&this._undoModel.removeSources(n,!1,us),this.lightUpdate(),(s.length>0||r.length>0)&&this._selectedSourceChanged.fire()}onSelectedSourceChanged(){return this._selectedSourceChanged}checkLineToolSelection(){const e=this.selection().allSources();this._selection.checkLineToolSelection(),e.length!==this.selection().allSources().length&&this._selectedSourceChanged.fire()}lineToolsGroupModel(){return this._lineToolsGroupModel}restoreLineToolsGroups(e){this._lineToolsGroupModel=kt.fromState(this,e)} realignLineTools(e){for(const t of this._panes)(void 0===e||t.hasDataSource(e))&&t.realignLineTools(e)&&this._dataSourceCollectionChanged.fire(t)}copyToOtherCharts(e,t){const i=this.mainSeries(),s=i.syncModel(),r=this.timeScale();if(s)for(const o of e){if(!o.isSynchronizable())continue;const e=o.linkKey().value()||(0,Q.randomHash)();o.linkKey().setValue(e);const a=o.state(!1),l=o.normalizedPoints(),c=o.properties().interval.value(),h=i.interval();let d;if(T.Interval.isEqual(c,h))d=l.map((e=>{const t=(0,n.ensureNotNull)(r.timePointToIndex(e.time_t))+e.offset;return{price:e.price,timeStamp:(0,n.ensureNotNull)(this.externalTimeStamp(t))}}));else{const e=s.createNewModelWithResolution(c);d=l.map((t=>({price:t.price,timeStamp:0===t.offset?t.time_t:e.projectTime(t.time_t,t.offset)})))}const u={...a,id:o.id(),linkKey:e,points:d,linetool:o.toolname,model:this,symbol:i.symbol(),withUndo:t,zOrder:o.zorder(),finalState:{points:l,interval:c},pointPositionPercents:o.isFixed()?o.calcPositionPercents():void 0,sharingMode:o.sharingMode().value()};(0,Pe.copyLineTool)(u)}}isSnapshot(){return this._isSnapshot}onWidget(){return this._options.onWidget}hideIdeas(){return this._options.hideIdeas}updateSource(e){const t=this._invalidationMaskForSource(e);null!==t&&this.invalidate(t)}updateSourcePriceScale(e){const t=this._invalidationMaskForSourcePriceScale(e);null!==t&&this.invalidate(t)}updatePane(e){this.invalidate(this._paneInvalidationMask(e))}updateTimeScaleBaseIndex(e){const t=this.mainSeries().bars();t.isEmpty()||this._updateBaseIndex((0,n.ensureNotNull)(t.lastIndex()),!!(e&&e.index>0))}setInterval(e,t){const i=setInterval(e,t);return this._modelIntervals.push(i),i}clearInterval(e){clearInterval(e);const t=this._modelIntervals.indexOf(e);t>-1&&this._modelIntervals.splice(t,1)}clearIntervals(){for(let e=0;e{i.ownerSource()===e&&i.setOwnerSource(t)})),this._invalidateBarColorerCaches(),t.start(),this.recalculatePane(i,(0,H.sourceChangeEvent)(t.id())),this.fullUpdate(),!0}insertStudyStub(e,t){const i=void 0!==t,s=new P.StudyStub(this,null,e,i);let r;if(t||!i){r=this.mainPane();const e=r.createPriceScaleAtPosition("overlay");r.addDataSource(s,e,!1)}else r=this.createPane(),r.addDataSource(s,null,!1);return this.recalculatePane(r,(0,H.sourceChangeEvent)(s.id())),this.fullUpdate(),s}removeStudyStub(e){const t=this.dataSourceForId(e);return null===t?(ms.logNormal("StudyStub id="+e+" is not found in chart model"),!1):(this.removeSource(t),!0)}allLineTools(){return this._getAllSources(y.isLineTool)}setHoveredSource(e,t=null){const i=this._hoveredSource!==e;if(!i&&(0,Ot.hitTestResultDataAreEqual)(this._lastHoveredHittestData,t))return;this._lastHoveredHittestData=t;let s=null;if(this._hoveredSource){this._hoveredSource.updateAllViews((0,H.selectionChangeEvent)()),s=new K.InvalidationMask(K.InvalidationLevel.Cursor);const e=this._invalidationMaskForSource(this._hoveredSource,K.InvalidationLevel.Light);null!==e&&s.merge(e)}if(this._hoveredSource=e,e){e.updateAllViews((0,H.selectionChangeEvent)()),s||(s=new K.InvalidationMask(K.InvalidationLevel.Cursor));const t=this._invalidationMaskForSource(e,K.InvalidationLevel.Light);null!==t&&s.merge(t)}s&&this.invalidate(s),i&&this._hoveredSourceChanged.fire(e)}properties(){return this._properties}chartApi(){return this._chartApi}disconnect(){this.sessions().stop();for(const e of this.dataSources())e.disconnect&&e.disconnect();this._timeScale.disconnect()}crossHairSource(){return this.m_crossHairSource}gridSource(){return this._gridSource}publishedChartsTimelineSource(){return null}hoveredSource(){return this._hoveredSource}hoveredSourceChanged(){return this._hoveredSourceChanged} -lastHittestData(){return this._lastHoveredHittestData}lastSelectedHittestData(){return this._lastSelectedHittestData}lightUpdate(){this.invalidate(K.InvalidationMask.light())}fullUpdate(){this.invalidate(K.InvalidationMask.full())}syncTimeWithModel(e,t){const i=this.mainSeries().syncModel();if(null===i)return;const s=1e3*this.createSyncPoint(e,i.syncSourceTarget()).sourceTimeToTargetTime(t/1e3),r=(0,Dt.get_timezone)(this.timezone());let n=(0,Dt.utc_to_cal)(r,s);this.mainSeries().isDWM()&&(n=i.getSession().spec.correctTradingDay(n),(0,Dt.set_hms)(n,0,0,0,0,(0,Dt.get_timezone)("Etc/UTC"))),this._gotoTimeImpl(n.getTime(),{centerIfVisible:!1})}gotoTime(e){return this._gotoTimeImpl(e,{centerIfVisible:!0})}recalculatePane(e,t){null==e||e.recalculate(t)}recalculateAllPanes(e){this._panes.forEach((t=>t.recalculate(e))),this.updateAllPaneViews(e),this.crossHairSource().updateAllViews(e)}gotoTimeRange(e,t){const i=this.timeScale(),s=i.tickMarks(),r=this.mainSeries();if(void 0===s.minIndex)return void(this._lastGotoTimeRange={from:e,to:t});let o=e,a=t;const l=r.symbolInfo();if(null!==l){let i=this.properties().childs().timezone.value();"exchange"===i&&(i=l.timezone);const s=(0,Dt.get_timezone)(i),n=(0,Dt.utc_to_cal)(s,e),c=(0,Dt.utc_to_cal)(s,t);if(r.isDWM()){const e=(0,Dt.get_timezone)("Etc/UTC");(0,Dt.set_hms)(n,0,0,0,0,e),(0,Dt.set_hms)(c,0,0,0,0,e)}o=n.getTime(),a=c.getTime()}const c=(0,n.ensureDefined)(s.maxIndex),h=(0,n.ensureDefined)(s.minIndex);if(o>=(0,n.ensureNotNull)(s.indexToTime(h)).valueOf()||r.endOfData()){const e=(e,t)=>e(0,n.ensureNotNull)(s.indexToTime(e)).valueOf(),l=(0,v.lowerboundExt)(t,o,e,s.nearestIndex(o),c);let d=o===a?l:(0,v.lowerboundExt)(t,a,e,s.nearestIndex(a),c);this._lastGotoTimeRange=null,null!==this._lastAppliedGotoTimeRange&&(this._lastAppliedGotoTimeRange.actual=!1);const u=i.baseIndex();if(l+Math.max(d-l+1,i.minVisibleBarCount())>u){const e=i.targetDefaultRightOffset();d-u=0;t--)if(this._panes[t].hasDataSource(e))return this._panes[t];return e instanceof Wt.BarsMarksContainer?this.paneForSource(this.mainSeries()):null}mainPane(){for(const e of this._panes)if(e.isMainPane())return e;throw new Error("Main pane is not found")}lastPane(){return this._panes[this._panes.length-1]}removeSource(e,t){this.selectionMacro((t=>t.removeSourceFromSelection(e)),!0), -this._hoveredSource===e&&(this._hoveredSource=null,this._lastHoveredHittestData=null),this._sourcesBeingMoved.includes(e)&&(this._sourcesBeingMoved=this._sourcesBeingMoved.filter((t=>t!==e)),this._sourcesBeingMoved.length||(this._activeItemBeingMoved=null)),e===this._lineBeingEdited&&(this._lineBeingEdited=null,Pe.isToolEditingNow.setValue(!1)),e===this._lineBeingCreated&&(this._lineBeingCreated=null,Pe.isToolCreatingNow.setValue(!1)),!t&&e.stop&&e.stop();const i=this.detachSource(e),s=this.mainSeries().priceScale();return(0,G.isStudy)(e)&&(0,me.isActingAsSymbolSource)(e)&&e.priceScale()===s&&s.isPercentage()&&1===s.seriesLikeSources().filter(me.isActingAsSymbolSource).length&&s.setMode({percentage:!1}),this.fullUpdate(),this._invalidateBarColorerCaches(),(0,G.isStudy)(e)&&((0,_.emit)("study_event",e.id(),"remove"),e.isChildStudy()&&e.parentSources().forEach((t=>t.unsetChild(e))),e.maxOffset().unsubscribe(this._boundUpdateStudiesMaxOffset)),!t&&e.destroy&&e.destroy(),(0,y.isLineTool)(e)&&(e.removeAlert(),(0,_.emit)("drawing_event",e.id(),"remove")),i}allStudies(e){const t=e?e=>(0,G.isStudy)(e)&&!0:G.isStudy;return this._getAllSources(t)}studiesWV(e){return e?this._studiesExcludeInternalWV.readonly():this._studiesWV.readonly()}findNonOverlayStudyWithGroupingKey(e,t){const i=void 0!==t?[t]:this._panes;for(const t of i){const i=t.dataSources().find((i=>(0,G.isStudy)(i)&&i.metaInfo().groupingKey===e&&!t.isOverlay(i)));if(void 0!==i)return{pane:t,study:i}}return null}movePaneUp(e){this.movePane(e,e-1)}movePaneDown(e){this.movePane(e,e+1)}movePane(e,t){const i=this._panes[e];this._panes.splice(e,1),this._panes.splice(t,0,i),this._panesCollectionChanged.fire(this._panes),this._onRearrangePanes.fire(),this.invalidate(K.InvalidationMask.panesOrder())}toggleCollapsedPane(e){const t=this._panes[e];t.collapsed().setValue(!t.collapsed().value()),this.fullUpdate()}backgroundColor(){return this._backgroundColor}backgroundTopColor(){return this._backgroundTopColor}backgroundColorAtYPercentFromTop(e){const t=this.backgroundColor().value(),i=this.backgroundTopColor().value();if(t===i)return t;if(e=Math.max(0,Math.min(100,Math.round(100*e))),null===this._gradientColorsCache||this._gradientColorsCache.topColor!==i||this._gradientColorsCache.bottomColor!==t)this._gradientColorsCache={topColor:i,bottomColor:t,colors:new Map};else{const t=this._gradientColorsCache.colors.get(e);if(void 0!==t)return t}const s=(0,Ft.gradientColorAtPercent)(i,t,e/100);return this._gradientColorsCache.colors.set(e,s),s}backgroundCounterColor(){return this._backgroundCounterColor.readonly()}dark(){return this._isDark}defaultResolutions(){return this.chartApi().defaultResolutions()}availableCurrencies(){const e=this._getAvailableCurrencies();return e.length!==this._availableCurrencies.size()&&(this._availableCurrencies=new Ut(e)),this._availableCurrencies}currencyConversionEnabled(){return this._options.currencyConversionEnabled}availableUnits(){const e=this._getAvailableUnits();return this._availableUnits.unitsChanged(e)&&(this._availableUnits=new jt(e)), -this._availableUnits}unitConversionEnabled(){return this._options.unitConversionEnabled}availablePriceSources(e){const t=this._getAvailablePriceSources(e);return null!==t&&this._availablePriceSources.priceSourcesChanged(t)&&(this._availablePriceSources=new cs(t)),this._availablePriceSources}resetDeferredStudies(){Oe.instance(this).reset()}isJustClonedChart(){return this._undoModel.isJustClonedChart()}studyTemplate(e,t,i){const s={panes:[],version:this.version()};for(const e of this.panes())s.panes.push(e.state(!0,!1,!0));const r=this.mainSeries();return e&&(s.symbol=r.symbol(),this.currencyConversionEnabled()&&i&&(s.currency=r.currency()),this.unitConversionEnabled()&&i&&(s.unit=r.unit())),t&&(s.interval=r.interval()),s}getStudyById(e){const t=this.dataSourceForId(e);return null!==t&&(0,G.isStudy)(t)?t:null}getLineToolById(e){const t=this.dataSourceForId(e);return null!==t&&(0,y.isLineTool)(t)?t:null}restoreLineToolState(e,t,i){var s;e.restorePoints(t.points,t.indexes||[]),t.state.intervalsVisibilities=(0,We.mergeIntervalVisibilitiesDefaults)(t.state.intervalsVisibilities),e.properties().merge(t.state),e.restoreData&&e.restoreData(t),e.linkKey().setValue(t.linkKey||null),e.createServerPoints(),e.setZorder(null!==(s=t.zorder)&&void 0!==s?s:e.zorder()),this.fullUpdate();const r=e.linkKey().value();null!==r&&i&&(0,Pe.restoreLineToolState)({model:this,linkKey:r,state:t})}preferences(){return(0,ss.preferencesByWhiteList)(this,this.mainSeries())}restoreTheme(e,t,i){e.mainSourceProperties.hollowCandleStyle||(e.mainSourceProperties.hollowCandleStyle=e.mainSourceProperties.candleStyle),this._undoModel.chartLoadTheme(e,t,i)}onResetScales(){return this._resetScales}startMovingSources(e,t,i,s,r,o){this._sourcesBeingMoved=e,this._activeItemBeingMoved=i;let a=!1;if(this._sourcesBeingMoved.forEach((e=>{!a&&(0,G.isStudy)(e)&&(a=!0);const l=(0,n.ensureNotNull)(this.paneForSource(e)),c=(0,y.isLineTool)(e),h=c&&e.linkKey().value();if(!1!==h&&null!==h&&s.has(h)&&c&&e.isFixed()){const t=(0,n.ensureDefined)(s.get(h)),a={screen:this._percentPositionToPoint(t,l)};e.startMoving(a,i,r,o)}else e.startMoving(t,i,r,o);const d=this._paneInvalidationMask(l,K.InvalidationLevel.Light);this.invalidate(d)})),!o){const s=e.filter(y.isLineTool).filter((e=>e.linkKey().value()&&e.isSynchronizable())).map((e=>e.linkKey().value()));if(s.length&&t.logical){const o=this.externalTimeStamp(t.logical.index),a={linkKeys:s,model:this,symbol:this.mainSeries().symbol(),point:{price:t.logical.price,timeStamp:o},activeItem:null!==i?i:void 0,envState:r,pointPositionPercents:new Map};e.forEach((e=>{if((0,y.isLineTool)(e)){const i=e.linkKey().value();if(i&&e.isSynchronizable()&&e.isFixed()){const s=(0,n.ensureNotNull)(this.paneForSource(e));a.pointPositionPercents.set(i,this._pointToPercentPosition((0,n.ensureDefined)(t.screen),s))}}})),(0,Pe.startMovingLineTool)(a)}}Pe.isToolMovingNow.setValue(!0),a&&Pe.isStudyEditingNow.setValue(!0)}moveSources(e,t,i,s){if(this._sourcesBeingMoved.filter((e=>!e.isLocked||!e.isLocked())).forEach((r=>{const o=(0, -y.isLineTool)(r)?r.linkKey().value():null;if(null!==o&&t.has(o)){const e=(0,n.ensureNotNull)(this.paneForSource(r)),a=(0,n.ensureDefined)(t.get(o)),l={screen:this._percentPositionToPoint(a,e)};r.move(l,this._activeItemBeingMoved,i,s)}else r.move(e,this._activeItemBeingMoved,i,s)})),this.lightUpdate(),!s&&e.logical){const t=this._sourcesBeingMoved.filter(y.isLineTool).filter((e=>e.isSynchronizable()&&!!e.linkKey().value())).map((e=>e.linkKey().value())),s=this.externalTimeStamp(e.logical.index),r={linkKeys:t,model:this,point:{price:e.logical.price,timeStamp:s},envState:i,pointPositionPercents:new Map};this._sourcesBeingMoved.filter(y.isLineTool).forEach((t=>{if(t.linkKey().value()&&t.isSynchronizable()&&t.isFixed()){const i=(0,n.ensureNotNull)(this.paneForSource(t));r.pointPositionPercents.set(t.linkKey().value(),this._pointToPercentPosition((0,n.ensureDefined)(e.screen),i))}})),(0,Pe.moveLineTool)(r)}}endMovingSources(e,t,i){const s=this._sourcesBeingMoved.map((s=>{const r=(0,n.ensureNotNull)(this.paneForSource(s)),o=s.endMoving(e,t,i),a=this._paneInvalidationMask(r,K.InvalidationLevel.Light);return a.invalidateAll(K.InvalidationLevel.Light),this.invalidate(a),o})),r=this._sourcesBeingMoved.filter(y.isLineTool).filter((e=>e.isSynchronizable()&&!!e.linkKey().value())).map((e=>e.linkKey().value())),o=this._sourcesBeingMoved.filter(y.isLineTool).filter((e=>e.isSynchronizable()&&!!e.linkKey)).map((e=>{const t={points:e.normalizedPoints(),interval:this.mainSeries().interval()};return e.isFixed()&&(t.pointPositionPercents=e.calcPositionPercents()),t}));r.length&&(0,Pe.finishMovingLineTool)({linkKeys:r,model:this,finalStates:o,changes:s}),this._sourcesBeingMoved=[],this._activeItemBeingMoved=null,Pe.isToolMovingNow.setValue(!1),Pe.isStudyEditingNow.setValue(!1)}sourcesBeingMoved(){return this._sourcesBeingMoved}setMovingCustomSource(e,t){this._customSourceBeingMoved=e,this._customSourceBeingMovedHitTestData=null!==t?{beingMoved:!1,cancelled:!1,...t}:null}processingCustomSourceMove(){null!==this._customSourceBeingMovedHitTestData&&(this._customSourceBeingMovedHitTestData.beingMoved=!0)}customSourceMovingHitTestData(){return this._customSourceBeingMovedHitTestData}customSourceBeingMoved(){return null!==this._customSourceBeingMovedHitTestData&&this._customSourceBeingMovedHitTestData.beingMoved?this._customSourceBeingMoved:null}lineToolsSynchronizer(){return this._lineToolsSynchronizer}setLineToolsSynchronizer(e){this._lineToolsSynchronizer=e}width(){return this._width}setWidth(e,t){this._width=e,this._timeScale.setWidth(e,t);for(const t of this._panes)t.setWidth(e);this.recalculateAllPanes((0,H.viewportChangeEvent)()),this.recalcVisibleRangeStudies()}setPaneHeight(e,t){e.setHeight(t),this.recalculateAllPanes((0,H.viewportChangeEvent)()),this.lightUpdate()}resetScalesAvailable(){return this._resetScalesAvailable.readonly()}panes(){return this._panes}paneForId(e){return this._panes.find((t=>t.id()===e))||null}createPane(e,t,i){const s=this._undoModel.chartWidget();s.isMaximizedPane()&&s.toggleMaximizePane(null) -;const r=this._properties.childs().paneProperties;t&&r.merge(t);const n=new Xe(this._timeScale,r,this,i);return void 0!==e?this._panes.splice(e,0,n):this._panes.push(n),n.onTagsChanged().subscribe(this,ys.prototype.onPaneTagsChanged),n.dataSourcesCollectionChanged().subscribe(this,(()=>this._dataSourceCollectionChanged.fire(n))),n.symbolSourceCollectionChanged().subscribe(this,(()=>this._onSymbolSourceCollectionChanged(n))),n.priceSourcesCollectionChanged().subscribe(this,(()=>this._onPriceSourcesCollectionChanged(n))),n.sourcePropertiesChanged().subscribe(this,(e=>this._sourceProperitesChanged.fire(n,e))),n.sourceZOrderChanged().subscribe(this,(e=>this._sourceZOrderChanged.fire(n,e))),n.symbolSourceResolved().subscribe(this,(e=>this._symbolSourceResolved.fire(n,e))),n.symbolSourceResolvingActive().subscribe(this._recalcSymbolResolvingActive),n.collapsed().subscribe(this._recalcPaneCollapsingAvailable),n.resetPriceScalesAvailable().subscribe(this._updateResetScalesAvailableValue,{callWithLast:!0}),this._recalcPaneCollapsingAvailable(),this._panesCollectionChanged.fire(this._panes),this.invalidate(K.InvalidationMask.panesOrder()),n}removePane(e){const t=this._undoModel.chartWidget();t.isMaximizedPane()&&t.toggleMaximizePane(null);const i=e;i.destroy();const s=this._panes.indexOf(i);-1!==s&&(this._panes.splice(s,1),e.dataSourcesCollectionChanged().unsubscribeAll(this),e.symbolSourceCollectionChanged().unsubscribeAll(this),e.priceSourcesCollectionChanged().unsubscribeAll(this),e.sourcePropertiesChanged().unsubscribeAll(this),e.onTagsChanged().unsubscribeAll(this),e.symbolSourceResolved().unsubscribeAll(this),i.symbolSourceResolvingActive().unsubscribe(this._recalcSymbolResolvingActive),e.collapsed().unsubscribe(this._recalcPaneCollapsingAvailable),e.resetPriceScalesAvailable().unsubscribe(this._updateResetScalesAvailableValue),this._recalcPaneCollapsingAvailable(!0)),this._updateResetScalesAvailableValue();this.crossHairSource().pane===e&&this.clearCurrentPosition(),this._panesCollectionChanged.fire(this._panes),this.invalidate(K.InvalidationMask.panesOrder())}changePanesHeight(e,t){if(this._panes.length<2)return;(0,n.assert)(e>=0&&ee+t.stretchFactor()),0),r=this._panes.reduce(((e,t)=>e+t.height()),0),o=r-30*(this._panes.length-1);t=Math.min(o,Math.max(30,t));const a=s/r,l=i.height();i.setStretchFactor(t*a);let c=t-l,h=this._panes.length-1;for(const e of this._panes)if(e!==i){const t=Math.min(o,Math.max(30,e.height()-c/h));c-=e.height()-t,h-=1;const i=t*a;e.setStretchFactor(i)}this.fullUpdate()}clearCurrentPosition(){const e=this.crossHairSource();e.clearPosition(),(0,n.ensureNotNull)(e.dataWindowView()).update(),fs(this._panes),this.invalidate(K.InvalidationMask.cursor());const t=this._undoModel.chartWidget();t.chartWidgetCollection().syncCrosshair(null,t.id()),this._phantomSourceContainer.onCursorPositionUpdated()}setAndSaveCurrentPosition(e,t,i,s){this.crossHairSource().saveOriginCoords(e,t),this.setCurrentPosition(e,t,i,s)} -setCurrentPosition(e,t,i,s){var r,o,a,l,c,h;let d=NaN;const u=this._timeScale.coordinateToVisibleIndex(e),p=null!==(a=null===(o=null!==(r=this._lineBeingEdited)&&void 0!==r?r:this._lineBeingCreated)||void 0===o?void 0:o.priceScale())&&void 0!==a?a:i.defaultPriceScale();let _=null;!p.isEmpty()&&Number.isFinite(t)&&(_=(0,n.ensureNotNull)(i.mainDataSource()).firstValue(),null!==_&&(d=p.coordinateToPrice(t,_)));const m=this._crossHairSelectPointMode.value()!==Pe.SelectPointMode.None,g=this.currentTool(),f=this.mainSeries(),v=this.crossHairSource(),y=v.index,S=v.price,b=m||Pe.isStudyEditingNow.value(),w=p===this.m_mainSeries.priceScale()&&(this._lineBeingCreated||this._lineBeingEdited||(0,de.isLineToolName)(g)||(0,Pe.toolIsMeasure)(g)||b);!this._isSettingsExternalPosition&&w?(d=this._magnet.align(d,u,i),null!==_&&this._setCorrectedPositionToCrosshair(u,d,i)):this._magnet.resetLastValue();let C=null;if(isNaN(d)||(C=i),this._isTimeScrolling){if(!this._isSettingsExternalPosition&&m){const e=f.bars().firstIndex(),t=f.bars().lastIndex();if(null!==e&&null!==t){const s=Math.min(Math.max(u,e),t);s!==u&&this._setCorrectedPositionToCrosshair(s,d,i)}}else v.setPosition(v.index,d,C);return}v.setOnHoveredChartWidget(!0),v.setPosition(u,d,C),(0,n.ensureNotNull)(v.dataWindowView()).update(),fs(this._panes);const P=f.syncModel();if(this.crossHairSource().startMeasurePoint()||this._lineBeingCreated?this.lightUpdate():this.invalidate(K.InvalidationMask.cursor()),this._lineBeingCreated){const e=this._lineBeingCreated.linkKey().value();if(!this._isSettingsExternalPosition){const t=this._lineBeingCreated.setLastPoint({index:u,price:d},s);if(this._lineBeingCreated.updateAllViews((0,H.sourceChangeEvent)(this._lineBeingCreated.id())),t.price===d&&t.index===u||this._setCorrectedPositionToCrosshair(t.index,t.price,i),P&&e){const i=this._timeScale.points().roughTime(t.index,P.projectTime.bind(P));(0,Pe.setLineToolLastPoint)({model:this,linkKey:e,point:{timeStamp:(0,n.ensureNotNull)(i),price:t.price}})}}}if(!this._isSettingsExternalPosition&&null!==this._lineBeingEdited&&null!==this._linePointBeingEdited){const e={index:u,price:d};if(null===(l=this._linePointBeingChanged)||void 0===l?void 0:l.nonDiscreteIndex){const t=this.crossHairSource().originX();Number.isFinite(t)&&(e.index=this._timeScale.coordinateToFloatIndex(t))}this.changeLinePoint(e,s);const t=this._lineBeingEdited.alignCrossHairToAnchor(this._linePointBeingEdited)?this._lineBeingEdited.getPoint(this._linePointBeingEdited):e;null!==t&&this._setCorrectedPositionToCrosshair(t.index,t.price,i)}if(!this._isSettingsExternalPosition&&1===this._sourcesBeingMoved.length){const e=this._sourcesBeingMoved[0];if(null===(c=e.alignCrossHairToMovePoint)||void 0===c?void 0:c.call(e)){const t=null===(h=e.currentMovingPoint)||void 0===h?void 0:h.call(e);t&&t.logical&&this._setCorrectedPositionToCrosshair(t.logical.index,t.logical.price,i)}}if(!this._isSettingsExternalPosition&&b){const e=f.bars().firstIndex(),t=f.bars().lastIndex();if(null!==e&&null!==t){const s=Math.min(Math.max(u,e),t) -;s!==u&&this._setCorrectedPositionToCrosshair(s,d,i)}}(y!==u||S!==d)&&this._syncCrosshair(s)}setExternalPosition(e,t){let i;const s=this.crossHairSource();if(s.setOnHoveredChartWidget(!1),null!==e&&(0,se.isNumber)(e.timeStamp)){const t=this.mainSeries().syncModel();if(t){const s=this.createSyncPoint(e.syncSourceTarget,t.syncSourceTarget()).sourceTimeToTargetTime(e.timeStamp);i=this._timeScale.points().roughIndex(s,t.distance.bind(t))}}if(null!==e&&null!=i&&Number.isFinite(i)){this._isSettingsExternalPosition=!0;const r=(0,n.ensureNotNull)(this.paneForSource(this.mainSeries())),o=this._timeScale.indexToCoordinate(i),a=(0,n.ensureNotNull)(r.mainDataSource()).firstValue();if(null!==a){let i=NaN;void 0!==e.price&&Number.isFinite(e.price)&&(i=this.mainSeries().priceScale().priceToCoordinate(e.price,a)),s.clearOriginCoords(),this.setCurrentPosition(o,i,r,t)}return s.setOnHoveredChartWidget(!1),void(this._isSettingsExternalPosition=!1)}s.clearPosition(),(0,n.ensureNotNull)(s.dataWindowView()).update(),fs(this._panes),this.invalidate(K.InvalidationMask.cursor())}startScaleTime(e){this._timeScale.startScale(e)}scaleTimeTo(e){this._timeScale.scaleTo(e),this.recalculateAllPanes((0,H.viewportChangeEvent)()),this.lightUpdate()}endScaleTime(){this._timeScale.endScale(),this.lightUpdate(),this.recalcVisibleRangeStudies()}resetTimeScale(){this._timeScale.restoreDefault(),this.recalculateAllPanes((0,H.viewportChangeEvent)()),this.recalcVisibleRangeStudies(),this.lightUpdate(),this._resetScales.fire()}startScalePrice(e,t,i){e.startScalePrice(t,i)}scalePriceTo(e,t,i){e.scalePriceTo(t,i),this.mainSeries().priceScale().isLockScale()?this.lightUpdate():this.invalidate(this._paneInvalidationMask(e,K.InvalidationLevel.Light))}endScalePrice(e,t){e.endScalePrice(t),this.invalidate(this._paneInvalidationMask(e,K.InvalidationLevel.Light))}startTwoPointsScalePrice(e,t,i,s){t.startTwoPointsScale(i,s)}twoPointsScalePriceTo(e,t,i,s){t.twoPointsScale(i,s),this.invalidate(this._paneInvalidationMask(e))}endTwoPointsScalePrice(e,t){t.endTwoPointsScale(),this.invalidate(this._paneInvalidationMask(e))}resetPriceScale(e,t){e.resetPriceScale(t),this.invalidate(this._paneInvalidationMask(e,K.InvalidationLevel.Light))}restorePriceScaleState(e,t,i){e.restorePriceScaleState(t,i),this.invalidate(this._paneInvalidationMask(e,K.InvalidationLevel.Light))}currentTool(){return this._currentTool}setCurrentTool(e){this._currentTool!==e&&((0,de.isLineToolName)(e)&&this.selectionMacro((e=>{e.clearSelection()})),this._currentTool=e,this._phantomSourceContainer.onToolChanged())}detachSource(e){const t=this.paneForSource(e);return!!t&&(t.removeDataSource(e),t.isEmpty()?(this._lineBeingCreated&&t===this._paneBeingCreatedLineOn&&this.cancelCreatingLine(),this.removePane(t),!0):(this.fullUpdate(),!1))}children(e,t){return this.dataSources().filter((i=>(0,G.isStudy)(i)?!t&&i.parentSources().includes(e):i.ownerSource()===e))}onRearrangePanes(){return this._onRearrangePanes}finishLineTool(e){const t=e.linkKey().value();(0, -Pe.drawOnAllCharts)().value()&&null!==t&&e.isSynchronizable()&&(0,Pe.finishLineTool)({linkKey:t,model:this})}startChangingLinetool(e,t,i,s,r){this._lineBeingEdited=e,this._linePointBeingChanged=t||null,this._linePointBeingEdited=void 0===i?null:i,this._lineBeingEdited.startChanging(i,t,r),Pe.isToolEditingNow.setValue(!0);const o=(0,n.ensureNotNull)(this.paneForSource(e));this._lineBeingEdited.startDragPoint&&void 0!==i&&void 0!==t&&this._lineBeingEdited.startDragPoint(i,t),r||void 0===i||void 0===t||this._lineBeingEdited.setPoint(i,t,s,r),this._lineBeingEdited.updateAllViews((0,H.sourceChangeEvent)(this._lineBeingEdited.id()));const a=this._paneInvalidationMask(o,K.InvalidationLevel.Light);this.invalidate(a);const l=e.linkKey().value();if(l&&e.isSynchronizable()&&void 0!==i&&void 0!==t){const e=(0,n.ensureNotNull)(this.externalTimeStamp(t.index));(0,Pe.startChangingLineTool)({linkKey:l,model:this,symbol:this.mainSeries().symbol(),point:{price:t.price,timeStamp:e},pointIndex:i,envState:s||null})}}createLineTool(e,t,i,s,r,a,l,c){if((0,n.assert)((0,de.isLineToolName)(i),`Cannot create unknown line tool: ${i}`),s){const e={...rs.intervalsVisibilitiesDefaults},t=s.childs().intervalsVisibilities.state();(0,se.merge)(e,null!=t?t:{});const r=s.state();r.intervalsVisibilities=e,s=(0,y.createLineToolProperties)(i,r,this)}const h=(0,y.createLineTool)(i,this,s,null,void 0,c);if("LineToolExecution"!==i){let e;switch(i){case"LineToolIcon":e=h.properties().childs().icon.value().toString(16).toUpperCase();break;case"LineToolEmoji":e=h.properties().childs().emoji.value();break;case"LineToolSticker":e=h.properties().childs().sticker.value()}(0,u.trackEvent)("drawings","Study_Drawing_"+i,e)}(0,y.isStudyLineTool)(h)&&(0,u.trackEvent)("studies",`Study_${h.metaInfo().id}`);const d=!h.linkKey().value()&&!r;l=(0,n.ensureDefined)(l||(0,n.ensureNotNull)(e.mainDataSource())),s||(0,y.prepareLineToolPropertiesByOwnerSource)(h.properties(),l),h.setOwnerSource(l);const p=l.priceScale();if(h.setPriceScale(p),_s&&l===this.mainSeries()&&h.share(a),e.addDataSource(h,p,!1),null!==h.preferredZOrder()&&e.insertAfter([h],this.mainSeries()),(0,Pe.drawOnAllCharts)().value()){const e=h.isSynchronizable()?r||(0,Q.randomHash)():null;h.linkKey().setValue(e)}else h.linkKey().setValue(r);let _;if(h.isFixed()){const i=(0,n.ensureNotNull)((0,n.ensureNotNull)(e.mainDataSource()).firstValue()),s=this._timeScale.indexToCoordinate(t.index),r=(0,n.ensureNotNull)(p).priceToCoordinate(t.price,i);_=h.addFixedPoint(new o.Point(s,r))}else _=h.addPoint(t);return _||(this._lineBeingCreated=h,this._paneBeingCreatedLineOn=e,Pe.isToolCreatingNow.setValue(!0)),d&&h.enableCurrentIntervalVisibility(),this.fullUpdate(),h}endChangingLinetool(e,t){const i=(0,n.ensureNotNull)(this._lineBeingEdited),s=i.endChanging(!1,e,t);this._lineBeingEdited=null,Pe.isToolEditingNow.setValue(!1),this._linePointBeingEdited=null,this._linePointBeingChanged=null,this.lightUpdate();const r={points:i.normalizedPoints(),interval:this.mainSeries().interval()},o=i.linkKey().value() -;null!==o&&i.isSynchronizable()&&!t&&(0,Pe.finishChangingLineTool)({model:this,linkKey:o,symbol:this.mainSeries().symbol(),finalState:r,changes:s})}continueCreatingLine(e,t,i,s){const r=(0,n.ensureNotNull)(this._lineBeingCreated),o=r.addPoint(e,t,i);r.updateAllViews((0,H.sourceChangeEvent)(r.id()));const a=new K.InvalidationMask(K.InvalidationLevel.Light);return o&&(this._paneBeingCreatedLineOn=null,this._lineBeingCreated=null,Pe.isToolCreatingNow.setValue(!1)),this.invalidate(a),o}cancelCreatingLine(){if(!this._lineBeingCreated)return;const e=this._lineBeingCreated;this.removeSource(this._lineBeingCreated),this._lineBeingCreated=null,this._lineCancelled.fire(),Pe.isToolCreatingNow.setValue(!1),(0,Pe.drawOnAllCharts)().value()&&e.isSynchronizable()&&(0,Pe.cancelLineTool)({model:this})}lineBeingCreated(){return this._lineBeingCreated}paneBeingCreatedLineOn(){return this._paneBeingCreatedLineOn}lineCancelled(){return this._lineCancelled}isPhantomLine(e){return this._phantomSourceContainer.source()===e}changeLinePoint(e,t,i){const s=(0,n.ensureNotNull)(this._lineBeingEdited),r=(0,n.ensureNotNull)(this._linePointBeingEdited);let o=e.price,a=e.index;if(s.setPoint(r,e,t,i),!i){const t=s.alignCrossHairToAnchor(r)?s.getPoint(r):e;null!==t&&(a=t.index,o=t.price)}s.updateAllViews((0,H.sourceChangeEvent)(s.id())),this.lightUpdate();const l=s.linkKey().value();if(!i&&null!==l&&s.isSynchronizable()){const e=(0,n.ensureNotNull)(this._linePointBeingChanged),i={indexesChanged:a!==e.index,pricesChanged:o!==e.price},c=s.getChangePointForSync(r);if(null!==c){const e=this.externalTimeStamp(a);null!==e&&(o=c.price,(0,Pe.changeLineTool)({linkKey:l,model:this,symbol:this.mainSeries().symbol(),point:{price:o,timeStamp:e},envState:t,changes:i}))}}}changeLinePoints(e,t,i){const s=e.points(),r=e.linkKey().value();!i&&r&&e.isSynchronizable()&&t.forEach(((t,i)=>{const o=s[i],a=o.price!==t.price,l=o.index!==t.index;if(e.getChangePointForSync(i)){const e=(0,n.ensureNotNull)(this.externalTimeStamp(t.index));(0,Pe.changeLineTool)({linkKey:r,model:this,symbol:this.mainSeries().symbol(),point:{price:t.price,timeStamp:e},changes:{pricesChanged:a,indexesChanged:l}})}})),e.setPoints(t),e.updateAllViews((0,H.sourceChangeEvent)(e.id())),this.lightUpdate()}startScrollTime(e){this._timeScale.startScroll(e),this._isTimeScrolling=!0,this.mainSeries().clearGotoDateResult()}scrollTimeTo(e){this._timeScale.scrollTo(e),this.recalculateAllPanes((0,H.viewportChangeEvent)()),this.lightUpdate()}endScrollTime(){this._timeScale.endScroll(),this.lightUpdate(),this.recalcVisibleRangeStudies(),this._isTimeScrolling=!1}startScrollPrice(e,t,i){e.startScrollPrice(t,i)}scrollPriceTo(e,t,i){e.scrollPriceTo(t,i),this.invalidate(this._paneInvalidationMask(e,K.InvalidationLevel.Light))}endScrollPrice(e,t){e.endScrollPrice(t),this.invalidate(this._paneInvalidationMask(e,K.InvalidationLevel.Light))}addCustomSource(e,t,i=g.CustomSourceLayer.Foreground){this._customSourcesMap.has(e)&&ms.logWarn(`Attempt to add the same custom source multiple time "${e}"`), -ms.logNormal(`Adding custom source "${e}"`);const s=t(e,this);switch(i){case g.CustomSourceLayer.Background:this._bgCustomSources.push(s);break;case g.CustomSourceLayer.Foreground:this._fgCustomSources.push(s);break;case g.CustomSourceLayer.Topmost:this._topmostCustomSources.push(s);break;default:throw new Error(`Unknown custom sources layer ${i}`)}this._allCustomSources.push(s),this._customSourcesMap.set(e,s),this.lightUpdate()}removeCustomSource(e){this._removeCustomSource(e),this.lightUpdate()}hasCustomSource(e){return this._customSourcesMap.has(e)}customSourceForName(e){return this._customSourcesMap.get(e)||null}customSourceName(e){let t=null;return this._customSourcesMap.forEach(((i,s)=>{i===e&&(t=s)})),t}customSources(e){switch(e){case g.CustomSourceLayer.Background:return this._bgCustomSources;case g.CustomSourceLayer.Foreground:return this._fgCustomSources;case g.CustomSourceLayer.Topmost:return this._topmostCustomSources;default:return this._allCustomSources}}addMultiPaneSource(e){this._multiPaneSources.push(e),this.lightUpdate()}removeMultiPaneSource(e){const t=this._multiPaneSources.indexOf(e);-1===t?ms.logWarn("Attempt to remove multi-pane source which does not exist in the model"):this._multiPaneSources.splice(t,1),this.lightUpdate()}multiPaneSources(e){return this._multiPaneSources.filter((t=>!e.hasDataSource(t)))}magnet(){return this._magnet}dateTimeFormatter(){return this._dateTimeFormatter}dateFormatter(){return this._dateFormatter}timeFormatter(){return this._timeFormatter}isUnmergeAvailableForSource(e){if(!this._unmergeAvailable(e))return!1;return(0,n.ensureNotNull)(this.paneForSource(e)).dataSources().filter(this._unmergeAvailable,this).length>1}isMergeDownAvailableForSource(e){if(!this._unmergeAvailable(e))return!1;const t=this.paneForSource(e),i=this.panes();return t!==i[i.length-1]}isMergeUpAvailableForSource(e){if(!this._unmergeAvailable(e))return!1;return this.paneForSource(e)!==this.panes()[0]}sessions(){return(0,n.ensureNotNull)(this._sessions)}createSessions(e){(0,n.assert)(null===this._sessions,"Sessions are already created"),this.addCustomSource("sessions",((t,i)=>(this._sessions=new j(t,i,e),this._sessions.start(),this._sessions)),g.CustomSourceLayer.Background)}createPrePostMarket(e){this.addCustomSource("prePostMarket",((t,i)=>new PrePostMarket(t,i,e)))}watermarkContentProvider(){return ds.WatermarkApi.getInstance().provider()}replayStatus(){return this._replayStatus}setReplayStatus(e){this._replayStatus.setValue(e)}isInReplay(){return this.m_mainSeries.isInReplay()}getSymbolString(){return this.m_mainSeries.getSymbolString()}interval(){return this.m_mainSeries.interval()}switchToReplay(e,t){0}switchToRealtime(){0}theme(){const e=this.properties().childs().paneProperties.state(["horzGridProperties.style","vertGridProperties.style"]);delete e.topMargin,delete e.bottomMargin;const t=this.mainSeries().state().state;t&&(delete t.symbol,delete t.interval,delete t.currencyId,delete t.unitId);const i={mainSourceProperties:t,sessions:this.sessions().properties().state(),chartProperties:{ -paneProperties:e,scalesProperties:this.properties().childs().scalesProperties.state()},version:this.version()};return i.version=this.version(),i}onChartThemeLoaded(){return this._chartThemeLoaded}chartThemeLoaded(){this._chartThemeLoaded.fire()}async colorStudiesPropertiesReady(){this._recalcColorStudiesImpl(this._recalcVRStudiesParams);const e=this.allStudies(!0).filter((e=>e.metaInfo().inputs.filter(C.isStudyInputDependsOnChartColors).length>0));await Promise.all(e.map((e=>e.propertiesPatched())))}state(e,t,i,s){var r;const n=this.publishedChartsTimelineSource(),o=this.properties().childs(),a=o.tradingProperties.state(),l={panes:this._panes.map((r=>r.state(!0,e,!1,t,i,s))),timeScale:this._timeScale.state(e),chartProperties:{paneProperties:o.paneProperties.state(["horzGridProperties.style","vertGridProperties.style"]),scalesProperties:o.scalesProperties.state(),publishedChartsTimelineProperties:n?n.state(e):void 0,chartEventsSourceProperties:null===(r=o.chartEventsSourceProperties)||void 0===r?void 0:r.state(),tradingProperties:a,priceScaleSelectionStrategyName:o.priceScaleSelectionStrategyName.value()},sessions:this.sessions().state(e),version:this.version(),timezone:this.timezone(),shouldBeSavedEvenIfHidden:this._shouldBeSavedEvenIfHidden,linkingGroup:this._linkingGroupIndex.value()};return s||(l.lineToolsGroups=this.lineToolsGroupModel().state(t)),l}restoreState(e,t,i){var s;Oe.instance(this).reset();const r={};if(!e.panes)return void ms.logDebug("ChartModel.restoreState: invalid state");if(!Array.isArray(e.panes))return void ms.logDebug("ChartModel.restoreState: invalid state");if(e.panes.length<1)return void ms.logDebug("ChartModel.restoreState: invalid state");for(const e of this._barsMarksSources)this.detachSource(e);if(this._shouldBeSavedEvenIfHidden=void 0===e.shouldBeSavedEvenIfHidden||e.shouldBeSavedEvenIfHidden,e.chartProperties&&!e.chartProperties.timezone&&(e.chartProperties.timezone=e.timezone),e.chartProperties){const i=(0,R.factoryDefaults)("chartproperties").scalesProperties;(0,se.merge)(i,e.chartProperties.scalesProperties),!("showLastValue"in i)||"showSeriesLastValue"in i||"showStudyLastValue"in i||(i.showSeriesLastValueProperty=i.showLastValue,i.showStudyLastValueProperty=i.showLastValue),"showSeriesLastValue"in i&&(r.showSeriesLastValueProperty=!0),"showStudyLastValue"in i&&(r.showStudyLastValueProperty=!0),(!this.isSnapshot()&&!this.readOnly()&&"showCurrency"in i||"showUnit"in i)&&((0,Z.migrateShowCurrencyAndShowUnitProperties)(i.showCurrency,i.showUnit),delete i.showCurrency,delete i.showUnit);{const{paneProperties:t}=e.chartProperties;t.vertGridProperties=t.vertGridProperties||(0,se.clone)(t.gridProperties),t.horzGridProperties=t.horzGridProperties||(0,se.clone)(t.gridProperties),"backgroundType"in t||(t.backgroundType=Ht.ColorType.Solid),"separatorColor"in t||(t.separatorColor=(0,d.getThemedColor)("color-chart-page-bg")),this._properties.childs().paneProperties.mergeAndFire(t)}this._properties.childs().scalesProperties.mergeAndFire(i), -e.chartProperties.timezone&&this._properties.childs().timezone.setValue(e.chartProperties.timezone),e.chartProperties.chartEventsSourceProperties&&this._properties.hasChild("chartEventsSourceProperties")&&this._properties.childs().chartEventsSourceProperties.mergeAndFire(e.chartProperties.chartEventsSourceProperties),e.chartProperties.tradingProperties&&this._properties.hasChild("tradingProperties")&&(void 0===e.chartProperties.tradingProperties.horizontalAlignment&&(e.chartProperties.tradingProperties.horizontalAlignment=(n=e.chartProperties.tradingProperties.lineLength)<=40?g.TradedGroupHorizontalAlignment.Right:n>=60?g.TradedGroupHorizontalAlignment.Left:g.TradedGroupHorizontalAlignment.Center),this._properties.childs().tradingProperties.mergeAndFire(e.chartProperties.tradingProperties)),this._timeScale.restoreState(e.timeScale,t),this._updateDateTimeFormatter()}var n;if(e.timeScale&&this._timeScale.restoreState(e.timeScale,t),!this.readOnly()){const t=this._getExceedingChildStudies(e.panes);if(t.length){for(let i=e.panes.length-1;i>=0;--i){const s=e.panes[i];for(let e=s.sources.length-1;e>=0;--e){const i=s.sources[e];~t.indexOf(i)&&s.sources.splice(e,1)}s.sources.length||e.panes.splice(i,1)}0}}const o=e.version||0,a=e.panes;let l="_seriesId";for(const e of a){const t=e.sources.find((e=>"MainSeries"===e.type));if(t){l=t.id;break}}this.panes()[0].restoreState({state:a[0],withData:t,version:o,seriesId:l,settingsMigration:r,contentOverrides:i,restoreSilently:true,reason:2});let c=1;for(let s=1;s_&&u%100==0?{lines_limit_exceeded:!0,line_tools_count:u}:(this.panes().forEach((e=>this._dataSourceCollectionChanged.fire(e))),this._lineToolsGroupModel.fireChangedAll(),this._linkingGroupIndex.setValue(null!==(s=e.linkingGroup)&&void 0!==s?s:null),{})}shouldBeSavedEvenIfHidden(){ -return this._shouldBeSavedEvenIfHidden}setShouldBeSavedEvenIfHidden(e){this._shouldBeSavedEvenIfHidden=e}externalTimeStamp(e){const t=this.mainSeries().syncModel();return this.timeScale().points().roughTime(e,t&&t.projectTime.bind(t))}syncLollipopSources(){var e;null===(e=this._lollipopSourcesWatcherLoader)||void 0===e||e.callFunction((()=>{null!==this._lollipopSourcesWatcher&&this._lollipopSourcesWatcher.syncSources()}))}restoreChartEvents(e){var t;null===(t=this._lollipopSourcesWatcherLoader)||void 0===t||t.callFunction((()=>{null!==this._lollipopSourcesWatcher&&this._options.chartEventsEnabled&&this._lollipopSourcesWatcher.restoreChartEvents(e)}))}recalcVisibleRangeStudies(e){this._recalcVRStudiesParams.force=this._recalcVRStudiesParams.force||Boolean(e),this.m_mainSeries.isStarted()&&this.m_mainSeries.isCompleted()?this._recalcVisibleRangeStudiesImplDebounced():this._recalcVisibleRangeStudiesImpl(this._recalcVRStudiesParams)}recalcColorStudies(e){this._recalcColorStudiesParams.force=this._recalcColorStudiesParams.force||Boolean(e),this._recalcColorStudiesImplDebounced()}recalcStudyBasedLineTools(){this.dataSources().forEach((e=>{(0,y.isStudyLineTool)(e)&&e.recalcStudyIfNeeded()}))}alertsWatcher(){return this._alertsWatcher}showLegend(){return this._showLegendProperty}id(){return this._id}selectPointMode(){return this._crossHairSelectPointMode}cancelRequestSelectPoint(){this.m_crossHairSource.cancelRequestSelectPoint()}requestSelectPoint(e){return this.m_crossHairSource.requestSelectPoint(e)}onPointSelected(){return this.m_crossHairSource.onPointSelected()}recalculatePriceRangeOnce(){const e=this.mainSeries();for(const t of this._panes)for(const i of t.priceDataSources())i.symbolSource()===e&&i.disablePriceRangeReady()}invalidate(e){var t;null===(t=this._invalidateHandler)||void 0===t||t.call(this,e)}appliedTimeFrame(){return this._appliedTimeFrame.appliedTimeFrame()}barsMarksSources(){return this._barsMarksSources}createSyncPoint(e,t){return(0,is.getDefault2Lazy)(this._syncPointCache,e.uniqueId,t.uniqueId,(()=>new Nt(e,t)))}isAutoSaveEnabled(){return this._isAutoSaveEnabled}linkingGroupIndex(){return this._linkingGroupIndex}studyAwareDefaultRightOffset(){return this._timeScale.usePercentageRightOffset().value()?this._timeScale.percentsToBarIndexLength(this.studyAwareDefaultRightOffsetPercentage()):Math.max(this._timeScale.defaultRightOffset().value(),this._cachedStudiesMaxOffset)}studyAwareDefaultRightOffsetPercentage(){return this._timeScale.usePercentageRightOffset().value()?Math.max(this._timeScale.defaultRightOffsetPercentage().value(),this._timeScale.barIndexLengthToPercents(this._cachedStudiesMaxOffset)):this._timeScale.barIndexLengthToPercents(this.studyAwareDefaultRightOffset())}clearAllStudies(){this.dataSources().forEach((e=>{var t;return null===(t=e.clearData)||void 0===t?void 0:t.call(e)}))}setTimeScaleAnimation(e){const t=K.InvalidationMask.light();t.setTimeScaleAnimation(e),this.invalidate(t)}stopTimeScaleAnimation(){const e=K.InvalidationMask.light();e.stopTimeScaleAnimation(),this.invalidate(e)} -lollipopSourcesOptions(){const e=this._options;return{chartEventsEnabled:!this._options.isSnapshot&&this._options.chartEventsEnabled,esdEnabled:e.esdEnabled,newsNotificationsEnabled:e.newsNotificationsEnabled,continuousContractSwitchesEnabled:e.continuousContractSwitchesEnabled,futuresContractExpirationEnabled:e.futuresContractExpirationEnabled,latestUpdatesEnabled:e.latestUpdatesEnabled}}_initAlertsList(){throw new Error("Not implemented")}_updateStudiesMaxOffset(){const e=Math.max(...this.allStudies().map((e=>e.maxOffset().value())));this._cachedStudiesMaxOffset=e;const t=this._timeScale.rightOffset();if(t<0)return;if(e<=t)return;const i=this._timeScale.logicalRange();i?this._timeScale.zoomToBarsRange(i.left(),this._timeScale.baseIndex()+Math.max(this._timeScale.rightOffset(),e)):this._timeScale.setRightOffset(Math.max(t,e))}_updateBaseIndex(e,t){const i=this._timeScale,s=i.baseIndex(),r=i.logicalRange();if(null!==r&&t){const t=r.contains(s),n=e-s,o=t?null:i.rightOffset()-n;if(!this._options.shiftVisibleRangeOnNewBar&&t){const e=i.width()/i.barSpacing(),t=e/(e+n),s=Math.max(i.minBarSpacing(),i.barSpacing()*t);i.setBarSpacing(s)}null!==o&&i.setRightOffset(o)}i.setBaseIndex(e)}async _createLollipopSourcesWatcher(){}_updateDateTimeFormatter(){const e=At.dateFormatProperty.value(),t=void 0;if(this._dateFormatter=new Mt.DateFormatter(e,t),this.mainSeries().isDWM())this._dateTimeFormatter=new Mt.DateFormatter(e,t),this._timeFormatter=new _t.TimeFormatter((0,mt.getHourMinuteFormat)(pt.timeHoursFormatProperty.value()));else{const i=T.Interval.parse(this.mainSeries().interval()),s=(0,mt.getTimeFormatForInterval)(i,pt.timeHoursFormatProperty.value());this._dateTimeFormatter=new It.DateTimeFormatter({dateFormat:e,withWeekday:t,timeFormat:s,dateTimeSeparator:" "}),this._timeFormatter=new _t.TimeFormatter(s)}}_invalidationMaskForSource(e,t=K.InvalidationLevel.Light){if(e===this.crossHairSource())return K.InvalidationMask.cursor();if(this._watermarkSource===e)return this._paneInvalidationMask((0,n.ensureNotNull)(this.paneForSource(this.mainSeries())),t);if(-1!==this._allCustomSources.indexOf(e)){const e=new K.InvalidationMask;return e.invalidateAll(t),e}if(!(0,f.isDataSource)(e))return null;if(e.isMultiPaneEnabled())return new K.InvalidationMask(t);const i=this.paneForSource(e);return null!==i?this._paneInvalidationMask(i,t):null}_paneInvalidationMask(e,t=K.InvalidationLevel.Light){const i=new K.InvalidationMask,s=this._panes.indexOf(e);return i.invalidateAllPane(s,t),i}_invalidationMaskForSourcePriceScale(e,t=K.InvalidationLevel.Light){if(!(0,f.isDataSource)(e))return new K.InvalidationMask(t);const i=this.paneForSource(e);if(null===i)return null;let s=e.priceScale();if(null===s)return null;const r=this._panes.indexOf(i);let n=i.priceScalePosition(s);if("overlay"===n){const e=this._panes[r].defaultPriceScale();s=e,n=i.priceScalePosition(e)}const o=i.priceScaleIndex(s,n);if(void 0===o)return null;const a=new K.InvalidationMask;return a.invalidatePriceScale(r,n,o,t),a}_removeCustomSource(e){const t=this._customSourcesMap.get(e) +lastHittestData(){return this._lastHoveredHittestData}lastSelectedHittestData(){return this._lastSelectedHittestData}lightUpdate(){this.invalidate(K.InvalidationMask.light())}fullUpdate(){this.invalidate(K.InvalidationMask.full())}syncTimeWithModel(e,t){const i=this.mainSeries().syncModel();if(null===i)return;const s=1e3*this.createSyncPoint(e,i.syncSourceTarget()).sourceTimeToTargetTime(t/1e3),r=(0,Dt.get_timezone)(this.timezone());let n=(0,Dt.utc_to_cal)(r,s);this.mainSeries().isDWM()&&(n=i.getSession().spec.correctTradingDay(n),(0,Dt.set_hms)(n,0,0,0,0,(0,Dt.get_timezone)("Etc/UTC"))),this._gotoTimeImpl(n.getTime(),{centerIfVisible:!1})}gotoTime(e){return this._gotoTimeImpl(e,{centerIfVisible:!0})}recalculatePane(e,t){null==e||e.recalculate(t)}recalculateAllPanes(e){this._panes.forEach((t=>t.recalculate(e))),this.updateAllPaneViews(e),this.crossHairSource().updateAllViews(e)}gotoTimeRange(e,t){const i=this.timeScale(),s=i.tickMarks(),r=this.mainSeries();if(void 0===s.minIndex)return void(this._lastGotoTimeRange={from:e,to:t});let o=e,a=t;const l=r.symbolInfo();if(null!==l){let i=this.properties().childs().timezone.value();"exchange"===i&&(i=l.timezone);const s=(0,Dt.get_timezone)(i),n=(0,Dt.utc_to_cal)(s,e),c=(0,Dt.utc_to_cal)(s,t);if(r.isDWM()){const e=(0,Dt.get_timezone)("Etc/UTC");(0,Dt.set_hms)(n,0,0,0,0,e),(0,Dt.set_hms)(c,0,0,0,0,e)}o=n.getTime(),a=c.getTime()}const c=(0,n.ensureDefined)(s.maxIndex),h=(0,n.ensureDefined)(s.minIndex);if(o>=(0,n.ensureNotNull)(s.indexToTime(h)).valueOf()||r.endOfData()){const e=(e,t)=>e(0,n.ensureNotNull)(s.indexToTime(e)).valueOf(),l=(0,v.lowerboundExt)(t,o,e,s.nearestIndex(o),c);let d=o===a?l:(0,v.lowerboundExt)(t,a,e,s.nearestIndex(a),c);this._lastGotoTimeRange=null,null!==this._lastAppliedGotoTimeRange&&(this._lastAppliedGotoTimeRange.actual=!1);const u=i.baseIndex();if(l+Math.max(d-l+1,i.minVisibleBarCount())>u){const e=i.targetDefaultRightOffset();d-u=0;t--)if(this._panes[t].hasDataSource(e))return this._panes[t];return e instanceof Wt.BarsMarksContainer?this.paneForSource(this.mainSeries()):null}mainPane(){for(const e of this._panes)if(e.isMainPane())return e;throw new Error("Main pane is not found")}lastPane(){return this._panes[this._panes.length-1]}removeSource(e,t){this.selectionMacro((t=>t.removeSourceFromSelection(e)),!0),this._hoveredSource===e&&(this._hoveredSource=null,this._lastHoveredHittestData=null),this._sourcesBeingMoved.includes(e)&&(this._sourcesBeingMoved=this._sourcesBeingMoved.filter((t=>t!==e)), +this._sourcesBeingMoved.length||(this._activeItemBeingMoved=null)),e===this._lineBeingEdited&&(this._lineBeingEdited=null,Pe.isToolEditingNow.setValue(!1)),e===this._lineBeingCreated&&(this._lineBeingCreated=null,Pe.isToolCreatingNow.setValue(!1)),!t&&e.stop&&e.stop();const i=this.detachSource(e),s=this.mainSeries().priceScale();return(0,G.isStudy)(e)&&(0,me.isActingAsSymbolSource)(e)&&e.priceScale()===s&&s.isPercentage()&&1===s.seriesLikeSources().filter(me.isActingAsSymbolSource).length&&s.setMode({percentage:!1}),this.fullUpdate(),this._invalidateBarColorerCaches(),(0,G.isStudy)(e)&&((0,_.emit)("study_event",e.id(),"remove"),e.isChildStudy()&&e.parentSources().forEach((t=>t.unsetChild(e))),e.maxOffset().unsubscribe(this._boundUpdateStudiesMaxOffset)),!t&&e.destroy&&e.destroy(),(0,y.isLineTool)(e)&&(e.removeAlert(),(0,_.emit)("drawing_event",e.id(),"remove")),i}allStudies(e){const t=e?e=>(0,G.isStudy)(e)&&!0:G.isStudy;return this._getAllSources(t)}studiesWV(e){return e?this._studiesExcludeInternalWV.readonly():this._studiesWV.readonly()}findNonOverlayStudyWithGroupingKey(e,t){const i=void 0!==t?[t]:this._panes;for(const t of i){const i=t.dataSources().find((i=>(0,G.isStudy)(i)&&i.metaInfo().groupingKey===e&&!t.isOverlay(i)));if(void 0!==i)return{pane:t,study:i}}return null}movePaneUp(e){this.movePane(e,e-1)}movePaneDown(e){this.movePane(e,e+1)}movePane(e,t){const i=this._panes[e];this._panes.splice(e,1),this._panes.splice(t,0,i),this._panesCollectionChanged.fire(this._panes),this._onRearrangePanes.fire(),this.invalidate(K.InvalidationMask.panesOrder())}toggleCollapsedPane(e){const t=this._panes[e];t.collapsed().setValue(!t.collapsed().value()),this.fullUpdate()}backgroundColor(){return this._backgroundColor}backgroundTopColor(){return this._backgroundTopColor}backgroundColorAtYPercentFromTop(e){const t=this.backgroundColor().value(),i=this.backgroundTopColor().value();if(t===i)return t;if(e=Math.max(0,Math.min(100,Math.round(100*e))),null===this._gradientColorsCache||this._gradientColorsCache.topColor!==i||this._gradientColorsCache.bottomColor!==t)this._gradientColorsCache={topColor:i,bottomColor:t,colors:new Map};else{const t=this._gradientColorsCache.colors.get(e);if(void 0!==t)return t}const s=(0,Ft.gradientColorAtPercent)(i,t,e/100);return this._gradientColorsCache.colors.set(e,s),s}backgroundCounterColor(){return this._backgroundCounterColor.readonly()}dark(){return this._isDark}defaultResolutions(){return this.chartApi().defaultResolutions()}availableCurrencies(){const e=this._getAvailableCurrencies();return e.length!==this._availableCurrencies.size()&&(this._availableCurrencies=new Ut(e)),this._availableCurrencies}currencyConversionEnabled(){return this._options.currencyConversionEnabled}availableUnits(){const e=this._getAvailableUnits();return this._availableUnits.unitsChanged(e)&&(this._availableUnits=new jt(e)),this._availableUnits}unitConversionEnabled(){return this._options.unitConversionEnabled}availablePriceSources(e){const t=this._getAvailablePriceSources(e) +;return null!==t&&this._availablePriceSources.priceSourcesChanged(t)&&(this._availablePriceSources=new cs(t)),this._availablePriceSources}resetDeferredStudies(){Oe.instance(this).reset()}isJustClonedChart(){return this._undoModel.isJustClonedChart()}studyTemplate(e,t,i){const s={panes:[],version:this.version()};for(const e of this.panes())s.panes.push(e.state(!0,!1,!0));const r=this.mainSeries();return e&&(s.symbol=r.symbol(),this.currencyConversionEnabled()&&i&&(s.currency=r.currency()),this.unitConversionEnabled()&&i&&(s.unit=r.unit())),t&&(s.interval=r.interval()),s}getStudyById(e){const t=this.dataSourceForId(e);return null!==t&&(0,G.isStudy)(t)?t:null}getLineToolById(e){const t=this.dataSourceForId(e);return null!==t&&(0,y.isLineTool)(t)?t:null}restoreLineToolState(e,t,i){var s;e.restorePoints(t.points,t.indexes||[]),t.state.intervalsVisibilities=(0,We.mergeIntervalVisibilitiesDefaults)(t.state.intervalsVisibilities),e.properties().merge(t.state),e.restoreData&&e.restoreData(t),e.linkKey().setValue(t.linkKey||null),e.createServerPoints(),e.setZorder(null!==(s=t.zorder)&&void 0!==s?s:e.zorder()),this.fullUpdate();const r=e.linkKey().value();null!==r&&i&&(0,Pe.restoreLineToolState)({model:this,linkKey:r,state:t})}preferences(){return(0,ss.preferencesByWhiteList)(this,this.mainSeries())}restoreTheme(e,t,i){e.mainSourceProperties.hollowCandleStyle||(e.mainSourceProperties.hollowCandleStyle=e.mainSourceProperties.candleStyle),this._undoModel.chartLoadTheme(e,t,i)}onResetScales(){return this._resetScales}startMovingSources(e,t,i,s,r,o){this._sourcesBeingMoved=e,this._activeItemBeingMoved=i;let a=!1;if(this._sourcesBeingMoved.forEach((e=>{!a&&(0,G.isStudy)(e)&&(a=!0);const l=(0,n.ensureNotNull)(this.paneForSource(e)),c=(0,y.isLineTool)(e),h=c&&e.linkKey().value();if(!1!==h&&null!==h&&s.has(h)&&c&&e.isFixed()){const t=(0,n.ensureDefined)(s.get(h)),a={screen:this._percentPositionToPoint(t,l)};e.startMoving(a,i,r,o)}else e.startMoving(t,i,r,o);const d=this._paneInvalidationMask(l,K.InvalidationLevel.Light);this.invalidate(d)})),!o){const s=e.filter(y.isLineTool).filter((e=>e.linkKey().value()&&e.isSynchronizable())).map((e=>e.linkKey().value()));if(s.length&&t.logical){const o=this.externalTimeStamp(t.logical.index),a={linkKeys:s,model:this,symbol:this.mainSeries().symbol(),point:{price:t.logical.price,timeStamp:o},activeItem:null!==i?i:void 0,envState:r,pointPositionPercents:new Map};e.forEach((e=>{if((0,y.isLineTool)(e)){const i=e.linkKey().value();if(i&&e.isSynchronizable()&&e.isFixed()){const s=(0,n.ensureNotNull)(this.paneForSource(e));a.pointPositionPercents.set(i,this._pointToPercentPosition((0,n.ensureDefined)(t.screen),s))}}})),(0,Pe.startMovingLineTool)(a)}}Pe.isToolMovingNow.setValue(!0),a&&Pe.isStudyEditingNow.setValue(!0)}moveSources(e,t,i,s){if(this._sourcesBeingMoved.filter((e=>!e.isLocked||!e.isLocked())).forEach((r=>{const o=(0,y.isLineTool)(r)?r.linkKey().value():null;if(null!==o&&t.has(o)){const e=(0,n.ensureNotNull)(this.paneForSource(r)),a=(0,n.ensureDefined)(t.get(o)),l={ +screen:this._percentPositionToPoint(a,e)};r.move(l,this._activeItemBeingMoved,i,s)}else r.move(e,this._activeItemBeingMoved,i,s)})),this.lightUpdate(),!s&&e.logical){const t=this._sourcesBeingMoved.filter(y.isLineTool).filter((e=>e.isSynchronizable()&&!!e.linkKey().value())).map((e=>e.linkKey().value())),s=this.externalTimeStamp(e.logical.index),r={linkKeys:t,model:this,point:{price:e.logical.price,timeStamp:s},envState:i,pointPositionPercents:new Map};this._sourcesBeingMoved.filter(y.isLineTool).forEach((t=>{if(t.linkKey().value()&&t.isSynchronizable()&&t.isFixed()){const i=(0,n.ensureNotNull)(this.paneForSource(t));r.pointPositionPercents.set(t.linkKey().value(),this._pointToPercentPosition((0,n.ensureDefined)(e.screen),i))}})),(0,Pe.moveLineTool)(r)}}endMovingSources(e,t,i){const s=this._sourcesBeingMoved.map((s=>{const r=(0,n.ensureNotNull)(this.paneForSource(s)),o=s.endMoving(e,t,i),a=this._paneInvalidationMask(r,K.InvalidationLevel.Light);return a.invalidateAll(K.InvalidationLevel.Light),this.invalidate(a),o})),r=this._sourcesBeingMoved.filter(y.isLineTool).filter((e=>e.isSynchronizable()&&!!e.linkKey().value())).map((e=>e.linkKey().value())),o=this._sourcesBeingMoved.filter(y.isLineTool).filter((e=>e.isSynchronizable()&&!!e.linkKey)).map((e=>{const t={points:e.normalizedPoints(),interval:this.mainSeries().interval()};return e.isFixed()&&(t.pointPositionPercents=e.calcPositionPercents()),t}));r.length&&(0,Pe.finishMovingLineTool)({linkKeys:r,model:this,finalStates:o,changes:s}),this._sourcesBeingMoved=[],this._activeItemBeingMoved=null,Pe.isToolMovingNow.setValue(!1),Pe.isStudyEditingNow.setValue(!1)}sourcesBeingMoved(){return this._sourcesBeingMoved}setMovingCustomSource(e,t){this._customSourceBeingMoved=e,this._customSourceBeingMovedHitTestData=null!==t?{beingMoved:!1,cancelled:!1,...t}:null}processingCustomSourceMove(){null!==this._customSourceBeingMovedHitTestData&&(this._customSourceBeingMovedHitTestData.beingMoved=!0)}customSourceMovingHitTestData(){return this._customSourceBeingMovedHitTestData}customSourceBeingMoved(){return null!==this._customSourceBeingMovedHitTestData&&this._customSourceBeingMovedHitTestData.beingMoved?this._customSourceBeingMoved:null}lineToolsSynchronizer(){return this._lineToolsSynchronizer}setLineToolsSynchronizer(e){this._lineToolsSynchronizer=e}width(){return this._width}setWidth(e,t){this._width=e,this._timeScale.setWidth(e,t);for(const t of this._panes)t.setWidth(e);this.recalculateAllPanes((0,H.viewportChangeEvent)()),this.recalcVisibleRangeStudies()}setPaneHeight(e,t){e.setHeight(t),this.recalculateAllPanes((0,H.viewportChangeEvent)()),this.lightUpdate()}resetScalesAvailable(){return this._resetScalesAvailable.readonly()}panes(){return this._panes}paneForId(e){return this._panes.find((t=>t.id()===e))||null}createPane(e,t,i){const s=this._undoModel.chartWidget();s.isMaximizedPane()&&s.toggleMaximizePane(null);const r=this._properties.childs().paneProperties;t&&r.merge(t);const n=new Xe(this._timeScale,r,this,i);return void 0!==e?this._panes.splice(e,0,n):this._panes.push(n), +n.onTagsChanged().subscribe(this,ys.prototype.onPaneTagsChanged),n.dataSourcesCollectionChanged().subscribe(this,(()=>this._dataSourceCollectionChanged.fire(n))),n.symbolSourceCollectionChanged().subscribe(this,(()=>this._onSymbolSourceCollectionChanged(n))),n.priceSourcesCollectionChanged().subscribe(this,(()=>this._onPriceSourcesCollectionChanged(n))),n.sourcePropertiesChanged().subscribe(this,(e=>this._sourceProperitesChanged.fire(n,e))),n.sourceZOrderChanged().subscribe(this,(e=>this._sourceZOrderChanged.fire(n,e))),n.symbolSourceResolved().subscribe(this,(e=>this._symbolSourceResolved.fire(n,e))),n.symbolSourceResolvingActive().subscribe(this._recalcSymbolResolvingActive),n.collapsed().subscribe(this._recalcPaneCollapsingAvailable),n.resetPriceScalesAvailable().subscribe(this._updateResetScalesAvailableValue,{callWithLast:!0}),this._recalcPaneCollapsingAvailable(),this._panesCollectionChanged.fire(this._panes),this.invalidate(K.InvalidationMask.panesOrder()),n}removePane(e){const t=this._undoModel.chartWidget();t.isMaximizedPane()&&t.toggleMaximizePane(null);const i=e;i.destroy();const s=this._panes.indexOf(i);-1!==s&&(this._panes.splice(s,1),e.dataSourcesCollectionChanged().unsubscribeAll(this),e.symbolSourceCollectionChanged().unsubscribeAll(this),e.priceSourcesCollectionChanged().unsubscribeAll(this),e.sourcePropertiesChanged().unsubscribeAll(this),e.onTagsChanged().unsubscribeAll(this),e.symbolSourceResolved().unsubscribeAll(this),i.symbolSourceResolvingActive().unsubscribe(this._recalcSymbolResolvingActive),e.collapsed().unsubscribe(this._recalcPaneCollapsingAvailable),e.resetPriceScalesAvailable().unsubscribe(this._updateResetScalesAvailableValue),this._recalcPaneCollapsingAvailable(!0)),this._updateResetScalesAvailableValue();this.crossHairSource().pane===e&&this.clearCurrentPosition(),this._panesCollectionChanged.fire(this._panes),this.invalidate(K.InvalidationMask.panesOrder())}changePanesHeight(e,t){if(this._panes.length<2)return;(0,n.assert)(e>=0&&ee+t.stretchFactor()),0),r=this._panes.reduce(((e,t)=>e+t.height()),0),o=r-30*(this._panes.length-1);t=Math.min(o,Math.max(30,t));const a=s/r,l=i.height();i.setStretchFactor(t*a);let c=t-l,h=this._panes.length-1;for(const e of this._panes)if(e!==i){const t=Math.min(o,Math.max(30,e.height()-c/h));c-=e.height()-t,h-=1;const i=t*a;e.setStretchFactor(i)}this.fullUpdate()}clearCurrentPosition(){const e=this.crossHairSource();e.clearPosition(),(0,n.ensureNotNull)(e.dataWindowView()).update(),fs(this._panes),this.invalidate(K.InvalidationMask.cursor());const t=this._undoModel.chartWidget();t.chartWidgetCollection().syncCrosshair(null,t.id()),this._phantomSourceContainer.onCursorPositionUpdated()}setAndSaveCurrentPosition(e,t,i,s){this.crossHairSource().saveOriginCoords(e,t),this.setCurrentPosition(e,t,i,s)}setCurrentPosition(e,t,i,s){var r,o,a,l,c,h;let d=NaN +;const u=this._timeScale.coordinateToVisibleIndex(e),p=null!==(a=null===(o=null!==(r=this._lineBeingEdited)&&void 0!==r?r:this._lineBeingCreated)||void 0===o?void 0:o.priceScale())&&void 0!==a?a:i.defaultPriceScale();let _=null;!p.isEmpty()&&Number.isFinite(t)&&(_=(0,n.ensureNotNull)(i.mainDataSource()).firstValue(),null!==_&&(d=p.coordinateToPrice(t,_)));const m=this._crossHairSelectPointMode.value()!==Pe.SelectPointMode.None,g=this.currentTool(),f=this.mainSeries(),v=this.crossHairSource(),y=v.index,S=v.price,b=m||Pe.isStudyEditingNow.value(),w=p===this.m_mainSeries.priceScale()&&(this._lineBeingCreated||this._lineBeingEdited||(0,de.isLineToolName)(g)||(0,Pe.toolIsMeasure)(g)||b);!this._isSettingsExternalPosition&&w?(d=this._magnet.align(d,u,i),null!==_&&this._setCorrectedPositionToCrosshair(u,d,i)):this._magnet.resetLastValue();let C=null;if(isNaN(d)||(C=i),this._isTimeScrolling){if(!this._isSettingsExternalPosition&&m){const e=f.bars().firstIndex(),t=f.bars().lastIndex();if(null!==e&&null!==t){const s=Math.min(Math.max(u,e),t);s!==u&&this._setCorrectedPositionToCrosshair(s,d,i)}}else v.setPosition(v.index,d,C);return}v.setOnHoveredChartWidget(!0),v.setPosition(u,d,C),(0,n.ensureNotNull)(v.dataWindowView()).update(),fs(this._panes);const P=f.syncModel();if(this.crossHairSource().startMeasurePoint()||this._lineBeingCreated?this.lightUpdate():this.invalidate(K.InvalidationMask.cursor()),this._lineBeingCreated){const e=this._lineBeingCreated.linkKey().value();if(!this._isSettingsExternalPosition){const t=this._lineBeingCreated.setLastPoint({index:u,price:d},s);if(this._lineBeingCreated.updateAllViews((0,H.sourceChangeEvent)(this._lineBeingCreated.id())),t.price===d&&t.index===u||this._setCorrectedPositionToCrosshair(t.index,t.price,i),P&&e){const i=this._timeScale.points().roughTime(t.index,P.projectTime.bind(P));(0,Pe.setLineToolLastPoint)({model:this,linkKey:e,point:{timeStamp:(0,n.ensureNotNull)(i),price:t.price}})}}}if(!this._isSettingsExternalPosition&&null!==this._lineBeingEdited&&null!==this._linePointBeingEdited){const e={index:u,price:d};if(null===(l=this._linePointBeingChanged)||void 0===l?void 0:l.nonDiscreteIndex){const t=this.crossHairSource().originX();Number.isFinite(t)&&(e.index=this._timeScale.coordinateToFloatIndex(t))}this.changeLinePoint(e,s);const t=this._lineBeingEdited.alignCrossHairToAnchor(this._linePointBeingEdited)?this._lineBeingEdited.getPoint(this._linePointBeingEdited):e;null!==t&&this._setCorrectedPositionToCrosshair(t.index,t.price,i)}if(!this._isSettingsExternalPosition&&1===this._sourcesBeingMoved.length){const e=this._sourcesBeingMoved[0];if(null===(c=e.alignCrossHairToMovePoint)||void 0===c?void 0:c.call(e)){const t=null===(h=e.currentMovingPoint)||void 0===h?void 0:h.call(e);t&&t.logical&&this._setCorrectedPositionToCrosshair(t.logical.index,t.logical.price,i)}}if(!this._isSettingsExternalPosition&&b){const e=f.bars().firstIndex(),t=f.bars().lastIndex();if(null!==e&&null!==t){const s=Math.min(Math.max(u,e),t);s!==u&&this._setCorrectedPositionToCrosshair(s,d,i)}} +(y!==u||S!==d)&&this._syncCrosshair(s)}setExternalPosition(e,t){let i;const s=this.crossHairSource();if(s.setOnHoveredChartWidget(!1),null!==e&&(0,se.isNumber)(e.timeStamp)){const t=this.mainSeries().syncModel();if(t){const s=this.createSyncPoint(e.syncSourceTarget,t.syncSourceTarget()).sourceTimeToTargetTime(e.timeStamp);i=this._timeScale.points().roughIndex(s,t.distance.bind(t))}}if(null!==e&&null!=i&&Number.isFinite(i)){this._isSettingsExternalPosition=!0;const r=(0,n.ensureNotNull)(this.paneForSource(this.mainSeries())),o=this._timeScale.indexToCoordinate(i),a=(0,n.ensureNotNull)(r.mainDataSource()).firstValue();if(null!==a){let i=NaN;void 0!==e.price&&Number.isFinite(e.price)&&(i=this.mainSeries().priceScale().priceToCoordinate(e.price,a)),s.clearOriginCoords(),this.setCurrentPosition(o,i,r,t)}return s.setOnHoveredChartWidget(!1),void(this._isSettingsExternalPosition=!1)}s.clearPosition(),(0,n.ensureNotNull)(s.dataWindowView()).update(),fs(this._panes),this.invalidate(K.InvalidationMask.cursor())}startScaleTime(e){this._timeScale.startScale(e)}scaleTimeTo(e){this._timeScale.scaleTo(e),this.recalculateAllPanes((0,H.viewportChangeEvent)()),this.lightUpdate()}endScaleTime(){this._timeScale.endScale(),this.lightUpdate(),this.recalcVisibleRangeStudies()}resetTimeScale(){this._timeScale.restoreDefault(),this.recalculateAllPanes((0,H.viewportChangeEvent)()),this.recalcVisibleRangeStudies(),this.lightUpdate(),this._resetScales.fire()}startScalePrice(e,t,i){e.startScalePrice(t,i)}scalePriceTo(e,t,i){e.scalePriceTo(t,i),this.mainSeries().priceScale().isLockScale()?this.lightUpdate():this.invalidate(this._paneInvalidationMask(e,K.InvalidationLevel.Light))}endScalePrice(e,t){e.endScalePrice(t),this.invalidate(this._paneInvalidationMask(e,K.InvalidationLevel.Light))}startTwoPointsScalePrice(e,t,i,s){t.startTwoPointsScale(i,s)}twoPointsScalePriceTo(e,t,i,s){t.twoPointsScale(i,s),this.invalidate(this._paneInvalidationMask(e))}endTwoPointsScalePrice(e,t){t.endTwoPointsScale(),this.invalidate(this._paneInvalidationMask(e))}resetPriceScale(e,t){e.resetPriceScale(t),this.invalidate(this._paneInvalidationMask(e,K.InvalidationLevel.Light))}restorePriceScaleState(e,t,i){e.restorePriceScaleState(t,i),this.invalidate(this._paneInvalidationMask(e,K.InvalidationLevel.Light))}currentTool(){return this._currentTool}setCurrentTool(e){this._currentTool!==e&&((0,de.isLineToolName)(e)&&this.selectionMacro((e=>{e.clearSelection()})),this._currentTool=e,this._phantomSourceContainer.onToolChanged())}detachSource(e){const t=this.paneForSource(e);return!!t&&(t.removeDataSource(e),t.isEmpty()?(this._lineBeingCreated&&t===this._paneBeingCreatedLineOn&&this.cancelCreatingLine(),this.removePane(t),!0):(this.fullUpdate(),!1))}children(e,t){return this.dataSources().filter((i=>(0,G.isStudy)(i)?!t&&i.parentSources().includes(e):i.ownerSource()===e))}onRearrangePanes(){return this._onRearrangePanes}finishLineTool(e){const t=e.linkKey().value();(0,Pe.drawOnAllCharts)().value()&&null!==t&&e.isSynchronizable()&&(0,Pe.finishLineTool)({linkKey:t,model:this})} +startChangingLinetool(e,t,i,s,r){this._lineBeingEdited=e,this._linePointBeingChanged=t||null,this._linePointBeingEdited=void 0===i?null:i,this._lineBeingEdited.startChanging(i,t,r),Pe.isToolEditingNow.setValue(!0);const o=(0,n.ensureNotNull)(this.paneForSource(e));this._lineBeingEdited.startDragPoint&&void 0!==i&&void 0!==t&&this._lineBeingEdited.startDragPoint(i,t),r||void 0===i||void 0===t||this._lineBeingEdited.setPoint(i,t,s,r),this._lineBeingEdited.updateAllViews((0,H.sourceChangeEvent)(this._lineBeingEdited.id()));const a=this._paneInvalidationMask(o,K.InvalidationLevel.Light);this.invalidate(a);const l=e.linkKey().value();if(l&&e.isSynchronizable()&&void 0!==i&&void 0!==t){const e=(0,n.ensureNotNull)(this.externalTimeStamp(t.index));(0,Pe.startChangingLineTool)({linkKey:l,model:this,symbol:this.mainSeries().symbol(),point:{price:t.price,timeStamp:e},pointIndex:i,envState:s||null})}}createLineTool(e,t,i,s,r,a,l,c){if((0,n.assert)((0,de.isLineToolName)(i),`Cannot create unknown line tool: ${i}`),s){const e={...rs.intervalsVisibilitiesDefaults},t=s.childs().intervalsVisibilities.state();(0,se.merge)(e,null!=t?t:{});const r=s.state();r.intervalsVisibilities=e,s=(0,y.createLineToolProperties)(i,r,this)}const h=(0,y.createLineTool)(i,this,s,null,void 0,c);if("LineToolExecution"!==i){let e;switch(i){case"LineToolIcon":e=h.properties().childs().icon.value().toString(16).toUpperCase();break;case"LineToolEmoji":e=h.properties().childs().emoji.value();break;case"LineToolSticker":e=h.properties().childs().sticker.value()}(0,u.trackEvent)("drawings","Study_Drawing_"+i,e)}(0,y.isStudyLineTool)(h)&&(0,u.trackEvent)("studies",`Study_${h.metaInfo().id}`);const d=!h.linkKey().value()&&!r;l=(0,n.ensureDefined)(l||(0,n.ensureNotNull)(e.mainDataSource())),s||(0,y.prepareLineToolPropertiesByOwnerSource)(h.properties(),l),h.setOwnerSource(l);const p=l.priceScale();if(h.setPriceScale(p),_s&&l===this.mainSeries()&&h.share(a),e.addDataSource(h,p,!1),null!==h.preferredZOrder()&&e.insertAfter([h],this.mainSeries()),(0,Pe.drawOnAllCharts)().value()){const e=h.isSynchronizable()?r||(0,Q.randomHash)():null;h.linkKey().setValue(e)}else h.linkKey().setValue(r);let _;if(h.isFixed()){const i=(0,n.ensureNotNull)((0,n.ensureNotNull)(e.mainDataSource()).firstValue()),s=this._timeScale.indexToCoordinate(t.index),r=(0,n.ensureNotNull)(p).priceToCoordinate(t.price,i);_=h.addFixedPoint(new o.Point(s,r))}else _=h.addPoint(t);return _||(this._lineBeingCreated=h,this._paneBeingCreatedLineOn=e,Pe.isToolCreatingNow.setValue(!0)),d&&h.enableCurrentIntervalVisibility(),this.fullUpdate(),h}endChangingLinetool(e,t){const i=(0,n.ensureNotNull)(this._lineBeingEdited),s=i.endChanging(!1,e,t);this._lineBeingEdited=null,Pe.isToolEditingNow.setValue(!1),this._linePointBeingEdited=null,this._linePointBeingChanged=null,this.lightUpdate();const r={points:i.normalizedPoints(),interval:this.mainSeries().interval()},o=i.linkKey().value();null!==o&&i.isSynchronizable()&&!t&&(0,Pe.finishChangingLineTool)({model:this,linkKey:o,symbol:this.mainSeries().symbol(),finalState:r, +changes:s})}continueCreatingLine(e,t,i,s){const r=(0,n.ensureNotNull)(this._lineBeingCreated),o=r.addPoint(e,t,i);r.updateAllViews((0,H.sourceChangeEvent)(r.id()));const a=new K.InvalidationMask(K.InvalidationLevel.Light);return o&&(this._paneBeingCreatedLineOn=null,this._lineBeingCreated=null,Pe.isToolCreatingNow.setValue(!1)),this.invalidate(a),o}cancelCreatingLine(){if(!this._lineBeingCreated)return;const e=this._lineBeingCreated;this.removeSource(this._lineBeingCreated),this._lineBeingCreated=null,this._lineCancelled.fire(),Pe.isToolCreatingNow.setValue(!1),(0,Pe.drawOnAllCharts)().value()&&e.isSynchronizable()&&(0,Pe.cancelLineTool)({model:this})}lineBeingCreated(){return this._lineBeingCreated}paneBeingCreatedLineOn(){return this._paneBeingCreatedLineOn}lineCancelled(){return this._lineCancelled}isPhantomLine(e){return this._phantomSourceContainer.source()===e}changeLinePoint(e,t,i){const s=(0,n.ensureNotNull)(this._lineBeingEdited),r=(0,n.ensureNotNull)(this._linePointBeingEdited);let o=e.price,a=e.index;if(s.setPoint(r,e,t,i),!i){const t=s.alignCrossHairToAnchor(r)?s.getPoint(r):e;null!==t&&(a=t.index,o=t.price)}s.updateAllViews((0,H.sourceChangeEvent)(s.id())),this.lightUpdate();const l=s.linkKey().value();if(!i&&null!==l&&s.isSynchronizable()){const e=(0,n.ensureNotNull)(this._linePointBeingChanged),i={indexesChanged:a!==e.index,pricesChanged:o!==e.price},c=s.getChangePointForSync(r);if(null!==c){const e=this.externalTimeStamp(a);null!==e&&(o=c.price,(0,Pe.changeLineTool)({linkKey:l,model:this,symbol:this.mainSeries().symbol(),point:{price:o,timeStamp:e},envState:t,changes:i}))}}}changeLinePoints(e,t,i){const s=e.points(),r=e.linkKey().value();!i&&r&&e.isSynchronizable()&&t.forEach(((t,i)=>{const o=s[i],a=o.price!==t.price,l=o.index!==t.index;if(e.getChangePointForSync(i)){const e=(0,n.ensureNotNull)(this.externalTimeStamp(t.index));(0,Pe.changeLineTool)({linkKey:r,model:this,symbol:this.mainSeries().symbol(),point:{price:t.price,timeStamp:e},changes:{pricesChanged:a,indexesChanged:l}})}})),e.setPoints(t),e.updateAllViews((0,H.sourceChangeEvent)(e.id())),this.lightUpdate()}startScrollTime(e){this._timeScale.startScroll(e),this._isTimeScrolling=!0,this.mainSeries().clearGotoDateResult()}scrollTimeTo(e){this._timeScale.scrollTo(e),this.recalculateAllPanes((0,H.viewportChangeEvent)()),this.lightUpdate()}endScrollTime(){this._timeScale.endScroll(),this.lightUpdate(),this.recalcVisibleRangeStudies(),this._isTimeScrolling=!1}startScrollPrice(e,t,i){e.startScrollPrice(t,i)}scrollPriceTo(e,t,i){e.scrollPriceTo(t,i),this.invalidate(this._paneInvalidationMask(e,K.InvalidationLevel.Light))}endScrollPrice(e,t){e.endScrollPrice(t),this.invalidate(this._paneInvalidationMask(e,K.InvalidationLevel.Light))}addCustomSource(e,t,i=g.CustomSourceLayer.Foreground){this._customSourcesMap.has(e)&&ms.logWarn(`Attempt to add the same custom source multiple time "${e}"`),ms.logNormal(`Adding custom source "${e}"`);const s=t(e,this);switch(i){case g.CustomSourceLayer.Background:this._bgCustomSources.push(s);break +;case g.CustomSourceLayer.Foreground:this._fgCustomSources.push(s);break;case g.CustomSourceLayer.Topmost:this._topmostCustomSources.push(s);break;default:throw new Error(`Unknown custom sources layer ${i}`)}this._allCustomSources.push(s),this._customSourcesMap.set(e,s),this.lightUpdate()}removeCustomSource(e){this._removeCustomSource(e),this.lightUpdate()}hasCustomSource(e){return this._customSourcesMap.has(e)}customSourceForName(e){return this._customSourcesMap.get(e)||null}customSourceName(e){let t=null;return this._customSourcesMap.forEach(((i,s)=>{i===e&&(t=s)})),t}customSources(e){switch(e){case g.CustomSourceLayer.Background:return this._bgCustomSources;case g.CustomSourceLayer.Foreground:return this._fgCustomSources;case g.CustomSourceLayer.Topmost:return this._topmostCustomSources;default:return this._allCustomSources}}addMultiPaneSource(e){this._multiPaneSources.push(e),this.lightUpdate()}removeMultiPaneSource(e){const t=this._multiPaneSources.indexOf(e);-1===t?ms.logWarn("Attempt to remove multi-pane source which does not exist in the model"):this._multiPaneSources.splice(t,1),this.lightUpdate()}multiPaneSources(e){return this._multiPaneSources.filter((t=>!e.hasDataSource(t)))}magnet(){return this._magnet}dateTimeFormatter(){return this._dateTimeFormatter}dateFormatter(){return this._dateFormatter}timeFormatter(){return this._timeFormatter}isUnmergeAvailableForSource(e){if(!this._unmergeAvailable(e))return!1;return(0,n.ensureNotNull)(this.paneForSource(e)).dataSources().filter(this._unmergeAvailable,this).length>1}isMergeDownAvailableForSource(e){if(!this._unmergeAvailable(e))return!1;const t=this.paneForSource(e),i=this.panes();return t!==i[i.length-1]}isMergeUpAvailableForSource(e){if(!this._unmergeAvailable(e))return!1;return this.paneForSource(e)!==this.panes()[0]}sessions(){return(0,n.ensureNotNull)(this._sessions)}createSessions(e){(0,n.assert)(null===this._sessions,"Sessions are already created"),this.addCustomSource("sessions",((t,i)=>(this._sessions=new j(t,i,e),this._sessions.start(),this._sessions)),g.CustomSourceLayer.Background)}createPrePostMarket(e){this.addCustomSource("prePostMarket",((t,i)=>new PrePostMarket(t,i,e)))}watermarkContentProvider(){return ds.WatermarkApi.getInstance().provider()}replayStatus(){return this._replayStatus}setReplayStatus(e){this._replayStatus.setValue(e)}isInReplay(){return this.m_mainSeries.isInReplay()}getSymbolString(){return this.m_mainSeries.getSymbolString()}interval(){return this.m_mainSeries.interval()}switchToReplay(e,t){0}switchToRealtime(){0}theme(){const e=this.properties().childs().paneProperties.state(["horzGridProperties.style","vertGridProperties.style"]);delete e.topMargin,delete e.bottomMargin;const t=this.mainSeries().state().state;t&&(delete t.symbol,delete t.interval,delete t.currencyId,delete t.unitId);const i={mainSourceProperties:t,sessions:this.sessions().properties().state(),chartProperties:{paneProperties:e,scalesProperties:this.properties().childs().scalesProperties.state()},version:this.version()};return i.version=this.version(),i} +onChartThemeLoaded(){return this._chartThemeLoaded}chartThemeLoaded(){this._chartThemeLoaded.fire()}async colorStudiesPropertiesReady(){this._recalcColorStudiesImpl(this._recalcVRStudiesParams);const e=this.allStudies(!0).filter((e=>e.metaInfo().inputs.filter(C.isStudyInputDependsOnChartColors).length>0));await Promise.all(e.map((e=>e.propertiesPatched())))}state(e,t,i,s){var r;const n=this.publishedChartsTimelineSource(),o=this.properties().childs(),a=o.tradingProperties.state(),l={panes:this._panes.map((r=>r.state(!0,e,!1,t,i,s))),timeScale:this._timeScale.state(e),chartProperties:{paneProperties:o.paneProperties.state(["horzGridProperties.style","vertGridProperties.style"]),scalesProperties:o.scalesProperties.state(),publishedChartsTimelineProperties:n?n.state(e):void 0,chartEventsSourceProperties:null===(r=o.chartEventsSourceProperties)||void 0===r?void 0:r.state(),tradingProperties:a,priceScaleSelectionStrategyName:o.priceScaleSelectionStrategyName.value()},sessions:this.sessions().state(e),version:this.version(),timezone:this.timezone(),shouldBeSavedEvenIfHidden:this._shouldBeSavedEvenIfHidden,linkingGroup:this._linkingGroupIndex.value()};return s||(l.lineToolsGroups=this.lineToolsGroupModel().state(t)),l}restoreState(e,t,i){var s;Oe.instance(this).reset();const r={};if(!e.panes)return void ms.logDebug("ChartModel.restoreState: invalid state");if(!Array.isArray(e.panes))return void ms.logDebug("ChartModel.restoreState: invalid state");if(e.panes.length<1)return void ms.logDebug("ChartModel.restoreState: invalid state");for(const e of this._barsMarksSources)this.detachSource(e);if(this._shouldBeSavedEvenIfHidden=void 0===e.shouldBeSavedEvenIfHidden||e.shouldBeSavedEvenIfHidden,e.chartProperties&&!e.chartProperties.timezone&&(e.chartProperties.timezone=e.timezone),e.chartProperties){const i=(0,R.factoryDefaults)("chartproperties").scalesProperties;(0,se.merge)(i,e.chartProperties.scalesProperties),!("showLastValue"in i)||"showSeriesLastValue"in i||"showStudyLastValue"in i||(i.showSeriesLastValueProperty=i.showLastValue,i.showStudyLastValueProperty=i.showLastValue),"showSeriesLastValue"in i&&(r.showSeriesLastValueProperty=!0),"showStudyLastValue"in i&&(r.showStudyLastValueProperty=!0),(!this.isSnapshot()&&!this.readOnly()&&"showCurrency"in i||"showUnit"in i)&&((0,Z.migrateShowCurrencyAndShowUnitProperties)(i.showCurrency,i.showUnit),delete i.showCurrency,delete i.showUnit);{const{paneProperties:t}=e.chartProperties;t.vertGridProperties=t.vertGridProperties||(0,se.clone)(t.gridProperties),t.horzGridProperties=t.horzGridProperties||(0,se.clone)(t.gridProperties),"backgroundType"in t||(t.backgroundType=Ht.ColorType.Solid),"separatorColor"in t||(t.separatorColor=(0,d.getThemedColor)("color-chart-page-bg")),this._properties.childs().paneProperties.mergeAndFire(t)}this._properties.childs().scalesProperties.mergeAndFire(i),e.chartProperties.timezone&&this._properties.childs().timezone.setValue(e.chartProperties.timezone), +e.chartProperties.chartEventsSourceProperties&&this._properties.hasChild("chartEventsSourceProperties")&&this._properties.childs().chartEventsSourceProperties.mergeAndFire(e.chartProperties.chartEventsSourceProperties),e.chartProperties.tradingProperties&&this._properties.hasChild("tradingProperties")&&(void 0===e.chartProperties.tradingProperties.horizontalAlignment&&(e.chartProperties.tradingProperties.horizontalAlignment=(n=e.chartProperties.tradingProperties.lineLength)<=40?g.TradedGroupHorizontalAlignment.Right:n>=60?g.TradedGroupHorizontalAlignment.Left:g.TradedGroupHorizontalAlignment.Center),this._properties.childs().tradingProperties.mergeAndFire(e.chartProperties.tradingProperties)),this._timeScale.restoreState(e.timeScale,t),this._updateDateTimeFormatter()}var n;if(e.timeScale&&this._timeScale.restoreState(e.timeScale,t),!this.readOnly()){const t=this._getExceedingChildStudies(e.panes);if(t.length){for(let i=e.panes.length-1;i>=0;--i){const s=e.panes[i];for(let e=s.sources.length-1;e>=0;--e){const i=s.sources[e];~t.indexOf(i)&&s.sources.splice(e,1)}s.sources.length||e.panes.splice(i,1)}0}}const o=e.version||0,a=e.panes;let l="_seriesId";for(const e of a){const t=e.sources.find((e=>"MainSeries"===e.type));if(t){l=t.id;break}}this.panes()[0].restoreState({state:a[0],withData:t,version:o,seriesId:l,settingsMigration:r,contentOverrides:i,restoreSilently:true,reason:2});let c=1;for(let s=1;s_&&u%100==0?{lines_limit_exceeded:!0,line_tools_count:u}:(this.panes().forEach((e=>this._dataSourceCollectionChanged.fire(e))),this._lineToolsGroupModel.fireChangedAll(),this._linkingGroupIndex.setValue(null!==(s=e.linkingGroup)&&void 0!==s?s:null),{})}shouldBeSavedEvenIfHidden(){return this._shouldBeSavedEvenIfHidden}setShouldBeSavedEvenIfHidden(e){this._shouldBeSavedEvenIfHidden=e} +externalTimeStamp(e){const t=this.mainSeries().syncModel();return this.timeScale().points().roughTime(e,t&&t.projectTime.bind(t))}syncLollipopSources(){var e;null===(e=this._lollipopSourcesWatcherLoader)||void 0===e||e.callFunction((()=>{null!==this._lollipopSourcesWatcher&&this._lollipopSourcesWatcher.syncSources()}))}restoreChartEvents(e){var t;null===(t=this._lollipopSourcesWatcherLoader)||void 0===t||t.callFunction((()=>{null!==this._lollipopSourcesWatcher&&this._options.chartEventsEnabled&&this._lollipopSourcesWatcher.restoreChartEvents(e)}))}recalcVisibleRangeStudies(e){this._recalcVRStudiesParams.force=this._recalcVRStudiesParams.force||Boolean(e),this.m_mainSeries.isStarted()&&this.m_mainSeries.isCompleted()?this._recalcVisibleRangeStudiesImplDebounced():this._recalcVisibleRangeStudiesImpl(this._recalcVRStudiesParams)}recalcColorStudies(e){this._recalcColorStudiesParams.force=this._recalcColorStudiesParams.force||Boolean(e),this._recalcColorStudiesImplDebounced()}recalcStudyBasedLineTools(){this.dataSources().forEach((e=>{(0,y.isStudyLineTool)(e)&&e.recalcStudyIfNeeded()}))}alertsWatcher(){return this._alertsWatcher}showLegend(){return this._showLegendProperty}id(){return this._id}selectPointMode(){return this._crossHairSelectPointMode}cancelRequestSelectPoint(){this.m_crossHairSource.cancelRequestSelectPoint()}requestSelectPoint(e){return this.m_crossHairSource.requestSelectPoint(e)}onPointSelected(){return this.m_crossHairSource.onPointSelected()}recalculatePriceRangeOnce(){const e=this.mainSeries();for(const t of this._panes)for(const i of t.priceDataSources())i.symbolSource()===e&&i.disablePriceRangeReady()}invalidate(e){var t;null===(t=this._invalidateHandler)||void 0===t||t.call(this,e)}appliedTimeFrame(){return this._appliedTimeFrame.appliedTimeFrame()}barsMarksSources(){return this._barsMarksSources}createSyncPoint(e,t){return(0,is.getDefault2Lazy)(this._syncPointCache,e.uniqueId,t.uniqueId,(()=>new Nt(e,t)))}isAutoSaveEnabled(){return this._isAutoSaveEnabled}linkingGroupIndex(){return this._linkingGroupIndex}studyAwareDefaultRightOffset(){return this._timeScale.usePercentageRightOffset().value()?this._timeScale.percentsToBarIndexLength(this.studyAwareDefaultRightOffsetPercentage()):Math.max(this._timeScale.defaultRightOffset().value(),this._cachedStudiesMaxOffset)}studyAwareDefaultRightOffsetPercentage(){return this._timeScale.usePercentageRightOffset().value()?Math.max(this._timeScale.defaultRightOffsetPercentage().value(),this._timeScale.barIndexLengthToPercents(this._cachedStudiesMaxOffset)):this._timeScale.barIndexLengthToPercents(this.studyAwareDefaultRightOffset())}clearAllStudies(){this.dataSources().forEach((e=>{var t;return null===(t=e.clearData)||void 0===t?void 0:t.call(e)}))}setTimeScaleAnimation(e){const t=K.InvalidationMask.light();t.setTimeScaleAnimation(e),this.invalidate(t)}stopTimeScaleAnimation(){const e=K.InvalidationMask.light();e.stopTimeScaleAnimation(),this.invalidate(e)}lollipopSourcesOptions(){const e=this._options;return{ +chartEventsEnabled:!this._options.isSnapshot&&this._options.chartEventsEnabled,esdEnabled:e.esdEnabled,newsNotificationsEnabled:e.newsNotificationsEnabled,continuousContractSwitchesEnabled:e.continuousContractSwitchesEnabled,futuresContractExpirationEnabled:e.futuresContractExpirationEnabled,latestUpdatesEnabled:e.latestUpdatesEnabled}}_initAlertsList(){throw new Error("Not implemented")}_updateStudiesMaxOffset(){const e=Math.max(...this.allStudies().map((e=>e.maxOffset().value())));this._cachedStudiesMaxOffset=e;const t=this._timeScale.rightOffset();if(t<0)return;if(e<=t)return;const i=this._timeScale.logicalRange();i?this._timeScale.zoomToBarsRange(i.left(),this._timeScale.baseIndex()+Math.max(this._timeScale.rightOffset(),e)):this._timeScale.setRightOffset(Math.max(t,e))}_updateBaseIndex(e,t){const i=this._timeScale,s=i.baseIndex(),r=i.logicalRange();if(null!==r&&t){const t=r.contains(s),n=e-s,o=t?null:i.rightOffset()-n;if(!this._options.shiftVisibleRangeOnNewBar&&t){const e=i.width()/i.barSpacing(),t=e/(e+n),s=Math.max(i.minBarSpacing(),i.barSpacing()*t);i.setBarSpacing(s)}null!==o&&i.setRightOffset(o)}i.setBaseIndex(e)}async _createLollipopSourcesWatcher(){}_updateDateTimeFormatter(){const e=At.dateFormatProperty.value(),t=void 0;if(this._dateFormatter=new Mt.DateFormatter(e,t),this.mainSeries().isDWM())this._dateTimeFormatter=new Mt.DateFormatter(e,t),this._timeFormatter=new _t.TimeFormatter((0,mt.getHourMinuteFormat)(pt.timeHoursFormatProperty.value()));else{const i=T.Interval.parse(this.mainSeries().interval()),s=(0,mt.getTimeFormatForInterval)(i,pt.timeHoursFormatProperty.value());this._dateTimeFormatter=new It.DateTimeFormatter({dateFormat:e,withWeekday:t,timeFormat:s,dateTimeSeparator:" "}),this._timeFormatter=new _t.TimeFormatter(s)}}_invalidationMaskForSource(e,t=K.InvalidationLevel.Light){if(e===this.crossHairSource())return K.InvalidationMask.cursor();if(this._watermarkSource===e)return this._paneInvalidationMask((0,n.ensureNotNull)(this.paneForSource(this.mainSeries())),t);if(-1!==this._allCustomSources.indexOf(e)){const e=new K.InvalidationMask;return e.invalidateAll(t),e}if(!(0,f.isDataSource)(e))return null;if(e.isMultiPaneEnabled())return new K.InvalidationMask(t);const i=this.paneForSource(e);return null!==i?this._paneInvalidationMask(i,t):null}_paneInvalidationMask(e,t=K.InvalidationLevel.Light){const i=new K.InvalidationMask,s=this._panes.indexOf(e);return i.invalidateAllPane(s,t),i}_invalidationMaskForSourcePriceScale(e,t=K.InvalidationLevel.Light){if(!(0,f.isDataSource)(e))return new K.InvalidationMask(t);const i=this.paneForSource(e);if(null===i)return null;let s=e.priceScale();if(null===s)return null;const r=this._panes.indexOf(i);let n=i.priceScalePosition(s);if("overlay"===n){const e=this._panes[r].defaultPriceScale();s=e,n=i.priceScalePosition(e)}const o=i.priceScaleIndex(s,n);if(void 0===o)return null;const a=new K.InvalidationMask;return a.invalidatePriceScale(r,n,o,t),a}_removeCustomSource(e){const t=this._customSourcesMap.get(e) ;if(void 0===t)return void ms.logWarn(`Attempt to remove custom source which does not exist in the model - "${e}"`);ms.logNormal(`Removing custom source "${e}"`),this.selectionMacro((e=>{e.removeSourceFromSelection(t)})),this._hoveredSource===t&&this.setHoveredSource(null),this._customSourceBeingMoved===t&&this.setMovingCustomSource(null,null);const i=gs(this._bgCustomSources,t),s=gs(this._fgCustomSources,t),r=gs(this._topmostCustomSources,t),o=gs(this._allCustomSources,t);(0,n.assert)(i||s||r,"Source should be presented in one of the layers"),(0,n.assert)(o,"Source should be presented in the array"),this._customSourcesMap.delete(e),t.destroy()}_updateShowLegendProperty(){const e=this._properties.childs().paneProperties.childs().legendProperties.childs().showLegend,t=this._showLegendProperty;if(e.value())t.setValue(!0);else{for(const e of this._panes){let i=0;for(const s of e.priceDataSources())if(null!==s.statusView()&&(i++,i>=2))return void t.setValue(!1)}t.setValue(!0)}}_pointToPercentPosition(e,t){return{x:e.x/this._timeScale.width(),y:e.y/(0,n.ensureNotNull)((0,n.ensureNotNull)(t.mainDataSource()).priceScale()).height()}}_percentPositionToPoint(e,t){const i=e.x*this._timeScale.width(),s=e.y*(0,n.ensureNotNull)((0,n.ensureNotNull)(t.mainDataSource()).priceScale()).height();return new o.Point(i,s)}_recalcVisibleRangeStudiesImpl(e){var t,i;if(!this.m_mainSeries.isStarted()||!this.m_mainSeries.isCompleted())return void this._visibleRangeStudiesInputs.setValue(null);if(this.timeScale().isEmpty())return;const s=this.timeScale().visibleBarsStrictRange();if(null===s)return;const r=this.m_mainSeries.bars(),n=r.search(s.firstBar(),gt.PlotRowSearchMode.NearestRight),o=r.search(s.lastBar(),gt.PlotRowSearchMode.NearestLeft),a=r.lastIndex(),l=n?n.index:void 0,c=o?o.index:void 0,h=l===e.oldStartVisibleIndex,d=c===e.oldEndVisibleIndex;h&&d&&!e.force||(e.force=!1,e.oldStartVisibleIndex=void 0!==l?l:NaN,e.oldEndVisibleIndex=void 0!==c?c:NaN,this._visibleRangeStudiesInputs.setValue({firstVisibleBarTime:1e3*(null!==(t=null==n?void 0:n.value[0])&&void 0!==t?t:0),lastVisibleBarTime:1e3*(null!==(i=null==o?void 0:o.value[0])&&void 0!==i?i:0),subscribeRealtime:(null==o?void 0:o.index)===a}))}_recalcColorStudiesImpl(e){var t;const i=this.backgroundColorAtYPercentFromTop(.5),s=this.dark().value()?l.colorsPalette["color-cold-gray-200"]:l.colorsPalette["color-cold-gray-900"],r=i===e.oldBgColor,n=s===e.oldFgColor;if(r&&n&&!e.force)return;e.force=!1,e.oldBgColor=i,e.oldFgColor=s;const o=null!==(t=e.studies)&&void 0!==t?t:this.priceDataSources();e.studies=void 0;for(const e of o)if((0,G.isStudy)(e)){const t=e.metaInfo().inputs.filter(C.isStudyInputDependsOnChartColors),r=e.properties().childs().inputs;t.forEach((e=>{const t=e.id===C.ChartColorDependentStudyInputNames.FgColor?s:i;r.childs()[e.id].setValueSilently(t)})),t.length>0&&r.listeners().fire(r,"")}}_getAllSources(e){const t=[];for(const i of this._panes){const s=i.sourcesByGroup().all();for(const i of s)e(i)&&t.push(i)}return t}_invalidateBarColorerCaches(){ this.mainSeries().invalidateBarColorerCache()}_addAlertLabelToChart(e){throw new Error("Not implemented")}_removeAlertLabelFromChart(e){throw new Error("Not implemented")}_removeAllAlertLabelsFromChart(){throw new Error("Not implemented")}_updateTimeScale(e){var t,i,s,r;const{index:n,zoffset:o,values:a,indexDiffs:l,baseIndex:c,marks:h,clearFlag:d}=e;if(d){this._timeScale.reset();for(const e of this.dataSources())null===(t=e.clearData)||void 0===t||t.call(e)}if(l.length>0)for(const e of this.dataSources())null===(i=e.moveData)||void 0===i||i.call(e,l);const u=this._timeScale.indexToTimePoint(this._timeScale.baseIndex()),p=this._timeScale.canNormalize();this._timeScale.update(n,o,a,h);const _=this._timeScale.points().range().value();let m="ChartModel.prototype._updateTimeScale("+n+","+o+","+a.length+","+l.length+","+h.length+","+d+")";if(m+="TimeScale: {first:"+(null!==(s=null==_?void 0:_.firstIndex)&&void 0!==s?s:null)+",last:"+(null!==(r=null==_?void 0:_.lastIndex)&&void 0!==r?r:null)+"}",null===c){this._timeScale.resetBaseIndex();const e=this._timeScale.rightOffset();e<0?this._timeScale.setRightOffset(this.studyAwareDefaultRightOffset()):this._timeScale.setRightOffset(Math.max(e,this._cachedStudiesMaxOffset))}else if(void 0!==c){const e=this._timeScale.indexToTimePoint(c),t=null!==u&&null!==e&&e>u;this._updateBaseIndex(c,t)}if(ms.logDebug(m),!p&&p!==this._timeScale.canNormalize())for(const e of this.dataSources())!(0,y.isLineTool)(e)||e.isFixed()||e.isSourceHidden()||e.processHibernate();for(const e of this.dataSources())e.updateAllViews({type:"data-source-change",sourceId:e.id(),clearData:!0});this.recalculateAllPanes((0,H.globalChangeEvent)()),this.lightUpdate()}_getAvailableCurrencies(){return!this.currencyConversionEnabled()||this.isSnapshot()?[]:(0,se.isArray)(this._availableCurrenciesList)?this._availableCurrenciesList:(null!==this._availableCurrenciesList||(this._availableCurrenciesList=this.chartApi().availableCurrencies(),this._availableCurrenciesList.then((e=>{this._destroyed||(this._availableCurrenciesList=e,this.fullUpdate())})).catch((e=>{ms.logWarn(`An error occurred while getting currencies config: ${e}`)}))),[])}_getAvailableUnits(){return!this.unitConversionEnabled()||this.isSnapshot()?{}:this._availableUnitsObject instanceof Promise||null===this._availableUnitsObject?(null!==this._availableUnitsObject||(this._availableUnitsObject=this.chartApi().availableUnits(),this._availableUnitsObject.then((e=>{this._destroyed||(this._availableUnitsObject=e,this.fullUpdate())})).catch((e=>{ms.logWarn(`An error occurred while getting units config: ${e}`)}))),{}):this._availableUnitsObject}_getAvailablePriceSources(e){const t=this._availablePriceSourcesBySymbol.get(e);if(Array.isArray(t))return t;if((0,se.isPromise)(t))return[];const i=this.chartApi().availablePriceSources(e);return this._availablePriceSourcesBySymbol.set(e,i),i.then((t=>{this._destroyed||(this._availablePriceSourcesBySymbol.set(e,t),this.fullUpdate())})).catch((e=>{ms.logWarn(`An error occurred while getting price sources config: ${e}`)})),[]} _clearAvailablePriceSources(){this._availablePriceSourcesBySymbol.clear()}_getBackgroundColor(e){const t=this._properties.childs().paneProperties.childs();if(t.backgroundType.value()===Ht.ColorType.Gradient){const i=t.backgroundGradientStartColor.value(),s=t.backgroundGradientEndColor.value();return e?i:s}return t.background.value()}_getBackgroundCounterColor(){const e=this.backgroundColor().value();return"black"===(0,a.rgbToBlackWhiteString)((0,a.parseRgb)(e),150)?"white":"black"}_updateBackgroundColor(){this._backgroundColor.setValue(this._getBackgroundColor()),this._backgroundTopColor.setValue(this._getBackgroundColor(!0))}_syncCrosshair(e){if(!this._isSettingsExternalPosition){const t=this._undoModel.chartWidget(),i=this._undoModel.mainSeries(),s=i.syncModel(),r=this._undoModel.crossHairSource(),n=r.pane;if(null!==s&&null!==n){const o={timeStamp:this._timeScale.points().roughTime(r.index,s.projectTime.bind(s)),syncSourceTarget:s.syncSourceTarget()};n.mainDataSource()===i&&(o.price=r.price,o.symbol=i.symbol());let a=this._lineBeingCreated||null!==this._linePointBeingEdited||Boolean(this._sourcesBeingMoved.length);a=a&&(0,Pe.drawOnAllCharts)().value(),t.chartWidgetCollection().syncCrosshair(o,t.id(),a,e)}this._phantomSourceContainer.onCursorPositionUpdated()}}_gotoTimeImpl(e,t){const i=this.timeScale(),s=this.mainSeries();let r;if(void 0!==e){if(this._scrollingState&&this._scrollingState.deferred.reject(),r=(0,p.createDeferredPromise)(),r.promise.catch((()=>{})),!s.isDWM()){const t=s.symbolInfo();if(null!==t){let i=this.properties().childs().timezone.value();"exchange"===i&&(i=t.timezone);const r=(0,Dt.cal_to_utc)((0,Dt.get_timezone)(i),new Date(e)),n=(0,Xt.createTimeToBarTimeAligner)(s.interval(),t)(r);e=(0,Dt.utc_to_cal)((0,Dt.get_timezone)(i),n).getTime()}}this._scrollingState={targetDate:e,deferred:r,centerIfVisible:t.centerIfVisible}}else{if(!this._scrollingState)return ms.logError("scrollTo called without an argument"),Promise.reject();e=this._scrollingState.targetDate,r=this._scrollingState.deferred}if(void 0===i.tickMarks().minIndex)return r.resolve(void 0),r.promise;this.stopTimeScaleAnimation();let o=((e,t)=>{if((e=>(0,n.ensureNotNull)(i.tickMarks().indexToTime((0,n.ensureDefined)(i.tickMarks().minIndex))).valueOf()-e)(t)<0){let r=i.tickMarks().nearestIndex(t);const o=s.bars().lastIndex();if(null===o)return null;r=Math.min(r,o);let a=(0,n.ensureNotNull)(i.tickMarks().indexToTime(r)).valueOf();for(;a0}_onAlertData(e){}_propertiesStateExclusions(){return null}_syncLineStyleIfNeeded(){const e=this.linkKey().value();!this._syncLineStyleMuted&&e&&(0,y.changeLineStyle)({linkKey:e,state:this.syncLineStyleState(),model:this._model})}_muteSyncLineStyle(){this._syncLineStyleMuted=!0}_unmuteSyncLineStyleWithoutApplyingChanges(){this.propertiesChanged(),this._syncLineStyleMuted=!1}_applyTemplateImpl(e){e.intervalsVisibilities=(0,p.mergeIntervalVisibilitiesDefaults)(e.intervalsVisibilities);const t=this.properties();t.applyTemplate(e,(0,k.factoryDefaults)(this.toolname.toLowerCase())),t.saveDefaults(),this.propertiesChanged()}_getPropertyDefinitionsViewModelClass(){return Promise.resolve(null)}_getAlertPlots(){return[]}_getUndoHistory(){return this._model.undoModel().undoHistory()}_synchronizeAlert(e){}_linePointsToAlertPlot(e,t,i,s){return null}_getAlertCreationAvailable(){return!1}static _configureProperties(e){if(this._addCollectedProperties(e),e.hasChild("symbolStateVersion")||e.addChild("symbolStateVersion",new v.default(1)),e.hasChild("zOrderVersion")||e.addChild("zOrderVersion",new v.default(1)),e.hasChild("visible")||e.addChild("visible",new v.default(!0)),e.hasChild("frozen")||e.addChild("frozen",new v.default(!1)),e.hasChild("symbol")||e.addChild("symbol",new v.default("")),e.hasChild("currencyId")||e.addChild("currencyId",new v.default(null)),e.hasChild("unitId")||e.addChild("unitId",new v.default(null)),e.addExclusion("symbolStateVersion"),e.addExclusion("zOrderVersion"),e.addExclusion("visible"),e.addExclusion("frozen"),e.addExclusion("symbol"),e.addExclusion("currencyId"),e.addExclusion("unitId"),e.hasChild("intervalsVisibilities")){const t=(0,w.merge)((0,w.clone)(_.intervalsVisibilitiesDefaults),e.childs().intervalsVisibilities.state());e.removeProperty("intervalsVisibilities"),e.addChild("intervalsVisibilities",new b.IntervalsVisibilitiesProperty(t))}else e.addChild("intervalsVisibilities",new b.IntervalsVisibilitiesProperty(_.intervalsVisibilitiesDefaults));e.hasChild("title")||e.addChild("title",new v.default("")),e.addExclusion("symbolInfo"),e.addExclusion("points"),e.addExclusion("interval"),e.addExclusion("title"),e.hasChild("singleChartOnly")&&e.removeProperty("singleChartOnly"),e.hasChild("font")&&e.removeProperty("font")}static _addCollectedProperties(e){e.hasChild("linewidth")&&e.addChild("linesWidths",new A.LineToolWidthsProperty([(0,r.ensureDefined)(e.child("linewidth"))])),e.hasChild("linecolor")&&e.addChild("linesColors",new A.LineToolColorsProperty([(0,r.ensureDefined)(e.child("linecolor"))])),e.hasChild("backgroundColor")&&e.addChild("backgroundsColors",new A.LineToolColorsProperty([(0,r.ensureDefined)(e.child("backgroundColor"))])),e.hasChild("textColor")&&e.addChild("textsColors",new A.LineToolColorsProperty([(0, r.ensureDefined)(e.child("textColor"))])),e.addExclusion("linesWidths"),e.addExclusion("linesColors"),e.addExclusion("backgroundsColors"),e.addExclusion("textsColors")}_removeAlertSubscriptions(){var e;null===(e=this._unsubscribeAlertCallbacks)||void 0===e||e.call(this),this._unsubscribeAlertCallbacks=void 0}_addAlertSubscriptions(e){}_destroyPanePaneViews(e){const t=this._paneViews.get(e);if(void 0!==t)for(const e of t)e.destroy&&e.destroy();void 0!==e&&e.onDestroyed().unsubscribeAll(this),this._paneViews.delete(e)}_copyPricesWithoutNormalization(){const e=Math.min(this._points.length,this._timePoint.length);for(let t=0;t{"use strict";i.r(t),i.d(t,{LineToolCollectedProperty:()=>c,LineToolColorsProperty:()=>d,LineToolMultiplePropertyBaseImpl:()=>l,LineToolWidthsProperty:()=>h,MultipleLineColorsProperty:()=>_,MultipleLineWidthsProperty:()=>p});var s=i(59224),r=i(57898),n=i(19782);const o=(0,s.getLogger)("Chart.LineToolCollectedProperty");class a{applyValue(e,t){e.setValue(t)}}class l{constructor(e,t){this._onChange=new r.Delegate,this._properties=e,e.forEach(((e,t)=>e.subscribe(this,((e,i)=>{this._onChange.fire(this,`${t}.${i}`)})))),this._showIfProperty=t}visible(){var e;return!this._showIfProperty||(null===(e=this._showIfProperty)||void 0===e?void 0:e.value())}value(){if(0===this._properties.length)return o.logError("Incorrect call, should not request value of 0 properties"),"mixed";const e=this._properties[0].value();return 1===this._properties.length||this._properties.every((t=>t.value()===e))?e:"mixed"}state(){}merge(){}destroy(){this._properties.forEach((e=>e.unsubscribeAll(this))),this._onChange.destroy()}subscribe(e,t){this._onChange.subscribe(e,t)}unsubscribe(e,t){this._onChange.unsubscribe(e,t)}unsubscribeAll(e){this._onChange.unsubscribeAll(e)}storeStateIfUndefined(){return!0}weakReference(){return(0,n.weakReference)(this)}ownership(){return(0,n.ownership)(this)}}class c extends l{setValue(e,t,i){if("mixed"===e)return;const s=null!=i?i:new a;this._properties.forEach((t=>s.applyValue(t,e)))}}class h extends c{}class d extends c{firstColor(){return this._properties[0].value()}}class u extends l{setValue(e,t,i){if("mixed"===e)return;const s=null!=i?i:new a;this._properties.forEach((t=>t.setValue(e,void 0,s)))}}class p extends u{}class _ extends u{}},56954:(e,t,i)=>{"use strict";t.LineToolFibRetracement=i(21558).LineToolFibRetracement,t.LineToolFibChannel=i(40634).LineToolFibChannel,t.LineToolFibSpeedResistanceArcs=i(28918).LineToolFibSpeedResistanceArcs,t.LineToolProjection=i(66967).LineToolProjection,t.LineToolTrendBasedFibExtension=i(84123).LineToolTrendBasedFibExtension,t.LineToolElliott=i(99366).LineToolElliott,t.LineToolFibCircles=i(27046).LineToolFibCircles,t.LineToolVertLine=i(54623).LineToolVertLine,t.LineToolCrossLine=i(28861).LineToolCrossLine,t.LineToolBarsPattern=i(2823).LineToolBarsPattern,t.LineToolTrendBasedFibTime=i(35625).LineToolTrendBasedFibTime,t.LineToolFibTimeZone=i(7226).LineToolFibTimeZone, t.LineToolCircleLines=i(38762).LineToolCyclicLines,t.LineToolDateRange=i(43485).LineToolDateRange,t.LineToolPriceRange=i(59776).LineToolPriceRange,t.LineToolDateAndPriceRange=i(53312).LineToolDateAndPriceRange,t.LineToolParallelChannel=i(87440).LineToolParallelChannel,t.LineToolTrendAngle=i(78856).LineToolTrendAngle,t.LineToolTrendLine=i(47246).LineToolTrendLine,t.LineToolInfoLine=i(48272).LineToolInfoLine,t.LineToolArrowMark=i(20521).LineToolArrowMark,t.LineToolExecution=i(29921).LineToolExecution,t.LineToolPitchfan=i(63596).LineToolPitchfan,t.LineToolGannSquare=i(86325).LineToolGannSquare,t.LineToolFibSpeedResistanceFan=i(88815).LineToolFibSpeedResistanceFan,t.LineToolGannComplex=i(49809).LineToolGannComplex,t.LineToolGannFixed=i(76124).LineToolGannFixed,t.LineToolGannFan=i(21608).LineToolGannFan,t.LineToolFibWedge=i(96837).LineToolFibWedge,t.LineToolPitchfork=i(70309).LineToolPitchfork,t.LineToolDisjointAngle=i(58786).LineToolDisjointChannel,t.LineToolFlatBottom=i(35629).LineToolFlatBottom,t.LineToolIcon=i(85452).LineToolIcon,t.LineToolEmoji=i(80058).LineToolEmoji,t.LineToolSticker=i(81217).LineToolSticker,t.LineToolRotatedRectangle=i(32491).LineToolRotatedRectangle,t.LineToolFibSpiral=i(83101).LineToolFibSpiral,t.LineToolHeadAndShoulders=i(83225).LineToolHeadAndShoulders,t.LineToolTriangle=i(38416).LineToolTriangle,t.LineToolTrianglePattern=i(45579).LineToolTrianglePattern,t.LineTool5PointsPattern=i(71902).LineTool5PointsPattern,t.LineToolThreeDrivers=i(89299).LineToolThreeDrivers,t.LineToolABCD=i(19194).LineToolABCD,t.LineToolPolyline=i(67686).LineToolPolyline,t.LineToolPath=i(40418).LineToolPath,t.LineToolPrediction=i(30597).LineToolPrediction,t.LineToolPriceLabel=i(27039).LineToolPriceLabel,t.LineToolPriceNote=i(32831).LineToolPriceNote,t.LineToolArrowMarker=i(91439).LineToolArrowMarker,t.LineToolNote=i(23558).LineToolNote,t.LineToolNoteAbsolute=i(23558).LineToolNoteAbsolute,t.LineToolSignpost=i(98624).LineToolSignpost,t.LineToolBrush=i(16642).LineToolBrush,t.LineToolArc=i(86902).LineToolArc,t.LineToolCallout=i(53086).LineToolCallout,t.LineToolBalloon=i(38440).LineToolBalloon,t.LineToolComment=i(6908).LineToolComment,t.LineToolText=i(79506).LineToolText,t.LineToolHorzLine=i(9801).LineToolHorzLine,t.LineToolHorzRay=i(2135).LineToolHorzRay,t.LineToolRectangle=i(32948).LineToolRectangle,t.LineToolCircle=i(34588).LineToolCircle,t.LineToolEllipse=i(56905).LineToolEllipse,t.LineToolTimeCycles=i(74861).LineToolTimeCycles,t.LineToolSineLine=i(94803).LineToolSineLine,t.LineToolGhostFeed=i(44010).LineToolGhostFeed,t.LineToolBezierQuadro=i(60041).LineToolBezierQuadro,t.LineToolBezierCubic=i(48218).LineToolBezierCubic,t.LineToolArrow=i(36992).LineToolArrow,t.LineToolRay=i(10279).LineToolRay,t.LineToolExtended=i(40934).LineToolExtended,t.LineToolSchiffPitchfork=i(5761).LineToolSchiffPitchfork,t.LineToolSchiffPitchfork2=i(85806).LineToolSchiffPitchfork2,t.LineToolInsidePitchfork=i(98501).LineToolInsidePitchfork,t.LineToolTextAbsolute=i(79506).LineToolTextAbsolute,t.LineToolArrowMarkLeft=i(20521).LineToolArrowMarkLeft, -t.LineToolArrowMarkRight=i(20521).LineToolArrowMarkRight,t.LineToolArrowMarkUp=i(20521).LineToolArrowMarkUp,t.LineToolArrowMarkDown=i(20521).LineToolArrowMarkDown,t.LineToolFlagMark=i(62575).LineToolFlagMark,t.LineToolCypherPattern=i(99636).LineToolCypherPattern,t.LineToolElliottImpulse=i(99366).LineToolElliottImpulse,t.LineToolElliottTriangle=i(99366).LineToolElliottTriangle,t.LineToolElliottTripleCombo=i(99366).LineToolElliottTripleCombo,t.LineToolElliottCorrection=i(99366).LineToolElliottCorrection,t.LineToolElliottDoubleCombo=i(99366).LineToolElliottDoubleCombo,t.LineToolRiskRewardLong=i(29378).LineToolRiskRewardLong,t.LineToolRiskRewardShort=i(29378).LineToolRiskRewardShort,t.LineToolPosition=i(37619).LineToolPosition,t.LineToolOrder=i(16907).LineToolOrder,t.LineToolHighlighter=i(25007).LineToolHighlighter},59656:(e,t,i)=>{"use strict";i.d(t,{lineToolsLocalizedNames:()=>r});var s=i(11542);const r={LineTool5PointsPattern:s.t(null,void 0,i(66527)),LineToolABCD:s.t(null,void 0,i(32852)),LineToolArc:s.t(null,void 0,i(45104)),LineToolArrow:s.t(null,void 0,i(96237)),LineToolArrowMarkDown:s.t(null,void 0,i(8738)),LineToolArrowMarkLeft:s.t(null,void 0,i(35062)),LineToolArrowMarkRight:s.t(null,void 0,i(92163)),LineToolArrowMarkUp:s.t(null,void 0,i(33196)),LineToolBalloon:s.t(null,void 0,i(40664)),LineToolComment:s.t(null,void 0,i(19372)),LineToolBarsPattern:s.t(null,void 0,i(98838)),LineToolBezierCubic:s.t(null,void 0,i(59368)),LineToolBezierQuadro:s.t(null,void 0,i(17206)),LineToolBrush:s.t(null,void 0,i(30251)),LineToolCallout:s.t(null,void 0,i(64149)),LineToolCircleLines:s.t(null,void 0,i(87761)),LineToolCypherPattern:s.t(null,void 0,i(27891)),LineToolDateAndPriceRange:s.t(null,void 0,i(79859)),LineToolDateRange:s.t(null,void 0,i(60222)),LineToolDisjointAngle:s.t(null,void 0,i(3556)),LineToolElliottCorrection:s.t(null,void 0,i(91215)),LineToolElliottDoubleCombo:s.t(null,void 0,i(80983)),LineToolElliottImpulse:s.t(null,void 0,i(74118)),LineToolElliottTriangle:s.t(null,void 0,i(95840)),LineToolElliottTripleCombo:s.t(null,void 0,i(66637)),LineToolEllipse:s.t(null,void 0,i(69418)),LineToolExtended:s.t(null,void 0,i(2578)),LineToolFibChannel:s.t(null,void 0,i(82719)),LineToolFibCircles:s.t(null,void 0,i(64192)),LineToolFibRetracement:s.t(null,void 0,i(63835)),LineToolFibSpeedResistanceArcs:s.t(null,void 0,i(18072)),LineToolFibSpeedResistanceFan:s.t(null,void 0,i(20877)),LineToolFibSpiral:s.t(null,void 0,i(76783)),LineToolFibTimeZone:s.t(null,void 0,i(89037)),LineToolFibWedge:s.t(null,void 0,i(72489)),LineToolFlagMark:s.t(null,void 0,i(55678)),LineToolImage:s.t(null,void 0,i(23450)),LineToolFlatBottom:s.t(null,void 0,i(29230)),LineToolAnchoredVWAP:s.t(null,void 0,i(61704)),LineToolGannComplex:s.t(null,void 0,i(66321)),LineToolGannFixed:s.t(null,void 0,i(87107)),LineToolGannFan:s.t(null,void 0,i(68102)),LineToolGannSquare:s.t(null,void 0,i(81180)),LineToolHeadAndShoulders:s.t(null,void 0,i(42616)),LineToolHorzLine:s.t(null,void 0,i(60049)),LineToolHorzRay:s.t(null,void 0,i(76604)),LineToolIcon:s.t(null,void 0,i(26579)), -LineToolEmoji:s.t(null,void 0,i(85223)),LineToolSticker:s.t(null,void 0,i(84573)),LineToolInsidePitchfork:s.t(null,void 0,i(12354)),LineToolNote:s.t(null,void 0,i(75549)),LineToolNoteAbsolute:s.t(null,void 0,i(66828)),LineToolSignpost:s.t(null,void 0,i(68161)),LineToolParallelChannel:s.t(null,void 0,i(70394)),LineToolPitchfan:s.t(null,void 0,i(22293)),LineToolPitchfork:s.t(null,void 0,i(43852)),LineToolPolyline:s.t(null,void 0,i(53047)),LineToolPath:s.t(null,void 0,i(34402)),LineToolPrediction:s.t(null,void 0,i(36972)),LineToolPriceLabel:s.t(null,void 0,i(95921)),LineToolArrowMarker:s.t(null,void 0,i(82473)),LineToolPriceRange:s.t(null,void 0,i(2032)),LineToolProjection:s.t(null,void 0,i(87086)),LineToolRay:s.t(null,void 0,i(50470)),LineToolRectangle:s.t(null,void 0,i(328)),LineToolCircle:s.t(null,void 0,i(90068)),LineToolRegressionTrend:s.t(null,void 0,i(35001)),LineToolRiskRewardLong:s.t(null,void 0,i(44604)),LineToolRiskRewardShort:s.t(null,void 0,i(37819)),LineToolFixedRangeVolumeProfile:s.t(null,{context:"study"},i(40434)),LineToolAnchoredVolumeProfile:s.t(null,{context:"study"},i(59791)),LineToolRotatedRectangle:s.t(null,void 0,i(9998)),LineToolSchiffPitchfork:s.t(null,void 0,i(18559)),LineToolSchiffPitchfork2:s.t(null,void 0,i(98114)),LineToolSineLine:s.t(null,void 0,i(69502)),LineToolText:s.t(null,{context:"tool"},i(20936)),LineToolTextAbsolute:s.t(null,void 0,i(94782)),LineToolThreeDrivers:s.t(null,void 0,i(98538)),LineToolTimeCycles:s.t(null,void 0,i(95005)),LineToolTrendAngle:s.t(null,void 0,i(94770)),LineToolTrendBasedFibExtension:s.t(null,void 0,i(15501)),LineToolTrendBasedFibTime:s.t(null,void 0,i(31196)),LineToolTrendLine:s.t(null,void 0,i(23104)),LineToolInfoLine:s.t(null,void 0,i(27677)),LineToolTriangle:s.t(null,void 0,i(29245)),LineToolTrianglePattern:s.t(null,void 0,i(12390)),LineToolVertLine:s.t(null,void 0,i(56211)),LineToolCrossLine:s.t(null,void 0,i(60997)),LineToolHighlighter:s.t(null,void 0,i(31895)),LineToolPriceNote:s.t(null,void 0,i(28625)),LineToolVbPFixed:s.t(null,void 0,i(18426)),LineToolGhostFeed:s.t(null,void 0,i(7914))}},92249:(e,t,i)=>{"use strict";i.r(t),i.d(t,{cloneLineTool:()=>ue,createLineTool:()=>se,createLineToolProperties:()=>ne,createStudyLineToolProperties:()=>oe,getNewToolProperties:()=>Q,initAllLineToolsFromContent:()=>ie,initLineTool:()=>te,isLineTool:()=>le,isStudyLineTool:()=>ce,isTrading:()=>he,lineToolByLinkKey:()=>pe,prepareLineToolPropertiesByOwnerSource:()=>re,setNewToolProperties:()=>X,supportsPhantomMode:()=>ae,tryFindStudyLineToolNameByStudyId:()=>de,unsetNewToolProperties:()=>J});var s=i(50151),r=i(86441),n=i(4949),o=i(8652),a=i(13087),l=i(56954),c=i.t(l,2),h=i(61401),d=i(70826),u=i(42856),p=i(56827),_=i(68806),m=i(1722),g=i(46100),f=i(74970);const v=(0,d.studyIdString)("RegressionTrend","tv-basicstudies");function y(e){return void 0!==e.startPrice&&void 0!==e.endPrice}function S(e,t,i,s){return t.styles&&(b(t.styles.baseLine),b(t.styles.downLine),b(t.styles.upLine)),t}function b(e){void 0!==e&&void 0!==e.visible&&(e.display=e.visible?15:0,delete e.visible)} -class w extends o.StudyLineDataSource{constructor(e,t,r,n,o){super(e,r=null!=r?r:(0,s.ensureNotNull)((0,f.studyMetaInfoRepository)().findByIdSync({type:"java",studyId:v})),"linreg_",null!=t?t:w.createProperties(e),n,o),this.version=2,this._trendData=null,i.e(1583).then(i.bind(i,5374)).then((e=>{this._setPaneViews([new e.RegressionTrendPaneView(this,this._model)])}))}formatter(){throw new Error("This method should never be called")}pointsCount(){return 2}clearData(){this._trendData=null,super.clearData()}state(e){var t;const i=super.state(e);return e?{...i,nonseriesdata:null!==(t=this._trendData)&&void 0!==t?t:void 0}:i}restoreData(e){var t;super.restoreData(e),this._trendData=null!==(t=e.nonseriesdata)&&void 0!==t?t:null}startIndex(){if(null===this._trendData||null===this._indexes)return null;const e=this._indexes[this._trendData.startIndex];return e!==h.INVALID_TIME_POINT_INDEX?e:null}endIndex(){if(null===this._trendData||null===this._indexes)return null;const e=this._indexes[this._trendData.endIndex];return e!==h.INVALID_TIME_POINT_INDEX?e:null}baseLine(){return null===this._trendData?null:this._trendData.baseLine}downLine(){return null===this._trendData?null:this._trendData.downLine}upLine(){return null===this._trendData?null:this._trendData.upLine}pearsons(){return null===this._trendData?null:this._trendData.pearsons}recalcStudyIfNeeded(){this._onStudyInputsMayChange()}cloneable(){return!1}static createProperties(e,t){const i=u.StudyMetaInfo.getStudyPropertyRootNameById(v),r=(0,s.ensureNotNull)((0,f.studyMetaInfoRepository)().findByIdSync({type:"java",studyId:v})),n=(0,g.createDefaultsState)(!0,i,[],e.studyVersioning());return this.createRegressionTrendPropertiesFromStudyMetaInfoAndState(r,r,(0,m.merge)((0,m.clone)(n),null!=t?t:{}),e.studyVersioning())}static createRegressionTrendPropertiesFromStudyMetaInfoAndState(e,t,i,s){const r=(0,p.prepareStudyPropertiesForLoadChart)(e,t,i,s,S);return this._configureProperties(r),r}static studyId(){return v}_studyInputs(e){(0,s.assert)(2===e.length,"all the line tool points should be defined");const[t,i]=e;if(t.index===i.index)return null;const r=this._getPointTime(t.index<=i.index?t:i,!0),n=this._getPointTime(i.index>=t.index?i:t,!0);return null===r||null===n?(this._subscribeApplyInputsOnSeriesCompleted(),null):{...this.properties().childs().inputs.state(),"first bar time":1e3*r,"last bar time":1e3*n}}_onDataUpdated(e,t,i){null!==t&&(t.indexes_replace||(this._trendData=t.data),"nochange"!==i&&(this._indexes=i),super._onDataUpdated(e,t,i))}_isReady(){return null!==this._trendData&&void 0!==this._trendData.startIndex&&void 0!==this._trendData.endIndex&&y(this._trendData.upLine)&&y(this._trendData.baseLine)&&y(this._trendData.downLine)}_updateAnchorsPrice(){if(!this._trendData||(0,m.isNaN)(this._trendData.baseLine.startPrice)||(0,m.isNaN)(this._trendData.baseLine.endPrice))return;const{startPrice:e,endPrice:t}=this._trendData.baseLine;2===this._points.length&&(this._points[0].price=(0,s.ensureDefined)(e),this._points[1].price=(0,s.ensureDefined)(t),this._timePoint[0].price=(0, -s.ensureDefined)(e),this._timePoint[1].price=(0,s.ensureDefined)(t))}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(2285),i.e(2578),i.e(8882),i.e(3986),i.e(8167),i.e(607)]).then(i.bind(i,41109))).RegressionTrendDefinitionsViewModel}static _configureProperties(e){super._configureProperties(e);const t=e.childs().styles.childs(),i=[t.upLine.childs().linewidth,t.downLine.childs().linewidth,t.baseLine.childs().linewidth];e.addChild("linesWidths",new _.LineToolWidthsProperty(i))}}var C=i(58229);const P=(0,d.studyIdString)("VbPFixed","tv-basicstudies");class x extends C.LineToolVbPFixed{constructor(e,t,i,s,r){super(e,t,i||(0,f.studyMetaInfoRepository)().findByIdSync({type:"java",studyId:P}),s,r)}calcIsActualSymbol(){o.StudyLineDataSource.prototype.calcIsActualSymbol.apply(this)}boundToSymbol(){return!0}isSynchronizable(){return this.priceScale()===this._model.mainSeries().priceScale()}static studyId(){return P}static createProperties(e,t){const i=u.StudyMetaInfo.getStudyPropertyRootNameById(P),r=(0,s.ensureNotNull)((0,f.studyMetaInfoRepository)().findByIdSync({type:"java",studyId:P})),n=(0,g.createDefaultsState)(!0,i,[],e.studyVersioning());return this.createPropertiesFromStudyMetaInfoAndState(r,r,(0,m.merge)((0,m.clone)(n),null!=t?t:{}),e.studyVersioning())}static createPropertiesFromStudyMetaInfoAndState(e,t,i,s){const r=(0,p.prepareStudyPropertiesForLoadChart)(e,t,i,s);return this._configureProperties(r),r}}var T=i(88640),I=i(34256),M=i(45802);class A extends M.StudyPriceAxisView{_showPaneLabel(){return!1}_showAxisLabel(){const e=this._model.properties().childs().scalesProperties.childs();return this._visible()&&"VWAP"===this._data.plotIndex&&e.showStudyLastValue.value()}_visible(){const e=this._source.properties().childs().styles.childs()[this._data.plotIndex].childs().display.value();return this._source.properties().childs().axisLabelVisible.value()&&Boolean(4&e)}}var L=i(39871);class k extends L.StudyPlotPaneView{constructor(e,t,i,s){super(e,t,i,s),this._line=e}_makeSureRendererIsValid(){(this._dataInvalidated||this._viewportInvalidated)&&this._updateImplFull(this._viewportInvalidated)&&(this._dataInvalidated=null),this._viewportInvalidated=!1}_updateRenderer(e,t){super._updateRenderer(e,t),this._addAlertsRenderer()}_addAlertsRenderer(){return!1}}var D,E=i(59224);!function(e){e.MainSeries="MainSeries",e.Study="Study",e.StudyLineTool="StudyLineTool",e.StudyStrategy="StudyStrategy"}(D||(D={}));var V=i(98098),B=(i(54358),i(28558)),R=i(3308),N=i(86094);class O extends o.StudyLineDataSource{lastValueData(e,t,i){const r={noData:!0},n=this.priceScale();if(this._model.timeScale().isEmpty()||null===this.priceScale()||null===n||n.isEmpty()||this.plots().isEmpty())return r;const o=this._model.timeScale().visibleBarsStrictRange();if(null===o)return r;const a=this._studyProps();if(!a.childs().visible.value())return r;const l=this.plots().search(o.lastBar(),N.PlotRowSearchMode.NearestLeft,1);if(null===l)return r;const c=o.contains(l.index),h=!t&&c?l:(0, -s.ensureNotNull)(this.plots().last()),d=this.metaInfo().plots.findIndex((t=>t.id===e));if(d<0||!h||!(0,R.default)(h.value[d+1]))return r;const u=h.value[d+1];if(null==u)return r;const p=(0,s.ensureDefined)(a.childs().styles.child(e)),_=(0,s.ensureNotNull)(this.firstValue()),m=n.priceToCoordinate(u,_);return{...n.getFormattedValues(u,_),noData:!1,price:u,color:p.childs().color.value(),coordinate:m,floatCoordinate:m,index:h.index}}priceLabelText(e){const t=(0,s.ensureDefined)(this._metaInfo.styles);return(0,s.ensureDefined)(t[e]).title}offset(e){return 0}getMinFirstBarIndexForPlot(){return-1/0}isPlotVisibleAt(e,t){return(this._studyProps().childs().styles.childs()[e].childs().display.value()&t)===t}_studyProps(){return this.properties()}}var F=i(43493);const W=(0,E.getLogger)("Chart.AnchoredVWAP"),H=(0,d.studyIdString)("AnchoredVWAP","tv-basicstudies");function z(e,t,i,r){return"calculate_stDev"in(0,s.ensureDefined)(e.inputs)||void 0===r.inputs.find((e=>"calculate_stDev"===e.id))||((0,s.ensureDefined)(t.inputs).calculate_stDev=!1),t.styles&&(U(t.styles.VWAP),U(t.styles.UpperBand),U(t.styles.LowerBand),U(t.styles.UpperBand_2),U(t.styles.LowerBand_2),U(t.styles.UpperBand_3),U(t.styles.LowerBand_3)),t}function U(e){void 0!==e&&void 0!==e.visible&&(e.display=e.visible?15:0,delete e.visible)}class j extends O{constructor(e,t,i,r,n){i=i||(0,s.ensureNotNull)((0,f.studyMetaInfoRepository)().findByIdSync({type:"java",studyId:H}));const o=null!=t?t:j.createProperties(e);super(e,i,"anchoredvwap",o,r,n);const[a,l,c,h,d,u,p]=this.metaInfo().plots,_=e.mainSeries(),m=[new k(this,_,e,a.id)];l&&c&&(m.push(new L.StudyPlotPaneView(this,_,e,l.id)),m.push(new L.StudyPlotPaneView(this,_,e,c.id))),h&&d&&u&&p&&(m.push(new L.StudyPlotPaneView(this,_,e,h.id)),m.push(new L.StudyPlotPaneView(this,_,e,d.id)),m.push(new L.StudyPlotPaneView(this,_,e,u.id)),m.push(new L.StudyPlotPaneView(this,_,e,p.id))),this._properties.childs().areaBackground&&m.splice(0,0,new V.AreaBackgroundPaneView(this,e)),this._priceAxisViews=this.metaInfo().plots.map((e=>new A(this,{plotIndex:e.id}))),m.push(...this._priceAxisViews.map((e=>new F.PanePriceAxisView(e,this,this._model)))),this._anchorPriceCalculated=!1,this._onInputsReadyCallbacks=[],this._setPaneViews(m),e.properties().childs().scalesProperties.childs().showStudyLastValue.subscribe(this,this._onShowStudyLastValueChanged),o.onRestoreFactoryDefaults().subscribe(this,this._onRestoreFactoryDefaults)}destroy(){this.properties().onRestoreFactoryDefaults().unsubscribeAll(this),this.model().properties().childs().scalesProperties.childs().showStudyLastValue.unsubscribeAll(this),this._onInputsReadyCallbacks=[],super.destroy()}canHasAlert(){return!0}pointsCount(){return 1}updateAllViews(e){super.updateAllViews(e),this._priceAxisViews.forEach((t=>t.update(e)))}firstValue(){return this._model.mainSeries().firstValue()}priceRange(e,t){if(!this._isReady()||this.isSourceHidden())return null;const i=this.plots().minMaxOnRangeCached(e,t,[{name:this.metaInfo().plots[0].id,offset:0}]);if(null===i)return null;const r=(0, -s.ensureNotNull)(this.priceScale());return r.isLog()?new I.PriceRange(r.priceToLogical(i.min),r.priceToLogical(i.max)):new I.PriceRange(i.min,i.max)}isIncludedInAutoScale(){return!0}restoreData(e){super.restoreData(e),void 0!==e.data&&(this._anchorPriceCalculated=!0)}properties(){return super.properties()}sourceId(){return this._studyId()}hasStateForAlert(){return!1}stateForAlert(){throw new Error("Not implemented")}inputsForAlertState(){null===this._inputs&&W.logError("Could not get inputsForAlertState if VWAP has no inputs");const{start_time:e,source:t}=this.inputs();return{start_time:e,source:t}}inputs(){return(0,s.ensureNotNull)(this._inputs)}idForAlert(){return super.idForAlert()}defaultPlotIdForAlert(){return this.metaInfo().plots[0].id}static createProperties(e,t){const i=u.StudyMetaInfo.getStudyPropertyRootNameById(H),r=(0,s.ensureNotNull)((0,f.studyMetaInfoRepository)().findByIdSync({type:"java",studyId:H})),n=(0,g.createDefaultsState)(!0,i,[],e.studyVersioning());return this.createPropertiesFromStudyMetaInfoAndState(r,r,(0,m.merge)((0,m.clone)(n),null!=t?t:{}),e.studyVersioning())}static studyId(){return H}static createPropertiesFromStudyMetaInfoAndState(e,t,i,s){const r=(0,p.prepareStudyPropertiesForLoadChart)(e,t,i,s,z);return this._configureProperties(r),r}_onPointsetUpdated(e){super._onPointsetUpdated(e),this._onStudyInputsMayChange()}_studyInputs(e){(0,s.assert)(1===e.length,"all the line tool points should be defined");const t=e[0],i=this._getPointTime(t,!1);return null===i?(this._subscribeApplyInputsOnSeriesCompleted(),null):{...this.properties().childs().inputs.state(["start_time"]),start_time:1e3*i}}_isReady(){return super._isReady()&&(null!==this._inputs||this._anchorPriceCalculated)&&this.model().lineBeingEdited()!==this}_onDataCleared(){super._onDataCleared(),this._anchorPriceCalculated=!1}_onInputsChanged(){if(super._onInputsChanged(),this._updateAlertCreationAvailable(),null!==this._inputs){for(const e of this._onInputsReadyCallbacks)try{e(this._inputs)}catch(e){W.logError(e.stack||e.message)}this._onInputsReadyCallbacks=[]}}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(2285),i.e(344),i.e(8882),i.e(8167),i.e(8537)]).then(i.bind(i,59973))).AnchoredVWAPDefinitionsViewModel}_updateAnchorsPrice(e){if(!e&&(this._anchorPriceCalculated||!this.isActualSymbol()))return;const t=this.firstValue(),i=this.points();if(null===t||0===i.length)return;const s=i[0].index,r=this.plots().valueAt(s);if(null===r)return;const n=r[1];null!=n&&(this._points[0].price=n,this._timePoint[0].price=n,this._anchorPriceCalculated=!0)}_synchronizeAlert(e){this._onInputsReady((()=>super._synchronizeAlert(e)))}static _configureProperties(e){super._configureProperties(e),e.hasChild("axisLabelVisible")||e.addChild("axisLabelVisible",new T.default(true));const t=e.childs().styles.childs().VWAP.childs().linewidth,i=e.childs().styles.childs().VWAP.childs().color;e.addChild("linesWidths",new _.LineToolWidthsProperty([t])),e.addChild("linesColors",new _.LineToolColorsProperty([i]))}_onInputsReady(e){ -null!==this._inputs?e(this._inputs):this._onInputsReadyCallbacks.push(e)}_onShowStudyLastValueChanged(){this._priceAxisViews.forEach((e=>e.update((0,B.sourceChangeEvent)(this.id())))),this.model().updateSource(this)}_onRestoreFactoryDefaults(){this.properties().childs().axisLabelVisible.setValue(true)}}var G=i(87564),q=i(42960),$=i(15367);function Y(e){for(const t of Object.keys(e))TradingView[t]=e[t]}Y(c),Y({LineToolRegressionTrend:w,LineToolVbPFixed:C.LineToolVbPFixed,LineToolFixedRangeVolumeProfile:x,LineToolAnchoredVWAP:j});const K={};Object.assign(K,c);let Z=null;function X(e,t,i){return null!==Z&&Z.tool===e&&Z.toolData===t||(Z={properties:ne(e,void 0,i),tool:e,toolData:t}),Z.properties}function J(){Z=null}function Q(e){return null!==Z&&Z.tool===e?Z.properties:null}const ee=new Map([["LineToolPriceNote",async()=>(await Promise.resolve().then(i.bind(i,32831))).LineToolPriceNote],["LineToolFibSpiral",async()=>(await Promise.resolve().then(i.bind(i,83101))).LineToolFibSpiral],["LineToolCircleLines",async()=>(await Promise.resolve().then(i.bind(i,38762))).LineToolCyclicLines]]);async function te(e){if(ce(e)&&await(0,f.studyMetaInfoRepository)().findAllJavaStudies(),K[e])return;if(!K.hasOwnProperty(e))return;const t=(0,s.ensureDefined)(ee.get(e));K[e]=await t()}async function ie(e){if(!e)return;const t=new Set;("charts"in e?e.charts:[e]).forEach((e=>{e.panes.forEach((e=>{e.sources.forEach((e=>{(0,$.isLineToolName)(e.type)&&t.add(e.type)}))}))})),await Promise.all(Array.from(t).map((e=>te(e))))}function se(e,t,i,r,n,o){let a;if((0,s.assert)((0,$.isLineToolName)(e),"Unknown line tool: "+e),n||i||(i=Q(e)||void 0),"LineToolVbPFixed"===e)a=new C.LineToolVbPFixed(t,i,(0,s.ensureDefined)(r),n,o);else if("LineToolAnchoredVolumeProfile"===e)a=new LineToolAnchoredVolumeProfile(t,i,(0,s.ensureDefined)(r),n,o);else if("LineToolFixedRangeVolumeProfile"===e)a=new x(t,i,(0,s.ensureDefined)(r),n,o);else if("LineToolRegressionTrend"===e)a=new w(t,i,(0,s.ensureDefined)(r),n,o);else if("LineToolAnchoredVWAP"===e)a=new j(t,i,(0,s.ensureDefined)(r),n,o);else{a=new((0,s.ensureDefined)(K[e]))(t,i,n,o)}return a.toolname=e,J(),a}function re(e,t){const i=(0,s.ensureNotNull)(t.symbolSource()),r=i.symbolInfo(),n=r?(0,q.extractLineToolSymbolFromSymbolInfo)(r,i.symbol()):i.symbol();e.childs().symbol.setValue(n),i.model().currencyConversionEnabled()&&e.childs().currencyId.setValue(i.currency()),i.model().unitConversionEnabled()&&e.childs().unitId.setValue(i.unit()),e.childs().symbolStateVersion.setValue(2),e.childs().zOrderVersion.setValue(2)}function ne(e,t,i,r){if((0,s.assert)((0,$.isLineToolName)(e),`${e} should be name of the line tool`),"LineToolVbPFixed"===e)return C.LineToolVbPFixed.createProperties(i,t);if("LineToolAnchoredVolumeProfile"===e)return LineToolAnchoredVolumeProfile.createProperties(i,t);if("LineToolFixedRangeVolumeProfile"===e)return x.createProperties(i,t);if("LineToolRegressionTrend"===e)return w.createProperties(i,t);if("LineToolAnchoredVWAP"===e)return j.createProperties(i,t);return(0, -s.ensureDefined)(K[e]).createProperties(t,r)}function oe(e,t,i,r,n){if((0,s.assert)((0,$.isStudyLineToolName)(e),`${e} should be name of the study line tool`),"LineToolVbPFixed"===e)return C.LineToolVbPFixed.createPropertiesFromStudyMetaInfoAndState(t,i,r,n);if("LineToolAnchoredVolumeProfile"===e)return LineToolAnchoredVolumeProfile.createPropertiesFromStudyMetaInfoAndState(t,i,r,n);if("LineToolFixedRangeVolumeProfile"===e)return x.createPropertiesFromStudyMetaInfoAndState(t,i,r,n);if("LineToolRegressionTrend"===e)return w.createRegressionTrendPropertiesFromStudyMetaInfoAndState(t,i,r,n);if("LineToolAnchoredVWAP"===e)return j.createPropertiesFromStudyMetaInfoAndState(t,i,r,n);throw new Error(`Property creation is not implemented for study line tool ${e}`)}function ae(e){(0,s.assert)((0,$.isLineToolName)(e),`${e} should be name of the line tool`);const t=c[e];return void 0!==t&&Boolean(t.supportPhantomMode)}function le(e){return e instanceof a.LineDataSource}function ce(e){return e instanceof o.StudyLineDataSource}function he(e){return e instanceof G.LineToolTrading}function de(e){let t=null;return e===w.studyId()?t="LineToolRegressionTrend":e===C.LineToolVbPFixed.studyId()?t="LineToolVbPFixed":e===x.studyId()&&(t="LineToolFixedRangeVolumeProfile"),t}function ue(e,t,i,o){const a=t.toolname,l=t.properties().state();l.intervalsVisibilities=(0,n.mergeIntervalVisibilitiesDefaults)(null==l?void 0:l.intervalsVisibilities);const c=ne(t.toolname,l,e);c.childs().visible.setValue(!0);const h=(0,s.ensureNotNull)(t.ownerSource()),d=se(a,e,c);void 0!==o&&d.setId(o),d.setOwnerSource(h),d.toolname=a;const u=d.clonePositionOffset();if(t.isFixed()){const e=(0,s.ensureDefined)(t.fixedPoint()),n=i?e.add(new r.Point(u.xCoordOffset,u.yCoordOffset)):e;d.addFixedPoint(n)}const p=t.normalizedPoints(),_=i?function(e,t,i){const r=(0,s.ensureNotNull)(t.priceScale()),n=(0,s.ensureNotNull)(t.firstValue());return e.map((e=>{const t=e.price,s=r.priceToCoordinate(t,n)+i.yCoordOffset,o=r.coordinateToPrice(s,n);return{time_t:e.time_t,price:o,offset:e.offset+i.barOffset}}))}(p,h,u):p,m=t.points();return d.restorePoints(_,m),d.cloneData&&d.cloneData(t),d.recalculateStateByData&&d.recalculateStateByData(),d}function pe(e,t){var i;return null!==(i=e.dataSources().find((e=>le(e)&&e.linkKey().value()===t)))&&void 0!==i?i:null}},23558:(e,t,i)=>{"use strict";var s=i(13087).LineDataSource,r=i(88640).default,n=i(46100).DefaultProperty;class o extends s{constructor(e,t,s,r){super(e,t||o.createProperties(),s,r),this.version=o.version,i.e(1583).then(i.bind(i,34658)).then((({NotePaneView:e})=>{this._setPaneViews([new e(this,this._model)])}))}pointsCount(){return 1}name(){return"Note"}getTooltipWidth(){return o.TOOLTIP_WIDTH}getTooltipPadding(){return o.TOOLTIP_PADDING}getTooltipLineSpacing(){return o.TOOLTIP_LINESPACING}template(){var e=super.template();return e.text=this.properties().childs().text.value(),e}_applyTemplateImpl(e){super._applyTemplateImpl(e),this.properties().childs().text.setValue(e.text)}static createProperties(e){ -void 0!==e&&void 0!==e.markerColor&&void 0===e.borderColor&&(e.borderColor=e.markerColor);var t=new n("linetoolnote",e);return this._configureProperties(t),t}state(e){var t=super.state(e);return e&&(t.state.fixedSize=!1),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(2285),i.e(344),i.e(8882),i.e(8167),i.e(8537)]).then(i.bind(i,77420))).NoteDefinitionsViewModel}static _configureProperties(e){super._configureProperties(e),e.hasChild("text")||e.addChild("text",new r(i.tf(null,void 0,i(37229)))),e.addExclusion("text")}}o.TOOLTIP_WIDTH=300,o.TOOLTIP_PADDING=10,o.TOOLTIP_LINESPACING=5,o.version=1;class a extends o{constructor(e,t){super(e,t||a.createProperties())}title(){return i.tf(null,void 0,i(66828))}name(){return"Anchored Note"}isFixed(){return!0}hasEditableCoordinates(){return!1}static createProperties(e){var t=new n("linetoolnoteabsolute",e);return this._configureProperties(t),t}}t.LineToolNote=o,t.LineToolNoteAbsolute=a},16907:(e,t,i)=>{"use strict";var s=i(87564).LineToolTrading,r=i(71243).LineToolPriceAxisView,n=i(47043),o=i(13087).LineDataSource,a=i(46100).DefaultProperty;const l=i(14483);var c=i(98517).sortSourcesPreOrdered.LineToolOrder;function h(e){return null==e?e="":e+="",e}class d{constructor(e){this._line=e,this._data={bodyText:"order",quantityText:"0"},this._editable=!0,this._cancellable=!0,this._mode="",this._direction="buy",this._active=!0}setMode(e){return this._mode=e,this._line.updateAllViewsAndRedraw(),this}setDirection(e){return this._direction=e,this._line.updateAllViewsAndRedraw(),this}setActive(e){return this._active=e,this._line.updateAllViewsAndRedraw(),this}setEditable(e){return this._editable=e,this._line.updateAllViewsAndRedraw(),this}getEditable(){return this._editable}setCancellable(e){return this._cancellable=e,this._line.updateAllViewsAndRedraw(),this}getCancellable(){return this._cancellable}hasMoveCallback(){return this.isFunction(this._onMoveCallback)}hasModifyCallback(){return this.isFunction(this._onModifyCallback)}getPrice(){return this._line.points().length>0?this._line.points()[0].price:this._line._timePoint.length>0?this._line._timePoint[0].price:void 0}setPrice(e){if(this._line.points().length>0){var t=this._line.points()[0];t.price=e,this._line._points[0]=t,this._line.normalizePoints(),this._line.updateAllViewsAndRedraw()}return this._line._timePoint.length>0&&(this._line._timePoint[0].price=e),this}getText(){return this._data.bodyText}setText(e){return this._data.bodyText=e||"",this._line.updateAllViewsAndRedraw(),this}setTooltip(e){return this._line.properties().tooltip.setValue(h(e)),this}getTooltip(){return this._line.properties().tooltip.value()}setModifyTooltip(e){return this._line.properties().modifyTooltip.setValue(h(e)),this}getModifyTooltip(){return this._line.properties().modifyTooltip.value()}setCancelTooltip(e){return this._line.properties().cancelTooltip.setValue(h(e)),this}getCancelTooltip(){return this._line.properties().cancelTooltip.value()}getQuantity(){return this._data.quantityText}setQuantity(e){ -return this._data.quantityText=e||"",this._line.updateAllViewsAndRedraw(),this}getExtendLeft(){var e=this._line.properties().extendLeft.value();return"inherit"===e?this._line._model.properties().tradingProperties.extendLeft.value():e}setExtendLeft(e){return this._line.properties().extendLeft.setValue(e),this}getLineLength(){var e=this._line.properties().lineLength.value();return"inherit"===e?this._line._model.properties().tradingProperties.lineLength.value():e}setLineLength(e,t="percentage"){const i=t&&"pixel"===t?e:Math.max(0,Math.min(e,100));return this._line.properties().lineLength.setValue(i),this._line.properties().lineLengthUnit.setValue(t),this}getLineLengthUnit(){return this._line.properties().lineLengthUnit.value()}getLineColor(){var e=this._line.properties();return"buy"===this._direction?this._active?e.lineActiveBuyColor.value():e.lineInactiveBuyColor.value():this._active?e.lineActiveSellColor.value():e.lineInactiveSellColor.value()}setLineColor(e){return"buy"===this._direction?this._active?this.setLineActiveBuyColor(e):this.setLineInactiveBuyColor(e):this._active?this.setLineActiveSellColor(e):this.setLineInactiveSellColor(e),this}setLineActiveBuyColor(e){return this._line.properties().lineActiveBuyColor.setValue(e),this}setLineInactiveBuyColor(e){return this._line.properties().lineInactiveBuyColor.setValue(e),this}setLineActiveSellColor(e){return this._line.properties().lineActiveSellColor.setValue(e),this}setLineInactiveSellColor(e){return this._line.properties().lineInactiveSellColor.setValue(e),this}getLineStyle(){var e=this._line.properties().lineStyle.value();return"inherit"===e?this._line._model.properties().tradingProperties.lineStyle.value():e}setLineStyle(e){return this._line.properties().lineStyle.setValue(e),this}getLineWidth(){var e=this._line.properties().lineWidth.value();return"inherit"===e?this._line._model.properties().tradingProperties.lineWidth.value():e}setLineWidth(e){return this._line.properties().lineWidth.setValue(e),this}getBodyBorderColor(){var e=this._line.properties();return"buy"===this._direction?this._active?e.bodyBorderActiveBuyColor.value():e.bodyBorderInactiveBuyColor.value():this._active?e.bodyBorderActiveSellColor.value():e.bodyBorderInactiveSellColor.value()}setBodyBorderColor(e){return"buy"===this._direction?this._active?this.setBodyBorderActiveBuyColor(e):this.setBodyBorderInactiveBuyColor(e):this._active?this.setBodyBorderActiveSellColor(e):this.setBodyBorderInactiveSellColor(e),this}setBodyBorderActiveBuyColor(e){return this._line.properties().bodyBorderActiveBuyColor.setValue(e),this}setBodyBorderInactiveBuyColor(e){return this._line.properties().bodyBorderInactiveBuyColor.setValue(e),this}setBodyBorderActiveSellColor(e){return this._line.properties().bodyBorderActiveSellColor.setValue(e),this}setBodyBorderInactiveSellColor(e){return this._line.properties().bodyBorderInactiveSellColor.setValue(e),this}getBodyBackgroundColor(){return n.getColorFromProperties(this._line.properties().bodyBackgroundColor,this._line.properties().bodyBackgroundTransparency)} -setBodyBackgroundColor(e){return n.setColorToProperties(e,this._line.properties().bodyBackgroundColor,this._line.properties().bodyBackgroundTransparency),this}getBodyTextColor(){var e=this._line.properties();return"limit"===this._mode?this._active?e.bodyTextActiveLimitColor.value():e.bodyTextInactiveLimitColor.value():"stop"===this._mode?this._active?e.bodyTextActiveStopColor.value():e.bodyTextInactiveStopColor.value():"buy"===this._direction?this._active?e.bodyTextActiveBuyColor.value():e.bodyTextInactiveBuyColor.value():this._active?e.bodyTextActiveSellColor.value():e.bodyTextInactiveSellColor.value()}setBodyTextColor(e){return"limit"===this._mode?this._active?this.setBodyTextActiveLimitColor(e):this.setBodyTextInactiveLimitColor(e):"stop"===this._mode?this._active?this.setBodyTextActiveStopColor(e):this.setBodyTextInactiveStopColor(e):"buy"===this._direction?this._active?this.setBodyTextActiveBuyColor(e):this.setBodyTextInactiveBuyColor(e):this._active?this.setBodyTextActiveSellColor(e):this.setBodyTextInactiveSellColor(e),this}setBodyTextInactiveLimitColor(e){return this._line.properties().bodyTextInactiveLimitColor.setValue(e),this}setBodyTextActiveLimitColor(e){return this._line.properties().bodyTextActiveLimitColor.setValue(e),this}setBodyTextInactiveStopColor(e){return this._line.properties().bodyTextInactiveStopColor.setValue(e),this}setBodyTextActiveStopColor(e){return this._line.properties().bodyTextActiveStopColor.setValue(e),this}setBodyTextInactiveBuyColor(e){return this._line.properties().bodyTextInactiveBuyColor.setValue(e),this}setBodyTextActiveBuyColor(e){return this._line.properties().bodyTextActiveBuyColor.setValue(e),this}setBodyTextInactiveSellColor(e){return this._line.properties().bodyTextInactiveSellColor.setValue(e),this}setBodyTextActiveSellColor(e){return this._line.properties().bodyTextActiveSellColor.setValue(e),this}getBodyFont(){return n.getFontFromProperties(this._line.properties().bodyFontFamily,this._line.properties().bodyFontSize,this._line.properties().bodyFontBold,this._line.properties().bodyFontItalic)}setBodyFont(e){return n.setFontToProperties(e,this._line.properties().bodyFontFamily,this._line.properties().bodyFontSize,this._line.properties().bodyFontBold,this._line.properties().bodyFontItalic),this}getQuantityBorderColor(){var e=this._line.properties();return"buy"===this._direction?this._active?e.quantityBorderActiveBuyColor.value():e.quantityBorderInactiveBuyColor.value():this._active?e.quantityBorderActiveSellColor.value():e.quantityBorderInactiveSellColor.value()}setQuantityBorderColor(e){return"buy"===this._direction?this._active?this.setQuantityBorderActiveBuyColor(e):this.setQuantityBorderInactiveBuyColor(e):this._active?this.setQuantityBorderActiveSellColor(e):this.setQuantityBorderInactiveSellColor(e),this}setQuantityBorderActiveBuyColor(e){return this._line.properties().quantityBorderActiveBuyColor.setValue(e),this}setQuantityBorderInactiveBuyColor(e){return this._line.properties().quantityBorderInactiveBuyColor.setValue(e),this}setQuantityBorderActiveSellColor(e){ -return this._line.properties().quantityBorderActiveSellColor.setValue(e),this}setQuantityBorderInactiveSellColor(e){return this._line.properties().quantityBorderInactiveSellColor.setValue(e),this}getQuantityBackgroundColor(){var e=this._line.properties();return"buy"===this._direction?this._active?e.quantityBackgroundActiveBuyColor.value():e.quantityBackgroundInactiveBuyColor.value():this._active?e.quantityBackgroundActiveSellColor.value():e.quantityBackgroundInactiveSellColor.value()}setQuantityBackgroundColor(e){return"buy"===this._direction?this._active?this.setQuantityBackgroundActiveBuyColor(e):this.setQuantityBackgroundInactiveBuyColor(e):this._active?this.setQuantityBackgroundActiveSellColor(e):this.setQuantityBackgroundInactiveSellColor(e),this}setQuantityBackgroundActiveBuyColor(e){return this._line.properties().quantityBackgroundActiveBuyColor.setValue(e),this}setQuantityBackgroundInactiveBuyColor(e){return this._line.properties().quantityBackgroundInactiveBuyColor.setValue(e),this}setQuantityBackgroundActiveSellColor(e){return this._line.properties().quantityBackgroundActiveSellColor.setValue(e),this}setQuantityBackgroundInactiveSellColor(e){return this._line.properties().quantityBackgroundInactiveSellColor.setValue(e),this}getQuantityTextColor(){return n.getColorFromProperties(this._line.properties().quantityTextColor,this._line.properties().quantityTextTransparency)}setQuantityTextColor(e){return n.setColorToProperties(e,this._line.properties().quantityTextColor,this._line.properties().quantityTextTransparency),this}getQuantityFont(){return n.getFontFromProperties(this._line.properties().quantityFontFamily,this._line.properties().quantityFontSize,this._line.properties().quantityFontBold,this._line.properties().quantityFontItalic)}setQuantityFont(e){return n.setFontToProperties(e,this._line.properties().quantityFontFamily,this._line.properties().quantityFontSize,this._line.properties().quantityFontBold,this._line.properties().quantityFontItalic),this}getCancelButtonBorderColor(){var e=this._line.properties();return"buy"===this._direction?this._active?e.cancelButtonBorderActiveBuyColor.value():e.cancelButtonBorderInactiveBuyColor.value():this._active?e.cancelButtonBorderActiveSellColor.value():e.cancelButtonBorderInactiveSellColor.value()}setCancelButtonBorderColor(e){return"buy"===this._direction?this._active?this.setCancelButtonBorderActiveBuyColor(e):this.setCancelButtonBorderInactiveBuyColor(e):this._active?this.setCancelButtonBorderActiveSellColor(e):this.setCancelButtonBorderInactiveSellColor(e),this}setCancelButtonBorderActiveBuyColor(e){return this._line.properties().cancelButtonBorderActiveBuyColor.setValue(e),this}setCancelButtonBorderInactiveBuyColor(e){return this._line.properties().cancelButtonBorderInactiveBuyColor.setValue(e),this}setCancelButtonBorderActiveSellColor(e){return this._line.properties().cancelButtonBorderActiveSellColor.setValue(e),this}setCancelButtonBorderInactiveSellColor(e){return this._line.properties().cancelButtonBorderInactiveSellColor.setValue(e),this} -getCancelButtonBackgroundColor(){return n.getColorFromProperties(this._line.properties().cancelButtonBackgroundColor,this._line.properties().cancelButtonBackgroundTransparency)}setCancelButtonBackgroundColor(e){return n.setColorToProperties(e,this._line.properties().cancelButtonBackgroundColor,this._line.properties().cancelButtonBackgroundTransparency),this}getCancelButtonIconColor(){var e=this._line.properties();return"buy"===this._direction?this._active?e.cancelButtonIconActiveBuyColor.value():e.cancelButtonIconInactiveBuyColor.value():this._active?e.cancelButtonIconActiveSellColor.value():e.cancelButtonIconInactiveSellColor.value()}setCancelButtonIconColor(e){return"buy"===this._direction?this._active?this.setCancelButtonIconActiveBuyColor(e):this.setCancelButtonIconInactiveBuyColor(e):this._active?this.setCancelButtonIconActiveSellColor(e):this.setCancelButtonIconInactiveSellColor(e),this}setCancelButtonIconActiveBuyColor(e){return this._line.properties().cancelButtonIconActiveBuyColor.setValue(e),this}setCancelButtonIconInactiveBuyColor(e){return this._line.properties().cancelButtonIconInactiveBuyColor.setValue(e),this}setCancelButtonIconActiveSellColor(e){return this._line.properties().cancelButtonIconActiveSellColor.setValue(e),this}setCancelButtonIconInactiveSellColor(e){return this._line.properties().cancelButtonIconInactiveSellColor.setValue(e),this}block(){this._blocked=!0,this._line.updateAllViewsAndRedraw()}unblock(){this._blocked=!1,this._line.updateAllViewsAndRedraw()}getBlocked(){return this._blocked}isFunction(e){return"function"==typeof e}onCancel(e,t){return t?this.isFunction(t)&&(this._onCancelData=e,this._onCancelCallback=t):this.isFunction(e)&&(this._onCancelCallback=e),this}callOnCancel(){this.isFunction(this._onCancelCallback)&&this._onCancelCallback.call(this,this._onCancelData)}isOnCancelCallbackPresent(){return this.isFunction(this._onCancelCallback)}onModify(e,t){return t?this.isFunction(t)&&(this._onModifyData=e,this._onModifyCallback=t):this.isFunction(e)&&(this._onModifyCallback=e),this}callOnModify(){this.isFunction(this._onModifyCallback)&&this._onModifyCallback.call(this,this._onModifyData)}onMove(e,t){return t?this.isFunction(t)&&(this._onMoveData=e,this._onMoveCallback=t):this.isFunction(e)&&(this._onMoveCallback=e),this}callOnMove(){this.isFunction(this._onMoveCallback)&&this._onMoveCallback.call(this,this._onMoveData)}onMoving(e,t){return t?this.isFunction(t)&&(this._onMovingData=e,this._onMovingCallback=t):this.isFunction(e)&&(this._onMovingCallback=e),this}callOnMoving(){this.isFunction(this._onMovingCallback)&&this._onMovingCallback.call(this,this._onMovingData)}onContextMenu(e,t){return t?this.isFunction(t)&&(this._onContextMenuData=e,this._onContextMenuCallback=t):this.isFunction(e)&&(this._onContextMenuCallback=e),this}shouldShowContextMenu(){return this.isFunction(this._onContextMenuCallback)}callOnContextMenu(){if(this.isFunction(this._onContextMenuCallback))return this._onContextMenuCallback.call(this,this._onContextMenuData)}remove(){ -this._line._model.removeSource(this._line),delete this._line}}class u extends s{constructor(e,t){super(e,t||u.createProperties()),this._adapter=new d(this),this.setSelectionEnabled(!0),i.e(1583).then(i.bind(i,61144)).then((({OrderPaneView:e})=>{this._setPaneViews([new e(this,this._model)])}))}zorder(){return c}isSpeciallyZOrderedSource(){return!0}setPoint(e,t,i){this._points[e]=t,this.normalizePoints()}addPoint(e,t){return this._points.push(e),this._lastPoint=null,this.normalizePoints(),this.createServerPoints(),!0}name(){return"Order"}move(e,t,i,s){var r=this._startMovingPoint&&this._currentMovingPoint&&this._startMovingPoint.logical.price!==this._currentMovingPoint.logical.price;super.move(e,t,i,s),r&&this._adapter.callOnMoving()}endMoving(e){var t=this._startMovingPoint&&this._currentMovingPoint&&this._startMovingPoint.logical.price!==this._currentMovingPoint.logical.price;super.endMoving(),!e&&t&&this._adapter.callOnMove()}createPriceAxisView(e){var t={pointIndex:e,backgroundPropertyGetter:()=>this._adapter.getLineColor()};return this._priceAxisView=new r(this,t),this._priceAxisView}paneViews(){return TradingView.printing&&!l.enabled("snapshot_trading_drawings")?null:this._model.properties().tradingProperties.showOrders.value()?o.prototype.paneViews.call(this):null}priceAxisViews(e,t){return TradingView.printing&&!l.enabled("snapshot_trading_drawings")?null:this._model.properties().tradingProperties.showOrders.value()?o.prototype.priceAxisViews.call(this,e,t):null}adapter(){return this._adapter}hasContextMenu(){return this._adapter.shouldShowContextMenu()}contextMenuItems(){return this._adapter.callOnContextMenu()}movable(){return Boolean(this._adapter._onMoveCallback)}static createProperties(e){var t=new a("linetoolorder",e,!1,!1);return this._configureProperties(t),t}}t.LineToolOrder=u},87440:(e,t,i)=>{"use strict";i.d(t,{LineToolParallelChannel:()=>h});var s=i(50151),r=i(86441),n=i(46100),o=i(88348),a=i(13087),l=i(1722),c=i(88640);class h extends a.LineDataSource{constructor(e,t,s,r){super(e,t||h.createProperties(),s,r),this._priceAxisViews.push(this.createPriceAxisView(3)),this._coordOffsetWhileMovingOrChanging=null,this._pendingPriceOffset=null,i.e(1583).then(i.bind(i,26013)).then((({ParallelChannelPaneView:e})=>{this._setPaneViews([new e(this,this._model)])}))}paneViews(e){return null!==this._pendingPriceOffset&&this._applyPendingPriceOffset(),super.paneViews(e)}setLastPoint(e,t){t&&t.shift()&&2===this.points().length&&this._snapPoint45Degree(e,this.points()[0]);const i=(0,l.clone)(e);return super.setLastPoint(e),i}startMoving(e,t,i,s){super.startMoving(e,t,i,s),this._coordOffsetWhileMovingOrChanging=this._findPixelsHeight()}endMoving(e,t,i){return this._coordOffsetWhileMovingOrChanging=null,super.endMoving(e,t,i)}startChanging(e,t){super.startChanging(e,t),this._coordOffsetWhileMovingOrChanging=this._findPixelsHeight()}endChanging(e,t,i){return this._coordOffsetWhileMovingOrChanging=null,super.endChanging(e,t,i)}restoreExternalPoints(e,t,i){const s=i?e.points:this._timePoint.map(((t,i)=>({price:t.price, -offset:e.points[i].offset,time_t:e.points[i].time_t})));if(super.restoreExternalPoints({...e,points:s},t),t.pricesChanged&&this._points.length===s.length)for(let e=0;e=4)return;this._snapPointBeforeChange(e,t,i);const a=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[0])),l=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[1])),c=(0,s.ensureNotNull)(this.pointToScreenPoint(t)),h=(0,s.ensureNotNull)(this._coordOffsetWhileMovingOrChanging),d=(0,s.ensureNotNull)(this.priceScale()),u=(0,s.ensure)(null===(n=this.ownerSource())||void 0===n?void 0:n.firstValue());switch(e){case 0:super.setPoint(e,t,i),this._points[2].price=d.coordinateToPrice(c.y+h,u);break;case 1:super.setPoint(e,t,i);break;case 2:super.setPoint(e,t,i),this._points[0].price=d.coordinateToPrice(c.y-h,u),this._points[0].index=t.index;break;case 3:this._points[1].price=d.coordinateToPrice(c.y-h,u),this._points[1].index=t.index;break;case 4:{const e=l.subtract(a),t=(c.x-a.x)/e.x,i=a.addScaled(e,t),s=c.y-i.y;this._points[2].price=d.coordinateToPrice(a.y+s,u);break}case 5:{const e=l.subtract(a),t=(c.x-a.x)/e.x,i=a.addScaled(e,t),s=c.y-i.y;this._points[0].price=d.coordinateToPrice(a.y+s,u),this._points[1].price=d.coordinateToPrice(l.y+s,u);break}}const p=this.linkKey().value();if(p&&!r&&e<4){const e=this._points.map((e=>e.price));(0,o.changeLineStyle)({model:this._model,linkKey:p,state:{prices:e}})}}state(e){const t=super.state(e);return this._pendingPriceOffset&&(t.priceOffset=this._pendingPriceOffset),t}restoreExternalState(e){const{prices:t,...i}=e;if(t&&this.isActualSymbol())for(let e=0;ee.index<=t.index?[e,t]:[t,e],s=i(t[0],t[1]),r=i(t[2],t[3]);let n,o,a,l;t[2].pricenull!==e))}_correctLastPoint(e){if(this._points.length<2||this._points[1].index===this._points[0].index)return e;const t=(0,s.ensureNotNull)(this.pointToScreenPoint(e)),i=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[1])),n=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[0])),o=i.subtract(n),a=(t.x-n.x)/o.x,l=n.addScaled(o,a),c=t.y-l.y,h=n.add(new r.Point(0,c));return(0,s.ensureNotNull)(this.screenPointToPoint(h))}static _configureProperties(e){super._configureProperties(e),e.hasChild("labelText")||e.addChild("labelText",new c.default("")),e.addExclusion("labelText")}_isTimePointsValid(){return this._timePoint.every((e=>Number.isFinite(e.price)))}_axisPoints(){const e=this.points(),t=this._points[0]?this.pointToScreenPoint(this._points[0]):null,i=this._points[1]?this.pointToScreenPoint(this._points[1]):null,n=this._points[2]?this.pointToScreenPoint(this._points[2]):null;if(t&&i&&n){const o=i.y-t.y,a=n.add(new r.Point(0,o));e.push((0,s.ensureNotNull)(this.screenPointToPoint(a)))}return e}_convertLastPointTo3rdPoint(e){const t=(0,s.ensureNotNull)(this.pointToScreenPoint(e)),i=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[1])),n=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[0])),o=i.subtract(n),a=(t.x-n.x)/o.x,l=n.addScaled(o,a),c=t.y-l.y,h=n.add(new r.Point(0,c));return(0,s.ensureNotNull)(this.screenPointToPoint(h))}_findPixelsHeight(){const e=this.pointToScreenPoint(this._points[2]),t=this.pointToScreenPoint(this._points[0]);return e&&t?e.y-t.y:null}_applyPendingPriceOffset(){const e=this._pendingPriceOffset;if(null===e||this._points.length<3)return;const t=this.priceScale(),i=(0,s.ensureNotNull)(this.ownerSource()).firstValue();if(!t||t.isEmpty()||null===i)return;const r=e+this._points[0].price,n=e+this._points[1].price,o=.5*(r+n)-e,a=.5*(r+n),l=t.priceToCoordinate(o,i),c=t.priceToCoordinate(a,i)-l,h=t.priceToCoordinate(this._points[0].price,i)+c,d=t.coordinateToPrice(h,i);this._points[2].price=d,this._timePoint[2].price=d, -this._points[2].index=this._points[0].index,this._timePoint[2].time_t=this._timePoint[0].time_t,this._timePoint[2].offset=this._timePoint[0].offset,this._pendingPriceOffset=null}_snapPointBeforeChange(e,t,i){if(i&&i.shift())switch(e){case 0:case 1:this._snapPoint45Degree(t,this._points[1-e]);break;case 2:case 3:const i=(0,s.ensureNotNull)(this.getPoint(5-e));this._snapPoint45Degree(t,i)}}}},40418:(e,t,i)=>{"use strict";i.d(t,{LineToolPath:()=>c});var s=i(50151),r=i(86441),n=i(46100),o=i(45197),a=i(13087),l=i(68806);class c extends a.LineDataSource{constructor(e,t,s,r){const n=t||c.createProperties();super(e,n,s,r),this._finished=!1,i.e(1583).then(i.bind(i,62801)).then((t=>{this._setPaneViews([new t.PathPaneView(this,e)])}))}pointsCount(){return-1}name(){return"Path"}hasEditableCoordinates(){return!1}finish(){this._finished=!0,this._lastPoint=null,this.normalizePoints(),this.createServerPoints()}addPoint(e,t,i){var n;if(this._finished)return!0;const a=(0,s.ensureNotNull)(this.priceScale()),l=this._model.timeScale().indexToCoordinate(e.index),c=e.price,h=(0,s.ensure)(null===(n=this.ownerSource())||void 0===n?void 0:n.firstValue()),d=a.priceToCoordinate(c,h);if(this._points.length>0){const e=this._points[this._points.length-1],i=this._model.timeScale().indexToCoordinate(e.index),s=e.price,n=a.priceToCoordinate(s,h),c=new r.Point(l,d).subtract(new r.Point(i,n)).length();if(!(null==t?void 0:t.isApiEvent())&&c<(0,o.interactionTolerance)().minDistanceBetweenPoints)return this._lastPoint=null,this.normalizePoints(),this.createServerPoints(),!0}return super.addPoint(e,t,i)}static createProperties(e){const t=new n.DefaultProperty("linetoolpath",e);return this._configureProperties(t),t}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(2285),i.e(344),i.e(8882),i.e(8167),i.e(8537)]).then(i.bind(i,74481)).then((e=>e.PathDefinitionsViewModel))}static _configureProperties(e){super._configureProperties(e),e.addChild("linesWidths",new l.LineToolWidthsProperty([(0,s.ensureDefined)(e.child("lineWidth"))])),e.addChild("linesColors",new l.LineToolColorsProperty([e.childs().lineColor]))}}},63596:(e,t,i)=>{"use strict";var s=i(36298).TranslatedString,r=i(13087).LineDataSource,n=i(53801).LevelsProperty,o=i(68806),a=o.LineToolWidthsProperty,l=o.LineToolColorsProperty,c=new s("erase level line",i.tf(null,void 0,i(12962)));class h extends r{constructor(e,t,s,r){super(e,t||h.createProperties(),s,r),i.e(1583).then(i.bind(i,87202)).then((({PitchfanLinePaneView:e})=>{this._setPaneViews([new e(this,this._model)])}))}levelsCount(){return h.LevelsCount}pointsCount(){return 3}name(){return"Pitchfan"}processErase(e,t){var i="level"+t,s=this.properties()[i].visible;e.setProperty(s,!1,c)}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(2285),i.e(344),i.e(8882),i.e(8167),i.e(8537)]).then(i.bind(i,81658))).PitchBaseDefinitionsViewModel}static createProperties(e){var t=new n("linetoolpitchfan",e,!1,{range:[0,8]});return this._configureProperties(t),t}static _configureProperties(e){super._configureProperties(e) -;for(var t=[e.child("median").child("linewidth")],i=[e.child("median").child("color")],s=0;s<=this.LevelsCount;s++)t.push(e.child("level"+s).child("linewidth")),i.push(e.child("level"+s).child("color"));e.addChild("linesColors",new l(i)),e.addChild("linesWidths",new a(t))}}h.LevelsCount=8,t.LineToolPitchfan=h},90095:(e,t,i)=>{"use strict";var s;i.d(t,{LineToolPitchforkStyle:()=>s}),function(e){e[e.Original=0]="Original",e[e.Schiff=1]="Schiff",e[e.Inside=2]="Inside",e[e.Schiff2=3]="Schiff2"}(s||(s={}))},70309:(e,t,i)=>{"use strict";var s=i(36298).TranslatedString,r=i(13087).LineDataSource,n=i(53801).LevelsProperty,o=i(39347).Action,a=i(95059).ACTION_ID,l=i(90095).LineToolPitchforkStyle,c=null,h=i(68806),d=h.LineToolWidthsProperty,u=h.LineToolColorsProperty,p=new s("erase level line",i.tf(null,void 0,i(12962))),_=new s("change {title} style",i.tf(null,void 0,i(74428)));class m extends r{constructor(e,t,i,s){super(e,t||m.createProperties(),i,s),this._properties.style.listeners().subscribe(this,this._recreatePaneView),this._recreatePaneView()}levelsCount(){return m.LevelsCount}additionalActions(e){for(var t=[],r=[{title:i.tf(null,void 0,i(25595)),actionId:a.ChartLineToolPitchforkChangeTypeToOriginal},{title:i.tf(null,void 0,i(66276)),actionId:a.ChartLineToolPitchforkChangeTypeToModifiedSchiff},{title:i.tf(null,void 0,i(9114)),actionId:a.ChartLineToolPitchforkChangeTypeToInside},{title:i.tf(null,void 0,i(51464)),actionId:a.ChartLineToolPitchforkChangeTypeToSchiff}],n=0;n<4;n++){var l=new o({actionId:r[n].actionId,options:{checked:this.properties().style.value()===n,checkable:!0,label:r[n].title,payload:{target:this,value:n},onExecute:function(t){var i=t.getPayload(),r=i.target;e.setProperty(r.properties().style,i.value,_.format({title:new s(r.name(),r.title())})),r.updateAllViews(),r._model.updateSource(r)}}});t.push(l)}return[t[0],t[3],t[1],t[2]]}_recreatePaneView(){if(null!==c){var e=[];this._properties.style.value()===l.Original?e=[new c.PitchforkLinePaneView(this,this._model)]:this._properties.style.value()===l.Schiff?e=[new c.SchiffPitchforkLinePaneView(this,this._model)]:this._properties.style.value()===l.Schiff2?e=[new c.SchiffPitchfork2LinePaneView(this,this._model)]:this._properties.style.value()===l.Inside&&(e=[new c.InsidePitchforkLinePaneView(this,this._model)]),this._setPaneViews(e)}else i.e(1583).then(i.bind(i,95337)).then((e=>{null===c&&(c=e),this._recreatePaneView()}))}pointsCount(){return 3}name(){return"Pitchfork"}processErase(e,t){var i="level"+t,s=this.properties()[i].visible;e.setProperty(s,!1,p)}static createProperties(e){var t=new n("linetoolpitchfork",e,!1,{range:[0,8]});return this._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(2285),i.e(344),i.e(8882),i.e(8167),i.e(8537)]).then(i.bind(i,769))).PitchForkDefinitionsViewModel}static _configureProperties(e){super._configureProperties(e);for(var t=[e.child("median").child("linewidth")],i=[e.child("median").child("color")],s=0;s<=this.LevelsCount;s++)t.push(e.child("level"+s).child("linewidth")), -i.push(e.child("level"+s).child("color"));e.addChild("linesColors",new u(i)),e.addChild("linesWidths",new d(t))}}m.LevelsCount=8,t.LineToolPitchfork=m},67686:(e,t,i)=>{"use strict";i.d(t,{LineToolPolyline:()=>l});var s=i(50151),r=i(86441),n=i(46100),o=i(45197),a=i(13087);class l extends a.LineDataSource{constructor(e,t,s,r){const n=t||l.createProperties();super(e,n,s,r),this._finished=!1,i.e(1583).then(i.bind(i,50253)).then((t=>{this._setPaneViews([new t.PolylinePaneView(this,e)])}))}pointsCount(){return-1}name(){return"Polyline"}hasEditableCoordinates(){return!1}finish(){this._finished=!0,this._lastPoint=null,this.normalizePoints(),this.createServerPoints()}addPoint(e,t,i){var n;if(this._finished)return!0;const a=(0,s.ensureNotNull)(this.priceScale()),l=this._model.timeScale().indexToCoordinate(e.index),c=e.price,h=(0,s.ensure)(null===(n=this.ownerSource())||void 0===n?void 0:n.firstValue()),d=a.priceToCoordinate(c,h),u=(0,o.interactionTolerance)().minDistanceBetweenPoints;if(this._points.length>0){const e=this._points[this._points.length-1],i=this._model.timeScale().indexToCoordinate(e.index),s=e.price,n=a.priceToCoordinate(s,h),o=new r.Point(l,d).subtract(new r.Point(i,n)).length();if(!(null==t?void 0:t.isApiEvent())&&oe.PolylinesDefinitionsViewModel))}static _configureProperties(e){super._configureProperties(e),e.addExclusion("filled")}}},66683:(e,t,i)=>{"use strict";i.d(t,{PositionAveragePriceAxisView:()=>r});var s=i(71243);class r extends s.LineToolPriceAxisView{_formatPrice(e,t){return this._source.formatter().format(e)}}},37619:(e,t,i)=>{"use strict" -;var s=i(87564).LineToolTrading,r=i(13087).LineDataSource,n=i(66683).PositionAveragePriceAxisView,o=i(47043),a=i(46100).DefaultProperty,l=i(71766).PriceFormatter;const c=i(14483);var h=i(98517).sortSourcesPreOrdered.LineToolPosition;function d(e){return null==e?e="":e+="",e}class u{constructor(e){this._line=e,this._data={bodyText:"position",quantityText:"0"},this._closeEnabled=!0,this._direction="buy",this._profitState="neutral"}setDirection(e){return this._direction=e,this._line.updateAllViewsAndRedraw(),this}setProfitState(e){return this._profitState=e,this._line.updateAllViewsAndRedraw(),this}getPrice(){return this._line.points().length>0?this._line.points()[0].price:this._line._timePoint.length>0?this._line._timePoint[0].price:void 0}setPrice(e){if(this._line.points().length>0){var t=this._line.points()[0];t.price=e,this._line._points[0]=t,this._line.normalizePoints(),this._line.updateAllViewsAndRedraw()}return this._line._timePoint.length>0&&(this._line._timePoint[0].price=e),this}getText(){return this._data.bodyText}setText(e){return this._data.bodyText=e||"",this._line.updateAllViewsAndRedraw(),this}setTooltip(e){return this._line.properties().tooltip.setValue(d(e)),this}getTooltip(){return this._line.properties().tooltip.value()}setProtectTooltip(e){return this._line.properties().protectTooltip.setValue(d(e)),this}getProtectTooltip(){return this._line.properties().protectTooltip.value()}setCloseTooltip(e){return this._line.properties().closeTooltip.setValue(d(e)),this}getCloseTooltip(){return this._line.properties().closeTooltip.value()}setReverseTooltip(e){return this._line.properties().reverseTooltip.setValue(d(e)),this}getReverseTooltip(){return this._line.properties().reverseTooltip.value()}getQuantity(){return this._data.quantityText}setQuantity(e){return this._data.quantityText=e||"",this._line.updateAllViewsAndRedraw(),this}getExtendLeft(){var e=this._line.properties().extendLeft.value();return"inherit"===e?this._line._model.properties().tradingProperties.extendLeft.value():e}setExtendLeft(e){return this._line.properties().extendLeft.setValue(e),this}getLineLength(){var e=this._line.properties().lineLength.value();return"inherit"===e?this._line._model.properties().tradingProperties.lineLength.value():e}getLineLengthUnit(){return this._line.properties().lineLengthUnit.value()}setLineLength(e,t="percentage"){const i=t&&"pixel"===t?e:Math.max(0,Math.min(e,100));return this._line.properties().lineLength.setValue(i),this._line.properties().lineLengthUnit.setValue(t),this}getLineColor(){var e=this._line.properties();return("buy"===this._direction?e.lineBuyColor:e.lineSellColor).value()}setLineColor(e){return"buy"===this._direction?this.setLineBuyColor(e):this.setLineSellColor(e),this}setLineBuyColor(e){return this._line.properties().lineBuyColor.setValue(e),this}setLineSellColor(e){return this._line.properties().lineSellColor.setValue(e),this}getLineStyle(){var e=this._line.properties().lineStyle.value();return"inherit"===e?this._line._model.properties().tradingProperties.lineStyle.value():e}setLineStyle(e){ -return this._line.properties().lineStyle.setValue(e),this}getLineWidth(){var e=this._line.properties().lineWidth.value();return"inherit"===e?this._line._model.properties().tradingProperties.lineWidth.value():e}setLineWidth(e){return this._line.properties().lineWidth.setValue(e),this}getBodyBorderColor(){var e=this._line.properties();return("buy"===this._direction?e.bodyBorderBuyColor:e.bodyBorderSellColor).value()}setBodyBorderColor(e){return"buy"===this._direction?this.setBodyBorderBuyColor(e):this.setBodyBorderSellColor(e),this}setBodyBorderBuyColor(e){return this._line.properties().bodyBorderBuyColor.setValue(e),this}setBodyBorderSellColor(e){return this._line.properties().bodyBorderSellColor.setValue(e),this}getBodyBackgroundColor(){return o.getColorFromProperties(this._line.properties().bodyBackgroundColor,this._line.properties().bodyBackgroundTransparency)}setBodyBackgroundColor(e){return o.setColorToProperties(e,this._line.properties().bodyBackgroundColor,this._line.properties().bodyBackgroundTransparency),this}getBodyTextColor(){var e=this._line.properties();return("positive"===this._profitState?e.bodyTextPositiveColor:"negative"===this._profitState?e.bodyTextNegativeColor:e.bodyTextNeutralColor).value()}setBodyTextColor(e){return"positive"===this._profitState?this.setBodyTextPositiveColor(e):"negative"===this._profitState?this.setBodyTextNegativeColor(e):this.setBodyTextNeutralColor(e),this}setBodyTextPositiveColor(e){return this._line.properties().bodyTextPositiveColor.setValue(e),this}setBodyTextNegativeColor(e){return this._line.properties().bodyTextNegativeColor.setValue(e),this}setBodyTextNeutralColor(e){return this._line.properties().bodyTextNeutralColor.setValue(e),this}getBodyFont(){return o.getFontFromProperties(this._line.properties().bodyFontFamily,this._line.properties().bodyFontSize,this._line.properties().bodyFontBold,this._line.properties().bodyFontItalic)}setBodyFont(e){return o.setFontToProperties(e,this._line.properties().bodyFontFamily,this._line.properties().bodyFontSize,this._line.properties().bodyFontBold,this._line.properties().bodyFontItalic),this}getQuantityBorderColor(){var e=this._line.properties();return("buy"===this._direction?e.quantityBorderBuyColor:e.quantityBorderSellColor).value()}setQuantityBorderColor(e){return"buy"===this._direction?this.setQuantityBorderBuyColor(e):this.setQuantityBorderSellColor(e),this}setQuantityBorderBuyColor(e){return this._line.properties().quantityBorderBuyColor.setValue(e),this}setQuantityBorderSellColor(e){return this._line.properties().quantityBorderSellColor.setValue(e),this}getQuantityBackgroundColor(){var e=this._line.properties();return("buy"===this._direction?e.quantityBackgroundBuyColor:e.quantityBackgroundSellColor).value()}setQuantityBackgroundColor(e){return"buy"===this._direction?this.setQuantityBackgroundBuyColor(e):this.setQuantityBackgroundSellColor(e),this}setQuantityBackgroundBuyColor(e){return this._line.properties().quantityBackgroundBuyColor.setValue(e),this}setQuantityBackgroundSellColor(e){ -return this._line.properties().quantityBackgroundSellColor.setValue(e),this}getQuantityTextColor(){return o.getColorFromProperties(this._line.properties().quantityTextColor,this._line.properties().quantityTextTransparency)}setQuantityTextColor(e){return o.setColorToProperties(e,this._line.properties().quantityTextColor,this._line.properties().quantityTextTransparency),this}getQuantityFont(){return o.getFontFromProperties(this._line.properties().quantityFontFamily,this._line.properties().quantityFontSize,this._line.properties().quantityFontBold,this._line.properties().quantityFontItalic)}setQuantityFont(e){return o.setFontToProperties(e,this._line.properties().quantityFontFamily,this._line.properties().quantityFontSize,this._line.properties().quantityFontBold,this._line.properties().quantityFontItalic),this}getReverseButtonBorderColor(){var e=this._line.properties();return("buy"===this._direction?e.reverseButtonBorderBuyColor:e.reverseButtonBorderSellColor).value()}setReverseButtonBorderColor(e){return"buy"===this._direction?this.setReverseButtonBorderBuyColor(e):this.setReverseButtonBorderSellColor(e),this}setReverseButtonBorderBuyColor(e){return this._line.properties().reverseButtonBorderBuyColor.setValue(e),this}setReverseButtonBorderSellColor(e){return this._line.properties().reverseButtonBorderSellColor.setValue(e),this}getReverseButtonBackgroundColor(){return o.getColorFromProperties(this._line.properties().reverseButtonBackgroundColor,this._line.properties().reverseButtonBackgroundTransparency)}setReverseButtonBackgroundColor(e){return o.setColorToProperties(e,this._line.properties().reverseButtonBackgroundColor,this._line.properties().reverseButtonBackgroundTransparency),this}getReverseButtonIconColor(){var e=this._line.properties();return("buy"===this._direction?e.reverseButtonIconBuyColor:e.reverseButtonIconSellColor).value()}setReverseButtonIconColor(e){return"buy"===this._direction?this.setReverseButtonIconBuyColor(e):this.setReverseButtonIconSellColor(e),this}setReverseButtonIconBuyColor(e){return this._line.properties().reverseButtonIconBuyColor.setValue(e),this}setReverseButtonIconSellColor(e){return this._line.properties().reverseButtonIconSellColor.setValue(e),this}getCloseButtonBorderColor(){var e=this._line.properties();return("buy"===this._direction?e.closeButtonBorderBuyColor:e.closeButtonBorderSellColor).value()}setCloseButtonBorderColor(e){return"buy"===this._direction?this.setCloseButtonBorderBuyColor(e):this.setCloseButtonBorderSellColor(e),this}setCloseButtonBorderBuyColor(e){return this._line.properties().closeButtonBorderBuyColor.setValue(e),this}setCloseButtonBorderSellColor(e){return this._line.properties().closeButtonBorderSellColor.setValue(e),this}getCloseButtonBackgroundColor(){return o.getColorFromProperties(this._line.properties().closeButtonBackgroundColor,this._line.properties().closeButtonBackgroundTransparency)}setCloseButtonBackgroundColor(e){ -return o.setColorToProperties(e,this._line.properties().closeButtonBackgroundColor,this._line.properties().closeButtonBackgroundTransparency),this}getCloseButtonIconColor(){var e=this._line.properties();return("buy"===this._direction?e.closeButtonIconBuyColor:e.closeButtonIconSellColor).value()}setCloseButtonIconColor(e){return"buy"===this._direction?this.setCloseButtonIconBuyColor(e):this.setCloseButtonIconSellColor(e),this}setCloseButtonIconBuyColor(e){return this._line.properties().closeButtonIconBuyColor.setValue(e),this}setCloseButtonIconSellColor(e){return this._line.properties().closeButtonIconSellColor.setValue(e),this}block(){this._blocked=!0,this._line.updateAllViewsAndRedraw()}unblock(){this._blocked=!1,this._line.updateAllViewsAndRedraw()}isFunction(e){return"function"==typeof e}onReverse(e,t){return t?this.isFunction(t)&&(this._onReverseData=e,this._onReverseCallback=t):this.isFunction(e)&&(this._onReverseCallback=e),this}callOnReverse(){this.isFunction(this._onReverseCallback)&&this._onReverseCallback.call(this,this._onReverseData)}isOnReverseCallbackPresent(){return this.isFunction(this._onReverseCallback)}onClose(e,t){return t?this.isFunction(t)&&(this._onCloseData=e,this._onCloseCallback=t):this.isFunction(e)&&(this._onCloseCallback=e),this}setCloseEnabled(e){return this._closeEnabled===e||(this._closeEnabled=e,this._onCloseCallback&&this._line.updateAllViewsAndRedraw()),this}isCloseEnabled(){return this._closeEnabled}callOnClose(){this.isFunction(this._onCloseCallback)&&this._closeEnabled&&this._onCloseCallback.call(this,this._onCloseData)}isOnCloseCallbackPresent(){return this._closeEnabled&&this.isFunction(this._onCloseCallback)}onModify(e,t){return t?this.isFunction(t)&&(this._onModifyData=e,this._onModifyCallback=t):this.isFunction(e)&&(this._onModifyCallback=e),this}callOnModify(){this.isFunction(this._onModifyCallback)&&this._onModifyCallback.call(this,this._onModifyData)}onContextMenu(e,t){return t?this.isFunction(t)&&(this._onContextMenuData=e,this._onContextMenuCallback=t):this.isFunction(e)&&(this._onContextMenuCallback=e),this}shouldShowContextMenu(){return this.isFunction(this._onContextMenuCallback)}callOnContextMenu(){if(this.isFunction(this._onContextMenuCallback))return this._onContextMenuCallback.call(this,this._onContextMenuData)}remove(){this._line._model.removeSource(this._line),delete this._line}}class p extends s{constructor(e,t){super(e,t||p.createProperties()),this._adapter=new u(this),i.e(1583).then(i.t.bind(i,46258,19)).then((({PositionPaneView:e})=>{this._setPaneViews([new e(this,this._model)])}));var s=e.mainSeries().symbolInfo(),r=null!==s?s.pricescale:100,n=null!==s&&s.fractional?s.minmov:1,o=null!==s&&s.fractional,a=null!==s?s.minmove2:void 0;this._formatter=new l(r,n,o,a)}zorder(){return h}isSpeciallyZOrderedSource(){return!0}setPoint(e,t,i){this._points[e]=t,this.normalizePoints()}addPoint(e,t){return this._points.push(e),this._lastPoint=null,this.normalizePoints(),this.createServerPoints(),!0}name(){return"Position"}createPriceAxisView(e){ -return this._priceAxisView=new n(this,{pointIndex:e,backgroundPropertyGetter:()=>this._adapter.getLineColor()}),this._priceAxisView}paneViews(){return TradingView.printing&&!c.enabled("snapshot_trading_drawings")?null:this._model.properties().tradingProperties.showPositions.value()?r.prototype.paneViews.call(this):null}priceAxisViews(e,t){return TradingView.printing&&!c.enabled("snapshot_trading_drawings")?null:this._model.properties().tradingProperties.showPositions.value()?r.prototype.priceAxisViews.call(this,e,t):null}hasContextMenu(){return this._adapter.shouldShowContextMenu()}contextMenuItems(){return this._adapter.callOnContextMenu()}formatter(){return this._formatter}static createProperties(e){var t=new a("linetoolposition",e,!1,!1);return this._configureProperties(t),t}}t.LineToolPosition=p},21316:(e,t,i)=>{"use strict";var s,r;i.r(t),i.d(t,{AlertStatus:()=>s,Direction:()=>r}),function(e){e[e.Waiting=0]="Waiting",e[e.Success=1]="Success",e[e.Failure=2]="Failure"}(s||(s={})),function(e){e[e.Up=1]="Up",e[e.Down=2]="Down"}(r||(r={}))},30597:(e,t,i)=>{"use strict";var s=i(50151).ensureNotNull,r=i(13087).LineDataSource,n=i(46100).DefaultProperty,o=i(21316);class a extends r{constructor(e,t,s,r){super(e,t||a.createProperties(),s,r),this._predictionPaneView=null;const n=this._model.mainSeries();n.properties().interval.subscribe(this,(()=>{this.setStatus(o.AlertStatus.Waiting)})),n.dataEvents().dataUpdated().subscribe(this,this.recalculateStateByData),i.e(1583).then(i.t.bind(i,75061,19)).then((({PredictionPaneView:e})=>{this._predictionPaneView=new e(this,this._model),this._setPaneViews([this._predictionPaneView])}))}destroy(){const e=this._model.mainSeries();e.properties().interval.unsubscribeAll(this),e.dataEvents().dataUpdated().unsubscribeAll(this),super.destroy()}dataAndViewsReady(){return super.dataAndViewsReady()&&this._predictionPaneView&&this._predictionPaneView.iconsReady()}isSynchronizable(){return!1}status(){return this._properties.status.value()}setStatus(e){return this._properties.status.setValue(e)}pointsCount(){return 2}name(){return"Forecast"}restorePoints(e,t,i){super.restorePoints(e,t,i),this.recalculateStateByData()}recalculateStateByData(){if(!this.isSourceHidden()&&!(this._points.length<2||this._model.mainSeries().bars().isEmpty())){var e=this._points[1];if(this.status())e.index>this._model.timeScale().baseIndex()&&this.setStatus(o.AlertStatus.Waiting);else{var t=this._model.mainSeries().bars().valueAt(e.index);if(null!==t){var i=this.direction();if(i===o.Direction.Up&&t[TradingView.HIGH_PLOT]>=e.price)this.setStatus(o.AlertStatus.Success);else if(i===o.Direction.Down&&t[TradingView.LOW_PLOT]<=e.price)this.setStatus(o.AlertStatus.Success);else{var r=s(this._model.mainSeries().bars().lastIndex());e.index!==r&&this.setStatus(o.AlertStatus.Failure)}}}}}addPoint(e){var t=super.addPoint(e);return t&&this.recalculateStateByData(),t}endChanging(){super.endChanging(),this.setStatus(o.AlertStatus.Waiting),this.recalculateStateByData()}onData(e){super.onData(e),this.recalculateStateByData()} +t.LineToolArrowMarkRight=i(20521).LineToolArrowMarkRight,t.LineToolArrowMarkUp=i(20521).LineToolArrowMarkUp,t.LineToolArrowMarkDown=i(20521).LineToolArrowMarkDown,t.LineToolFlagMark=i(62575).LineToolFlagMark,t.LineToolCypherPattern=i(99636).LineToolCypherPattern,t.LineToolElliottImpulse=i(99366).LineToolElliottImpulse,t.LineToolElliottTriangle=i(99366).LineToolElliottTriangle,t.LineToolElliottTripleCombo=i(99366).LineToolElliottTripleCombo,t.LineToolElliottCorrection=i(99366).LineToolElliottCorrection,t.LineToolElliottDoubleCombo=i(99366).LineToolElliottDoubleCombo,t.LineToolRiskRewardLong=i(29378).LineToolRiskRewardLong,t.LineToolRiskRewardShort=i(29378).LineToolRiskRewardShort,t.LineToolPosition=i(37619).LineToolPosition,t.LineToolOrder=i(16907).LineToolOrder,t.LineToolHighlighter=i(25007).LineToolHighlighter},21648:(e,t,i)=>{"use strict";i.d(t,{LineToolTradingPriceAxisView:()=>r});var s=i(71243);class r extends s.LineToolPriceAxisView{_formatPrice(e,t){return this._source.formatter().format(e)}}},59656:(e,t,i)=>{"use strict";i.d(t,{lineToolsLocalizedNames:()=>r});var s=i(11542);const r={LineTool5PointsPattern:s.t(null,void 0,i(66527)),LineToolABCD:s.t(null,void 0,i(32852)),LineToolArc:s.t(null,void 0,i(45104)),LineToolArrow:s.t(null,void 0,i(96237)),LineToolArrowMarkDown:s.t(null,void 0,i(8738)),LineToolArrowMarkLeft:s.t(null,void 0,i(35062)),LineToolArrowMarkRight:s.t(null,void 0,i(92163)),LineToolArrowMarkUp:s.t(null,void 0,i(33196)),LineToolBalloon:s.t(null,void 0,i(40664)),LineToolComment:s.t(null,void 0,i(19372)),LineToolBarsPattern:s.t(null,void 0,i(98838)),LineToolBezierCubic:s.t(null,void 0,i(59368)),LineToolBezierQuadro:s.t(null,void 0,i(17206)),LineToolBrush:s.t(null,void 0,i(30251)),LineToolCallout:s.t(null,void 0,i(64149)),LineToolCircleLines:s.t(null,void 0,i(87761)),LineToolCypherPattern:s.t(null,void 0,i(27891)),LineToolDateAndPriceRange:s.t(null,void 0,i(79859)),LineToolDateRange:s.t(null,void 0,i(60222)),LineToolDisjointAngle:s.t(null,void 0,i(3556)),LineToolElliottCorrection:s.t(null,void 0,i(91215)),LineToolElliottDoubleCombo:s.t(null,void 0,i(80983)),LineToolElliottImpulse:s.t(null,void 0,i(74118)),LineToolElliottTriangle:s.t(null,void 0,i(95840)),LineToolElliottTripleCombo:s.t(null,void 0,i(66637)),LineToolEllipse:s.t(null,void 0,i(69418)),LineToolExtended:s.t(null,void 0,i(2578)),LineToolFibChannel:s.t(null,void 0,i(82719)),LineToolFibCircles:s.t(null,void 0,i(64192)),LineToolFibRetracement:s.t(null,void 0,i(63835)),LineToolFibSpeedResistanceArcs:s.t(null,void 0,i(18072)),LineToolFibSpeedResistanceFan:s.t(null,void 0,i(20877)),LineToolFibSpiral:s.t(null,void 0,i(76783)),LineToolFibTimeZone:s.t(null,void 0,i(89037)),LineToolFibWedge:s.t(null,void 0,i(72489)),LineToolFlagMark:s.t(null,void 0,i(55678)),LineToolImage:s.t(null,void 0,i(23450)),LineToolFlatBottom:s.t(null,void 0,i(29230)),LineToolAnchoredVWAP:s.t(null,void 0,i(61704)),LineToolGannComplex:s.t(null,void 0,i(66321)),LineToolGannFixed:s.t(null,void 0,i(87107)),LineToolGannFan:s.t(null,void 0,i(68102)), +LineToolGannSquare:s.t(null,void 0,i(81180)),LineToolHeadAndShoulders:s.t(null,void 0,i(42616)),LineToolHorzLine:s.t(null,void 0,i(60049)),LineToolHorzRay:s.t(null,void 0,i(76604)),LineToolIcon:s.t(null,void 0,i(26579)),LineToolEmoji:s.t(null,void 0,i(85223)),LineToolSticker:s.t(null,void 0,i(84573)),LineToolInsidePitchfork:s.t(null,void 0,i(12354)),LineToolNote:s.t(null,void 0,i(75549)),LineToolNoteAbsolute:s.t(null,void 0,i(66828)),LineToolSignpost:s.t(null,void 0,i(68161)),LineToolParallelChannel:s.t(null,void 0,i(70394)),LineToolPitchfan:s.t(null,void 0,i(22293)),LineToolPitchfork:s.t(null,void 0,i(43852)),LineToolPolyline:s.t(null,void 0,i(53047)),LineToolPath:s.t(null,void 0,i(34402)),LineToolPrediction:s.t(null,void 0,i(36972)),LineToolPriceLabel:s.t(null,void 0,i(95921)),LineToolArrowMarker:s.t(null,void 0,i(82473)),LineToolPriceRange:s.t(null,void 0,i(2032)),LineToolProjection:s.t(null,void 0,i(87086)),LineToolRay:s.t(null,void 0,i(50470)),LineToolRectangle:s.t(null,void 0,i(328)),LineToolCircle:s.t(null,void 0,i(90068)),LineToolRegressionTrend:s.t(null,void 0,i(35001)),LineToolRiskRewardLong:s.t(null,void 0,i(44604)),LineToolRiskRewardShort:s.t(null,void 0,i(37819)),LineToolFixedRangeVolumeProfile:s.t(null,{context:"study"},i(40434)),LineToolAnchoredVolumeProfile:s.t(null,{context:"study"},i(59791)),LineToolRotatedRectangle:s.t(null,void 0,i(9998)),LineToolSchiffPitchfork:s.t(null,void 0,i(18559)),LineToolSchiffPitchfork2:s.t(null,void 0,i(98114)),LineToolSineLine:s.t(null,void 0,i(69502)),LineToolText:s.t(null,{context:"tool"},i(20936)),LineToolTextAbsolute:s.t(null,void 0,i(94782)),LineToolThreeDrivers:s.t(null,void 0,i(98538)),LineToolTimeCycles:s.t(null,void 0,i(95005)),LineToolTrendAngle:s.t(null,void 0,i(94770)),LineToolTrendBasedFibExtension:s.t(null,void 0,i(15501)),LineToolTrendBasedFibTime:s.t(null,void 0,i(31196)),LineToolTrendLine:s.t(null,void 0,i(23104)),LineToolInfoLine:s.t(null,void 0,i(27677)),LineToolTriangle:s.t(null,void 0,i(29245)),LineToolTrianglePattern:s.t(null,void 0,i(12390)),LineToolVertLine:s.t(null,void 0,i(56211)),LineToolCrossLine:s.t(null,void 0,i(60997)),LineToolHighlighter:s.t(null,void 0,i(31895)),LineToolPriceNote:s.t(null,void 0,i(28625)),LineToolVbPFixed:s.t(null,void 0,i(18426)),LineToolGhostFeed:s.t(null,void 0,i(7914))}},92249:(e,t,i)=>{"use strict";i.r(t),i.d(t,{cloneLineTool:()=>ue,createLineTool:()=>se,createLineToolProperties:()=>ne,createStudyLineToolProperties:()=>oe,getNewToolProperties:()=>Q,initAllLineToolsFromContent:()=>ie,initLineTool:()=>te,isLineTool:()=>le,isStudyLineTool:()=>ce,isTrading:()=>he,lineToolByLinkKey:()=>pe,prepareLineToolPropertiesByOwnerSource:()=>re,setNewToolProperties:()=>X,supportsPhantomMode:()=>ae,tryFindStudyLineToolNameByStudyId:()=>de,unsetNewToolProperties:()=>J});var s=i(50151),r=i(86441),n=i(4949),o=i(8652),a=i(13087),l=i(56954),c=i.t(l,2),h=i(61401),d=i(70826),u=i(42856),p=i(56827),_=i(68806),m=i(1722),g=i(46100),f=i(74970);const v=(0,d.studyIdString)("RegressionTrend","tv-basicstudies");function y(e){ +return void 0!==e.startPrice&&void 0!==e.endPrice}function S(e,t,i,s){return t.styles&&(b(t.styles.baseLine),b(t.styles.downLine),b(t.styles.upLine)),t}function b(e){void 0!==e&&void 0!==e.visible&&(e.display=e.visible?15:0,delete e.visible)}class w extends o.StudyLineDataSource{constructor(e,t,r,n,o){super(e,r=null!=r?r:(0,s.ensureNotNull)((0,f.studyMetaInfoRepository)().findByIdSync({type:"java",studyId:v})),"linreg_",null!=t?t:w.createProperties(e),n,o),this.version=2,this._trendData=null,i.e(1583).then(i.bind(i,5374)).then((e=>{this._setPaneViews([new e.RegressionTrendPaneView(this,this._model)])}))}formatter(){throw new Error("This method should never be called")}pointsCount(){return 2}clearData(){this._trendData=null,super.clearData()}state(e){var t;const i=super.state(e);return e?{...i,nonseriesdata:null!==(t=this._trendData)&&void 0!==t?t:void 0}:i}restoreData(e){var t;super.restoreData(e),this._trendData=null!==(t=e.nonseriesdata)&&void 0!==t?t:null}startIndex(){if(null===this._trendData||null===this._indexes)return null;const e=this._indexes[this._trendData.startIndex];return e!==h.INVALID_TIME_POINT_INDEX?e:null}endIndex(){if(null===this._trendData||null===this._indexes)return null;const e=this._indexes[this._trendData.endIndex];return e!==h.INVALID_TIME_POINT_INDEX?e:null}baseLine(){return null===this._trendData?null:this._trendData.baseLine}downLine(){return null===this._trendData?null:this._trendData.downLine}upLine(){return null===this._trendData?null:this._trendData.upLine}pearsons(){return null===this._trendData?null:this._trendData.pearsons}recalcStudyIfNeeded(){this._onStudyInputsMayChange()}cloneable(){return!1}static createProperties(e,t){const i=u.StudyMetaInfo.getStudyPropertyRootNameById(v),r=(0,s.ensureNotNull)((0,f.studyMetaInfoRepository)().findByIdSync({type:"java",studyId:v})),n=(0,g.createDefaultsState)(!0,i,[],e.studyVersioning());return this.createRegressionTrendPropertiesFromStudyMetaInfoAndState(r,r,(0,m.merge)((0,m.clone)(n),null!=t?t:{}),e.studyVersioning())}static createRegressionTrendPropertiesFromStudyMetaInfoAndState(e,t,i,s){const r=(0,p.prepareStudyPropertiesForLoadChart)(e,t,i,s,S);return this._configureProperties(r),r}static studyId(){return v}_studyInputs(e){(0,s.assert)(2===e.length,"all the line tool points should be defined");const[t,i]=e;if(t.index===i.index)return null;const r=this._getPointTime(t.index<=i.index?t:i,!0),n=this._getPointTime(i.index>=t.index?i:t,!0);return null===r||null===n?(this._subscribeApplyInputsOnSeriesCompleted(),null):{...this.properties().childs().inputs.state(),"first bar time":1e3*r,"last bar time":1e3*n}}_onDataUpdated(e,t,i){null!==t&&(t.indexes_replace||(this._trendData=t.data),"nochange"!==i&&(this._indexes=i),super._onDataUpdated(e,t,i))}_isReady(){return null!==this._trendData&&void 0!==this._trendData.startIndex&&void 0!==this._trendData.endIndex&&y(this._trendData.upLine)&&y(this._trendData.baseLine)&&y(this._trendData.downLine)}_updateAnchorsPrice(){if(!this._trendData||(0,m.isNaN)(this._trendData.baseLine.startPrice)||(0, +m.isNaN)(this._trendData.baseLine.endPrice))return;const{startPrice:e,endPrice:t}=this._trendData.baseLine;2===this._points.length&&(this._points[0].price=(0,s.ensureDefined)(e),this._points[1].price=(0,s.ensureDefined)(t),this._timePoint[0].price=(0,s.ensureDefined)(e),this._timePoint[1].price=(0,s.ensureDefined)(t))}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(2285),i.e(2578),i.e(8882),i.e(3986),i.e(8167),i.e(607)]).then(i.bind(i,41109))).RegressionTrendDefinitionsViewModel}static _configureProperties(e){super._configureProperties(e);const t=e.childs().styles.childs(),i=[t.upLine.childs().linewidth,t.downLine.childs().linewidth,t.baseLine.childs().linewidth];e.addChild("linesWidths",new _.LineToolWidthsProperty(i))}}var C=i(58229);const P=(0,d.studyIdString)("VbPFixed","tv-basicstudies");class x extends C.LineToolVbPFixed{constructor(e,t,i,s,r){super(e,t,i||(0,f.studyMetaInfoRepository)().findByIdSync({type:"java",studyId:P}),s,r)}calcIsActualSymbol(){o.StudyLineDataSource.prototype.calcIsActualSymbol.apply(this)}boundToSymbol(){return!0}isSynchronizable(){return this.priceScale()===this._model.mainSeries().priceScale()}static studyId(){return P}static createProperties(e,t){const i=u.StudyMetaInfo.getStudyPropertyRootNameById(P),r=(0,s.ensureNotNull)((0,f.studyMetaInfoRepository)().findByIdSync({type:"java",studyId:P})),n=(0,g.createDefaultsState)(!0,i,[],e.studyVersioning());return this.createPropertiesFromStudyMetaInfoAndState(r,r,(0,m.merge)((0,m.clone)(n),null!=t?t:{}),e.studyVersioning())}static createPropertiesFromStudyMetaInfoAndState(e,t,i,s){const r=(0,p.prepareStudyPropertiesForLoadChart)(e,t,i,s);return this._configureProperties(r),r}}var T=i(88640),I=i(34256),M=i(45802);class A extends M.StudyPriceAxisView{_showPaneLabel(){return!1}_showAxisLabel(){const e=this._model.properties().childs().scalesProperties.childs();return this._visible()&&"VWAP"===this._data.plotIndex&&e.showStudyLastValue.value()}_visible(){const e=this._source.properties().childs().styles.childs()[this._data.plotIndex].childs().display.value();return this._source.properties().childs().axisLabelVisible.value()&&Boolean(4&e)}}var L=i(39871);class k extends L.StudyPlotPaneView{constructor(e,t,i,s){super(e,t,i,s),this._line=e}_makeSureRendererIsValid(){(this._dataInvalidated||this._viewportInvalidated)&&this._updateImplFull(this._viewportInvalidated)&&(this._dataInvalidated=null),this._viewportInvalidated=!1}_updateRenderer(e,t){super._updateRenderer(e,t),this._addAlertsRenderer()}_addAlertsRenderer(){return!1}}var D,E=i(59224);!function(e){e.MainSeries="MainSeries",e.Study="Study",e.StudyLineTool="StudyLineTool",e.StudyStrategy="StudyStrategy"}(D||(D={}));var V=i(98098),B=(i(54358),i(28558)),R=i(3308),N=i(86094);class O extends o.StudyLineDataSource{lastValueData(e,t,i){const r={noData:!0},n=this.priceScale();if(this._model.timeScale().isEmpty()||null===this.priceScale()||null===n||n.isEmpty()||this.plots().isEmpty())return r;const o=this._model.timeScale().visibleBarsStrictRange();if(null===o)return r +;const a=this._studyProps();if(!a.childs().visible.value())return r;const l=this.plots().search(o.lastBar(),N.PlotRowSearchMode.NearestLeft,1);if(null===l)return r;const c=o.contains(l.index),h=!t&&c?l:(0,s.ensureNotNull)(this.plots().last()),d=this.metaInfo().plots.findIndex((t=>t.id===e));if(d<0||!h||!(0,R.default)(h.value[d+1]))return r;const u=h.value[d+1];if(null==u)return r;const p=(0,s.ensureDefined)(a.childs().styles.child(e)),_=(0,s.ensureNotNull)(this.firstValue()),m=n.priceToCoordinate(u,_);return{...n.getFormattedValues(u,_),noData:!1,price:u,color:p.childs().color.value(),coordinate:m,floatCoordinate:m,index:h.index}}priceLabelText(e){const t=(0,s.ensureDefined)(this._metaInfo.styles);return(0,s.ensureDefined)(t[e]).title}offset(e){return 0}getMinFirstBarIndexForPlot(){return-1/0}isPlotVisibleAt(e,t){return(this._studyProps().childs().styles.childs()[e].childs().display.value()&t)===t}_studyProps(){return this.properties()}}var F=i(43493);const W=(0,E.getLogger)("Chart.AnchoredVWAP"),H=(0,d.studyIdString)("AnchoredVWAP","tv-basicstudies");function z(e,t,i,r){return"calculate_stDev"in(0,s.ensureDefined)(e.inputs)||void 0===r.inputs.find((e=>"calculate_stDev"===e.id))||((0,s.ensureDefined)(t.inputs).calculate_stDev=!1),t.styles&&(U(t.styles.VWAP),U(t.styles.UpperBand),U(t.styles.LowerBand),U(t.styles.UpperBand_2),U(t.styles.LowerBand_2),U(t.styles.UpperBand_3),U(t.styles.LowerBand_3)),t}function U(e){void 0!==e&&void 0!==e.visible&&(e.display=e.visible?15:0,delete e.visible)}class j extends O{constructor(e,t,i,r,n){i=i||(0,s.ensureNotNull)((0,f.studyMetaInfoRepository)().findByIdSync({type:"java",studyId:H}));const o=null!=t?t:j.createProperties(e);super(e,i,"anchoredvwap",o,r,n);const[a,l,c,h,d,u,p]=this.metaInfo().plots,_=e.mainSeries(),m=[new k(this,_,e,a.id)];l&&c&&(m.push(new L.StudyPlotPaneView(this,_,e,l.id)),m.push(new L.StudyPlotPaneView(this,_,e,c.id))),h&&d&&u&&p&&(m.push(new L.StudyPlotPaneView(this,_,e,h.id)),m.push(new L.StudyPlotPaneView(this,_,e,d.id)),m.push(new L.StudyPlotPaneView(this,_,e,u.id)),m.push(new L.StudyPlotPaneView(this,_,e,p.id))),this._properties.childs().areaBackground&&m.splice(0,0,new V.AreaBackgroundPaneView(this,e)),this._priceAxisViews=this.metaInfo().plots.map((e=>new A(this,{plotIndex:e.id}))),m.push(...this._priceAxisViews.map((e=>new F.PanePriceAxisView(e,this,this._model)))),this._anchorPriceCalculated=!1,this._onInputsReadyCallbacks=[],this._setPaneViews(m),e.properties().childs().scalesProperties.childs().showStudyLastValue.subscribe(this,this._onShowStudyLastValueChanged),o.onRestoreFactoryDefaults().subscribe(this,this._onRestoreFactoryDefaults)}destroy(){this.properties().onRestoreFactoryDefaults().unsubscribeAll(this),this.model().properties().childs().scalesProperties.childs().showStudyLastValue.unsubscribeAll(this),this._onInputsReadyCallbacks=[],super.destroy()}canHasAlert(){return!0}pointsCount(){return 1}updateAllViews(e){super.updateAllViews(e),this._priceAxisViews.forEach((t=>t.update(e)))}firstValue(){return this._model.mainSeries().firstValue()} +priceRange(e,t){if(!this._isReady()||this.isSourceHidden())return null;const i=this.plots().minMaxOnRangeCached(e,t,[{name:this.metaInfo().plots[0].id,offset:0}]);if(null===i)return null;const r=(0,s.ensureNotNull)(this.priceScale());return r.isLog()?new I.PriceRange(r.priceToLogical(i.min),r.priceToLogical(i.max)):new I.PriceRange(i.min,i.max)}isIncludedInAutoScale(){return!0}restoreData(e){super.restoreData(e),void 0!==e.data&&(this._anchorPriceCalculated=!0)}properties(){return super.properties()}sourceId(){return this._studyId()}hasStateForAlert(){return!1}stateForAlert(){throw new Error("Not implemented")}inputsForAlertState(){null===this._inputs&&W.logError("Could not get inputsForAlertState if VWAP has no inputs");const{start_time:e,source:t}=this.inputs();return{start_time:e,source:t}}inputs(){return(0,s.ensureNotNull)(this._inputs)}idForAlert(){return super.idForAlert()}defaultPlotIdForAlert(){return this.metaInfo().plots[0].id}static createProperties(e,t){const i=u.StudyMetaInfo.getStudyPropertyRootNameById(H),r=(0,s.ensureNotNull)((0,f.studyMetaInfoRepository)().findByIdSync({type:"java",studyId:H})),n=(0,g.createDefaultsState)(!0,i,[],e.studyVersioning());return this.createPropertiesFromStudyMetaInfoAndState(r,r,(0,m.merge)((0,m.clone)(n),null!=t?t:{}),e.studyVersioning())}static studyId(){return H}static createPropertiesFromStudyMetaInfoAndState(e,t,i,s){const r=(0,p.prepareStudyPropertiesForLoadChart)(e,t,i,s,z);return this._configureProperties(r),r}_onPointsetUpdated(e){super._onPointsetUpdated(e),this._onStudyInputsMayChange()}_studyInputs(e){(0,s.assert)(1===e.length,"all the line tool points should be defined");const t=e[0],i=this._getPointTime(t,!1);return null===i?(this._subscribeApplyInputsOnSeriesCompleted(),null):{...this.properties().childs().inputs.state(["start_time"]),start_time:1e3*i}}_isReady(){return super._isReady()&&(null!==this._inputs||this._anchorPriceCalculated)&&this.model().lineBeingEdited()!==this}_onDataCleared(){super._onDataCleared(),this._anchorPriceCalculated=!1}_onInputsChanged(){if(super._onInputsChanged(),this._updateAlertCreationAvailable(),null!==this._inputs){for(const e of this._onInputsReadyCallbacks)try{e(this._inputs)}catch(e){W.logError(e.stack||e.message)}this._onInputsReadyCallbacks=[]}}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(2285),i.e(344),i.e(8882),i.e(8167),i.e(8537)]).then(i.bind(i,59973))).AnchoredVWAPDefinitionsViewModel}_updateAnchorsPrice(e){if(!e&&(this._anchorPriceCalculated||!this.isActualSymbol()))return;const t=this.firstValue(),i=this.points();if(null===t||0===i.length)return;const s=i[0].index,r=this.plots().valueAt(s);if(null===r)return;const n=r[1];null!=n&&(this._points[0].price=n,this._timePoint[0].price=n,this._anchorPriceCalculated=!0)}_synchronizeAlert(e){this._onInputsReady((()=>super._synchronizeAlert(e)))}static _configureProperties(e){super._configureProperties(e),e.hasChild("axisLabelVisible")||e.addChild("axisLabelVisible",new T.default(true)) +;const t=e.childs().styles.childs().VWAP.childs().linewidth,i=e.childs().styles.childs().VWAP.childs().color;e.addChild("linesWidths",new _.LineToolWidthsProperty([t])),e.addChild("linesColors",new _.LineToolColorsProperty([i]))}_onInputsReady(e){null!==this._inputs?e(this._inputs):this._onInputsReadyCallbacks.push(e)}_onShowStudyLastValueChanged(){this._priceAxisViews.forEach((e=>e.update((0,B.sourceChangeEvent)(this.id())))),this.model().updateSource(this)}_onRestoreFactoryDefaults(){this.properties().childs().axisLabelVisible.setValue(true)}}var G=i(87564),q=i(42960),$=i(15367);function Y(e){for(const t of Object.keys(e))TradingView[t]=e[t]}Y(c),Y({LineToolRegressionTrend:w,LineToolVbPFixed:C.LineToolVbPFixed,LineToolFixedRangeVolumeProfile:x,LineToolAnchoredVWAP:j});const K={};Object.assign(K,c);let Z=null;function X(e,t,i){return null!==Z&&Z.tool===e&&Z.toolData===t||(Z={properties:ne(e,void 0,i),tool:e,toolData:t}),Z.properties}function J(){Z=null}function Q(e){return null!==Z&&Z.tool===e?Z.properties:null}const ee=new Map([["LineToolPriceNote",async()=>(await Promise.resolve().then(i.bind(i,32831))).LineToolPriceNote],["LineToolFibSpiral",async()=>(await Promise.resolve().then(i.bind(i,83101))).LineToolFibSpiral],["LineToolCircleLines",async()=>(await Promise.resolve().then(i.bind(i,38762))).LineToolCyclicLines]]);async function te(e){if(ce(e)&&await(0,f.studyMetaInfoRepository)().findAllJavaStudies(),K[e])return;if(!K.hasOwnProperty(e))return;const t=(0,s.ensureDefined)(ee.get(e));K[e]=await t()}async function ie(e){if(!e)return;const t=new Set;("charts"in e?e.charts:[e]).forEach((e=>{e.panes.forEach((e=>{e.sources.forEach((e=>{(0,$.isLineToolName)(e.type)&&t.add(e.type)}))}))})),await Promise.all(Array.from(t).map((e=>te(e))))}function se(e,t,i,r,n,o){let a;if((0,s.assert)((0,$.isLineToolName)(e),"Unknown line tool: "+e),n||i||(i=Q(e)||void 0),"LineToolVbPFixed"===e)a=new C.LineToolVbPFixed(t,i,(0,s.ensureDefined)(r),n,o);else if("LineToolAnchoredVolumeProfile"===e)a=new LineToolAnchoredVolumeProfile(t,i,(0,s.ensureDefined)(r),n,o);else if("LineToolFixedRangeVolumeProfile"===e)a=new x(t,i,(0,s.ensureDefined)(r),n,o);else if("LineToolRegressionTrend"===e)a=new w(t,i,(0,s.ensureDefined)(r),n,o);else if("LineToolAnchoredVWAP"===e)a=new j(t,i,(0,s.ensureDefined)(r),n,o);else{a=new((0,s.ensureDefined)(K[e]))(t,i,n,o)}return a.toolname=e,J(),a}function re(e,t){const i=(0,s.ensureNotNull)(t.symbolSource()),r=i.symbolInfo(),n=r?(0,q.extractLineToolSymbolFromSymbolInfo)(r,i.symbol()):i.symbol();e.childs().symbol.setValue(n),i.model().currencyConversionEnabled()&&e.childs().currencyId.setValue(i.currency()),i.model().unitConversionEnabled()&&e.childs().unitId.setValue(i.unit()),e.childs().symbolStateVersion.setValue(2),e.childs().zOrderVersion.setValue(2)}function ne(e,t,i,r){if((0,s.assert)((0,$.isLineToolName)(e),`${e} should be name of the line tool`),"LineToolVbPFixed"===e)return C.LineToolVbPFixed.createProperties(i,t) +;if("LineToolAnchoredVolumeProfile"===e)return LineToolAnchoredVolumeProfile.createProperties(i,t);if("LineToolFixedRangeVolumeProfile"===e)return x.createProperties(i,t);if("LineToolRegressionTrend"===e)return w.createProperties(i,t);if("LineToolAnchoredVWAP"===e)return j.createProperties(i,t);return(0,s.ensureDefined)(K[e]).createProperties(t,r)}function oe(e,t,i,r,n){if((0,s.assert)((0,$.isStudyLineToolName)(e),`${e} should be name of the study line tool`),"LineToolVbPFixed"===e)return C.LineToolVbPFixed.createPropertiesFromStudyMetaInfoAndState(t,i,r,n);if("LineToolAnchoredVolumeProfile"===e)return LineToolAnchoredVolumeProfile.createPropertiesFromStudyMetaInfoAndState(t,i,r,n);if("LineToolFixedRangeVolumeProfile"===e)return x.createPropertiesFromStudyMetaInfoAndState(t,i,r,n);if("LineToolRegressionTrend"===e)return w.createRegressionTrendPropertiesFromStudyMetaInfoAndState(t,i,r,n);if("LineToolAnchoredVWAP"===e)return j.createPropertiesFromStudyMetaInfoAndState(t,i,r,n);throw new Error(`Property creation is not implemented for study line tool ${e}`)}function ae(e){(0,s.assert)((0,$.isLineToolName)(e),`${e} should be name of the line tool`);const t=c[e];return void 0!==t&&Boolean(t.supportPhantomMode)}function le(e){return e instanceof a.LineDataSource}function ce(e){return e instanceof o.StudyLineDataSource}function he(e){return e instanceof G.LineToolTrading}function de(e){let t=null;return e===w.studyId()?t="LineToolRegressionTrend":e===C.LineToolVbPFixed.studyId()?t="LineToolVbPFixed":e===x.studyId()&&(t="LineToolFixedRangeVolumeProfile"),t}function ue(e,t,i,o){const a=t.toolname,l=t.properties().state();l.intervalsVisibilities=(0,n.mergeIntervalVisibilitiesDefaults)(null==l?void 0:l.intervalsVisibilities);const c=ne(t.toolname,l,e);c.childs().visible.setValue(!0);const h=(0,s.ensureNotNull)(t.ownerSource()),d=se(a,e,c);void 0!==o&&d.setId(o),d.setOwnerSource(h),d.toolname=a;const u=d.clonePositionOffset();if(t.isFixed()){const e=(0,s.ensureDefined)(t.fixedPoint()),n=i?e.add(new r.Point(u.xCoordOffset,u.yCoordOffset)):e;d.addFixedPoint(n)}const p=t.normalizedPoints(),_=i?function(e,t,i){const r=(0,s.ensureNotNull)(t.priceScale()),n=(0,s.ensureNotNull)(t.firstValue());return e.map((e=>{const t=e.price,s=r.priceToCoordinate(t,n)+i.yCoordOffset,o=r.coordinateToPrice(s,n);return{time_t:e.time_t,price:o,offset:e.offset+i.barOffset}}))}(p,h,u):p,m=t.points();return d.restorePoints(_,m),d.cloneData&&d.cloneData(t),d.recalculateStateByData&&d.recalculateStateByData(),d}function pe(e,t){var i;return null!==(i=e.dataSources().find((e=>le(e)&&e.linkKey().value()===t)))&&void 0!==i?i:null}},23558:(e,t,i)=>{"use strict";var s=i(13087).LineDataSource,r=i(88640).default,n=i(46100).DefaultProperty;class o extends s{constructor(e,t,s,r){super(e,t||o.createProperties(),s,r),this.version=o.version,i.e(1583).then(i.bind(i,34658)).then((({NotePaneView:e})=>{this._setPaneViews([new e(this,this._model)])}))}pointsCount(){return 1}name(){return"Note"}getTooltipWidth(){return o.TOOLTIP_WIDTH}getTooltipPadding(){ +return o.TOOLTIP_PADDING}getTooltipLineSpacing(){return o.TOOLTIP_LINESPACING}template(){var e=super.template();return e.text=this.properties().childs().text.value(),e}_applyTemplateImpl(e){super._applyTemplateImpl(e),this.properties().childs().text.setValue(e.text)}static createProperties(e){void 0!==e&&void 0!==e.markerColor&&void 0===e.borderColor&&(e.borderColor=e.markerColor);var t=new n("linetoolnote",e);return this._configureProperties(t),t}state(e){var t=super.state(e);return e&&(t.state.fixedSize=!1),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(2285),i.e(344),i.e(8882),i.e(8167),i.e(8537)]).then(i.bind(i,77420))).NoteDefinitionsViewModel}static _configureProperties(e){super._configureProperties(e),e.hasChild("text")||e.addChild("text",new r(i.tf(null,void 0,i(37229)))),e.addExclusion("text")}}o.TOOLTIP_WIDTH=300,o.TOOLTIP_PADDING=10,o.TOOLTIP_LINESPACING=5,o.version=1;class a extends o{constructor(e,t){super(e,t||a.createProperties())}title(){return i.tf(null,void 0,i(66828))}name(){return"Anchored Note"}isFixed(){return!0}hasEditableCoordinates(){return!1}static createProperties(e){var t=new n("linetoolnoteabsolute",e);return this._configureProperties(t),t}}t.LineToolNote=o,t.LineToolNoteAbsolute=a},16907:(e,t,i)=>{"use strict";var s=i(87564).LineToolTrading,r=i(21648).LineToolTradingPriceAxisView,n=i(47043),o=i(13087).LineDataSource,a=i(46100).DefaultProperty;const l=i(14483);var c=i(98517).sortSourcesPreOrdered.LineToolOrder;function h(e){return null==e?e="":e+="",e}class d{constructor(e){this._line=e,this._data={bodyText:"order",quantityText:"0"},this._editable=!0,this._cancellable=!0,this._mode="",this._direction="buy",this._active=!0}setMode(e){return this._mode=e,this._line.updateAllViewsAndRedraw(),this}setDirection(e){return this._direction=e,this._line.updateAllViewsAndRedraw(),this}setActive(e){return this._active=e,this._line.updateAllViewsAndRedraw(),this}setEditable(e){return this._editable=e,this._line.updateAllViewsAndRedraw(),this}getEditable(){return this._editable}setCancellable(e){return this._cancellable=e,this._line.updateAllViewsAndRedraw(),this}getCancellable(){return this._cancellable}hasMoveCallback(){return this.isFunction(this._onMoveCallback)}hasModifyCallback(){return this.isFunction(this._onModifyCallback)}getPrice(){return this._line.points().length>0?this._line.points()[0].price:this._line._timePoint.length>0?this._line._timePoint[0].price:void 0}setPrice(e){if(this._line.points().length>0){var t=this._line.points()[0];t.price=e,this._line._points[0]=t,this._line.normalizePoints(),this._line.updateAllViewsAndRedraw()}return this._line._timePoint.length>0&&(this._line._timePoint[0].price=e),this}getText(){return this._data.bodyText}setText(e){return this._data.bodyText=e||"",this._line.updateAllViewsAndRedraw(),this}setTooltip(e){return this._line.properties().tooltip.setValue(h(e)),this}getTooltip(){return this._line.properties().tooltip.value()}setModifyTooltip(e){return this._line.properties().modifyTooltip.setValue(h(e)),this} +getModifyTooltip(){return this._line.properties().modifyTooltip.value()}setCancelTooltip(e){return this._line.properties().cancelTooltip.setValue(h(e)),this}getCancelTooltip(){return this._line.properties().cancelTooltip.value()}getQuantity(){return this._data.quantityText}setQuantity(e){return this._data.quantityText=e||"",this._line.updateAllViewsAndRedraw(),this}getExtendLeft(){var e=this._line.properties().extendLeft.value();return"inherit"===e?this._line._model.properties().tradingProperties.extendLeft.value():e}setExtendLeft(e){return this._line.properties().extendLeft.setValue(e),this}getLineLength(){var e=this._line.properties().lineLength.value();return"inherit"===e?this._line._model.properties().tradingProperties.lineLength.value():e}setLineLength(e,t="percentage"){const i=t&&"pixel"===t?e:Math.max(0,Math.min(e,100));return this._line.properties().lineLength.setValue(i),this._line.properties().lineLengthUnit.setValue(t),this}getLineLengthUnit(){return this._line.properties().lineLengthUnit.value()}getLineColor(){var e=this._line.properties();return"buy"===this._direction?this._active?e.lineActiveBuyColor.value():e.lineInactiveBuyColor.value():this._active?e.lineActiveSellColor.value():e.lineInactiveSellColor.value()}setLineColor(e){return"buy"===this._direction?this._active?this.setLineActiveBuyColor(e):this.setLineInactiveBuyColor(e):this._active?this.setLineActiveSellColor(e):this.setLineInactiveSellColor(e),this}setLineActiveBuyColor(e){return this._line.properties().lineActiveBuyColor.setValue(e),this}setLineInactiveBuyColor(e){return this._line.properties().lineInactiveBuyColor.setValue(e),this}setLineActiveSellColor(e){return this._line.properties().lineActiveSellColor.setValue(e),this}setLineInactiveSellColor(e){return this._line.properties().lineInactiveSellColor.setValue(e),this}getLineStyle(){var e=this._line.properties().lineStyle.value();return"inherit"===e?this._line._model.properties().tradingProperties.lineStyle.value():e}setLineStyle(e){return this._line.properties().lineStyle.setValue(e),this}getLineWidth(){var e=this._line.properties().lineWidth.value();return"inherit"===e?this._line._model.properties().tradingProperties.lineWidth.value():e}setLineWidth(e){return this._line.properties().lineWidth.setValue(e),this}getBodyBorderColor(){var e=this._line.properties();return"buy"===this._direction?this._active?e.bodyBorderActiveBuyColor.value():e.bodyBorderInactiveBuyColor.value():this._active?e.bodyBorderActiveSellColor.value():e.bodyBorderInactiveSellColor.value()}setBodyBorderColor(e){return"buy"===this._direction?this._active?this.setBodyBorderActiveBuyColor(e):this.setBodyBorderInactiveBuyColor(e):this._active?this.setBodyBorderActiveSellColor(e):this.setBodyBorderInactiveSellColor(e),this}setBodyBorderActiveBuyColor(e){return this._line.properties().bodyBorderActiveBuyColor.setValue(e),this}setBodyBorderInactiveBuyColor(e){return this._line.properties().bodyBorderInactiveBuyColor.setValue(e),this}setBodyBorderActiveSellColor(e){ +return this._line.properties().bodyBorderActiveSellColor.setValue(e),this}setBodyBorderInactiveSellColor(e){return this._line.properties().bodyBorderInactiveSellColor.setValue(e),this}getBodyBackgroundColor(){return n.getColorFromProperties(this._line.properties().bodyBackgroundColor,this._line.properties().bodyBackgroundTransparency)}setBodyBackgroundColor(e){return n.setColorToProperties(e,this._line.properties().bodyBackgroundColor,this._line.properties().bodyBackgroundTransparency),this}getBodyTextColor(){var e=this._line.properties();return"limit"===this._mode?this._active?e.bodyTextActiveLimitColor.value():e.bodyTextInactiveLimitColor.value():"stop"===this._mode?this._active?e.bodyTextActiveStopColor.value():e.bodyTextInactiveStopColor.value():"buy"===this._direction?this._active?e.bodyTextActiveBuyColor.value():e.bodyTextInactiveBuyColor.value():this._active?e.bodyTextActiveSellColor.value():e.bodyTextInactiveSellColor.value()}setBodyTextColor(e){return"limit"===this._mode?this._active?this.setBodyTextActiveLimitColor(e):this.setBodyTextInactiveLimitColor(e):"stop"===this._mode?this._active?this.setBodyTextActiveStopColor(e):this.setBodyTextInactiveStopColor(e):"buy"===this._direction?this._active?this.setBodyTextActiveBuyColor(e):this.setBodyTextInactiveBuyColor(e):this._active?this.setBodyTextActiveSellColor(e):this.setBodyTextInactiveSellColor(e),this}setBodyTextInactiveLimitColor(e){return this._line.properties().bodyTextInactiveLimitColor.setValue(e),this}setBodyTextActiveLimitColor(e){return this._line.properties().bodyTextActiveLimitColor.setValue(e),this}setBodyTextInactiveStopColor(e){return this._line.properties().bodyTextInactiveStopColor.setValue(e),this}setBodyTextActiveStopColor(e){return this._line.properties().bodyTextActiveStopColor.setValue(e),this}setBodyTextInactiveBuyColor(e){return this._line.properties().bodyTextInactiveBuyColor.setValue(e),this}setBodyTextActiveBuyColor(e){return this._line.properties().bodyTextActiveBuyColor.setValue(e),this}setBodyTextInactiveSellColor(e){return this._line.properties().bodyTextInactiveSellColor.setValue(e),this}setBodyTextActiveSellColor(e){return this._line.properties().bodyTextActiveSellColor.setValue(e),this}getBodyFont(){return n.getFontFromProperties(this._line.properties().bodyFontFamily,this._line.properties().bodyFontSize,this._line.properties().bodyFontBold,this._line.properties().bodyFontItalic)}setBodyFont(e){return n.setFontToProperties(e,this._line.properties().bodyFontFamily,this._line.properties().bodyFontSize,this._line.properties().bodyFontBold,this._line.properties().bodyFontItalic),this}getQuantityBorderColor(){var e=this._line.properties();return"buy"===this._direction?this._active?e.quantityBorderActiveBuyColor.value():e.quantityBorderInactiveBuyColor.value():this._active?e.quantityBorderActiveSellColor.value():e.quantityBorderInactiveSellColor.value()}setQuantityBorderColor(e){ +return"buy"===this._direction?this._active?this.setQuantityBorderActiveBuyColor(e):this.setQuantityBorderInactiveBuyColor(e):this._active?this.setQuantityBorderActiveSellColor(e):this.setQuantityBorderInactiveSellColor(e),this}setQuantityBorderActiveBuyColor(e){return this._line.properties().quantityBorderActiveBuyColor.setValue(e),this}setQuantityBorderInactiveBuyColor(e){return this._line.properties().quantityBorderInactiveBuyColor.setValue(e),this}setQuantityBorderActiveSellColor(e){return this._line.properties().quantityBorderActiveSellColor.setValue(e),this}setQuantityBorderInactiveSellColor(e){return this._line.properties().quantityBorderInactiveSellColor.setValue(e),this}getQuantityBackgroundColor(){var e=this._line.properties();return"buy"===this._direction?this._active?e.quantityBackgroundActiveBuyColor.value():e.quantityBackgroundInactiveBuyColor.value():this._active?e.quantityBackgroundActiveSellColor.value():e.quantityBackgroundInactiveSellColor.value()}setQuantityBackgroundColor(e){return"buy"===this._direction?this._active?this.setQuantityBackgroundActiveBuyColor(e):this.setQuantityBackgroundInactiveBuyColor(e):this._active?this.setQuantityBackgroundActiveSellColor(e):this.setQuantityBackgroundInactiveSellColor(e),this}setQuantityBackgroundActiveBuyColor(e){return this._line.properties().quantityBackgroundActiveBuyColor.setValue(e),this}setQuantityBackgroundInactiveBuyColor(e){return this._line.properties().quantityBackgroundInactiveBuyColor.setValue(e),this}setQuantityBackgroundActiveSellColor(e){return this._line.properties().quantityBackgroundActiveSellColor.setValue(e),this}setQuantityBackgroundInactiveSellColor(e){return this._line.properties().quantityBackgroundInactiveSellColor.setValue(e),this}getQuantityTextColor(){return n.getColorFromProperties(this._line.properties().quantityTextColor,this._line.properties().quantityTextTransparency)}setQuantityTextColor(e){return n.setColorToProperties(e,this._line.properties().quantityTextColor,this._line.properties().quantityTextTransparency),this}getQuantityFont(){return n.getFontFromProperties(this._line.properties().quantityFontFamily,this._line.properties().quantityFontSize,this._line.properties().quantityFontBold,this._line.properties().quantityFontItalic)}setQuantityFont(e){return n.setFontToProperties(e,this._line.properties().quantityFontFamily,this._line.properties().quantityFontSize,this._line.properties().quantityFontBold,this._line.properties().quantityFontItalic),this}getCancelButtonBorderColor(){var e=this._line.properties();return"buy"===this._direction?this._active?e.cancelButtonBorderActiveBuyColor.value():e.cancelButtonBorderInactiveBuyColor.value():this._active?e.cancelButtonBorderActiveSellColor.value():e.cancelButtonBorderInactiveSellColor.value()}setCancelButtonBorderColor(e){return"buy"===this._direction?this._active?this.setCancelButtonBorderActiveBuyColor(e):this.setCancelButtonBorderInactiveBuyColor(e):this._active?this.setCancelButtonBorderActiveSellColor(e):this.setCancelButtonBorderInactiveSellColor(e),this} +setCancelButtonBorderActiveBuyColor(e){return this._line.properties().cancelButtonBorderActiveBuyColor.setValue(e),this}setCancelButtonBorderInactiveBuyColor(e){return this._line.properties().cancelButtonBorderInactiveBuyColor.setValue(e),this}setCancelButtonBorderActiveSellColor(e){return this._line.properties().cancelButtonBorderActiveSellColor.setValue(e),this}setCancelButtonBorderInactiveSellColor(e){return this._line.properties().cancelButtonBorderInactiveSellColor.setValue(e),this}getCancelButtonBackgroundColor(){return n.getColorFromProperties(this._line.properties().cancelButtonBackgroundColor,this._line.properties().cancelButtonBackgroundTransparency)}setCancelButtonBackgroundColor(e){return n.setColorToProperties(e,this._line.properties().cancelButtonBackgroundColor,this._line.properties().cancelButtonBackgroundTransparency),this}getCancelButtonIconColor(){var e=this._line.properties();return"buy"===this._direction?this._active?e.cancelButtonIconActiveBuyColor.value():e.cancelButtonIconInactiveBuyColor.value():this._active?e.cancelButtonIconActiveSellColor.value():e.cancelButtonIconInactiveSellColor.value()}setCancelButtonIconColor(e){return"buy"===this._direction?this._active?this.setCancelButtonIconActiveBuyColor(e):this.setCancelButtonIconInactiveBuyColor(e):this._active?this.setCancelButtonIconActiveSellColor(e):this.setCancelButtonIconInactiveSellColor(e),this}setCancelButtonIconActiveBuyColor(e){return this._line.properties().cancelButtonIconActiveBuyColor.setValue(e),this}setCancelButtonIconInactiveBuyColor(e){return this._line.properties().cancelButtonIconInactiveBuyColor.setValue(e),this}setCancelButtonIconActiveSellColor(e){return this._line.properties().cancelButtonIconActiveSellColor.setValue(e),this}setCancelButtonIconInactiveSellColor(e){return this._line.properties().cancelButtonIconInactiveSellColor.setValue(e),this}block(){this._blocked=!0,this._line.updateAllViewsAndRedraw()}unblock(){this._blocked=!1,this._line.updateAllViewsAndRedraw()}getBlocked(){return this._blocked}isFunction(e){return"function"==typeof e}onCancel(e,t){return t?this.isFunction(t)&&(this._onCancelData=e,this._onCancelCallback=t):this.isFunction(e)&&(this._onCancelCallback=e),this}callOnCancel(){this.isFunction(this._onCancelCallback)&&this._onCancelCallback.call(this,this._onCancelData)}isOnCancelCallbackPresent(){return this.isFunction(this._onCancelCallback)}onModify(e,t){return t?this.isFunction(t)&&(this._onModifyData=e,this._onModifyCallback=t):this.isFunction(e)&&(this._onModifyCallback=e),this}callOnModify(){this.isFunction(this._onModifyCallback)&&this._onModifyCallback.call(this,this._onModifyData)}onMove(e,t){return t?this.isFunction(t)&&(this._onMoveData=e,this._onMoveCallback=t):this.isFunction(e)&&(this._onMoveCallback=e),this}callOnMove(){this.isFunction(this._onMoveCallback)&&this._onMoveCallback.call(this,this._onMoveData)}onMoving(e,t){return t?this.isFunction(t)&&(this._onMovingData=e,this._onMovingCallback=t):this.isFunction(e)&&(this._onMovingCallback=e),this}callOnMoving(){ +this.isFunction(this._onMovingCallback)&&this._onMovingCallback.call(this,this._onMovingData)}onContextMenu(e,t){return t?this.isFunction(t)&&(this._onContextMenuData=e,this._onContextMenuCallback=t):this.isFunction(e)&&(this._onContextMenuCallback=e),this}shouldShowContextMenu(){return this.isFunction(this._onContextMenuCallback)}callOnContextMenu(){if(this.isFunction(this._onContextMenuCallback))return this._onContextMenuCallback.call(this,this._onContextMenuData)}remove(){this._line._model.removeSource(this._line),delete this._line}}class u extends s{constructor(e,t){super(e,t||u.createProperties()),this._adapter=new d(this),this.setSelectionEnabled(!0),i.e(1583).then(i.bind(i,61144)).then((({OrderPaneView:e})=>{this._setPaneViews([new e(this,this._model)])}))}zorder(){return c}isSpeciallyZOrderedSource(){return!0}setPoint(e,t,i){this._points[e]=t,this.normalizePoints()}addPoint(e,t){return this._points.push(e),this._lastPoint=null,this.normalizePoints(),this.createServerPoints(),!0}name(){return"Order"}move(e,t,i,s){var r=this._startMovingPoint&&this._currentMovingPoint&&this._startMovingPoint.logical.price!==this._currentMovingPoint.logical.price;super.move(e,t,i,s),r&&this._adapter.callOnMoving()}endMoving(e){var t=this._startMovingPoint&&this._currentMovingPoint&&this._startMovingPoint.logical.price!==this._currentMovingPoint.logical.price;super.endMoving(),!e&&t&&this._adapter.callOnMove()}createPriceAxisView(e){var t={pointIndex:e,backgroundPropertyGetter:()=>this._adapter.getLineColor()};return this._priceAxisView=new r(this,t),this._priceAxisView}paneViews(){return TradingView.printing&&!l.enabled("snapshot_trading_drawings")?null:this._model.properties().tradingProperties.showOrders.value()?o.prototype.paneViews.call(this):null}priceAxisViews(e,t){return TradingView.printing&&!l.enabled("snapshot_trading_drawings")?null:this._model.properties().tradingProperties.showOrders.value()?o.prototype.priceAxisViews.call(this,e,t):null}adapter(){return this._adapter}hasContextMenu(){return this._adapter.shouldShowContextMenu()}contextMenuItems(){return this._adapter.callOnContextMenu()}movable(){return Boolean(this._adapter._onMoveCallback)}formatter(){return this._formatter}static createProperties(e){var t=new a("linetoolorder",e,!1,!1);return this._configureProperties(t),t}}t.LineToolOrder=u},87440:(e,t,i)=>{"use strict";i.d(t,{LineToolParallelChannel:()=>h});var s=i(50151),r=i(86441),n=i(46100),o=i(88348),a=i(13087),l=i(1722),c=i(88640);class h extends a.LineDataSource{constructor(e,t,s,r){super(e,t||h.createProperties(),s,r),this._priceAxisViews.push(this.createPriceAxisView(3)),this._coordOffsetWhileMovingOrChanging=null,this._pendingPriceOffset=null,i.e(1583).then(i.bind(i,26013)).then((({ParallelChannelPaneView:e})=>{this._setPaneViews([new e(this,this._model)])}))}paneViews(e){return null!==this._pendingPriceOffset&&this._applyPendingPriceOffset(),super.paneViews(e)}setLastPoint(e,t){t&&t.shift()&&2===this.points().length&&this._snapPoint45Degree(e,this.points()[0]);const i=(0,l.clone)(e) +;return super.setLastPoint(e),i}startMoving(e,t,i,s){super.startMoving(e,t,i,s),this._coordOffsetWhileMovingOrChanging=this._findPixelsHeight()}endMoving(e,t,i){return this._coordOffsetWhileMovingOrChanging=null,super.endMoving(e,t,i)}startChanging(e,t){super.startChanging(e,t),this._coordOffsetWhileMovingOrChanging=this._findPixelsHeight()}endChanging(e,t,i){return this._coordOffsetWhileMovingOrChanging=null,super.endChanging(e,t,i)}restoreExternalPoints(e,t,i){const s=i?e.points:this._timePoint.map(((t,i)=>({price:t.price,offset:e.points[i].offset,time_t:e.points[i].time_t})));if(super.restoreExternalPoints({...e,points:s},t),t.pricesChanged&&this._points.length===s.length)for(let e=0;e=4)return;this._snapPointBeforeChange(e,t,i);const a=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[0])),l=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[1])),c=(0,s.ensureNotNull)(this.pointToScreenPoint(t)),h=(0,s.ensureNotNull)(this._coordOffsetWhileMovingOrChanging),d=(0,s.ensureNotNull)(this.priceScale()),u=(0,s.ensure)(null===(n=this.ownerSource())||void 0===n?void 0:n.firstValue());switch(e){case 0:super.setPoint(e,t,i),this._points[2].price=d.coordinateToPrice(c.y+h,u);break;case 1:super.setPoint(e,t,i);break;case 2:super.setPoint(e,t,i),this._points[0].price=d.coordinateToPrice(c.y-h,u),this._points[0].index=t.index;break;case 3:this._points[1].price=d.coordinateToPrice(c.y-h,u),this._points[1].index=t.index;break;case 4:{const e=l.subtract(a),t=(c.x-a.x)/e.x,i=a.addScaled(e,t),s=c.y-i.y;this._points[2].price=d.coordinateToPrice(a.y+s,u);break}case 5:{const e=l.subtract(a),t=(c.x-a.x)/e.x,i=a.addScaled(e,t),s=c.y-i.y;this._points[0].price=d.coordinateToPrice(a.y+s,u),this._points[1].price=d.coordinateToPrice(l.y+s,u);break}}const p=this.linkKey().value();if(p&&!r&&e<4){const e=this._points.map((e=>e.price));(0,o.changeLineStyle)({model:this._model,linkKey:p,state:{prices:e}})}}state(e){const t=super.state(e);return this._pendingPriceOffset&&(t.priceOffset=this._pendingPriceOffset),t}restoreExternalState(e){const{prices:t,...i}=e;if(t&&this.isActualSymbol())for(let e=0;ee.index<=t.index?[e,t]:[t,e],s=i(t[0],t[1]),r=i(t[2],t[3]);let n,o,a,l;t[2].pricenull!==e))}_correctLastPoint(e){if(this._points.length<2||this._points[1].index===this._points[0].index)return e;const t=(0,s.ensureNotNull)(this.pointToScreenPoint(e)),i=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[1])),n=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[0])),o=i.subtract(n),a=(t.x-n.x)/o.x,l=n.addScaled(o,a),c=t.y-l.y,h=n.add(new r.Point(0,c));return(0,s.ensureNotNull)(this.screenPointToPoint(h))}static _configureProperties(e){super._configureProperties(e),e.hasChild("labelText")||e.addChild("labelText",new c.default("")),e.addExclusion("labelText")}_isTimePointsValid(){return this._timePoint.every((e=>Number.isFinite(e.price)))}_axisPoints(){const e=this.points(),t=this._points[0]?this.pointToScreenPoint(this._points[0]):null,i=this._points[1]?this.pointToScreenPoint(this._points[1]):null,n=this._points[2]?this.pointToScreenPoint(this._points[2]):null;if(t&&i&&n){const o=i.y-t.y,a=n.add(new r.Point(0,o));e.push((0,s.ensureNotNull)(this.screenPointToPoint(a)))}return e}_convertLastPointTo3rdPoint(e){const t=(0,s.ensureNotNull)(this.pointToScreenPoint(e)),i=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[1])),n=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[0])),o=i.subtract(n),a=(t.x-n.x)/o.x,l=n.addScaled(o,a),c=t.y-l.y,h=n.add(new r.Point(0,c));return(0,s.ensureNotNull)(this.screenPointToPoint(h))}_findPixelsHeight(){const e=this.pointToScreenPoint(this._points[2]),t=this.pointToScreenPoint(this._points[0]);return e&&t?e.y-t.y:null} +_applyPendingPriceOffset(){const e=this._pendingPriceOffset;if(null===e||this._points.length<3)return;const t=this.priceScale(),i=(0,s.ensureNotNull)(this.ownerSource()).firstValue();if(!t||t.isEmpty()||null===i)return;const r=e+this._points[0].price,n=e+this._points[1].price,o=.5*(r+n)-e,a=.5*(r+n),l=t.priceToCoordinate(o,i),c=t.priceToCoordinate(a,i)-l,h=t.priceToCoordinate(this._points[0].price,i)+c,d=t.coordinateToPrice(h,i);this._points[2].price=d,this._timePoint[2].price=d,this._points[2].index=this._points[0].index,this._timePoint[2].time_t=this._timePoint[0].time_t,this._timePoint[2].offset=this._timePoint[0].offset,this._pendingPriceOffset=null}_snapPointBeforeChange(e,t,i){if(i&&i.shift())switch(e){case 0:case 1:this._snapPoint45Degree(t,this._points[1-e]);break;case 2:case 3:const i=(0,s.ensureNotNull)(this.getPoint(5-e));this._snapPoint45Degree(t,i)}}}},40418:(e,t,i)=>{"use strict";i.d(t,{LineToolPath:()=>c});var s=i(50151),r=i(86441),n=i(46100),o=i(45197),a=i(13087),l=i(68806);class c extends a.LineDataSource{constructor(e,t,s,r){const n=t||c.createProperties();super(e,n,s,r),this._finished=!1,i.e(1583).then(i.bind(i,62801)).then((t=>{this._setPaneViews([new t.PathPaneView(this,e)])}))}pointsCount(){return-1}name(){return"Path"}hasEditableCoordinates(){return!1}finish(){this._finished=!0,this._lastPoint=null,this.normalizePoints(),this.createServerPoints()}addPoint(e,t,i){var n;if(this._finished)return!0;const a=(0,s.ensureNotNull)(this.priceScale()),l=this._model.timeScale().indexToCoordinate(e.index),c=e.price,h=(0,s.ensure)(null===(n=this.ownerSource())||void 0===n?void 0:n.firstValue()),d=a.priceToCoordinate(c,h);if(this._points.length>0){const e=this._points[this._points.length-1],i=this._model.timeScale().indexToCoordinate(e.index),s=e.price,n=a.priceToCoordinate(s,h),c=new r.Point(l,d).subtract(new r.Point(i,n)).length();if(!(null==t?void 0:t.isApiEvent())&&c<(0,o.interactionTolerance)().minDistanceBetweenPoints)return this._lastPoint=null,this.normalizePoints(),this.createServerPoints(),!0}return super.addPoint(e,t,i)}static createProperties(e){const t=new n.DefaultProperty("linetoolpath",e);return this._configureProperties(t),t}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(2285),i.e(344),i.e(8882),i.e(8167),i.e(8537)]).then(i.bind(i,74481)).then((e=>e.PathDefinitionsViewModel))}static _configureProperties(e){super._configureProperties(e),e.addChild("linesWidths",new l.LineToolWidthsProperty([(0,s.ensureDefined)(e.child("lineWidth"))])),e.addChild("linesColors",new l.LineToolColorsProperty([e.childs().lineColor]))}}},63596:(e,t,i)=>{"use strict";var s=i(36298).TranslatedString,r=i(13087).LineDataSource,n=i(53801).LevelsProperty,o=i(68806),a=o.LineToolWidthsProperty,l=o.LineToolColorsProperty,c=new s("erase level line",i.tf(null,void 0,i(12962)));class h extends r{constructor(e,t,s,r){super(e,t||h.createProperties(),s,r),i.e(1583).then(i.bind(i,87202)).then((({PitchfanLinePaneView:e})=>{this._setPaneViews([new e(this,this._model)])}))}levelsCount(){return h.LevelsCount} +pointsCount(){return 3}name(){return"Pitchfan"}processErase(e,t){var i="level"+t,s=this.properties()[i].visible;e.setProperty(s,!1,c)}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(2285),i.e(344),i.e(8882),i.e(8167),i.e(8537)]).then(i.bind(i,81658))).PitchBaseDefinitionsViewModel}static createProperties(e){var t=new n("linetoolpitchfan",e,!1,{range:[0,8]});return this._configureProperties(t),t}static _configureProperties(e){super._configureProperties(e);for(var t=[e.child("median").child("linewidth")],i=[e.child("median").child("color")],s=0;s<=this.LevelsCount;s++)t.push(e.child("level"+s).child("linewidth")),i.push(e.child("level"+s).child("color"));e.addChild("linesColors",new l(i)),e.addChild("linesWidths",new a(t))}}h.LevelsCount=8,t.LineToolPitchfan=h},90095:(e,t,i)=>{"use strict";var s;i.d(t,{LineToolPitchforkStyle:()=>s}),function(e){e[e.Original=0]="Original",e[e.Schiff=1]="Schiff",e[e.Inside=2]="Inside",e[e.Schiff2=3]="Schiff2"}(s||(s={}))},70309:(e,t,i)=>{"use strict";var s=i(36298).TranslatedString,r=i(13087).LineDataSource,n=i(53801).LevelsProperty,o=i(39347).Action,a=i(95059).ACTION_ID,l=i(90095).LineToolPitchforkStyle,c=null,h=i(68806),d=h.LineToolWidthsProperty,u=h.LineToolColorsProperty,p=new s("erase level line",i.tf(null,void 0,i(12962))),_=new s("change {title} style",i.tf(null,void 0,i(74428)));class m extends r{constructor(e,t,i,s){super(e,t||m.createProperties(),i,s),this._properties.style.listeners().subscribe(this,this._recreatePaneView),this._recreatePaneView()}levelsCount(){return m.LevelsCount}additionalActions(e){for(var t=[],r=[{title:i.tf(null,void 0,i(25595)),actionId:a.ChartLineToolPitchforkChangeTypeToOriginal},{title:i.tf(null,void 0,i(66276)),actionId:a.ChartLineToolPitchforkChangeTypeToModifiedSchiff},{title:i.tf(null,void 0,i(9114)),actionId:a.ChartLineToolPitchforkChangeTypeToInside},{title:i.tf(null,void 0,i(51464)),actionId:a.ChartLineToolPitchforkChangeTypeToSchiff}],n=0;n<4;n++){var l=new o({actionId:r[n].actionId,options:{checked:this.properties().style.value()===n,checkable:!0,label:r[n].title,payload:{target:this,value:n},onExecute:function(t){var i=t.getPayload(),r=i.target;e.setProperty(r.properties().style,i.value,_.format({title:new s(r.name(),r.title())})),r.updateAllViews(),r._model.updateSource(r)}}});t.push(l)}return[t[0],t[3],t[1],t[2]]}_recreatePaneView(){if(null!==c){var e=[];this._properties.style.value()===l.Original?e=[new c.PitchforkLinePaneView(this,this._model)]:this._properties.style.value()===l.Schiff?e=[new c.SchiffPitchforkLinePaneView(this,this._model)]:this._properties.style.value()===l.Schiff2?e=[new c.SchiffPitchfork2LinePaneView(this,this._model)]:this._properties.style.value()===l.Inside&&(e=[new c.InsidePitchforkLinePaneView(this,this._model)]),this._setPaneViews(e)}else i.e(1583).then(i.bind(i,95337)).then((e=>{null===c&&(c=e),this._recreatePaneView()}))}pointsCount(){return 3}name(){return"Pitchfork"}processErase(e,t){var i="level"+t,s=this.properties()[i].visible;e.setProperty(s,!1,p)}static createProperties(e){ +var t=new n("linetoolpitchfork",e,!1,{range:[0,8]});return this._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(2285),i.e(344),i.e(8882),i.e(8167),i.e(8537)]).then(i.bind(i,769))).PitchForkDefinitionsViewModel}static _configureProperties(e){super._configureProperties(e);for(var t=[e.child("median").child("linewidth")],i=[e.child("median").child("color")],s=0;s<=this.LevelsCount;s++)t.push(e.child("level"+s).child("linewidth")),i.push(e.child("level"+s).child("color"));e.addChild("linesColors",new u(i)),e.addChild("linesWidths",new d(t))}}m.LevelsCount=8,t.LineToolPitchfork=m},67686:(e,t,i)=>{"use strict";i.d(t,{LineToolPolyline:()=>l});var s=i(50151),r=i(86441),n=i(46100),o=i(45197),a=i(13087);class l extends a.LineDataSource{constructor(e,t,s,r){const n=t||l.createProperties();super(e,n,s,r),this._finished=!1,i.e(1583).then(i.bind(i,50253)).then((t=>{this._setPaneViews([new t.PolylinePaneView(this,e)])}))}pointsCount(){return-1}name(){return"Polyline"}hasEditableCoordinates(){return!1}finish(){this._finished=!0,this._lastPoint=null,this.normalizePoints(),this.createServerPoints()}addPoint(e,t,i){var n;if(this._finished)return!0;const a=(0,s.ensureNotNull)(this.priceScale()),l=this._model.timeScale().indexToCoordinate(e.index),c=e.price,h=(0,s.ensure)(null===(n=this.ownerSource())||void 0===n?void 0:n.firstValue()),d=a.priceToCoordinate(c,h),u=(0,o.interactionTolerance)().minDistanceBetweenPoints;if(this._points.length>0){const e=this._points[this._points.length-1],i=this._model.timeScale().indexToCoordinate(e.index),s=e.price,n=a.priceToCoordinate(s,h),o=new r.Point(l,d).subtract(new r.Point(i,n)).length();if(!(null==t?void 0:t.isApiEvent())&&oe.PolylinesDefinitionsViewModel))}static _configureProperties(e){super._configureProperties(e),e.addExclusion("filled")}}},37619:(e,t,i)=>{"use strict";var s=i(87564).LineToolTrading,r=i(13087).LineDataSource,n=i(21648).LineToolTradingPriceAxisView,o=i(47043),a=i(46100).DefaultProperty;const l=i(14483);var c=i(98517).sortSourcesPreOrdered.LineToolPosition;function h(e){return null==e?e="":e+="",e}class d{constructor(e){this._line=e,this._data={bodyText:"position",quantityText:"0"},this._closeEnabled=!0,this._direction="buy",this._profitState="neutral"}setDirection(e){return this._direction=e,this._line.updateAllViewsAndRedraw(),this}setProfitState(e){return this._profitState=e,this._line.updateAllViewsAndRedraw(),this}getPrice(){return this._line.points().length>0?this._line.points()[0].price:this._line._timePoint.length>0?this._line._timePoint[0].price:void 0}setPrice(e){if(this._line.points().length>0){var t=this._line.points()[0];t.price=e,this._line._points[0]=t,this._line.normalizePoints(),this._line.updateAllViewsAndRedraw()}return this._line._timePoint.length>0&&(this._line._timePoint[0].price=e),this}getText(){return this._data.bodyText}setText(e){return this._data.bodyText=e||"",this._line.updateAllViewsAndRedraw(),this}setTooltip(e){return this._line.properties().tooltip.setValue(h(e)),this}getTooltip(){return this._line.properties().tooltip.value()}setProtectTooltip(e){return this._line.properties().protectTooltip.setValue(h(e)),this}getProtectTooltip(){return this._line.properties().protectTooltip.value()}setCloseTooltip(e){return this._line.properties().closeTooltip.setValue(h(e)),this}getCloseTooltip(){return this._line.properties().closeTooltip.value()}setReverseTooltip(e){return this._line.properties().reverseTooltip.setValue(h(e)),this}getReverseTooltip(){return this._line.properties().reverseTooltip.value()}getQuantity(){return this._data.quantityText}setQuantity(e){return this._data.quantityText=e||"",this._line.updateAllViewsAndRedraw(),this}getExtendLeft(){var e=this._line.properties().extendLeft.value();return"inherit"===e?this._line._model.properties().tradingProperties.extendLeft.value():e}setExtendLeft(e){return this._line.properties().extendLeft.setValue(e),this}getLineLength(){var e=this._line.properties().lineLength.value();return"inherit"===e?this._line._model.properties().tradingProperties.lineLength.value():e}getLineLengthUnit(){return this._line.properties().lineLengthUnit.value()}setLineLength(e,t="percentage"){const i=t&&"pixel"===t?e:Math.max(0,Math.min(e,100));return this._line.properties().lineLength.setValue(i),this._line.properties().lineLengthUnit.setValue(t),this}getLineColor(){var e=this._line.properties();return("buy"===this._direction?e.lineBuyColor:e.lineSellColor).value()}setLineColor(e){return"buy"===this._direction?this.setLineBuyColor(e):this.setLineSellColor(e),this}setLineBuyColor(e){return this._line.properties().lineBuyColor.setValue(e),this}setLineSellColor(e){ +return this._line.properties().lineSellColor.setValue(e),this}getLineStyle(){var e=this._line.properties().lineStyle.value();return"inherit"===e?this._line._model.properties().tradingProperties.lineStyle.value():e}setLineStyle(e){return this._line.properties().lineStyle.setValue(e),this}getLineWidth(){var e=this._line.properties().lineWidth.value();return"inherit"===e?this._line._model.properties().tradingProperties.lineWidth.value():e}setLineWidth(e){return this._line.properties().lineWidth.setValue(e),this}getBodyBorderColor(){var e=this._line.properties();return("buy"===this._direction?e.bodyBorderBuyColor:e.bodyBorderSellColor).value()}setBodyBorderColor(e){return"buy"===this._direction?this.setBodyBorderBuyColor(e):this.setBodyBorderSellColor(e),this}setBodyBorderBuyColor(e){return this._line.properties().bodyBorderBuyColor.setValue(e),this}setBodyBorderSellColor(e){return this._line.properties().bodyBorderSellColor.setValue(e),this}getBodyBackgroundColor(){return o.getColorFromProperties(this._line.properties().bodyBackgroundColor,this._line.properties().bodyBackgroundTransparency)}setBodyBackgroundColor(e){return o.setColorToProperties(e,this._line.properties().bodyBackgroundColor,this._line.properties().bodyBackgroundTransparency),this}getBodyTextColor(){var e=this._line.properties();return("positive"===this._profitState?e.bodyTextPositiveColor:"negative"===this._profitState?e.bodyTextNegativeColor:e.bodyTextNeutralColor).value()}setBodyTextColor(e){return"positive"===this._profitState?this.setBodyTextPositiveColor(e):"negative"===this._profitState?this.setBodyTextNegativeColor(e):this.setBodyTextNeutralColor(e),this}setBodyTextPositiveColor(e){return this._line.properties().bodyTextPositiveColor.setValue(e),this}setBodyTextNegativeColor(e){return this._line.properties().bodyTextNegativeColor.setValue(e),this}setBodyTextNeutralColor(e){return this._line.properties().bodyTextNeutralColor.setValue(e),this}getBodyFont(){return o.getFontFromProperties(this._line.properties().bodyFontFamily,this._line.properties().bodyFontSize,this._line.properties().bodyFontBold,this._line.properties().bodyFontItalic)}setBodyFont(e){return o.setFontToProperties(e,this._line.properties().bodyFontFamily,this._line.properties().bodyFontSize,this._line.properties().bodyFontBold,this._line.properties().bodyFontItalic),this}getQuantityBorderColor(){var e=this._line.properties();return("buy"===this._direction?e.quantityBorderBuyColor:e.quantityBorderSellColor).value()}setQuantityBorderColor(e){return"buy"===this._direction?this.setQuantityBorderBuyColor(e):this.setQuantityBorderSellColor(e),this}setQuantityBorderBuyColor(e){return this._line.properties().quantityBorderBuyColor.setValue(e),this}setQuantityBorderSellColor(e){return this._line.properties().quantityBorderSellColor.setValue(e),this}getQuantityBackgroundColor(){var e=this._line.properties();return("buy"===this._direction?e.quantityBackgroundBuyColor:e.quantityBackgroundSellColor).value()}setQuantityBackgroundColor(e){ +return"buy"===this._direction?this.setQuantityBackgroundBuyColor(e):this.setQuantityBackgroundSellColor(e),this}setQuantityBackgroundBuyColor(e){return this._line.properties().quantityBackgroundBuyColor.setValue(e),this}setQuantityBackgroundSellColor(e){return this._line.properties().quantityBackgroundSellColor.setValue(e),this}getQuantityTextColor(){return o.getColorFromProperties(this._line.properties().quantityTextColor,this._line.properties().quantityTextTransparency)}setQuantityTextColor(e){return o.setColorToProperties(e,this._line.properties().quantityTextColor,this._line.properties().quantityTextTransparency),this}getQuantityFont(){return o.getFontFromProperties(this._line.properties().quantityFontFamily,this._line.properties().quantityFontSize,this._line.properties().quantityFontBold,this._line.properties().quantityFontItalic)}setQuantityFont(e){return o.setFontToProperties(e,this._line.properties().quantityFontFamily,this._line.properties().quantityFontSize,this._line.properties().quantityFontBold,this._line.properties().quantityFontItalic),this}getReverseButtonBorderColor(){var e=this._line.properties();return("buy"===this._direction?e.reverseButtonBorderBuyColor:e.reverseButtonBorderSellColor).value()}setReverseButtonBorderColor(e){return"buy"===this._direction?this.setReverseButtonBorderBuyColor(e):this.setReverseButtonBorderSellColor(e),this}setReverseButtonBorderBuyColor(e){return this._line.properties().reverseButtonBorderBuyColor.setValue(e),this}setReverseButtonBorderSellColor(e){return this._line.properties().reverseButtonBorderSellColor.setValue(e),this}getReverseButtonBackgroundColor(){return o.getColorFromProperties(this._line.properties().reverseButtonBackgroundColor,this._line.properties().reverseButtonBackgroundTransparency)}setReverseButtonBackgroundColor(e){return o.setColorToProperties(e,this._line.properties().reverseButtonBackgroundColor,this._line.properties().reverseButtonBackgroundTransparency),this}getReverseButtonIconColor(){var e=this._line.properties();return("buy"===this._direction?e.reverseButtonIconBuyColor:e.reverseButtonIconSellColor).value()}setReverseButtonIconColor(e){return"buy"===this._direction?this.setReverseButtonIconBuyColor(e):this.setReverseButtonIconSellColor(e),this}setReverseButtonIconBuyColor(e){return this._line.properties().reverseButtonIconBuyColor.setValue(e),this}setReverseButtonIconSellColor(e){return this._line.properties().reverseButtonIconSellColor.setValue(e),this}getCloseButtonBorderColor(){var e=this._line.properties();return("buy"===this._direction?e.closeButtonBorderBuyColor:e.closeButtonBorderSellColor).value()}setCloseButtonBorderColor(e){return"buy"===this._direction?this.setCloseButtonBorderBuyColor(e):this.setCloseButtonBorderSellColor(e),this}setCloseButtonBorderBuyColor(e){return this._line.properties().closeButtonBorderBuyColor.setValue(e),this}setCloseButtonBorderSellColor(e){return this._line.properties().closeButtonBorderSellColor.setValue(e),this}getCloseButtonBackgroundColor(){ +return o.getColorFromProperties(this._line.properties().closeButtonBackgroundColor,this._line.properties().closeButtonBackgroundTransparency)}setCloseButtonBackgroundColor(e){return o.setColorToProperties(e,this._line.properties().closeButtonBackgroundColor,this._line.properties().closeButtonBackgroundTransparency),this}getCloseButtonIconColor(){var e=this._line.properties();return("buy"===this._direction?e.closeButtonIconBuyColor:e.closeButtonIconSellColor).value()}setCloseButtonIconColor(e){return"buy"===this._direction?this.setCloseButtonIconBuyColor(e):this.setCloseButtonIconSellColor(e),this}setCloseButtonIconBuyColor(e){return this._line.properties().closeButtonIconBuyColor.setValue(e),this}setCloseButtonIconSellColor(e){return this._line.properties().closeButtonIconSellColor.setValue(e),this}block(){this._blocked=!0,this._line.updateAllViewsAndRedraw()}unblock(){this._blocked=!1,this._line.updateAllViewsAndRedraw()}isFunction(e){return"function"==typeof e}onReverse(e,t){return t?this.isFunction(t)&&(this._onReverseData=e,this._onReverseCallback=t):this.isFunction(e)&&(this._onReverseCallback=e),this}callOnReverse(){this.isFunction(this._onReverseCallback)&&this._onReverseCallback.call(this,this._onReverseData)}isOnReverseCallbackPresent(){return this.isFunction(this._onReverseCallback)}onClose(e,t){return t?this.isFunction(t)&&(this._onCloseData=e,this._onCloseCallback=t):this.isFunction(e)&&(this._onCloseCallback=e),this}setCloseEnabled(e){return this._closeEnabled===e||(this._closeEnabled=e,this._onCloseCallback&&this._line.updateAllViewsAndRedraw()),this}isCloseEnabled(){return this._closeEnabled}callOnClose(){this.isFunction(this._onCloseCallback)&&this._closeEnabled&&this._onCloseCallback.call(this,this._onCloseData)}isOnCloseCallbackPresent(){return this._closeEnabled&&this.isFunction(this._onCloseCallback)}onModify(e,t){return t?this.isFunction(t)&&(this._onModifyData=e,this._onModifyCallback=t):this.isFunction(e)&&(this._onModifyCallback=e),this}callOnModify(){this.isFunction(this._onModifyCallback)&&this._onModifyCallback.call(this,this._onModifyData)}onContextMenu(e,t){return t?this.isFunction(t)&&(this._onContextMenuData=e,this._onContextMenuCallback=t):this.isFunction(e)&&(this._onContextMenuCallback=e),this}shouldShowContextMenu(){return this.isFunction(this._onContextMenuCallback)}callOnContextMenu(){if(this.isFunction(this._onContextMenuCallback))return this._onContextMenuCallback.call(this,this._onContextMenuData)}remove(){this._line._model.removeSource(this._line),delete this._line}}class u extends s{constructor(e,t){super(e,t||u.createProperties()),this._adapter=new d(this),i.e(1583).then(i.t.bind(i,46258,19)).then((({PositionPaneView:e})=>{this._setPaneViews([new e(this,this._model)])}))}zorder(){return c}isSpeciallyZOrderedSource(){return!0}setPoint(e,t,i){this._points[e]=t,this.normalizePoints()}addPoint(e,t){return this._points.push(e),this._lastPoint=null,this.normalizePoints(),this.createServerPoints(),!0}name(){return"Position"}createPriceAxisView(e){ +return this._priceAxisView=new n(this,{pointIndex:e,backgroundPropertyGetter:()=>this._adapter.getLineColor()}),this._priceAxisView}paneViews(){return TradingView.printing&&!l.enabled("snapshot_trading_drawings")?null:this._model.properties().tradingProperties.showPositions.value()?r.prototype.paneViews.call(this):null}priceAxisViews(e,t){return TradingView.printing&&!l.enabled("snapshot_trading_drawings")?null:this._model.properties().tradingProperties.showPositions.value()?r.prototype.priceAxisViews.call(this,e,t):null}hasContextMenu(){return this._adapter.shouldShowContextMenu()}contextMenuItems(){return this._adapter.callOnContextMenu()}formatter(){return this._formatter}static createProperties(e){var t=new a("linetoolposition",e,!1,!1);return this._configureProperties(t),t}}t.LineToolPosition=u},21316:(e,t,i)=>{"use strict";var s,r;i.r(t),i.d(t,{AlertStatus:()=>s,Direction:()=>r}),function(e){e[e.Waiting=0]="Waiting",e[e.Success=1]="Success",e[e.Failure=2]="Failure"}(s||(s={})),function(e){e[e.Up=1]="Up",e[e.Down=2]="Down"}(r||(r={}))},30597:(e,t,i)=>{"use strict";var s=i(50151).ensureNotNull,r=i(13087).LineDataSource,n=i(46100).DefaultProperty,o=i(21316);class a extends r{constructor(e,t,s,r){super(e,t||a.createProperties(),s,r),this._predictionPaneView=null;const n=this._model.mainSeries();n.properties().interval.subscribe(this,(()=>{this.setStatus(o.AlertStatus.Waiting)})),n.dataEvents().dataUpdated().subscribe(this,this.recalculateStateByData),i.e(1583).then(i.t.bind(i,75061,19)).then((({PredictionPaneView:e})=>{this._predictionPaneView=new e(this,this._model),this._setPaneViews([this._predictionPaneView])}))}destroy(){const e=this._model.mainSeries();e.properties().interval.unsubscribeAll(this),e.dataEvents().dataUpdated().unsubscribeAll(this),super.destroy()}dataAndViewsReady(){return super.dataAndViewsReady()&&this._predictionPaneView&&this._predictionPaneView.iconsReady()}isSynchronizable(){return!1}status(){return this._properties.status.value()}setStatus(e){return this._properties.status.setValue(e)}pointsCount(){return 2}name(){return"Forecast"}restorePoints(e,t,i){super.restorePoints(e,t,i),this.recalculateStateByData()}recalculateStateByData(){if(!this.isSourceHidden()&&!(this._points.length<2||this._model.mainSeries().bars().isEmpty())){var e=this._points[1];if(this.status())e.index>this._model.timeScale().baseIndex()&&this.setStatus(o.AlertStatus.Waiting);else{var t=this._model.mainSeries().bars().valueAt(e.index);if(null!==t){var i=this.direction();if(i===o.Direction.Up&&t[TradingView.HIGH_PLOT]>=e.price)this.setStatus(o.AlertStatus.Success);else if(i===o.Direction.Down&&t[TradingView.LOW_PLOT]<=e.price)this.setStatus(o.AlertStatus.Success);else{var r=s(this._model.mainSeries().bars().lastIndex());e.index!==r&&this.setStatus(o.AlertStatus.Failure)}}}}}addPoint(e){var t=super.addPoint(e);return t&&this.recalculateStateByData(),t}endChanging(){super.endChanging(),this.setStatus(o.AlertStatus.Waiting),this.recalculateStateByData()}onData(e){super.onData(e),this.recalculateStateByData()} endMoving(e,t,i){super.endMoving(e,t,i),this.setStatus(o.AlertStatus.Waiting),this.recalculateStateByData()}direction(){if(this.points().length<2)return o.Direction.Up;var e=this.points()[0];return this.points()[1].price>e.price?o.Direction.Up:o.Direction.Down}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(2285),i.e(344),i.e(8882),i.e(8167),i.e(8537)]).then(i.bind(i,54440))).PredictionDefinitionsViewModel}cloneable(){return!1}static createProperties(e){var t=new n("linetoolprediction",e);return this._configureProperties(t),t}static _configureProperties(e){super._configureProperties(e),e.merge({status:o.AlertStatus.Waiting})}}t.LineToolPrediction=a},27039:(e,t,i)=>{"use strict";var s=i(13087).LineDataSource,r=i(46100).DefaultProperty,n=i(68806).LineToolColorsProperty;class o extends s{constructor(e,t,s,r){super(e,t||o.createProperties(),s,r),i.e(1583).then(i.t.bind(i,86583,19)).then((({PriceLabelPaneView:e})=>{this._setPaneViews([new e(this,this._model)])}))}pointsCount(){return 1}name(){return"Price Label"}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(2285),i.e(344),i.e(8882),i.e(8167),i.e(8537)]).then(i.bind(i,17265))).PriceLabelDefinitionsViewModel}static createProperties(e){var t=new r("linetoolpricelabel",e);return this._configureProperties(t),t}static _configureProperties(e){super._configureProperties(e),e.addChild("linesColors",new n([e.childs().borderColor])),e.addChild("textsColors",new n([e.childs().color]))}}t.LineToolPriceLabel=o},32831:(e,t,i)=>{"use strict";i.r(t),i.d(t,{LineToolPriceNote:()=>w});var s=i(50151),r=i(13087),n=i(33013),o=i(24633),a=i(32430),l=i(68806),c=i(17236),h=i(13637),d=i(88640),u=i(77680);const p={intervalsVisibilities:{...c.intervalsVisibilitiesDefaults},showLabel:!1,horzLabelsAlign:"center",vertLabelsAlign:"top",fontSize:14,bold:!1,italic:!1,priceLabelFontSize:12,priceLabelBold:!1,priceLabelItalic:!1},_=(0,n.getHexColorByName)("color-tv-blue-500"),m={lineColor:_,textColor:_,priceLabelBackgroundColor:_,priceLabelBorderColor:_,priceLabelTextColor:(0,n.getHexColorByName)("color-white")},g=new Map([[o.StdTheme.Light,m],[o.StdTheme.Dark,m]]),f=(0,h.extractAllPropertiesKeys)((0,s.ensureDefined)(g.get(o.StdTheme.Light))),v=(0,h.extractAllPropertiesKeys)(p),y=[...f,...v,...a.commonLineToolPropertiesStateKeys,"text"];class S extends u.LineDataSourceThemedProperty{constructor(e){var t,i;super(e),this._textProperty=new d.default(null!==(i=null===(t=e.state)||void 0===t?void 0:t.text)&&void 0!==i?i:""),this.addChild("text",this._textProperty),this.addChild("linesColors",new l.LineToolColorsProperty([(0,s.ensureDefined)(this.child("lineColor"))])),this.addChild("backgroundsColors",new l.LineToolColorsProperty([(0,s.ensureDefined)(this.child("priceLabelBackgroundColor"))])),this.addChild("textsColors",new l.LineToolColorsProperty([(0,s.ensureDefined)(this.child("priceLabelTextColor"))]))}template(){return{...super.template(),text:this._textProperty.value()}}static create(e){return new this({defaultName:"linetoolpricenote", defaultsSupplier:()=>(0,h.factoryDefaultsForCurrentTheme)(p,g),nonThemedDefaultsKeys:v,themedDefaultsKeys:f,allStateKeys:y,state:e})}}var b=i(28558);class w extends r.LineDataSource{constructor(e,t,s,r){super(e,t||w.createProperties(),s,r),this._labelMovingDelta=null,i.e(1583).then(i.bind(i,29734)).then((t=>{this._setPaneViews([new t.PriceNotePaneView(this,e)])}))}pointsCount(){return 2}name(){return"Price Note"}template(){return this._properties.template()}startMoving(e,t,i){if(1===t){if(this.isSourceHidden())return;const i=(0,s.ensureDefined)(e.logical),r=this.points()[1];this._labelMovingDelta={index:r.index-i.index,price:r.price-i.price},this.startChanging(t,i)}else this._labelMovingDelta=null,super.startMoving(e,t,i)}move(e,t,i){if(null!==this._labelMovingDelta){const t=(0,s.ensureDefined)(e.logical),r={index:t.index+this._labelMovingDelta.index,price:t.price+this._labelMovingDelta.price};this.setPoint(1,r,i),this.updateAllViews((0,b.sourceChangeEvent)(this.id()))}else super.move(e,t,i)}endMoving(e,t,i){return null!==this._labelMovingDelta?(this._labelMovingDelta=null,this.endChanging(!1,e)):super.endMoving(e,t,i)}static createProperties(e){const t=S.create(e);return this._configureProperties(t),t}_applyTemplateImpl(e){super._applyTemplateImpl(e),this.properties().childs().text.setValue(e.text)}async _getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(2285),i.e(344),i.e(8882),i.e(8167),i.e(8537)]).then(i.bind(i,11980)).then((e=>e.PriceNoteDefinitionsViewModel))}_snapTo45DegreesAvailable(){return!0}static _addCollectedProperties(e){}}},59776:(e,t,i)=>{"use strict";i.d(t,{LineToolPriceRange:()=>m});var s=i(13087),r=i(50151),n=i(24633),o=i(13637),a=i(30541),l=i(32430);const c={...a.nonThemedFactoryDefaultsBase,extendLeft:!1,extendRight:!1},h=a.themedFactoryDefaultsBase,d=(0,o.extractAllPropertiesKeys)((0,r.ensureDefined)(h.get(n.StdTheme.Light))),u=(0,o.extractAllPropertiesKeys)(c),p=[...d,...u,...l.commonLineToolPropertiesStateKeys,...a.allPropertiesStateKeysBase];class _ extends a.DateAndPriceBaseProperties{static create(e){return new this({defaultName:"linetoolpricerange",defaultsSupplier:()=>(0,o.factoryDefaultsForCurrentTheme)(c,h),nonThemedDefaultsKeys:u,themedDefaultsKeys:d,allStateKeys:p,state:e})}}class m extends s.LineDataSource{constructor(e,t,s,r){super(e,t||m.createProperties(),s,r),i.e(1583).then(i.bind(i,61416)).then((e=>{this._setPaneViews([new e.PriceRangePaneView(this,this._model)])}))}pointsCount(){return 2}name(){return"Price Range"}template(){return this._properties.template()}static createProperties(e){const t=_.create(e);return this._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(2285),i.e(344),i.e(8882),i.e(8167),i.e(8537)]).then(i.bind(i,83115))).GeneralDatePriceRangeDefinitionsViewModel}}},66967:(e,t,i)=>{"use strict";i.d(t,{LineToolProjection:()=>o});var s=i(37122),r=i(53801),n=i(68806);class o extends s.LineToolFibWedgeBase{constructor(e,t,s,r){super(e,null!=t?t:o.createProperties(),s,r), i.e(1583).then(i.bind(i,75219)).then((e=>{this._setPaneViews([new e.ProjectionLinePaneView(this,this._model)])}))}levelsCount(){return 1}name(){return"Projection"}static createProperties(e){const t=new r.LevelsProperty("linetoolprojection",e,!1,{range:[1,1]});return this._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(2285),i.e(344),i.e(8882),i.e(8167),i.e(8537)]).then(i.bind(i,12501))).ProjectionDefinitionsViewModel}static _configureProperties(e){super._configureProperties(e),e.addChild("linesColors",new n.LineToolColorsProperty([e.childs().trendline.childs().color]))}}},10279:(e,t,i)=>{"use strict";i.d(t,{LineToolRay:()=>r});var s=i(47246);class r extends s.LineToolTrendLine{constructor(e,t,i,s){super(e,null!=t?t:r.createProperties(),i,s)}name(){return"Ray"}static createProperties(e){const t=s.LineToolTrendLine._createPropertiesImpl("linetoolray",e);return r._configureProperties(t),t}}},32948:(e,t,i)=>{"use strict";i.d(t,{LineToolRectangle:()=>c});var s=i(86441),r=i(46100),n=i(88640),o=i(13087),a=i(68806),l=i(50151);class c extends o.LineDataSource{constructor(e,t,s,r){const n=t||c.createProperties();super(e,n,s,r),i.e(1583).then(i.bind(i,31320)).then((({RectanglePaneView:t})=>{const i=[new t(this,e)];this._setPaneViews(i)}))}pointsCount(){return 2}textColorsProperty(){return this.properties().childs().showLabel.value()?super.textColorsProperty():null}name(){return"Rectangle"}setPoint(e,t,i){if(e<2&&super.setPoint(e,t,i),i&&i.shift()){const i=this._getAnchorPointForIndex(e);if(e>=4)return this._correctMiddlePoints(e,t,i),void this.normalizePoints();this._snapPoint45Degree(t,i)}switch(e){case 2:this._points[1].price=t.price,this._points[0].index=t.index;break;case 3:this._points[0].price=t.price,this._points[1].index=t.index;break;case 4:this._points[0].index=t.index;break;case 5:this._points[1].index=t.index;break;case 6:this._points[0].price=t.price;break;case 7:this._points[1].price=t.price}this.normalizePoints()}getPoint(e){return e<2?super.getPoint(e):this._getAnchorPointForIndex(e)}template(){const e=super.template();return e.text=this.properties().childs().text.value(),e}static createProperties(e,t){const i=new r.DefaultProperty("linetoolrectangle",e,void 0,t);return this._configureProperties(i),i}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(2285),i.e(344),i.e(8882),i.e(8167),i.e(8537)]).then(i.bind(i,3664)).then((e=>e.RectangleDefinitionsViewModel))}_applyTemplateImpl(e){super._applyTemplateImpl(e),this.properties().childs().text.setValue(e.text)}_snapPoint45Degree(e,t,i){const s=this._priceScale,r=this.ownerSource();if(null===s||null===r)return;const n=r.firstValue();if(null===n)return;const o=this._model.timeScale(),a=(0,l.ensureNotNull)(this.pointToScreenPoint(e)),c=(0,l.ensureNotNull)(this.pointToScreenPoint(t)),h=a.x-c.x,d=a.y-c.y,u=h<0?-1:1,p=d<0?-1:1,_=Math.max(Math.abs(h),Math.abs(d)),m=Math.round(o.coordinateToIndex(c.x+_*u)),g=Math.abs(o.indexToCoordinate(m)-c.x),f=s.coordinateToPrice(c.y+g*p,n);e.index=m,e.price=f} @@ -622,10 +622,10 @@ _correctMiddlePoints(e,t,i){e<6?this._correctRightLeftMiddlePoint(e,t,i):this._c r=s.price,n=(s.index+i.index)/2}return{index:n,price:r}}}},4895:(e,t,i)=>{"use strict";var s;i.d(t,{RiskDisplayMode:()=>s}),function(e){e.Percentage="percents",e.Money="money"}(s||(s={}))},95539:(e,t,i)=>{"use strict";var s;i.d(t,{RiskRewardPointIndex:()=>s}),function(e){e[e.Entry=0]="Entry",e[e.Close=1]="Close",e[e.ActualEntry=2]="ActualEntry",e[e.ActualClose=3]="ActualClose"}(s||(s={}))},29378:(e,t,i)=>{"use strict";i.d(t,{LineToolRiskRewardLong:()=>x,LineToolRiskRewardShort:()=>P});var s=i(50151),r=i(87663),n=i(86094),o=i(34256),a=i(13087),l=i(4895),c=i(95539),h=i(42275),d=i(87095);class u extends h.PriceAxisView{constructor(e,t){super(),this._source=e,this._data=t}_updateRendererData(e,t,i){if(e.visible=!1,!this._showAxisLabel())return;const s=this._source.priceScale();if(0===this._source.points().length||null===s||s.isEmpty())return;const r=this._source.ownerSource(),n=null!==r?r.firstValue():null;if(null===n)return;const o=this._data.priceProperty.value(),a=(0,d.resetTransparency)(this._data.colorProperty.value());i.background=a,i.textColor=this.generateTextColor(a),i.coordinate=s.priceToCoordinate(o,n),e.text=s.formatPrice(o,n),e.visible=!0}_showAxisLabel(){return this._source.properties().childs().showPriceLabels.value()}}var p=i(88640);class _ extends p.default{constructor(e,t){super(),this._lineSource=e,this._pointIndex=t}value(){const e=this._lineSource.points()[this._pointIndex].price;return this._formatAndParsePrice(e)}state(){return this.value()}merge(e,t){return this.setValue(e),t?[]:null}_formatAndParsePrice(e){const t=(0,s.ensureNotNull)(this._lineSource.ownerSource()).formatter();if(t.parse){const i=t.format(e),s=t.parse(i);return s.res?s.value:e}return e}}class m extends _{constructor(e){super(e,0)}setValue(e){const t=this._lineSource.points()[this._pointIndex];this._lineSource.startChanging(this._pointIndex,t),t.price=parseFloat(""+e),this._lineSource.setPoint(this._pointIndex,t),this._lineSource.recalculate(),this._lineSource.model().updateSource(this._lineSource),this._listeners.fire(this,""),this._lineSource.endChanging(!1,!1),this._lineSource.syncPriceLevels()}}class g extends _{constructor(e){super(e,1)}value(){const e=this._lineSource.stopPrice();return this._formatAndParsePrice(e)}setValue(e){const t=Math.round(Math.abs(e-this._lineSource.entryPrice())*this._lineSource.ownerSourceBase());this._lineSource.properties().childs().stopLevel.setValue(t),this._lineSource.syncPriceLevels()}}class f extends _{constructor(e){super(e,2)}value(){const e=this._lineSource.profitPrice();return this._formatAndParsePrice(e)}setValue(e){const t=Math.round(Math.abs(e-this._lineSource.entryPrice())*this._lineSource.ownerSourceBase());this._lineSource.properties().childs().profitLevel.setValue(t),this._lineSource.syncPriceLevels()}}var v=i(1722),y=i(88348),S=i(28558);function b(e){return parseFloat(e.toFixed(2))}class w extends a.LineDataSource{constructor(e,t,n,a){super(e,t,n,a), this._syncStateExclusions=["points","entryPrice","stopPrice","targetPrice","stopLevel","profitLevel","riskSize","qty","amountTarget","amountStop"],this._riskInChange=!1,this.version=2,t.hasChild("stopLevel")||t.hasChild("profitLevel")||(t.addProperty("stopLevel",0),t.addProperty("profitLevel",0),this.ownerSourceChanged().subscribe(this,(()=>{const i=(0,s.ensureNotNull)(e.timeScale().visibleBarsStrictRange()),r=i.firstBar(),n=i.lastBar(),a=(0,s.ensureNotNull)(this.ownerSource()),l=a.priceScale();let c=(0,s.ensureNotNull)(a.priceRange(r,n));if(l&&l.isLog()){const e=l.logicalToPrice(c.minValue()),t=l.logicalToPrice(c.maxValue());c=new o.PriceRange(e,t)}if(c&&!c.isEmpty()){const e=Math.round(.2*c.length()*this.ownerSourceBase());t.merge({stopLevel:e,profitLevel:e})}}),!0));const h=t.childs();h.stopLevel.listeners().subscribe(this,this.recalculate),h.stopLevel.listeners().subscribe(null,(()=>{this.properties().childs().stopPrice.childChanged(null,"")})),h.profitLevel.listeners().subscribe(this,this.recalculate),h.profitLevel.listeners().subscribe(null,(()=>{this.properties().childs().targetPrice.childChanged(null,"")})),t.addChild("entryPrice",new m(this)),t.addChild("stopPrice",new g(this)),t.addChild("targetPrice",new f(this)),t.hasChild("riskSize")||t.addProperty("riskSize",0),t.hasChild("qty")||t.addProperty("qty",0),t.hasChild("amountTarget")||t.addProperty("amountTarget",h.accountSize.value()),t.hasChild("amountStop")||t.addProperty("amountStop",h.accountSize.value()),t.addExclusion("riskSize"),t.addExclusion("qty"),t.addExclusion("amountTarget"),t.addExclusion("amountStop"),this._riskInPercentsFormatter=new r.NumericFormatter(2),this._riskInMoneyFormatter=new r.NumericFormatter,h.risk.subscribe(this,this._recalculateRiskSize),h.accountSize.subscribe(this,this._recalculateRiskSize),h.riskDisplayMode.subscribe(this,this._recalculateRisk),h.riskDisplayMode.subscribe(this,this._recalculateRiskSize),h.entryPrice.subscribe(this,this._recalculateRiskSize),h.stopPrice.subscribe(this,this._recalculateRiskSize),h.profitLevel.subscribe(this,this._recalculateRiskSize),h.profitLevel.subscribe(this,this.syncPriceLevels.bind(this)),h.stopLevel.subscribe(this,this._recalculateRiskSize),h.stopLevel.subscribe(this,this.syncPriceLevels.bind(this)),h.qty.subscribe(this,this._recalculateRiskSize),this.ownerSourceChanged().subscribe(null,((e,t)=>{e&&e.barsProvider().dataUpdated().unsubscribeAll(this),t&&t.barsProvider().dataUpdated().subscribe(this,this._onSeriesUpdated)})),this.pointAdded().subscribe(this,(e=>{switch(e){case c.RiskRewardPointIndex.Entry:case c.RiskRewardPointIndex.Close:this._recalculateRiskSize(),this._recalculateQty()}})),this.pointChanged().subscribe(this,(e=>{switch(e){case c.RiskRewardPointIndex.Entry:case c.RiskRewardPointIndex.Close:this._recalculateRiskSize(),this._recalculateQty()}})),h.riskDisplayMode.value()===l.RiskDisplayMode.Percentage&&h.risk.value()>100&&h.riskDisplayMode.setValueSilently(l.RiskDisplayMode.Money),h.entryPrice.subscribe(this,this._recalculateQty), h.stopPrice.subscribe(this,this._recalculateQty),h.riskSize.subscribe(this,this._recalculateQty),h.entryPrice.subscribe(this,this._recalculateAmount),h.profitLevel.subscribe(this,this._recalculateAmount),h.stopLevel.subscribe(this,this._recalculateAmount),h.accountSize.subscribe(this,this._recalculateAmount),h.riskSize.subscribe(this,this._recalculateAmount),h.qty.subscribe(this,this._recalculateAmount),this._entryPriceAxisView=new u(this,{colorProperty:h.linecolor,priceProperty:h.entryPrice}),this._stopPriceAxisView=new u(this,{colorProperty:h.stopBackground,priceProperty:h.stopPrice}),this._profitPriceAxisView=new u(this,{colorProperty:h.profitBackground,priceProperty:h.targetPrice}),i.e(1583).then(i.bind(i,56457)).then((({RiskRewardPaneView:t})=>{const i=[new t(this,e)];this._setPaneViews(i)}))}destroy(){var e;null===(e=this.ownerSource())||void 0===e||e.barsProvider().dataUpdated().unsubscribeAll(this),this.ownerSourceChanged().unsubscribeAll(this),super.destroy()}hasEditableCoordinates(){return!1}setOwnerSource(e){super.setOwnerSource(e);const t=this.ownerSource();t&&t.symbolSource().symbolInfo()&&(this._recalculateAmount(),this._recalculateRiskSize(),this._recalculateQty())}pointsCount(){return 2}priceAxisViews(e,t){return this.isSourceHidden()||t!==this.priceScale()||this._model.paneForSource(this)!==e?null:[this._entryPriceAxisView,this._stopPriceAxisView,this._profitPriceAxisView]}updateAllViews(e){this.isActualSymbol()&&this.properties().childs().visible.value()&&((0,y.hideAllDrawings)().value()&&this.userEditEnabled()||(super.updateAllViews(e),this._entryPriceAxisView.update(e),this._stopPriceAxisView.update(e),this._profitPriceAxisView.update(e)))}migrateVersion(e,t,i){if(1===e&&this._points.length>=1){const e=[];e.push(this._points[0]);let t=this._points[0];if(t={price:t.price,index:this._getClosePointIndex(t.index)},e.push(t),this._points[1]&&e.push(this._points[1]),this._points[2]&&e.push(this._points[2]),this._points=e,this._timePoint.length>=1){const t=[],i=this._timePoint[0];t.push(i);const s={price:i.price,time_t:i.time_t,offset:this._getClosePointIndex(i.offset)};t.push(s),this._timePoint[1]&&e.push(this._points[1]),this._timePoint[2]&&e.push(this._points[2]),this._timePoint=t}}}restoreExternalState(e){if((0,v.isNumber)(e.entryPrice)){if(e=Object.assign({},e),!this.isActualSymbol()){this._timePoint[0].price=e.entryPrice,delete e.entryPrice}this.properties().merge(e)}else super.restoreExternalState(e)}addPoint(e,t,i){e.price=this._roundPrice(e.price),super.addPoint(e,void 0,!0);const s={price:e.price,index:this._getClosePointIndex(e.index)};super._addPointIntenal(s,void 0,!0);const r=this._calculateActualEntry(e,s);if(r){super._addPointIntenal(r,void 0,!0);const e=this._findClosePoint(r,s);e&&super._addPointIntenal(e,void 0,!0)}return this._lastPoint=null,this.normalizePoints(),this.createServerPoints(),!0}setPoint(e,t,i,s){if(!this.isActualSymbol())return;const r=this.properties().childs();switch(this._muteSyncLineStyle(),e){case 0:this._changeEntryPoint(t);break;case 2: -r.stopPrice.setValue(this.prepareStopPrice(t.price));break;case 3:r.targetPrice.setValue(this.prepareProfitPrice(t.price));break;case 1:t.price=this._roundPrice(t.price),super.setPoint(1,t),this.recalculate()}this._unmuteSyncLineStyleWithoutApplyingChanges(),this.syncPriceLevels()}getPoint(e){switch(e){case 0:return this._points[0];case 1:return{index:this._points[1].index,price:this._points[0].price};case 2:return{index:this._points[0].index,price:this.stopPrice()};case 3:return{index:this._points[0].index,price:this.profitPrice()}}return null}setPoints(e){this._muteSyncLineStyle(),super.setPoints(e),this.recalculate(),this._unmuteSyncLineStyleWithoutApplyingChanges(),this.syncPriceLevels()}start(){super.start(),this.recalculate()}startMoving(e,t,i,r){const n=(0,s.ensureDefined)(e.logical);n.price=this._roundPrice(n.price),super.startMoving(e,t,i)}move(e,t,i,r){const n=(0,s.ensureDefined)(e.logical);n.price=this._roundPrice(n.price),super.move(e,t,i),this.recalculate(),this._entryPriceAxisView.update((0,S.sourceChangeEvent)(this.id()))}axisPoints(){if(!this._points[c.RiskRewardPointIndex.ActualEntry])return[];const e=this._points[c.RiskRewardPointIndex.ActualEntry];let t=null;if(4===this._points.length)t=this._points[c.RiskRewardPointIndex.ActualClose];else{const e=this.lastBarData();if(!e)return[];t={index:e.index,price:e.closePrice}}return[e,t]}recalculateStateByData(){this.recalculate()}recalculate(){if(0===this.points().length)return;const e=this.properties().childs(),t=e.targetPrice.value(),i=e.stopPrice.value(),s=[this._points[0],this._points[1]],r=this._calculateActualEntry(this.points()[0],this.points()[1]);if(r){s.push(r);const e=this._findClosePoint(r,this.points()[1]);e&&s.push(e)}this._points=s,t!==e.targetPrice.value()&&e.targetPrice.listeners().fire(e.targetPrice,""),i!==e.stopPrice.value()&&e.stopPrice.listeners().fire(e.stopPrice,"")}syncPriceLevels(){const e=this.linkKey().value();if(e){const t=this.properties().childs(),i={entryPrice:t.entryPrice.value(),stopLevel:t.stopLevel.value(),profitLevel:t.profitLevel.value()};(0,y.changeLineStyle)({linkKey:e,state:i,model:this._model})}}entryPrice(){return this.points()[0].price}lastBarData(){var e;const t=null===(e=this.ownerSource())||void 0===e?void 0:e.barsProvider();if(!t)return null;const i=t.bars().firstIndex(),r=t.bars().lastIndex();if(null===i||null===r||isNaN(i)||isNaN(r))return null;const o=this.points();if(4===o.length){const e=o[c.RiskRewardPointIndex.ActualClose];return e.indexs?(e.risk.setValue(s),e.riskSize.setValue(s)):e.riskSize.setValue(t)}_roundPrice(e){const t=this.ownerSourceBase();return Math.round(e*t)/t}_ownerSourcePointValue(){var e,t,i;return null!==(i=null===(t=null===(e=this.ownerSource())||void 0===e?void 0:e.symbolSource().symbolInfo())||void 0===t?void 0:t.pointvalue)&&void 0!==i?i:1}static _configureProperties(e){a.LineDataSource._configureProperties(e),e.addExclusion("stopLevel"),e.addExclusion("profitLevel"),e.addExclusion("stopPrice"),e.addExclusion("targetPrice"),e.addExclusion("entryPrice")}_onSeriesUpdated(e,t,i){this.isSourceHidden()||this._points.length<2||null!==i&&i.index>Math.max(this._points[0].index,this._points[1].index)||this.recalculateStateByData()}_recalculateRisk(){const e=this.properties().childs(),t=e.riskDisplayMode.value(),i=e.riskSize.value(),s=e.accountSize.value();let r=e.risk.value();r=t===l.RiskDisplayMode.Percentage?b(i/s*100):b(s/100*r),this._riskInChange=!0,e.risk.setValue(+this._riskFormatter(t).format(r)),this._riskInChange=!1}_recalculateAmount(){if(0===this.points().length)return;const e=this.properties().childs(),t=e.accountSize.value(),i=e.entryPrice.value(),s=e.qty.value(),r=e.stopPrice.value(),n=e.targetPrice.value(),o=this._ownerSourcePointValue();e.amountTarget.setValue(this._amountTarget(t,n,i,s,o)),e.amountStop.setValue(this._amountStop(t,r,i,s,o))}_recalculateQty(){if(0===this.points().length)return;const e=this.properties().childs(),t=e.entryPrice.value(),i=e.stopPrice.value(),s=e.riskSize.value()/(Math.abs(t-i)*this._ownerSourcePointValue());e.qty.setValue(s)}_calculateActualEntry(e,t){const i=this.ownerSource();if(!i)return null;const r=i.barsProvider().bars();if(r.isEmpty())return null;const n=(0,s.ensureNotNull)(r.firstIndex()),o=Math.max(e.index,n),a=e.price,l=(0,s.ensureNotNull)(r.lastIndex()),c=Math.min(l,t.index);for(const e of r.rangeIterator(o,c+1)){const t=e.value;if(null!==t&&(0,s.ensure)(t[2])>=a&&(0,s.ensure)(t[3])<=a)return{index:e.index,price:a}}return null}_riskFormatter(e){return e===l.RiskDisplayMode.Percentage?this._riskInPercentsFormatter:this._riskInMoneyFormatter}_getClosePointIndex(e){const t=this._model.timeScale(),i=Math.round(t.width()/t.barSpacing()) -;return e+Math.max(3,Math.round(.15*i))}_findClosePoint(e,t){const i=this.ownerSource();if(!i)return null;const r=i.barsProvider().bars(),n=(0,s.ensureNotNull)(r.firstIndex()),o=Math.max(e.index,n),a=(0,s.ensureNotNull)(r.lastIndex()),l=Math.min(a,t.index);for(const e of r.rangeIterator(o,l+1)){const t=e.value;if(null===t)continue;const i=this._checkStopPrice(t);if(null!=i)return{index:e.index,price:i}}return null}_changeEntryPoint(e){const t=this.properties().childs(),i=t.stopPrice.value(),s=t.targetPrice.value(),r=1/this.ownerSourceBase(),n=Math.min(i,s)+r,o=Math.max(i,s)-r;e.price=Math.max(n,Math.min(o,this._roundPrice(e.price))),super.setPoint(0,e),t.stopPrice.setValue(i),t.targetPrice.setValue(s)}}var C=i(46100);class P extends w{constructor(e,t,i,s){super(e,null!=t?t:P.createProperties(),i,s)}name(){return"Risk/Reward short"}stopPrice(){return this.entryPrice()+this.properties().childs().stopLevel.value()/this.ownerSourceBase()}calculatePL(e){return this.entryPrice()-e}profitPrice(){return this.entryPrice()-this.properties().childs().profitLevel.value()/this.ownerSourceBase()}prepareStopPrice(e){e=this._roundPrice(e);const t=this.entryPrice()+1/this.ownerSourceBase();return Math.max(e,t)}prepareProfitPrice(e){e=this._roundPrice(e);const t=this.entryPrice()-1/this.ownerSourceBase();return Math.min(e,t)}static createProperties(e){const t=new C.DefaultProperty("linetoolriskrewardshort",e);return this._configureProperties(t),t}_amountTarget(e,t,i,s,r){return b(e+(i-t)*s*r)}_amountStop(e,t,i,s,r){return b(e-(t-i)*s*r)}_checkStopPrice(e){const t=this.stopPrice(),i=this.profitPrice();return(0,s.ensure)(e[2])>=t?this.stopPrice():(0,s.ensure)(e[3])<=i?this.profitPrice():null}_orderSide(){throw new Error("not supported")}}class x extends w{constructor(e,t,i,s){super(e,null!=t?t:x.createProperties(),i,s)}name(){return"Risk/Reward long"}stopPrice(){return this.entryPrice()-this.properties().childs().stopLevel.value()/this.ownerSourceBase()}profitPrice(){return this.entryPrice()+this.properties().childs().profitLevel.value()/this.ownerSourceBase()}calculatePL(e){return e-this.entryPrice()}prepareStopPrice(e){e=this._roundPrice(e);const t=this.entryPrice()-1/this.ownerSourceBase();return Math.min(e,t)}prepareProfitPrice(e){e=this._roundPrice(e);const t=this.entryPrice()+1/this.ownerSourceBase();return Math.max(e,t)}static createProperties(e){const t=new C.DefaultProperty("linetoolriskrewardlong",e);return this._configureProperties(t),t}_amountTarget(e,t,i,s,r){return b(e+(t-i)*s*r)}_amountStop(e,t,i,s,r){return b(e-(i-t)*s*r)}_checkStopPrice(e){const t=this.stopPrice(),i=this.profitPrice();return(0,s.ensure)(e[3])<=t?this.stopPrice():(0,s.ensure)(e[2])>=i?this.profitPrice():null}_orderSide(){throw new Error("not supported")}}},32491:(e,t,i)=>{"use strict";var s=i(86441).Point,r=i(4652).distanceToLine,n=i(13087).LineDataSource,o=i(46100).DefaultProperty,a=i(68806).LineToolColorsProperty;class l extends n{constructor(e,t,s,r){super(e,t||l.createProperties(),s,r), -i.e(1583).then(i.t.bind(i,55832,19)).then((({RotatedRectanglePaneView:e})=>{this._setPaneViews([new e(this,this._model)])}))}startChanging(e,t){if(super.startChanging(e,t),0===e||1===e){var i=this._getPaneViews()[0],s=i._points[0],n=i._points[1],o=i._points[2];this._distance=r(s,n,o).distance}}setPoint(e,t,i){if(super.setPoint(e,t,i),0===e||1===e){var r=this._getPaneViews()[0];r.update();var n=r._points[0],o=r._points[1].subtract(n),a=new s(o.y,-o.x).normalized().scaled(this._distance),l=n.add(a),c=this.screenPointToPoint(l);this._points[2]=c}}endChanging(e,t){delete this._distance,super.endChanging(e,t)}pointsCount(){return 3}name(){return"Rotated Rectangle"}hasEditableCoordinates(){return!1}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(2285),i.e(344),i.e(8882),i.e(8167),i.e(8537)]).then(i.bind(i,20061))).GeneralFiguresDefinitionsViewModel}_snapTo45DegreesAvailable(){return!0}static createProperties(e){var t=new o("linetoolrotatedrectangle",e);return this._configureProperties(t),t}static _configureProperties(e){super._configureProperties(e),e.addChild("linesColors",new a([e.color]))}}t.LineToolRotatedRectangle=l},5761:(e,t,i)=>{"use strict";var s=i(53801).LevelsProperty,r=i(70309).LineToolPitchfork;class n extends r{constructor(e,t,i,s){super(e,t||n.createProperties(),i,s)}name(){return"Modified Schiff Pitchfork"}static createProperties(e){var t=new s("linetoolschiffpitchfork",e,!1,{range:[0,8]});return this._configureProperties(t),t}}t.LineToolSchiffPitchfork=n},85806:(e,t,i)=>{"use strict";var s=i(53801).LevelsProperty,r=i(70309).LineToolPitchfork;class n extends r{constructor(e,t,i,s){super(e,t||n.createProperties(),i,s)}name(){return"Schiff Pitchfork"}static createProperties(e){var t=new s("linetoolschiffpitchfork2",e,!1,{range:[0,8]});return this._configureProperties(t),t}}t.LineToolSchiffPitchfork2=n},98624:(e,t,i)=>{"use strict";i.d(t,{LineToolSignpost:()=>m});var s=i(11542),r=i(46100),n=i(13087),o=i(88640);class a extends o.default{constructor(e){super(),this._source=e,e.pointAdded().subscribe(this,(()=>this.listeners().fire(this,""))),e.pointChanged().subscribe(this,(()=>this.listeners().fire(this,"")))}value(){const e=this._source.properties().childs().position.value();return parseFloat(e.toFixed(2))}setValue(e){this._source.properties().childs().position.setValue(e),this._source.model().updateSource(this._source),this.listeners().fire(this,""),this._source.syncMultichartState({pricesChanged:!1,indexesChanged:!1})}}var l=i(75149);class c extends l.LineDataSourcePointIndexProperty{constructor(e,t){super(e,t),this._source=e}_setPointImpl(e){this._source.setPointAndChangeIndex(this._pointIndex,e)}}var h=i(68806),d=i(50151),u=i(85573),p=i(88348);class _ extends n.LineDataSource{constructor(){super(...arguments),this._startMovingAnchorY=NaN}priceSource(){return this.ownerSource()}addPoint(e,t,i){return super.addPoint(this._updatePositionAndCorrectPoint(e),t,i)}setPoint(e,t,i){ +r.stopPrice.setValue(this.prepareStopPrice(t.price));break;case 3:r.targetPrice.setValue(this.prepareProfitPrice(t.price));break;case 1:t.price=this._points[0].price,super.setPoint(1,t),this.recalculate()}this._unmuteSyncLineStyleWithoutApplyingChanges(),this.syncPriceLevels()}getPoint(e){switch(e){case 0:return this._points[0];case 1:return{index:this._points[1].index,price:this._points[0].price};case 2:return{index:this._points[0].index,price:this.stopPrice()};case 3:return{index:this._points[0].index,price:this.profitPrice()}}return null}setPoints(e){this._muteSyncLineStyle(),super.setPoints(e),this.recalculate(),this._unmuteSyncLineStyleWithoutApplyingChanges(),this.syncPriceLevels()}start(){super.start(),this.recalculate()}startMoving(e,t,i,r){const n=(0,s.ensureDefined)(e.logical);n.price=this._roundPrice(n.price),super.startMoving(e,t,i)}move(e,t,i,r){const n=(0,s.ensureDefined)(e.logical);n.price=this._roundPrice(n.price),super.move(e,t,i),this.recalculate(),this._entryPriceAxisView.update((0,S.sourceChangeEvent)(this.id()))}axisPoints(){if(!this._points[c.RiskRewardPointIndex.ActualEntry])return[];const e=this._points[c.RiskRewardPointIndex.ActualEntry];let t=null;if(4===this._points.length)t=this._points[c.RiskRewardPointIndex.ActualClose];else{const e=this.lastBarData();if(!e)return[];t={index:e.index,price:e.closePrice}}return[e,t]}recalculateStateByData(){this.recalculate()}recalculate(){if(0===this.points().length)return;const e=this.properties().childs(),t=e.targetPrice.value(),i=e.stopPrice.value(),s=[this._points[0],this._points[1]],r=this._calculateActualEntry(this.points()[0],this.points()[1]);if(r){s.push(r);const e=this._findClosePoint(r,this.points()[1]);e&&s.push(e)}this._points=s,t!==e.targetPrice.value()&&e.targetPrice.listeners().fire(e.targetPrice,""),i!==e.stopPrice.value()&&e.stopPrice.listeners().fire(e.stopPrice,"")}syncPriceLevels(){const e=this.linkKey().value();if(e){const t=this.properties().childs(),i={entryPrice:t.entryPrice.value(),stopLevel:t.stopLevel.value(),profitLevel:t.profitLevel.value()};(0,y.changeLineStyle)({linkKey:e,state:i,model:this._model})}}entryPrice(){return this.points()[0].price}lastBarData(){var e;const t=null===(e=this.ownerSource())||void 0===e?void 0:e.barsProvider();if(!t)return null;const i=t.bars().firstIndex(),r=t.bars().lastIndex();if(null===i||null===r||isNaN(i)||isNaN(r))return null;const o=this.points();if(4===o.length){const e=o[c.RiskRewardPointIndex.ActualClose];return e.indexs?(e.risk.setValue(s),e.riskSize.setValue(s)):e.riskSize.setValue(t)}_roundPrice(e){const t=this.ownerSourceBase();return Math.round(e*t)/t}_ownerSourcePointValue(){var e,t,i;return null!==(i=null===(t=null===(e=this.ownerSource())||void 0===e?void 0:e.symbolSource().symbolInfo())||void 0===t?void 0:t.pointvalue)&&void 0!==i?i:1}static _configureProperties(e){a.LineDataSource._configureProperties(e),e.addExclusion("stopLevel"),e.addExclusion("profitLevel"),e.addExclusion("stopPrice"),e.addExclusion("targetPrice"),e.addExclusion("entryPrice")}_onSeriesUpdated(e,t,i){this.isSourceHidden()||this._points.length<2||null!==i&&i.index>Math.max(this._points[0].index,this._points[1].index)||this.recalculateStateByData()}_recalculateRisk(){const e=this.properties().childs(),t=e.riskDisplayMode.value(),i=e.riskSize.value(),s=e.accountSize.value();let r=e.risk.value();r=t===l.RiskDisplayMode.Percentage?b(i/s*100):b(s/100*r),this._riskInChange=!0,e.risk.setValue(+this._riskFormatter(t).format(r)),this._riskInChange=!1}_recalculateAmount(){if(0===this.points().length)return;const e=this.properties().childs(),t=e.accountSize.value(),i=e.entryPrice.value(),s=e.qty.value(),r=e.stopPrice.value(),n=e.targetPrice.value(),o=this._ownerSourcePointValue();e.amountTarget.setValue(this._amountTarget(t,n,i,s,o)),e.amountStop.setValue(this._amountStop(t,r,i,s,o))}_recalculateQty(){if(0===this.points().length)return;const e=this.properties().childs(),t=e.entryPrice.value(),i=e.stopPrice.value(),s=e.riskSize.value()/(Math.abs(t-i)*this._ownerSourcePointValue());e.qty.setValue(s)}_calculateActualEntry(e,t){const i=this.ownerSource();if(!i)return null;const r=i.barsProvider().bars();if(r.isEmpty())return null;const n=(0,s.ensureNotNull)(r.firstIndex()),o=Math.max(e.index,n),a=e.price,l=(0,s.ensureNotNull)(r.lastIndex()),c=Math.min(l,t.index);for(const e of r.rangeIterator(o,c+1)){const t=e.value;if(null!==t&&(0,s.ensure)(t[2])>=a&&(0,s.ensure)(t[3])<=a)return{index:e.index,price:a}}return null}_riskFormatter(e){return e===l.RiskDisplayMode.Percentage?this._riskInPercentsFormatter:this._riskInMoneyFormatter} +_getClosePointIndex(e){const t=this._model.timeScale(),i=Math.round(t.width()/t.barSpacing());return e+Math.max(3,Math.round(.15*i))}_findClosePoint(e,t){const i=this.ownerSource();if(!i)return null;const r=i.barsProvider().bars(),n=(0,s.ensureNotNull)(r.firstIndex()),o=Math.max(e.index,n),a=(0,s.ensureNotNull)(r.lastIndex()),l=Math.min(a,t.index);for(const e of r.rangeIterator(o,l+1)){const t=e.value;if(null===t)continue;const i=this._checkStopPrice(t);if(null!=i)return{index:e.index,price:i}}return null}_changeEntryPoint(e){const t=this.properties().childs(),i=t.stopPrice.value(),s=t.targetPrice.value(),r=1/this.ownerSourceBase(),n=Math.min(i,s)+r,o=Math.max(i,s)-r;e.price=Math.max(n,Math.min(o,this._roundPrice(e.price))),this.setPoints([e,{...this._points[1],price:e.price}]),t.stopPrice.setValue(i),t.targetPrice.setValue(s)}}var C=i(46100);class P extends w{constructor(e,t,i,s){super(e,null!=t?t:P.createProperties(),i,s)}name(){return"Risk/Reward short"}stopPrice(){return this.entryPrice()+this.properties().childs().stopLevel.value()/this.ownerSourceBase()}calculatePL(e){return this.entryPrice()-e}profitPrice(){return this.entryPrice()-this.properties().childs().profitLevel.value()/this.ownerSourceBase()}prepareStopPrice(e){e=this._roundPrice(e);const t=this.entryPrice()+1/this.ownerSourceBase();return Math.max(e,t)}prepareProfitPrice(e){e=this._roundPrice(e);const t=this.entryPrice()-1/this.ownerSourceBase();return Math.min(e,t)}static createProperties(e){const t=new C.DefaultProperty("linetoolriskrewardshort",e);return this._configureProperties(t),t}_amountTarget(e,t,i,s,r){return b(e+(i-t)*s*r)}_amountStop(e,t,i,s,r){return b(e-(t-i)*s*r)}_checkStopPrice(e){const t=this.stopPrice(),i=this.profitPrice();return(0,s.ensure)(e[2])>=t?this.stopPrice():(0,s.ensure)(e[3])<=i?this.profitPrice():null}_orderSide(){throw new Error("not supported")}}class x extends w{constructor(e,t,i,s){super(e,null!=t?t:x.createProperties(),i,s)}name(){return"Risk/Reward long"}stopPrice(){return this.entryPrice()-this.properties().childs().stopLevel.value()/this.ownerSourceBase()}profitPrice(){return this.entryPrice()+this.properties().childs().profitLevel.value()/this.ownerSourceBase()}calculatePL(e){return e-this.entryPrice()}prepareStopPrice(e){e=this._roundPrice(e);const t=this.entryPrice()-1/this.ownerSourceBase();return Math.min(e,t)}prepareProfitPrice(e){e=this._roundPrice(e);const t=this.entryPrice()+1/this.ownerSourceBase();return Math.max(e,t)}static createProperties(e){const t=new C.DefaultProperty("linetoolriskrewardlong",e);return this._configureProperties(t),t}_amountTarget(e,t,i,s,r){return b(e+(t-i)*s*r)}_amountStop(e,t,i,s,r){return b(e-(i-t)*s*r)}_checkStopPrice(e){const t=this.stopPrice(),i=this.profitPrice();return(0,s.ensure)(e[3])<=t?this.stopPrice():(0,s.ensure)(e[2])>=i?this.profitPrice():null}_orderSide(){throw new Error("not supported")}}},32491:(e,t,i)=>{"use strict";var s=i(86441).Point,r=i(4652).distanceToLine,n=i(13087).LineDataSource,o=i(46100).DefaultProperty,a=i(68806).LineToolColorsProperty +;class l extends n{constructor(e,t,s,r){super(e,t||l.createProperties(),s,r),i.e(1583).then(i.t.bind(i,55832,19)).then((({RotatedRectanglePaneView:e})=>{this._setPaneViews([new e(this,this._model)])}))}startChanging(e,t){if(super.startChanging(e,t),0===e||1===e){var i=this._getPaneViews()[0],s=i._points[0],n=i._points[1],o=i._points[2];this._distance=r(s,n,o).distance}}setPoint(e,t,i){if(super.setPoint(e,t,i),0===e||1===e){var r=this._getPaneViews()[0];r.update();var n=r._points[0],o=r._points[1].subtract(n),a=new s(o.y,-o.x).normalized().scaled(this._distance),l=n.add(a),c=this.screenPointToPoint(l);this._points[2]=c}}endChanging(e,t){delete this._distance,super.endChanging(e,t)}pointsCount(){return 3}name(){return"Rotated Rectangle"}hasEditableCoordinates(){return!1}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(2285),i.e(344),i.e(8882),i.e(8167),i.e(8537)]).then(i.bind(i,20061))).GeneralFiguresDefinitionsViewModel}_snapTo45DegreesAvailable(){return!0}static createProperties(e){var t=new o("linetoolrotatedrectangle",e);return this._configureProperties(t),t}static _configureProperties(e){super._configureProperties(e),e.addChild("linesColors",new a([e.color]))}}t.LineToolRotatedRectangle=l},5761:(e,t,i)=>{"use strict";var s=i(53801).LevelsProperty,r=i(70309).LineToolPitchfork;class n extends r{constructor(e,t,i,s){super(e,t||n.createProperties(),i,s)}name(){return"Modified Schiff Pitchfork"}static createProperties(e){var t=new s("linetoolschiffpitchfork",e,!1,{range:[0,8]});return this._configureProperties(t),t}}t.LineToolSchiffPitchfork=n},85806:(e,t,i)=>{"use strict";var s=i(53801).LevelsProperty,r=i(70309).LineToolPitchfork;class n extends r{constructor(e,t,i,s){super(e,t||n.createProperties(),i,s)}name(){return"Schiff Pitchfork"}static createProperties(e){var t=new s("linetoolschiffpitchfork2",e,!1,{range:[0,8]});return this._configureProperties(t),t}}t.LineToolSchiffPitchfork2=n},98624:(e,t,i)=>{"use strict";i.d(t,{LineToolSignpost:()=>m});var s=i(11542),r=i(46100),n=i(13087),o=i(88640);class a extends o.default{constructor(e){super(),this._source=e,e.pointAdded().subscribe(this,(()=>this.listeners().fire(this,""))),e.pointChanged().subscribe(this,(()=>this.listeners().fire(this,"")))}value(){const e=this._source.properties().childs().position.value();return parseFloat(e.toFixed(2))}setValue(e){this._source.properties().childs().position.setValue(e),this._source.model().updateSource(this._source),this.listeners().fire(this,""),this._source.syncMultichartState({pricesChanged:!1,indexesChanged:!1})}}var l=i(75149);class c extends l.LineDataSourcePointIndexProperty{constructor(e,t){super(e,t),this._source=e}_setPointImpl(e){this._source.setPointAndChangeIndex(this._pointIndex,e)}}var h=i(68806),d=i(50151),u=i(85573),p=i(88348);class _ extends n.LineDataSource{constructor(){super(...arguments),this._startMovingAnchorY=NaN}priceSource(){return this.ownerSource()}addPoint(e,t,i){return super.addPoint(this._updatePositionAndCorrectPoint(e),t,i)}setPoint(e,t,i){ super.setPoint(e,this._updatePositionAndCorrectPoint(t,!this.isPhantom()&&!this._allowChangeAnchorHorizontally()),i),this._syncPosition()}setPointAndChangeIndex(e,t,i){super.setPoint(e,this._updatePositionAndCorrectPoint(t,!1),i),this._syncPosition()}startMoving(e,t,i,s){s||(this._startMovingAnchorY=(0,d.ensureNotNull)(this._anchorYCoordinate())),super.startMoving(e,t,i)}move(e,t,i,s){var r;const n=(0,d.ensureDefined)((0,d.ensureNotNull)(this.startMovingPoint()).logical),o=(0,d.ensureDefined)(e.logical);if(!s&&0===t){const e=this._points[0],t=o.index-n.index,i=(0,d.ensureNotNull)(this.priceScale()),s=(0,d.ensure)(null===(r=this.ownerSource())||void 0===r?void 0:r.firstValue()),a=i.priceToCoordinate(o.price,s)-i.priceToCoordinate(n.price,s),l=this._startMovingAnchorY+a,c=i.coordinateToPrice(l,s);this._updatePositionAndCorrectPoint({index:e.index+t,price:c})}super.move(e,t,i),s||this._syncPosition()}_allowChangeAnchorHorizontally(){return!1}_updatePositionAndCorrectPoint(e,t){t&&(e.index=this._points[0].index);const i=this.priceSource();if(null===i)return e;const s=i.priceScale(),r=i.firstValue();if(null===s||s.isEmpty()||null===r)return e;const n=s.height();let o=n/2,a=e.price>=s.coordinateToPrice(o,r)?1:-1;const l=this._model.mainSeries();if(i===l){const t=l.data().search(this._baseSeriesIndexForPoint(e));if(null!==t){const i=(0,u.seriesPrice)(l,t,-1),n=(0,u.seriesPrice)(l,t,1);a=e.price>=i?1:-1,o=s.priceToCoordinate(1===a?n:i,r),e.price=1===a?Math.max(n,e.price):e.price}}const c=1===(-1===a!==s.isInverted()?-1:1)?o:n-o,h=s.priceToCoordinate(e.price,r),d=Math.min(n,Math.abs(h-o)),p=Math.max(0,Math.min(100,100*d/c))*a;return this.properties().childs().position.setValue(p),e}_baseSeriesIndexForPoint(e){return e.index}_syncPosition(){const e=this.linkKey().value();if(null!==e){const t={position:this.properties().childs().position.value()};(0,p.changeLineStyle)({linkKey:e,state:t,model:this._model})}}_anchorYCoordinate(){const e=this.priceSource();if(null===e)return null;const t=e.priceScale(),i=e.firstValue();if(null===t||t.isEmpty()||null===i)return null;const s=this._model.mainSeries(),r=this.customEvent();if(null===r)return null;let n=null;if(e===s&&(n=(0,u.seriesBasePosition)(s,r)),null===n&&(n=(0,u.noDataBasePosition)(r,t,i)),null===n)return null;const o=r.position(),a=t.priceToCoordinate(n.price,i);return(0,u.positionToCoordinate)(o,t.height(),a,(0,u.positionVisualDirection)(o,t.isInverted()))}}class m extends _{constructor(e,t,s,r){super(e,null!=t?t:m.createProperties(),s,r),i.e(1583).then(i.bind(i,26294)).then((t=>{this._setPaneViews([new t.SignpostPaneView(this,e)])}))}pointsCount(){return 1}name(){return"Signpost"}customEvent(){return{index:()=>{var e,t;return null!==(t=null===(e=this.points()[0])||void 0===e?void 0:e.index)&&void 0!==t?t:null},position:()=>this.properties().childs().position.value()}}showInObjectTree(){return!this.isPhantom()&&super.showInObjectTree()}isPhantom(){return this._model.isPhantomLine(this)}clonePositionOffset(){return{barOffset:1,xCoordOffset:0,yCoordOffset:0}}template(){ const e=super.template(),t=this.properties().childs();return e.text=t.text.value(),e.position=t.position.value(),e}shouldBeRemovedOnDeselect(){const e=this._properties.childs();if(e.showImage.value())return!1;return""===e.text.value().trim()}static createProperties(e){const t=new r.DefaultProperty("linetoolsignpost",e);return this._configureProperties(t),t.hasChild("text")||t.addChild("text",new o.default(s.t(null,void 0,i(37229)))),t.hasChild("position")||t.addChild("position",new o.default(50)),t.addExclusion("text"),t.addExclusion("position"),t.addChild("backgroundsColors",new h.LineToolColorsProperty([t.childs().plateColor])),t}_createPointProperty(e){super._createPointProperty(e);const t=this._pointsProperty.childs().points[e];t.removeProperty("price"),t.removeProperty("bar"),t.addChild("price",new a(this)),t.addChild("bar",new c(this,0))}_applyTemplateImpl(e){super._applyTemplateImpl(e),this.properties().childs().text.setValue(e.text),this.properties().childs().position.setValue(e.position)}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(2285),i.e(344),i.e(8882),i.e(8167),i.e(8537)]).then(i.bind(i,18613)).then((e=>e.SignpostDefinitionsViewModel))}static _configureProperties(e){n.LineDataSource._configureProperties(e)}}m.supportPhantomMode=!0},94803:(e,t,i)=>{"use strict";i.d(t,{LineToolSineLine:()=>n});var s=i(46100),r=i(13087);class n extends r.LineDataSource{constructor(e,t,s,r){super(e,t||n.createProperties(),s,r),i.e(1583).then(i.bind(i,5362)).then((e=>{this._setPaneViews([new e.SineLinePaneView(this,this._model)])}))}pointsCount(){return 2}name(){return"Sine Line"}static createProperties(e){const t=new s.DefaultProperty("linetoolsineline",e);return this._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(2285),i.e(344),i.e(8882),i.e(8167),i.e(8537)]).then(i.bind(i,15673))).CyclicAndSineLinesPatternDefinitionsViewModel}}},81217:(e,t,i)=>{"use strict";i.d(t,{LineToolSticker:()=>y});var s=i(88348),r=i(8459),n=i(59224),o=i(27788),a=i(14314),l=i(77680),c=i(17236),h=i(13637),d=i(32430);const u={intervalsVisibilities:{...c.intervalsVisibilitiesDefaults},size:110},p={sticker:"bitcoin",angle:.5*Math.PI},_=(0,h.extractAllPropertiesKeys)(u),m=(0,h.extractAllPropertiesKeys)(p),g=[..._,...m,...d.commonLineToolPropertiesStateKeys];class f extends l.LineDataSourceThemedProperty{constructor(e){super(e)}static create(e,t){return new this({defaultName:"linetoolsticker",defaultsSupplier:()=>(0,o.default)(u),nonThemedDefaultsKeys:_,themedDefaultsKeys:[],allStateKeys:g,state:(0,a.default)({},p,{sticker:t},null!=e?e:{})})}}const v=(0,n.getLogger)("Chart.LineToolSticker");class y extends r.LineToolSvgIconBase{constructor(e,t,i,s){super(e,t||y.createProperties(),i,s),this.version=1,this._loadViews()}name(){return"Sticker"}static createProperties(e){const t=f.create(e,s.stickerTool.value());return y._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){ return(await Promise.all([i.e(2285),i.e(344),i.e(8882),i.e(8167),i.e(8537)]).then(i.bind(i,85766))).LineDataSourceDefinitionsViewModel}async _loadViews(){const[{getSvgContentForSticker:e,getSvgRenderer:t},{StickerPaneView:s},{svgRenderer:r}]=await Promise.all([i.e(5598).then(i.bind(i,31235)),i.e(1583).then(i.bind(i,15378)),i.e(2616).then(i.bind(i,50765))]);if(!this._isDestroyed){const i=this._properties.childs().sticker.value();this._svgContent=e(i),this._onIconChanged.fire();const n=t(r,i);null===n&&v.logWarn(`Couldn't create svg renderer for sticker ${i}`),this._setPaneViews([new s(this,this._model,n)])}}}},8652:(e,t,i)=>{"use strict";i.d(t,{StudyLineDataSource:()=>x});var s=i(50151),r=i(1722),n=i(97034),o=i(13087),a=i(46100),l=i(42856),c=i(12442),h=i(33703),d=i(94739),u=i(56827);class p extends d.StudyDataSource{constructor(e,t,i,s){super(e,t.seriesSource(),i,s),this._series=t}_createStudyError(e){var t;return(0,u.createStudyError)(this._getStudyErrorDescription(e),null===(t=this._series.symbolInfo())||void 0===t?void 0:t.exchange)}}var _=i(75319),m=i(72007),g=i(41249),f=i(77475),v=i(28558),y=i(13333),S=i(11877);class b extends S.StatusProviderBase{constructor(e){super(e.model().properties().childs().scalesProperties.childs().textColor),this._source=e}color(){return"#ff0000"}errorStatus(){const e=this._source.status();return e.type===y.StudyStatusType.Error?{error:this.sourceStatusText(),solutionId:(0,y.studyStatusSolutionId)(e),title:(0,y.studyStatusTitle)(e),studyFeature:(0,y.studyStatusFeature)(e)}:null}getSplitTitle(){return this._source.titleInParts()}text(){return this._source.translatedType()}sourceStatusText(){return(0,y.convertStudyStatusToString)(this._source.status(),!0)}}var w=i(91280),C=i(79055);class P extends C.StatusView{constructor(e){super(e.statusProvider({}))}getSplitTitle(){return this._statusProvider.getSplitTitle()}}class x extends o.LineDataSource{constructor(e,t,s,r,n,o){super(e,r,n,o),this._indexes=null,this._inputs=null,this._definitionsViewModel=null,this._pointsetPoints=null,this._loadedPlots=null,this._loadedGraphics=null,this._beingCreatedPaneView=null,this._anchorsPaneView=null,this._isLegendDisplayed=!1,this._alignerCache=null,Promise.all([i.e(1583).then(i.bind(i,99058)),i.e(1583).then(i.bind(i,44666))]).then((t=>{const{LineToolBeingCreatedPaneView:i}=t[0],{StudyLineDataSourceAnchorsPaneView:s}=t[1];this._beingCreatedPaneView=new i(this,e),this._anchorsPaneView=new s(this,this.model()),this._model.lightUpdate()})),this._metaInfo=t,this._dataSource=new p(e.chartApi(),e.mainSeries(),s,t),this._dataSource.dataCleared().subscribe(this,this._onDataCleared),this._dataSource.dataUpdated().subscribe(this,this._onDataUpdated),this._dataSource.studyStatusChanged().subscribe(this,this._onStudyStatusChanged),this._statusProvider=new b(this),this._statusView=new P(this),this._showStudyArgumentsProperty=e.properties().childs().paneProperties.childs().legendProperties.childs().showStudyArguments}isDisplayedInLegend(){return this._isLegendDisplayed}titleInParts(){const e=[] @@ -633,15 +633,15 @@ return(await Promise.all([i.e(2285),i.e(344),i.e(8882),i.e(8167),i.e(8537)]).the dataAndViewsReady(){return super.dataAndViewsReady()&&this._isReady()}endChanging(e,t){const i=super.endChanging(e,t);return i.indexesChanged?this.clearData():this._updateAnchorsPrice(!0),i}moveData(e){this._dataSource.moveData(e)}restorePoints(e,t,i){super.restorePoints(e,t,i),this._updateAnchorsPrice(!0)}realign(){super.realign(),null===this._model.mainSeries().symbolInfo()&&(this._alignerCache=null)}statusProvider(e){return this._statusProvider}statusView(){return this._statusView}legendView(){return null}dataProblemModel(){return null}dataUpdatedModeModel(){return null}marketStatusModel(){return null}onStatusChanged(){return this._dataSource.studyStatusChanged()}status(){return this._dataSource.studyStatus()}recalcStudyIfNeeded(){}static createPropertiesFromStudyMetaInfoAndState(e,t,i,s){const r=(0,u.prepareStudyPropertiesForLoadChart)(e,t,i,s);return this._configureProperties(r),r}_onStudyStatusChanged(e,t){let i;switch(t.type){case _.StudyStatusType.Error:i=!0;break;case _.StudyStatusType.Completed:i=!1;break;default:return}if(i===this._isLegendDisplayed)return;this._isLegendDisplayed=i;const s=this._model.paneForSource(this);if(s){const e=this._model.panes().indexOf(s),t=w.InvalidationMask.invalidateLegendWidgetLayout(e);this.model().invalidate(t)}}_studyId(){return this._dataSource.studyId()}_isReady(){return!0}_updateAllPaneViews(e){var t,i;super._updateAllPaneViews(e),null===(t=this._beingCreatedPaneView)||void 0===t||t.update(),null===(i=this._anchorsPaneView)||void 0===i||i.update(e)}_getPointTime(e,t){const i=e.index,s=this._model.timeScale().indexToTimePoint(i);if(null!==s)return s;if(t||void 0===e.time)return null;const r=this._model.mainSeries().symbolInfo();if(null===r)return null;let n=this._model.properties().childs().timezone.value();"exchange"===n&&(n=r.timezone);const o=(0,g.cal_to_utc)((0,g.get_timezone)(n),e.time);return this._getStartBarAligner()(o)/1e3}_updateAnchorsPrice(e){}_onPointsetUpdated(e){super._onPointsetUpdated(e),this._pointsetPoints=this._points.map((e=>({price:e.price,index:e.index,time:e.time}))),this._onStudyInputsMayChange()}_onDataCleared(){this.updateAllViews((0,v.sourceChangeEvent)({sourceId:this.id(),clearData:!0})),this._model.updateSource(this)}_onDataUpdated(e,t,i){var s;this._updateAnchorsPrice(),this.updateAllViews((0,v.sourceChangeEvent)({sourceId:this.id(),firstUpdatedTimePointIndex:null===(s=e[0])||void 0===s?void 0:s.index})),this._model.updateSource(this)}_onStudyInputsMayChange(){let e=null;if(null!==this._pointsetPoints&&this._pointsetPoints.length===this.pointsCount()&&(e=this._studyInputs(this._pointsetPoints),null===e&&(this._clearAllDataExceptPointsetPoints(),this.updateAllViews((0,v.sourceChangeEvent)(this.id())))),null!==e){const t=this.metaInfo().inputs.map((e=>e.id)),i=Object.keys(e);for(const s of i)t.includes(s)||delete e[s]}this._areInputsEqual(this._inputs,e)||this._applyStudyInputs(e)}_preparePoint(e,t){return super._preparePoint(this._alignPointToRangeOfActualData(e),t)}_getPropertyDefinitionsViewModelClass(){return Promise.resolve(null)} _subscribeApplyInputsOnSeriesCompleted(){this._unsubscribeApplyInputsOnSeriesCompleted(),this._model.mainSeries().dataEvents().completed().subscribe(this,(()=>this._onStudyInputsMayChange()),!0)}_unsubscribeApplyInputsOnSeriesCompleted(){this._model.mainSeries().dataEvents().completed().unsubscribeAll(this)}_onInputsChanged(){0}static _createPropertiesFromStudyIdAndState(e,t){const i=l.StudyMetaInfo.getStudyPropertyRootNameById(e),s=new a.DefaultProperty(i,t);return this._configureProperties(s),s}static _configureProperties(e){super._configureProperties(e),e.removeExclusion("intervalsVisibilities")}_areInputsEqual(e,t){return null===t?null===e:null!==e&&(0,h.areStudyInputsEqual)(this._metaInfo.inputs,e,t)}_applyStudyInputs(e){const t=this._inputs;this._inputs=e,null!==e&&(this._unsubscribeApplyInputsOnSeriesCompleted(),this._dataSource.setInputs(e),null===t&&this.isStarted()&&!this._dataSource.isStarted()&&this._dataSource.start()),this._onInputsChanged()}_clearAllDataExceptPointsetPoints(){this._inputs=null,this._dataSource.clearData(),this._loadedPlots=null,this._indexes=null,this._loadedGraphics=null}_getStartBarAligner(){const e=this._model.mainSeries().interval();return null!==this._alignerCache&&this._alignerCache.resolution===this._model.mainSeries().interval()||(this._alignerCache={resolution:e,aligner:(0,f.createTimeToBarTimeAligner)(e,(0,s.ensureNotNull)(this._model.mainSeries().symbolInfo()))}),this._alignerCache.aligner}}},8459:(e,t,i)=>{"use strict";i.d(t,{LineToolSvgIconBase:()=>l});var s=i(50151),r=i(86441),n=i(25422),o=i(57898),a=i(13087);class l extends a.LineDataSource{constructor(e,t,i,s){super(e,t,i,s),this._onIconChanged=new o.Delegate,this._svgContent=null,this._changePointData=null,this._loadViews()}pointsCount(){return 1}hasEditableCoordinates(){return!1}getAnchorLimit(){return 80}getChangePointForSync(e){return null}startChanging(e,t){const i=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[0])),o=this.properties().childs(),a=o.size.value();let l;if(t)l=(0,s.ensureNotNull)(this.pointToScreenPoint(t));else{let e=new r.Point(0,Math.max(80,a)/2);const t=(0,n.rotationMatrix)(o.angle.value());e=(0,n.transformPoint)(t,e),l=i.add(e)}const c=i.subtract(l).length();this._changePointData={centerPoint:i,initialLength:c,initialSize:a},super.startChanging(e,t)}setPoint(e,t,i){const{centerPoint:r,initialLength:n,initialSize:o}=(0,s.ensureNotNull)(this._changePointData),a=(0,s.ensureNotNull)(this.pointToScreenPoint(t)),l=this.properties().childs();if(0===e||1===e){const t=a.subtract(r).normalized();let i=Math.acos(-t.x);Math.asin(t.y)>0&&(i=2*Math.PI-i),0===e&&(i+=Math.PI),l.angle.setValue(i)}else{const e=o*(r.subtract(a).length()/n);l.size.setValue(e)}}getSourceIcon(){const e=this.svgContent();return null===e?null:{type:"svgContent",content:e}}onSourceIconChanged(){return this._onIconChanged}svgContent(){return this._svgContent}static _configureProperties(e){super._configureProperties(e),e.addExclusion("angle")}}},79506:(e,t,i)=>{"use strict";i.d(t,{LineToolText:()=>d,LineToolTextAbsolute:()=>u}) ;var s=i(50151),r=i(86441),n=i(11542),o=i(13087),a=i(88640),l=i(46100),c=i(68806),h=i(28558);class d extends o.LineDataSource{constructor(e,t,s,r){const n=t||d.createProperties();super(e,n,s,r),this._barSpacing=e.timeScale().barSpacing(),this._recalculatePointsOnCenter=!1,i.e(1583).then(i.bind(i,62912)).then((({TextPaneView:t})=>{const i=this._recalculatePointsOnCenter?(e,t)=>{this._recalculatePointsOnCenter&&this._recalculateCenterPosition(e,t)}:void 0;this._setPaneViews([new t(this,e,void 0,void 0,void 0,void 0,void 0,i)])}))}centerPosition(){this._recalculatePointsOnCenter=!0}setPoint(e,t,i){const r=this.properties().childs();let n;if(1===e&&r.wordWrapWidth.value()){const e=this.model().timeScale();n=this.isFixed()?(0,s.ensureDefined)(this.fixedPoint()).x:e.indexToCoordinate(this.points()[0].index);const i=e.indexToCoordinate(t.index)-n-~~(r.fontsize.value()/6);if(!isFinite(i))return;r.wordWrapWidth.setValue(Math.max(100,i))}}pointsCount(){return 1}name(){return"Text"}setPriceScale(e){super.setPriceScale(e),e&&e.priceRange()&&(this._priceDencity=e.height()/(0,s.ensureNotNull)(e.priceRange()).length(),this._isPriceDencityLog=e.isLog())}restoreSize(){const e=(0,s.ensureNotNull)(this.priceScale());this._barSpacing=this.model().timeScale().barSpacing(),this._priceDencity=e.height()/(0,s.ensureNotNull)(e.priceRange()).length(),this.redraw((0,h.sourceChangeEvent)(this.id()))}redraw(e){this.updateAllViews(e),this._model.updateSource(this)}template(){const e=super.template();return e.text=this.properties().childs().text.value(),e}state(e){const t=super.state(e);return e&&(t.state.fixedSize=!1),t}barSpacing(){return this._barSpacing}priceDencity(){return this._priceDencity}isPriceDencityLog(){return this._isPriceDencityLog}hasEditableCoordinates(){return!1}shouldBeRemovedOnDeselect(){return""===this._properties.childs().text.value().trim()}static createProperties(e){const t=new l.DefaultProperty("linetooltext",e);return this._configureProperties(t),t}_applyTemplateImpl(e){super._applyTemplateImpl(e),this.properties().childs().text.setValue(e.text)}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(2285),i.e(344),i.e(8882),i.e(8167),i.e(8537)]).then(i.bind(i,94625)).then((e=>e.TextDefinitionsViewModel))}static _configureProperties(e){super._configureProperties(e),e.hasChild("text")||e.addChild("text",new a.default(n.t(null,void 0,i(37229)))),e.addChild("linesColors",new c.LineToolColorsProperty([e.childs().borderColor])),e.addChild("textsColors",new c.LineToolColorsProperty([e.childs().color])),e.addExclusion("text"),e.addExclusion("linesColors"),e.addExclusion("textsColors")}_recalculateCenterPosition(e,t){const i=this.isFixed()?(0,s.ensureDefined)(this.fixedPoint()):(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[0])),n=new r.Point(i.x-e/2,i.y-t/2),o=(0,s.ensureNotNull)(this.screenPointToPoint(n));this.setPoints([o]),this.normalizePoints(),this.createServerPoints(),this.redraw((0,h.sourceChangeEvent)(this.id()))}}class u extends d{constructor(e,t){super(e,t||u.createProperties())}name(){ -return"Anchored Text"}hasEditableCoordinates(){return!1}isFixed(){return!0}static createProperties(e){const t=new l.DefaultProperty("linetooltextabsolute",e);return this._configureProperties(t),t}}},89299:(e,t,i)=>{"use strict";i.d(t,{LineToolThreeDrivers:()=>o});var s=i(46100),r=i(13087),n=i(68806);class o extends r.LineDataSource{constructor(e,t,s,r){const n=t||o.createProperties();super(e,n,s,r),i.e(1583).then(i.bind(i,90042)).then((t=>{this._setPaneViews([new t.LineToolThreeDrivesPaneView(this,e)])}))}pointsCount(){return 7}name(){return"Three Drives Pattern"}static createProperties(e){const t=new s.DefaultProperty("linetoolthreedrivers",e);return this._configureProperties(t),t}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(2285),i.e(344),i.e(8882),i.e(8167),i.e(8537)]).then(i.bind(i,63311)).then((e=>e.PatternWithoutBackgroundDefinitionsViewModel))}static _configureProperties(e){super._configureProperties(e),e.addChild("linesColors",new n.LineToolColorsProperty([e.childs().color])),e.addChild("textsColors",new n.LineToolColorsProperty([e.childs().textcolor])),e.addChild("linesWidths",new n.LineToolWidthsProperty([e.childs().linewidth])),e.hasChild("backgroundsColors")&&e.removeProperty("backgroundsColors")}}},74861:(e,t,i)=>{"use strict";i.d(t,{LineToolTimeCycles:()=>o});var s=i(27788),r=i(46100),n=i(13087);class o extends n.LineDataSource{constructor(e,t,s,r){super(e,null!=t?t:o.createProperties(),s,r),i.e(1583).then(i.bind(i,65557)).then((e=>{this._setPaneViews([new e.TimeCyclesPaneView(this,this._model)])}))}pointsCount(){return 2}name(){return"Time Cycles"}setPoint(e,t){const i=(0,s.default)(t),r=this._points[0],n=this._points[1];r.price=i.price,n.price=i.price,this._points[e]=i,this.normalizePoints()}addPoint(e,t,i){const s=super.addPoint(e,t,!0);if(s){const e=this._points[0];this._points[1].price=e.price,i||(this.normalizePoints(),this.createServerPoints())}return s}static createProperties(e){const t=new r.DefaultProperty("linetooltimecycles",e);return this._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(2285),i.e(344),i.e(8882),i.e(8167),i.e(8537)]).then(i.bind(i,81888))).TimeCyclesPatternDefinitionsViewModel}}},87564:(e,t,i)=>{"use strict";const s=i(13087).LineDataSource,r=i(83654).alignToStep;class n extends s{constructor(e,t){super(e,t),this.customization.forcePriceAxisLabel=!0,this.customization.disableErasing=!0,this.customization.showInObjectsTree=!1,this.setSelectionEnabled(!1)}isSynchronizable(){return!1}pointsCount(){return n.POINTS_COUNT}hasContextMenu(){return!1}state(){return null}startMoving(){super.startMoving.apply(this,arguments),this._cursorMoved=!1}endMoving(){super.endMoving.apply(this,arguments),this._cursorMoved=!1}_correctPoints(e,t){this._currentMovingPoint&&this._startMovingPoint?this._currentMovingPoint.logical.price-this._startMovingPoint.logical.price&&(this._cursorMoved=!0):this._cursorMoved=!1;for(var i=1/this.priceScale().mainSource().base(),s=0;s{"use strict";i.d(t,{LineToolTrendAngle:()=>h});var s=i(86441),r=i(50151),n=i(46100),o=i(13087),a=i(88640),l=i(28558);class c extends a.default{constructor(e){super(),this._lineSource=e}value(){return Math.round(180*this._lineSource.angle()/Math.PI)}setValue(e){const t=e*Math.PI/180,i=(0,r.ensureNotNull)(this._lineSource.pointToScreenPoint(this._lineSource.points()[0])),n=Math.cos(t),o=-Math.sin(t),a=new s.Point(n,o),c=i.addScaled(a,this._lineSource.distance()),h=(0,r.ensureNotNull)(this._lineSource.screenPointToPoint(c));this._lineSource.setPoint(1,h);const d=this._lineSource.model();d.updateSource(this._lineSource),this._lineSource.updateAllViews((0,l.sourceChangeEvent)(this._lineSource.id())),d.updateSource(this._lineSource)}notifyChanged(){this._listeners.fire(this,"")}}class h extends o.LineDataSource{constructor(e,t,s,r){const n=t||h.createProperties();super(e,n,s,r),this._angle=0,this._distance=0,n.addChild("angle",new c(this)),i.e(1583).then(i.bind(i,67998)).then((({TrendAnglePaneView:t})=>{const i=[new t(this,e)];this._setPaneViews(i)}))}isSynchronizable(){return!1}pointsCount(){return 2}name(){return"Trend Angle"}angle(){return this._angle}distance(){return this._distance}addPoint(e,t){const i=super.addPoint(e,t);return i&&this._calculateAngle(),i}setLastPoint(e,t){const i=super.setLastPoint(e,t);return this.points().length>1&&this._calculateAngle(),i}axisPoints(){if(this.points().length<2)return[];const e=[this.points()[0]],t=(0,r.ensureNotNull)(this.pointToScreenPoint(this.points()[0])),i=Math.cos(this._angle)*this._distance,n=-Math.sin(this._angle)*this._distance,o=t.add(new s.Point(i,n)),a=(0,r.ensureNotNull)(this.screenPointToPoint(o));return e.push(a),e}timeAxisPoints(){return this.axisPoints()}priceAxisPoints(){return this.axisPoints()}setPoint(e,t,i){super.setPoint(e,t,i),this.points().length>1&&1===e&&this._calculateAngle()}restoreData(e){var t,i;this._angle=null!==(t=e.angle)&&void 0!==t?t:0,this._distance=null!==(i=e.distance)&&void 0!==i?i:0}state(e){const t=super.state(e);return t.angle=this._angle,t.distance=this._distance,t}cloneData(e){this._angle=e.angle(),this._distance=e.distance()}canHasAlert(){return!0}static createProperties(e){e&&void 0===e.showPercentPriceRange&&(e.showPercentPriceRange=e.showPriceRange,e.showPipsPriceRange=e.showPriceRange);const t=new n.DefaultProperty("linetooltrendangle",e);return this._configureProperties(t),t}_snapTo45DegreesAvailable(){return!0}_getAlertPlots(){const e=this._linePointsToAlertPlot(this._points,null,this._properties.childs().extendLeft.value(),this._properties.childs().extendRight.value());return null===e?[]:[e]} -_calculateAngle(){const e=(0,r.ensureNotNull)(this.pointToScreenPoint(this.points()[0]));let t=(0,r.ensureNotNull)(this.pointToScreenPoint(this.points()[1])).subtract(e);const i=t.length();i>0?(t=t.normalized(),this._angle=Math.acos(t.x),t.y>0&&(this._angle=-this._angle),this._distance=i):this._angle=0;this.properties().childs().angle.notifyChanged()}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(2285),i.e(344),i.e(8882),i.e(8167),i.e(8537)]).then(i.bind(i,34935)).then((e=>e.TrendAngleDefinitionsViewModel))}}},84123:(e,t,i)=>{"use strict";i.d(t,{LineToolTrendBasedFibExtension:()=>c});var s=i(11542),r=i(36298),n=i(53801),o=i(68806),a=i(13087);const l=new r.TranslatedString("erase level line",s.t(null,void 0,i(12962)));class c extends a.LineDataSource{constructor(e,t,s,r){super(e,t||c.createProperties(),s,r),this.version=2,i.e(1583).then(i.bind(i,38058)).then((({TrendBasedFibExtensionPaneView:e})=>{this._setPaneViews([new e(this,this._model)])}))}levelsCount(){return 24}pointsCount(){return 3}name(){return"Trend-Based Fib Extension"}migrateVersion(e,t){1===e&&this.properties().childs().extendLines.setValue(!0)}processErase(e,t){const i="level"+t,s=this.properties().childs()[i].childs().visible;e.setProperty(s,!1,l)}fibLevelsBasedOnLogScale(){var e;return this.properties().childs().fibLevelsBasedOnLogScale.value()&&Boolean(null===(e=this.priceScale())||void 0===e?void 0:e.isLog())}static createProperties(e){const t=new n.LevelsProperty("linetooltrendbasedfibextension",e,!1,{range:[0,8]});return this._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(2285),i.e(344),i.e(8882),i.e(8167),i.e(8537)]).then(i.bind(i,56194))).FibDrawingsWith24LevelsDefinitionsViewModel}static _configureProperties(e){const t=e.childs();super._configureProperties(e);const i=[t.trendline.childs().color];for(let e=1;e<=24;e++){const s=t["level"+e].childs().color;i.push(s)}e.addChild("linesColors",new o.LineToolColorsProperty(i));const s=[t.trendline.childs().linewidth,t.levelsStyle.childs().linewidth];e.addChild("linesWidths",new o.LineToolWidthsProperty(s))}}},35625:(e,t,i)=>{"use strict";i.d(t,{LineToolTrendBasedFibTime:()=>c});var s=i(11542),r=i(36298),n=i(13087),o=i(53801),a=i(68806);const l=new r.TranslatedString("erase level line",s.t(null,void 0,i(12962)));class c extends n.LineDataSource{constructor(e,t,s,r){super(e,t||c.createProperties(),s,r),this.version=1,i.e(1583).then(i.bind(i,33482)).then((({TrendBasedFibTimePaneView:e})=>{this._setPaneViews([new e(this,this._model)])}))}levelsCount(){return 11}pointsCount(){return 3}name(){return"Trend-Based Fib Time"}processErase(e,t){const i="level"+t,s=this.properties().childs()[i].childs().visible;e.setProperty(s,!1,l)}static createProperties(e){const t=new o.LevelsProperty("linetooltrendbasedfibtime",e,!1,{range:[1,11]});return this._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){ -return(await Promise.all([i.e(2285),i.e(344),i.e(8882),i.e(8167),i.e(8537)]).then(i.bind(i,60007))).TrendBasedFibTimeDefinitionsViewModel}static _configureProperties(e){super._configureProperties(e);const t=e.childs(),i=[t.trendline.childs().linewidth],s=[t.trendline.childs().color];for(let e=1;e<=11;e++)i.push(t["level"+e].childs().linewidth),s.push(t["level"+e].childs().color);e.addChild("linesColors",new a.LineToolColorsProperty(s)),e.addChild("linesWidths",new a.LineToolWidthsProperty(i))}}},47246:(e,t,i)=>{"use strict";i.d(t,{LineToolTrendLine:()=>a});var s=i(46100),r=i(13087),n=i(71243),o=i(88640);class a extends r.LineDataSource{constructor(e,t,s,r){super(e,t||a.createProperties(),s,r),this._trendLinePaneView=null,i.e(1583).then(i.bind(i,96310)).then((({TrendLinePaneView:e})=>{this._trendLinePaneView=new e(this,this._model),this._setPaneViews([this._trendLinePaneView])}))}dataAndViewsReady(){return super.dataAndViewsReady()&&null!==this._trendLinePaneView&&this._trendLinePaneView.iconsReady()}pointsCount(){return 2}name(){return"Trend Line"}canHasAlert(){return!0}showPriceLabels(){return this._properties.childs().showPriceLabels.value()}createPriceAxisView(e){return new n.LineToolPriceAxisView(this,{pointIndex:e,backgroundPropertyGetter:()=>this.showPriceLabels()?this._properties.childs().linecolor.value():null})}isForcedDrawPriceAxisLabel(){return this.showPriceLabels()}template(){const e=super.template();return e.text=this.properties().childs().text.value(),e}static createProperties(e,t){return a._createPropertiesImpl("linetooltrendline",e,t)}_getAlertPlots(){const e=this._linePointsToAlertPlot(this._points,null,this._properties.childs().extendLeft.value(),this._properties.childs().extendRight.value());return null===e?[]:[e]}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(2285),i.e(344),i.e(8882),i.e(8167),i.e(8537)]).then(i.bind(i,84926))).TrendLineDefinitionsViewModel}_applyTemplateImpl(e){super._applyTemplateImpl(e),this.properties().childs().text.setValue(e.text||"")}_snapTo45DegreesAvailable(){return!0}static _createPropertiesImpl(e,t,i){t&&void 0===t.showPercentPriceRange&&(t.showPercentPriceRange=t.showPriceRange,t.showPipsPriceRange=t.showPriceRange);const r=new s.DefaultProperty(e,t,void 0,i);return this._configureProperties(r),r}static _configureProperties(e){super._configureProperties(e),e.hasChild("text")||e.addChild("text",new o.default("")),e.addExclusion("text")}}},45579:(e,t,i)=>{"use strict";i.d(t,{LineToolTrianglePattern:()=>o});var s=i(46100),r=i(13087),n=i(68806);class o extends r.LineDataSource{constructor(e,t,s,r){const n=t||o.createProperties();super(e,n,s,r),i.e(1583).then(i.bind(i,23545)).then((t=>{this._setPaneViews([new t.LineToolTrianglePatternPaneView(this,e)])}))}pointsCount(){return 4}name(){return"Triangle Pattern"}static createProperties(e){const t=new s.DefaultProperty("linetooltrianglepattern",e);return this._configureProperties(t),t}_getPropertyDefinitionsViewModelClass(){ -return Promise.all([i.e(2285),i.e(344),i.e(8882),i.e(8167),i.e(8537)]).then(i.bind(i,25107)).then((e=>e.PatternWithBackgroundDefinitionViewModel))}static _configureProperties(e){super._configureProperties(e),e.addChild("linesColors",new n.LineToolColorsProperty([e.childs().color])),e.addChild("textsColors",new n.LineToolColorsProperty([e.childs().textcolor])),e.addChild("backgroundsColors",new n.LineToolColorsProperty([e.childs().backgroundColor]))}}},38416:(e,t,i)=>{"use strict";var s=i(13087).LineDataSource,r=i(46100).DefaultProperty,n=i(68806).LineToolColorsProperty;class o extends s{constructor(e,t,s,r){super(e,t||o.createProperties(),s,r),i.e(1583).then(i.t.bind(i,97615,19)).then((({TrianglePaneView:e})=>{this._setPaneViews([new e(this,this._model)])}))}pointsCount(){return 3}name(){return"Triangle"}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(2285),i.e(344),i.e(8882),i.e(8167),i.e(8537)]).then(i.bind(i,20061))).GeneralFiguresDefinitionsViewModel}static createProperties(e){var t=new r("linetooltriangle",e);return this._configureProperties(t),t}static _configureProperties(e){super._configureProperties(e),e.addChild("linesColors",new n([e.childs().color]))}}t.LineToolTriangle=o},26642:(e,t,i)=>{"use strict";i.d(t,{LineToolVertLineTimeAxisView:()=>r});var s=i(95977);class r extends s.LineDataSourceTimeAxisView{constructor(e){super(e,0)}_getBgColor(){return this._source.properties().linecolor.value()}_getAlwaysInViewPort(){return!1}_getIndex(){const e=this._source.points();return 0===e.length?null:e[0].index}}},54623:(e,t,i)=>{"use strict";i.d(t,{LineToolVertLine:()=>c});var s=i(50151),r=i(86441),n=i(46100),o=i(88640),a=i(13087),l=i(26642);class c extends a.LineDataSource{constructor(e,t,s,r){const n=t||c.createProperties();super(e,n,s,r),this._timeAxisView=new l.LineToolVertLineTimeAxisView(this),this._paneViewFactory=null,this.properties().childs().extendLine.subscribe(this,(()=>e.lightUpdate())),i.e(1583).then(i.bind(i,77444)).then((t=>{this._paneViewFactory=i=>new t.VertLinePaneView(this,e,i),this._model.lightUpdate()}))}destroy(){this.properties().childs().extendLine.unsubscribeAll(this),super.destroy()}pointsCount(){return 1}name(){return"Vertical Line"}timeAxisViews(){return this.isSourceHidden()?null:this.properties().childs().showTime.value()?[this._timeAxisView]:null}updateAllViews(e){super.updateAllViews(e),this._timeAxisView.update(e)}canHasAlert(){return!0}template(){const e=super.template();return e.text=this.properties().childs().text.value(),e}isMultiPaneAvailable(){return!0}isMultiPaneEnabled(){return this.properties().childs().extendLine.value()}paneViews(e){return e=(0,s.ensureDefined)(e),this.isMultiPaneEnabled()||this._model.paneForSource(this)===e?(null===this._getPaneViews(e)&&null!==this._paneViewFactory&&this._setPaneViews([this._paneViewFactory(e)],e,!0),super.paneViews(e)):null}priceAxisViews(){return null}priceAxisPoints(){return[]}pointToScreenPoint(e){const t=this._model.timeScale();if(t.isEmpty())return null;const i=t.indexToCoordinate(e.index) -;return new r.Point(i,0)}convertYCoordinateToPriceForMoving(e){return 0}static createProperties(e){null!=e&&(void 0===e.textOrientation&&(e.textOrientation="horizontal"),void 0===e.extendLine&&(e.extendLine=!1));const t=new n.DefaultProperty("linetoolvertline",e);return this._configureProperties(t),t}_getAlertPlots(){const e=this._points[0],t={index:e.index,price:e.price+1},i=this._linePointsToAlertPlot([e,t],null,!0,!0);return null===i?[]:[i]}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(2285),i.e(344),i.e(8882),i.e(8167),i.e(8537)]).then(i.bind(i,71472)).then((e=>e.VerticalLineDefinitionsViewModel))}_applyTemplateImpl(e){super._applyTemplateImpl(e),this.properties().childs().text.setValue(e.text||"")}static _configureProperties(e){super._configureProperties(e),e.hasChild("text")||e.addChild("text",new o.default("")),e.addExclusion("text")}}},58229:(e,t,i)=>{"use strict";i.d(t,{LineToolVbPFixed:()=>v});var s=i(77973),r=i(50151),n=i(70826),o=i(42856),a=i(8652),l=i(12442),c=i(39871),h=i(28558),d=i(1722),u=i(46100),p=i(56827),_=i(74970);const m=(0,n.studyIdString)("VbPFixed","tv-volumebyprice");function g(e,t,i,s){return t.styles&&(f(t.styles.developingPoc),f(t.styles.developingVAHigh),f(t.styles.developingVALow)),t}function f(e){void 0!==e&&void 0!==e.visible&&(e.display=e.visible?15:0,delete e.visible)}class v extends a.StudyLineDataSource{constructor(e,t,i,s,r){super(e,i||(0,_.studyMetaInfoRepository)().findByIdSync({type:"java",studyId:m}),"vbpfixed_",null!=t?t:v.createProperties(e),s,r),this._createPaneViews().then((e=>{this._setPaneViews(e),e.forEach((e=>e.update((0,h.sourceChangeEvent)({sourceId:this.id(),clearData:!0}))))})),this.clearData()}pointsCount(){return 2}boundToSymbol(){return!1}offset(e){return 0}getMinFirstBarIndexForPlot(){return-1/0}calcIsActualSymbol(){this._isActualSymbol=!0,this._isActualCurrency=!0,this._isActualUnit=!0,this.calcIsActualInterval()}cloneable(){return!1}isSynchronizable(){return!1}isPlotVisibleAt(e,t){return(this.properties().childs().styles.childs()[e].childs().display.value()&t)===t}preferredZOrder(){return 0}static createProperties(e,t){const i=o.StudyMetaInfo.getStudyPropertyRootNameById(m),s=(0,r.ensureNotNull)((0,_.studyMetaInfoRepository)().findByIdSync({type:"java",studyId:m})),n=(0,u.createDefaultsState)(!0,i,[],e.studyVersioning());return this.createPropertiesFromStudyMetaInfoAndState(s,s,(0,d.merge)((0,d.clone)(n),null!=t?t:{}),e.studyVersioning())}static createPropertiesFromStudyMetaInfoAndState(e,t,i,s){const r=(0,p.prepareStudyPropertiesForLoadChart)(e,t,i,s,g);return this._configureProperties(r),r}static studyId(){return m}_studyInputs(e){(0,r.assert)(2===e.length,"all the line tool points should be defined");const[t,i]=e,s=Math.max(t.index,i.index),n=this._model.mainSeries().bars().lastIndex(),o=this._getPointTime(t.index<=i.index?t:i,!0),a=this._getPointTime(i.index>=t.index?i:t,!0);if(null===o||null===a)return this._subscribeApplyInputsOnSeriesCompleted(),null;return{...this.properties().childs().inputs.state(),first_bar_time:1e3*o, -last_bar_time:1e3*a,subscribeRealtime:n===s,mapRightBoundaryToBarStartTime:!!this._needExtendToBarsEnding()||void 0}}_isReady(){return!(0,l.isStudyGraphicsEmpty)(this.graphics())}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(2285),i.e(2578),i.e(8882),i.e(3986),i.e(8167),i.e(607)]).then(i.bind(i,56059))).StudyLineDataSourceDefinitionsViewModel}_onDataUpdated(){this._updateAnchors(),this.updateAllViews((0,h.sourceChangeEvent)(this.id())),this._model.updateSource(this)}_updateAnchors(){const e=this._calculateAnchors();if(!e)return;const[{index:t,price:i},{index:s,price:r}]=e;if(this._timePoint.length&&(this._timePoint[0].price=i,this._timePoint[1].price=r),this._points.length){const e=this.model().timeScale(),n=e.indexToTimePoint(t),o=e.indexToTimePoint(t);this._points[0]={index:t,price:i,time:(0,d.isNumber)(n)?new Date(1e3*n):void 0},this._points[1]={index:s,price:r,time:(0,d.isNumber)(o)?new Date(1e3*o):void 0}}}_calculateAnchors(){let e=null,t=null,i=null,r=null;if(this.graphics().hhists().forEach((s=>{s.forEach((s=>{const{priceLow:n,priceHigh:o,firstBarTime:a,lastBarTime:l}=s;(!e||nt)&&(t=o),(!i||ar)&&(r=l)}))})),!((0,s.default)(e)||(0,s.default)(t)||(0,s.default)(r)||(0,s.default)(i)))return[{price:t,index:i},{price:e,index:r}]}_updateAnchorsPrice(){const e=this._calculateAnchors();if(!e)return;const[{price:t},{price:i}]=e;this._timePoint.length&&(this._timePoint[0].price=t,this._timePoint[1].price=i),this._points.length&&(this._points[0].price=t,this._points[1].price=i)}async _createPaneViews(){var e;const t=this._metaInfo,s=t.graphics,r=[],n=this._needExtendToBarsEnding();if(s.hhists){const{HHistPaneView:t}=await i.e(507).then(i.bind(i,21335)),s=null===(e=this.properties().childs().graphics.childs().polygons)||void 0===e?void 0:e.childs();r.push(new t(this,this._model,void 0,null==s?void 0:s.histBoxBg,n))}if(s.horizlines){const{HorizLinePaneView:e}=await i.e(507).then(i.bind(i,13369));r.push(new e(this,this._model,void 0,n))}return t.plots.length>0&&r.push(this._createStudyPlotPaneView(t.plots[0].id,n)),t.plots.length>1&&r.push(this._createStudyPlotPaneView(t.plots[1].id,n)),t.plots.length>2&&r.push(this._createStudyPlotPaneView(t.plots[2].id,n)),r}_createStudyPlotPaneView(e,t){return new c.StudyPlotPaneView(this,this._model.mainSeries(),this._model,e,t)}_needExtendToBarsEnding(){var e;return void 0!==(null===(e=this.metaInfo().defaults.inputs)||void 0===e?void 0:e.mapRightBoundaryToBarStartTime)}}},36147:(e,t,i)=>{"use strict";var s;i.d(t,{MagnetMode:()=>s}),function(e){e[e.WeakMagnet=0]="WeakMagnet",e[e.StrongMagnet=1]="StrongMagnet"}(s||(s={}))},18540:(e,t,i)=>{"use strict";i.d(t,{magnetEnabled:()=>_,magnetMode:()=>m,setIsMagnetEnabled:()=>g,setMagnetMode:()=>f});var s=i(46100),r=i(97145),n=i(36147),o=i(88348),a=i(15367),l=i(28571);const c=new r.WatchedValue(!1),h=new r.WatchedValue(n.MagnetMode.WeakMagnet),d=(0,l.modifierPressed)(),u=(0,l.shiftPressed)();function p(){const e=d.value() -;if(u.value()&&(o.isToolEditingNow.value()||o.isToolCreatingNow.value()))return void c.setValue(!1);let t,i;if(o.activePointSelectionMode.value()===o.SelectPointMode.Replay)t=i=!1;else{const s=o.tool.value(),r=o.isStudyEditingNow.value()||o.activePointSelectionMode.value()===o.SelectPointMode.Study;t=e&&((0,a.isLineToolName)(s)||o.isToolEditingNow.value()||(0,o.toolIsMeasure)(s)||r),i=(0,o.properties)().childs().magnet.value()}h.setValue(!i&&t?n.MagnetMode.StrongMagnet:(0,o.properties)().childs().magnetMode.value()),c.setValue(t?!i:i)}function _(){return c}function m(){return h}function g(e){(0,s.saveDefaultProperties)(!0),(0,o.properties)().childs().magnet.setValue(e),(0,s.saveDefaultProperties)(!1)}function f(e){(0,s.saveDefaultProperties)(!0),(0,o.properties)().childs().magnetMode.setValue(e),(0,o.properties)().childs().magnet.setValue(!0),(0,s.saveDefaultProperties)(!1)}(0,o.runOnDrawingStateReady)((()=>{(0,o.properties)().childs().magnet.subscribe(null,p),(0,o.properties)().childs().magnetMode.subscribe(null,p),d.subscribe(p),u.subscribe(p),o.tool.subscribe(p),o.isToolEditingNow.subscribe(p),p()}))},90565:(e,t,i)=>{"use strict";i.d(t,{MainSeriesScaleRatioProperty:()=>n});var s=i(57898),r=i(19782);class n{constructor(e){this._changed=new s.Delegate,this._model=e}destroy(){this._changed.destroy()}getStepChangeValue(){return.1}getMinValue(){return 1e-7}getMaxValue(){return 99999999}value(){return this._model.mainSeriesScaleRatio()}setValue(e,t){(e!==this.value()||t)&&(this._model.setMainSeriesScaleRatio(e),this._onChanged())}state(){return null}clone(){return new n(this._model)}listeners(){return this._changed}subscribe(e,t){this._changed.subscribe(e,t)}unsubscribe(e,t){this._changed.unsubscribe(e,t)}unsubscribeAll(e){this._changed.unsubscribeAll(e)}storeStateIfUndefined(){return!0}weakReference(){return(0,r.weakReference)(this)}ownership(){return(0,r.ownership)(this)}_onChanged(){this._changed.fire(this,"")}}},28558:(e,t,i)=>{"use strict";i.r(t),i.d(t,{globalChangeEvent:()=>o,selectionChangeEvent:()=>h,sourceChangeEvent:()=>r,viewportChangeEvent:()=>l});var s=i(27147);function r(e){return(0,s.default)(e)?{type:"data-source-change",sourceId:e}:{type:"data-source-change",...e}}const n={type:"global-change"};function o(){return n}const a={type:"viewport-change"};function l(){return a}const c={type:"selection-change"};function h(){return c}},1115:(e,t,i)=>{"use strict";i.d(t,{unpackNonSeriesData:()=>n});var s=i(30551),r=i(50151);async function n(e){if(""===e)return null;const t=JSON.parse(e);if(!(0,s.isObject)(t)||"function"==typeof t)throw new Error("Non-object content in the non-series envelope");if((0,s.hasProperty)(t,"indexes_replace"))return{indexes_replace:!0};const i={indexes_replace:!1};if((0,s.hasProperty)(t,"offsets")&&(i.offsets=t.offsets),(0,s.hasProperty)(t,"isUpdate")){if("boolean"!=typeof t.isUpdate)throw new Error('Invalid type of "isUpdate" field');i.isUpdate=t.isUpdate}return(0,s.hasProperty)(t,"data")&&(i.data=t.data),(0,s.hasProperty)(t,"graphicsCmds")&&(i.graphicsCmds=function(e){if(!(0, -s.isObject)(e))throw new Error("Graphics commands should be wrapped in an object");if((0,s.hasProperty)(e,"create"),(0,s.hasProperty)(e,"erase")){const t=e.erase;(0,r.assert)(Array.isArray(t),"Collection of erase commands should be array");for(const e of t){if(!(0,s.isObject)(e)||!(0,s.hasProperty)(e,"action"))throw new Error("Command should be an object with 'action' property");(0,r.assert)("all"===e.action||"one"===e.action,"Erase command action should be 'all' or 'one'")}}return e}(t.graphicsCmds)),i}},88546:(e,t,i)=>{"use strict";i.d(t,{notAvailable:()=>r});var s=i(11542);const r=i(14483).enabled("use_na_string_for_not_available_values")?s.t(null,void 0,i(16542)):"∅"},66103:(e,t,i)=>{"use strict";var s;i.d(t,{PaneCursorType:()=>s}),function(e){e[e.Default=0]="Default",e[e.Pointer=1]="Pointer",e[e.Eraser=2]="Eraser",e[e.Dot=3]="Dot",e[e.Grabbing=4]="Grabbing",e[e.ZoomIn=5]="ZoomIn",e[e.VerticalResize=6]="VerticalResize",e[e.HorizontalResize=7]="HorizontalResize",e[e.DiagonalNeSwResize=8]="DiagonalNeSwResize",e[e.DiagonalNwSeResize=9]="DiagonalNwSeResize"}(s||(s={}))},43493:(e,t,i)=>{"use strict";i.d(t,{PanePriceAxisView:()=>n});var s=i(34565);class r{constructor(e){this._priceAxisViewRenderer=null,this._rendererOptions=null,this._align="right",this._width=0,this._height=0,this._textWidthCache=e}setParams(e,t,i,s,r){this._priceAxisViewRenderer=e,this._rendererOptions=t,this._width=i,this._height=s,this._align=r}draw(e,t){null!==this._rendererOptions&&null!==this._priceAxisViewRenderer&&this._priceAxisViewRenderer.draw(e,this._rendererOptions,this._textWidthCache,this._width,this._height,this._align,t.pixelRatio)}hitTest(e){var t,i;return void 0===(null===(t=this._priceAxisViewRenderer)||void 0===t?void 0:t.hitTest)?null:null===(i=this._priceAxisViewRenderer)||void 0===i?void 0:i.hitTest(e,this._width,this._align)}}class n{constructor(e,t,i){this._renderer=null,this._invalidated=!0,this._priceAxisView=e,this._textWidthCache=new s.TextWidthCache(100),this._dataSource=t,this._chartModel=i,this._fontSize=-1,this._panePriceAxisViewRenderer=new r(this._textWidthCache)}update(e){this._invalidated=!0}renderer(e,t){return this._invalidated&&this._updateImpl(e,t),this._renderer}_position(){const e=this._chartModel.crossHairSource(),t=this._dataSource===e?e.pane:this._chartModel.paneForSource(this._dataSource);if(null===t)return null;const i=this._priceScale();if(null===i)return null;let s=t.priceScalePosition(i);return"overlay"===s&&(s=t.priceScalePosition(t.defaultPriceScale())),"overlay"===s?null:s}_updateImpl(e,t){this._renderer=null;const i=this._position();if(null===i)return;const s=this._chartModel.priceAxisRendererOptions();s.fontSize!==this._fontSize&&(this._fontSize=s.fontSize,this._textWidthCache.reset()),this._panePriceAxisViewRenderer.setParams(this._priceAxisView.paneRenderer(),s,t,e,i),this._renderer=this._panePriceAxisViewRenderer,this._invalidated=!1}_priceScale(){return this._dataSource.priceScale()}}},82386:(e,t,i)=>{"use strict";i.d(t,{AreaBackgroundItem:()=>l,AreaBackgroundItemsGroup:()=>o, +return"Anchored Text"}hasEditableCoordinates(){return!1}isFixed(){return!0}static createProperties(e){const t=new l.DefaultProperty("linetooltextabsolute",e);return this._configureProperties(t),t}}},89299:(e,t,i)=>{"use strict";i.d(t,{LineToolThreeDrivers:()=>o});var s=i(46100),r=i(13087),n=i(68806);class o extends r.LineDataSource{constructor(e,t,s,r){const n=t||o.createProperties();super(e,n,s,r),i.e(1583).then(i.bind(i,90042)).then((t=>{this._setPaneViews([new t.LineToolThreeDrivesPaneView(this,e)])}))}pointsCount(){return 7}name(){return"Three Drives Pattern"}static createProperties(e){const t=new s.DefaultProperty("linetoolthreedrivers",e);return this._configureProperties(t),t}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(2285),i.e(344),i.e(8882),i.e(8167),i.e(8537)]).then(i.bind(i,63311)).then((e=>e.PatternWithoutBackgroundDefinitionsViewModel))}static _configureProperties(e){super._configureProperties(e),e.addChild("linesColors",new n.LineToolColorsProperty([e.childs().color])),e.addChild("textsColors",new n.LineToolColorsProperty([e.childs().textcolor])),e.addChild("linesWidths",new n.LineToolWidthsProperty([e.childs().linewidth])),e.hasChild("backgroundsColors")&&e.removeProperty("backgroundsColors")}}},74861:(e,t,i)=>{"use strict";i.d(t,{LineToolTimeCycles:()=>o});var s=i(27788),r=i(46100),n=i(13087);class o extends n.LineDataSource{constructor(e,t,s,r){super(e,null!=t?t:o.createProperties(),s,r),i.e(1583).then(i.bind(i,65557)).then((e=>{this._setPaneViews([new e.TimeCyclesPaneView(this,this._model)])}))}pointsCount(){return 2}name(){return"Time Cycles"}setPoint(e,t){const i=(0,s.default)(t),r=this._points[0],n=this._points[1];r.price=i.price,n.price=i.price,this._points[e]=i,this.normalizePoints()}addPoint(e,t,i){const s=super.addPoint(e,t,!0);if(s){const e=this._points[0];this._points[1].price=e.price,i||(this.normalizePoints(),this.createServerPoints())}return s}static createProperties(e){const t=new r.DefaultProperty("linetooltimecycles",e);return this._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(2285),i.e(344),i.e(8882),i.e(8167),i.e(8537)]).then(i.bind(i,81888))).TimeCyclesPatternDefinitionsViewModel}}},87564:(e,t,i)=>{"use strict";const s=i(13087).LineDataSource,r=i(83654).alignToStep,n=i(1763).customFormatters,o=i(42960).createSeriesFormatter;class a extends s{constructor(e,t){super(e,t),this.customization.forcePriceAxisLabel=!0,this.customization.disableErasing=!0,this.customization.showInObjectsTree=!1,this._createFormatter(e.mainSeries().symbolInfo()),this.setSelectionEnabled(!1)}isSynchronizable(){return!1}pointsCount(){return a.POINTS_COUNT}hasContextMenu(){return!1}state(){return null}startMoving(){super.startMoving.apply(this,arguments),this._cursorMoved=!1}endMoving(){super.endMoving.apply(this,arguments),this._cursorMoved=!1}userEditEnabled(){return!0}movable(){return!1}canBeHidden(){return!1}isUserDeletable(){return!1}showInObjectTree(){return!1}doesMovingAffectsUndo(){return!1}isAvailableInFloatingWidget(){return!1 +}timeAxisViews(){return null}cloneable(){return!1}copiable(){return!1}_correctPoints(e,t){this._currentMovingPoint&&this._startMovingPoint?this._currentMovingPoint.logical.price-this._startMovingPoint.logical.price&&(this._cursorMoved=!0):this._cursorMoved=!1;for(var i=1/this.priceScale().mainSource().base(),s=0;s{"use strict";i.d(t,{LineToolTrendAngle:()=>h});var s=i(86441),r=i(50151),n=i(46100),o=i(13087),a=i(88640),l=i(28558);class c extends a.default{constructor(e){super(),this._lineSource=e}value(){return Math.round(180*this._lineSource.angle()/Math.PI)}setValue(e){const t=e*Math.PI/180,i=(0,r.ensureNotNull)(this._lineSource.pointToScreenPoint(this._lineSource.points()[0])),n=Math.cos(t),o=-Math.sin(t),a=new s.Point(n,o),c=i.addScaled(a,this._lineSource.distance()),h=(0,r.ensureNotNull)(this._lineSource.screenPointToPoint(c));this._lineSource.setPoint(1,h);const d=this._lineSource.model();d.updateSource(this._lineSource),this._lineSource.updateAllViews((0,l.sourceChangeEvent)(this._lineSource.id())),d.updateSource(this._lineSource)}notifyChanged(){this._listeners.fire(this,"")}}class h extends o.LineDataSource{constructor(e,t,s,r){const n=t||h.createProperties();super(e,n,s,r),this._angle=0,this._distance=0,n.addChild("angle",new c(this)),i.e(1583).then(i.bind(i,67998)).then((({TrendAnglePaneView:t})=>{const i=[new t(this,e)];this._setPaneViews(i)}))}isSynchronizable(){return!1}pointsCount(){return 2}name(){return"Trend Angle"}angle(){return this._angle}distance(){return this._distance}addPoint(e,t){const i=super.addPoint(e,t);return i&&this._calculateAngle(),i}setLastPoint(e,t){const i=super.setLastPoint(e,t);return this.points().length>1&&this._calculateAngle(),i}axisPoints(){if(this.points().length<2)return[];const e=[this.points()[0]],t=(0,r.ensureNotNull)(this.pointToScreenPoint(this.points()[0])),i=Math.cos(this._angle)*this._distance,n=-Math.sin(this._angle)*this._distance,o=t.add(new s.Point(i,n)),a=(0,r.ensureNotNull)(this.screenPointToPoint(o));return e.push(a),e}timeAxisPoints(){return this.axisPoints()}priceAxisPoints(){return this.axisPoints()}setPoint(e,t,i){super.setPoint(e,t,i),this.points().length>1&&1===e&&this._calculateAngle()}restoreData(e){var t,i;this._angle=null!==(t=e.angle)&&void 0!==t?t:0,this._distance=null!==(i=e.distance)&&void 0!==i?i:0}state(e){const t=super.state(e);return t.angle=this._angle,t.distance=this._distance,t}cloneData(e){this._angle=e.angle(),this._distance=e.distance()}canHasAlert(){return!0}static createProperties(e){e&&void 0===e.showPercentPriceRange&&(e.showPercentPriceRange=e.showPriceRange,e.showPipsPriceRange=e.showPriceRange);const t=new n.DefaultProperty("linetooltrendangle",e);return this._configureProperties(t),t} +_snapTo45DegreesAvailable(){return!0}_getAlertPlots(){const e=this._linePointsToAlertPlot(this._points,null,this._properties.childs().extendLeft.value(),this._properties.childs().extendRight.value());return null===e?[]:[e]}_calculateAngle(){const e=(0,r.ensureNotNull)(this.pointToScreenPoint(this.points()[0]));let t=(0,r.ensureNotNull)(this.pointToScreenPoint(this.points()[1])).subtract(e);const i=t.length();i>0?(t=t.normalized(),this._angle=Math.acos(t.x),t.y>0&&(this._angle=-this._angle),this._distance=i):this._angle=0;this.properties().childs().angle.notifyChanged()}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(2285),i.e(344),i.e(8882),i.e(8167),i.e(8537)]).then(i.bind(i,34935)).then((e=>e.TrendAngleDefinitionsViewModel))}}},84123:(e,t,i)=>{"use strict";i.d(t,{LineToolTrendBasedFibExtension:()=>c});var s=i(11542),r=i(36298),n=i(53801),o=i(68806),a=i(13087);const l=new r.TranslatedString("erase level line",s.t(null,void 0,i(12962)));class c extends a.LineDataSource{constructor(e,t,s,r){super(e,t||c.createProperties(),s,r),this.version=2,i.e(1583).then(i.bind(i,38058)).then((({TrendBasedFibExtensionPaneView:e})=>{this._setPaneViews([new e(this,this._model)])}))}levelsCount(){return 24}pointsCount(){return 3}name(){return"Trend-Based Fib Extension"}migrateVersion(e,t){1===e&&this.properties().childs().extendLines.setValue(!0)}processErase(e,t){const i="level"+t,s=this.properties().childs()[i].childs().visible;e.setProperty(s,!1,l)}fibLevelsBasedOnLogScale(){var e;return this.properties().childs().fibLevelsBasedOnLogScale.value()&&Boolean(null===(e=this.priceScale())||void 0===e?void 0:e.isLog())}static createProperties(e){const t=new n.LevelsProperty("linetooltrendbasedfibextension",e,!1,{range:[0,8]});return this._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(2285),i.e(344),i.e(8882),i.e(8167),i.e(8537)]).then(i.bind(i,56194))).FibDrawingsWith24LevelsDefinitionsViewModel}static _configureProperties(e){const t=e.childs();super._configureProperties(e);const i=[t.trendline.childs().color];for(let e=1;e<=24;e++){const s=t["level"+e].childs().color;i.push(s)}e.addChild("linesColors",new o.LineToolColorsProperty(i));const s=[t.trendline.childs().linewidth,t.levelsStyle.childs().linewidth];e.addChild("linesWidths",new o.LineToolWidthsProperty(s))}}},35625:(e,t,i)=>{"use strict";i.d(t,{LineToolTrendBasedFibTime:()=>c});var s=i(11542),r=i(36298),n=i(13087),o=i(53801),a=i(68806);const l=new r.TranslatedString("erase level line",s.t(null,void 0,i(12962)));class c extends n.LineDataSource{constructor(e,t,s,r){super(e,t||c.createProperties(),s,r),this.version=1,i.e(1583).then(i.bind(i,33482)).then((({TrendBasedFibTimePaneView:e})=>{this._setPaneViews([new e(this,this._model)])}))}levelsCount(){return 11}pointsCount(){return 3}name(){return"Trend-Based Fib Time"}processErase(e,t){const i="level"+t,s=this.properties().childs()[i].childs().visible;e.setProperty(s,!1,l)}static createProperties(e){const t=new o.LevelsProperty("linetooltrendbasedfibtime",e,!1,{ +range:[1,11]});return this._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(2285),i.e(344),i.e(8882),i.e(8167),i.e(8537)]).then(i.bind(i,60007))).TrendBasedFibTimeDefinitionsViewModel}static _configureProperties(e){super._configureProperties(e);const t=e.childs(),i=[t.trendline.childs().linewidth],s=[t.trendline.childs().color];for(let e=1;e<=11;e++)i.push(t["level"+e].childs().linewidth),s.push(t["level"+e].childs().color);e.addChild("linesColors",new a.LineToolColorsProperty(s)),e.addChild("linesWidths",new a.LineToolWidthsProperty(i))}}},47246:(e,t,i)=>{"use strict";i.d(t,{LineToolTrendLine:()=>a});var s=i(46100),r=i(13087),n=i(71243),o=i(88640);class a extends r.LineDataSource{constructor(e,t,s,r){super(e,t||a.createProperties(),s,r),this._trendLinePaneView=null,i.e(1583).then(i.bind(i,96310)).then((({TrendLinePaneView:e})=>{this._trendLinePaneView=new e(this,this._model),this._setPaneViews([this._trendLinePaneView])}))}dataAndViewsReady(){return super.dataAndViewsReady()&&null!==this._trendLinePaneView&&this._trendLinePaneView.iconsReady()}pointsCount(){return 2}name(){return"Trend Line"}canHasAlert(){return!0}showPriceLabels(){return this._properties.childs().showPriceLabels.value()}createPriceAxisView(e){return new n.LineToolPriceAxisView(this,{pointIndex:e,backgroundPropertyGetter:()=>this.showPriceLabels()?this._properties.childs().linecolor.value():null})}isForcedDrawPriceAxisLabel(){return this.showPriceLabels()}template(){const e=super.template();return e.text=this.properties().childs().text.value(),e}static createProperties(e,t){return a._createPropertiesImpl("linetooltrendline",e,t)}_getAlertPlots(){const e=this._linePointsToAlertPlot(this._points,null,this._properties.childs().extendLeft.value(),this._properties.childs().extendRight.value());return null===e?[]:[e]}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(2285),i.e(344),i.e(8882),i.e(8167),i.e(8537)]).then(i.bind(i,84926))).TrendLineDefinitionsViewModel}_applyTemplateImpl(e){super._applyTemplateImpl(e),this.properties().childs().text.setValue(e.text||"")}_snapTo45DegreesAvailable(){return!0}static _createPropertiesImpl(e,t,i){t&&void 0===t.showPercentPriceRange&&(t.showPercentPriceRange=t.showPriceRange,t.showPipsPriceRange=t.showPriceRange);const r=new s.DefaultProperty(e,t,void 0,i);return this._configureProperties(r),r}static _configureProperties(e){super._configureProperties(e),e.hasChild("text")||e.addChild("text",new o.default("")),e.addExclusion("text")}}},45579:(e,t,i)=>{"use strict";i.d(t,{LineToolTrianglePattern:()=>o});var s=i(46100),r=i(13087),n=i(68806);class o extends r.LineDataSource{constructor(e,t,s,r){const n=t||o.createProperties();super(e,n,s,r),i.e(1583).then(i.bind(i,23545)).then((t=>{this._setPaneViews([new t.LineToolTrianglePatternPaneView(this,e)])}))}pointsCount(){return 4}name(){return"Triangle Pattern"}static createProperties(e){const t=new s.DefaultProperty("linetooltrianglepattern",e);return this._configureProperties(t),t} +_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(2285),i.e(344),i.e(8882),i.e(8167),i.e(8537)]).then(i.bind(i,25107)).then((e=>e.PatternWithBackgroundDefinitionViewModel))}static _configureProperties(e){super._configureProperties(e),e.addChild("linesColors",new n.LineToolColorsProperty([e.childs().color])),e.addChild("textsColors",new n.LineToolColorsProperty([e.childs().textcolor])),e.addChild("backgroundsColors",new n.LineToolColorsProperty([e.childs().backgroundColor]))}}},38416:(e,t,i)=>{"use strict";var s=i(13087).LineDataSource,r=i(46100).DefaultProperty,n=i(68806).LineToolColorsProperty;class o extends s{constructor(e,t,s,r){super(e,t||o.createProperties(),s,r),i.e(1583).then(i.t.bind(i,97615,19)).then((({TrianglePaneView:e})=>{this._setPaneViews([new e(this,this._model)])}))}pointsCount(){return 3}name(){return"Triangle"}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(2285),i.e(344),i.e(8882),i.e(8167),i.e(8537)]).then(i.bind(i,20061))).GeneralFiguresDefinitionsViewModel}static createProperties(e){var t=new r("linetooltriangle",e);return this._configureProperties(t),t}static _configureProperties(e){super._configureProperties(e),e.addChild("linesColors",new n([e.childs().color]))}}t.LineToolTriangle=o},26642:(e,t,i)=>{"use strict";i.d(t,{LineToolVertLineTimeAxisView:()=>r});var s=i(95977);class r extends s.LineDataSourceTimeAxisView{constructor(e){super(e,0)}_getBgColor(){return this._source.properties().linecolor.value()}_getAlwaysInViewPort(){return!1}_getIndex(){const e=this._source.points();return 0===e.length?null:e[0].index}}},54623:(e,t,i)=>{"use strict";i.d(t,{LineToolVertLine:()=>c});var s=i(50151),r=i(86441),n=i(46100),o=i(88640),a=i(13087),l=i(26642);class c extends a.LineDataSource{constructor(e,t,s,r){const n=t||c.createProperties();super(e,n,s,r),this._timeAxisView=new l.LineToolVertLineTimeAxisView(this),this._paneViewFactory=null,this.properties().childs().extendLine.subscribe(this,(()=>e.lightUpdate())),i.e(1583).then(i.bind(i,77444)).then((t=>{this._paneViewFactory=i=>new t.VertLinePaneView(this,e,i),this._model.lightUpdate()}))}destroy(){this.properties().childs().extendLine.unsubscribeAll(this),super.destroy()}pointsCount(){return 1}name(){return"Vertical Line"}timeAxisViews(){return this.isSourceHidden()?null:this.properties().childs().showTime.value()?[this._timeAxisView]:null}updateAllViews(e){super.updateAllViews(e),this._timeAxisView.update(e)}canHasAlert(){return!0}template(){const e=super.template();return e.text=this.properties().childs().text.value(),e}isMultiPaneAvailable(){return!0}isMultiPaneEnabled(){return this.properties().childs().extendLine.value()}paneViews(e){return e=(0,s.ensureDefined)(e),this.isMultiPaneEnabled()||this._model.paneForSource(this)===e?(null===this._getPaneViews(e)&&null!==this._paneViewFactory&&this._setPaneViews([this._paneViewFactory(e)],e,!0),super.paneViews(e)):null}priceAxisViews(){return null}priceAxisPoints(){return[]}pointToScreenPoint(e){const t=this._model.timeScale();if(t.isEmpty())return null +;const i=t.indexToCoordinate(e.index);return new r.Point(i,0)}convertYCoordinateToPriceForMoving(e){return 0}static createProperties(e){null!=e&&(void 0===e.textOrientation&&(e.textOrientation="horizontal"),void 0===e.extendLine&&(e.extendLine=!1));const t=new n.DefaultProperty("linetoolvertline",e);return this._configureProperties(t),t}_getAlertPlots(){const e=this._points[0],t={index:e.index,price:e.price+1},i=this._linePointsToAlertPlot([e,t],null,!0,!0);return null===i?[]:[i]}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(2285),i.e(344),i.e(8882),i.e(8167),i.e(8537)]).then(i.bind(i,71472)).then((e=>e.VerticalLineDefinitionsViewModel))}_applyTemplateImpl(e){super._applyTemplateImpl(e),this.properties().childs().text.setValue(e.text||"")}static _configureProperties(e){super._configureProperties(e),e.hasChild("text")||e.addChild("text",new o.default("")),e.addExclusion("text")}}},58229:(e,t,i)=>{"use strict";i.d(t,{LineToolVbPFixed:()=>v});var s=i(77973),r=i(50151),n=i(70826),o=i(42856),a=i(8652),l=i(12442),c=i(39871),h=i(28558),d=i(1722),u=i(46100),p=i(56827),_=i(74970);const m=(0,n.studyIdString)("VbPFixed","tv-volumebyprice");function g(e,t,i,s){return t.styles&&(f(t.styles.developingPoc),f(t.styles.developingVAHigh),f(t.styles.developingVALow)),t}function f(e){void 0!==e&&void 0!==e.visible&&(e.display=e.visible?15:0,delete e.visible)}class v extends a.StudyLineDataSource{constructor(e,t,i,s,r){super(e,i||(0,_.studyMetaInfoRepository)().findByIdSync({type:"java",studyId:m}),"vbpfixed_",null!=t?t:v.createProperties(e),s,r),this._createPaneViews().then((e=>{this._setPaneViews(e),e.forEach((e=>e.update((0,h.sourceChangeEvent)({sourceId:this.id(),clearData:!0}))))})),this.clearData()}pointsCount(){return 2}boundToSymbol(){return!1}offset(e){return 0}getMinFirstBarIndexForPlot(){return-1/0}calcIsActualSymbol(){this._isActualSymbol=!0,this._isActualCurrency=!0,this._isActualUnit=!0,this.calcIsActualInterval()}cloneable(){return!1}isSynchronizable(){return!1}isPlotVisibleAt(e,t){return(this.properties().childs().styles.childs()[e].childs().display.value()&t)===t}preferredZOrder(){return 0}static createProperties(e,t){const i=o.StudyMetaInfo.getStudyPropertyRootNameById(m),s=(0,r.ensureNotNull)((0,_.studyMetaInfoRepository)().findByIdSync({type:"java",studyId:m})),n=(0,u.createDefaultsState)(!0,i,[],e.studyVersioning());return this.createPropertiesFromStudyMetaInfoAndState(s,s,(0,d.merge)((0,d.clone)(n),null!=t?t:{}),e.studyVersioning())}static createPropertiesFromStudyMetaInfoAndState(e,t,i,s){const r=(0,p.prepareStudyPropertiesForLoadChart)(e,t,i,s,g);return this._configureProperties(r),r}static studyId(){return m}_studyInputs(e){(0,r.assert)(2===e.length,"all the line tool points should be defined");const[t,i]=e,s=Math.max(t.index,i.index),n=this._model.mainSeries().bars().lastIndex(),o=this._getPointTime(t.index<=i.index?t:i,!0),a=this._getPointTime(i.index>=t.index?i:t,!0);if(null===o||null===a)return this._subscribeApplyInputsOnSeriesCompleted(),null;return{ +...this.properties().childs().inputs.state(),first_bar_time:1e3*o,last_bar_time:1e3*a,subscribeRealtime:n===s,mapRightBoundaryToBarStartTime:!!this._needExtendToBarsEnding()||void 0}}_isReady(){return!(0,l.isStudyGraphicsEmpty)(this.graphics())}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(2285),i.e(2578),i.e(8882),i.e(3986),i.e(8167),i.e(607)]).then(i.bind(i,56059))).StudyLineDataSourceDefinitionsViewModel}_onDataUpdated(){this._updateAnchors(),this.updateAllViews((0,h.sourceChangeEvent)(this.id())),this._model.updateSource(this)}_updateAnchors(){const e=this._calculateAnchors();if(!e)return;const[{index:t,price:i},{index:s,price:r}]=e;if(this._timePoint.length&&(this._timePoint[0].price=i,this._timePoint[1].price=r),this._points.length){const e=this.model().timeScale(),n=e.indexToTimePoint(t),o=e.indexToTimePoint(t);this._points[0]={index:t,price:i,time:(0,d.isNumber)(n)?new Date(1e3*n):void 0},this._points[1]={index:s,price:r,time:(0,d.isNumber)(o)?new Date(1e3*o):void 0}}}_calculateAnchors(){let e=null,t=null,i=null,r=null;if(this.graphics().hhists().forEach((s=>{s.forEach((s=>{const{priceLow:n,priceHigh:o,firstBarTime:a,lastBarTime:l}=s;(!e||nt)&&(t=o),(!i||ar)&&(r=l)}))})),!((0,s.default)(e)||(0,s.default)(t)||(0,s.default)(r)||(0,s.default)(i)))return[{price:t,index:i},{price:e,index:r}]}_updateAnchorsPrice(){const e=this._calculateAnchors();if(!e)return;const[{price:t},{price:i}]=e;this._timePoint.length&&(this._timePoint[0].price=t,this._timePoint[1].price=i),this._points.length&&(this._points[0].price=t,this._points[1].price=i)}async _createPaneViews(){var e;const t=this._metaInfo,s=t.graphics,r=[],n=this._needExtendToBarsEnding();if(s.hhists){const{HHistPaneView:t}=await i.e(507).then(i.bind(i,21335)),s=null===(e=this.properties().childs().graphics.childs().polygons)||void 0===e?void 0:e.childs();r.push(new t(this,this._model,void 0,null==s?void 0:s.histBoxBg,n))}if(s.horizlines){const{HorizLinePaneView:e}=await i.e(507).then(i.bind(i,13369));r.push(new e(this,this._model,void 0,n))}return t.plots.length>0&&r.push(this._createStudyPlotPaneView(t.plots[0].id,n)),t.plots.length>1&&r.push(this._createStudyPlotPaneView(t.plots[1].id,n)),t.plots.length>2&&r.push(this._createStudyPlotPaneView(t.plots[2].id,n)),r}_createStudyPlotPaneView(e,t){return new c.StudyPlotPaneView(this,this._model.mainSeries(),this._model,e,t)}_needExtendToBarsEnding(){var e;return void 0!==(null===(e=this.metaInfo().defaults.inputs)||void 0===e?void 0:e.mapRightBoundaryToBarStartTime)}}},36147:(e,t,i)=>{"use strict";var s;i.d(t,{MagnetMode:()=>s}),function(e){e[e.WeakMagnet=0]="WeakMagnet",e[e.StrongMagnet=1]="StrongMagnet"}(s||(s={}))},18540:(e,t,i)=>{"use strict";i.d(t,{magnetEnabled:()=>_,magnetMode:()=>m,setIsMagnetEnabled:()=>g,setMagnetMode:()=>f});var s=i(46100),r=i(97145),n=i(36147),o=i(88348),a=i(15367),l=i(28571);const c=new r.WatchedValue(!1),h=new r.WatchedValue(n.MagnetMode.WeakMagnet),d=(0,l.modifierPressed)(),u=(0,l.shiftPressed)();function p(){ +const e=d.value();if(u.value()&&(o.isToolEditingNow.value()||o.isToolCreatingNow.value()))return void c.setValue(!1);let t,i;if(o.activePointSelectionMode.value()===o.SelectPointMode.Replay)t=i=!1;else{const s=o.tool.value(),r=o.isStudyEditingNow.value()||o.activePointSelectionMode.value()===o.SelectPointMode.Study;t=e&&((0,a.isLineToolName)(s)||o.isToolEditingNow.value()||(0,o.toolIsMeasure)(s)||r),i=(0,o.properties)().childs().magnet.value()}h.setValue(!i&&t?n.MagnetMode.StrongMagnet:(0,o.properties)().childs().magnetMode.value()),c.setValue(t?!i:i)}function _(){return c}function m(){return h}function g(e){(0,s.saveDefaultProperties)(!0),(0,o.properties)().childs().magnet.setValue(e),(0,s.saveDefaultProperties)(!1)}function f(e){(0,s.saveDefaultProperties)(!0),(0,o.properties)().childs().magnetMode.setValue(e),(0,o.properties)().childs().magnet.setValue(!0),(0,s.saveDefaultProperties)(!1)}(0,o.runOnDrawingStateReady)((()=>{(0,o.properties)().childs().magnet.subscribe(null,p),(0,o.properties)().childs().magnetMode.subscribe(null,p),d.subscribe(p),u.subscribe(p),o.tool.subscribe(p),o.isToolEditingNow.subscribe(p),p()}))},90565:(e,t,i)=>{"use strict";i.d(t,{MainSeriesScaleRatioProperty:()=>n});var s=i(57898),r=i(19782);class n{constructor(e){this._changed=new s.Delegate,this._model=e}destroy(){this._changed.destroy()}getStepChangeValue(){return.1}getMinValue(){return 1e-7}getMaxValue(){return 99999999}value(){return this._model.mainSeriesScaleRatio()}setValue(e,t){(e!==this.value()||t)&&(this._model.setMainSeriesScaleRatio(e),this._onChanged())}state(){return null}clone(){return new n(this._model)}listeners(){return this._changed}subscribe(e,t){this._changed.subscribe(e,t)}unsubscribe(e,t){this._changed.unsubscribe(e,t)}unsubscribeAll(e){this._changed.unsubscribeAll(e)}storeStateIfUndefined(){return!0}weakReference(){return(0,r.weakReference)(this)}ownership(){return(0,r.ownership)(this)}_onChanged(){this._changed.fire(this,"")}}},28558:(e,t,i)=>{"use strict";i.r(t),i.d(t,{globalChangeEvent:()=>o,selectionChangeEvent:()=>h,sourceChangeEvent:()=>r,viewportChangeEvent:()=>l});var s=i(27147);function r(e){return(0,s.default)(e)?{type:"data-source-change",sourceId:e}:{type:"data-source-change",...e}}const n={type:"global-change"};function o(){return n}const a={type:"viewport-change"};function l(){return a}const c={type:"selection-change"};function h(){return c}},1115:(e,t,i)=>{"use strict";i.d(t,{unpackNonSeriesData:()=>n});var s=i(30551),r=i(50151);async function n(e){if(""===e)return null;const t=JSON.parse(e);if(!(0,s.isObject)(t)||"function"==typeof t)throw new Error("Non-object content in the non-series envelope");if((0,s.hasProperty)(t,"indexes_replace"))return{indexes_replace:!0};const i={indexes_replace:!1};if((0,s.hasProperty)(t,"offsets")&&(i.offsets=t.offsets),(0,s.hasProperty)(t,"isUpdate")){if("boolean"!=typeof t.isUpdate)throw new Error('Invalid type of "isUpdate" field');i.isUpdate=t.isUpdate}return(0,s.hasProperty)(t,"data")&&(i.data=t.data),(0,s.hasProperty)(t,"graphicsCmds")&&(i.graphicsCmds=function(e){ +if(!(0,s.isObject)(e))throw new Error("Graphics commands should be wrapped in an object");if((0,s.hasProperty)(e,"create"),(0,s.hasProperty)(e,"erase")){const t=e.erase;(0,r.assert)(Array.isArray(t),"Collection of erase commands should be array");for(const e of t){if(!(0,s.isObject)(e)||!(0,s.hasProperty)(e,"action"))throw new Error("Command should be an object with 'action' property");(0,r.assert)("all"===e.action||"one"===e.action,"Erase command action should be 'all' or 'one'")}}return e}(t.graphicsCmds)),i}},88546:(e,t,i)=>{"use strict";i.d(t,{notAvailable:()=>r});var s=i(11542);const r=i(14483).enabled("use_na_string_for_not_available_values")?s.t(null,void 0,i(16542)):"∅"},66103:(e,t,i)=>{"use strict";var s;i.d(t,{PaneCursorType:()=>s}),function(e){e[e.Default=0]="Default",e[e.Pointer=1]="Pointer",e[e.Eraser=2]="Eraser",e[e.Dot=3]="Dot",e[e.Grabbing=4]="Grabbing",e[e.ZoomIn=5]="ZoomIn",e[e.VerticalResize=6]="VerticalResize",e[e.HorizontalResize=7]="HorizontalResize",e[e.DiagonalNeSwResize=8]="DiagonalNeSwResize",e[e.DiagonalNwSeResize=9]="DiagonalNwSeResize"}(s||(s={}))},43493:(e,t,i)=>{"use strict";i.d(t,{PanePriceAxisView:()=>n});var s=i(34565);class r{constructor(e){this._priceAxisViewRenderer=null,this._rendererOptions=null,this._align="right",this._width=0,this._height=0,this._textWidthCache=e}setParams(e,t,i,s,r){this._priceAxisViewRenderer=e,this._rendererOptions=t,this._width=i,this._height=s,this._align=r}draw(e,t){null!==this._rendererOptions&&null!==this._priceAxisViewRenderer&&this._priceAxisViewRenderer.draw(e,this._rendererOptions,this._textWidthCache,this._width,this._height,this._align,t.pixelRatio)}hitTest(e){var t,i;return void 0===(null===(t=this._priceAxisViewRenderer)||void 0===t?void 0:t.hitTest)?null:null===(i=this._priceAxisViewRenderer)||void 0===i?void 0:i.hitTest(e,this._width,this._align)}}class n{constructor(e,t,i){this._renderer=null,this._invalidated=!0,this._priceAxisView=e,this._textWidthCache=new s.TextWidthCache(100),this._dataSource=t,this._chartModel=i,this._fontSize=-1,this._panePriceAxisViewRenderer=new r(this._textWidthCache)}update(e){this._invalidated=!0}renderer(e,t){return this._invalidated&&this._updateImpl(e,t),this._renderer}_position(){const e=this._chartModel.crossHairSource(),t=this._dataSource===e?e.pane:this._chartModel.paneForSource(this._dataSource);if(null===t)return null;const i=this._priceScale();if(null===i)return null;let s=t.priceScalePosition(i);return"overlay"===s&&(s=t.priceScalePosition(t.defaultPriceScale())),"overlay"===s?null:s}_updateImpl(e,t){this._renderer=null;const i=this._position();if(null===i)return;const s=this._chartModel.priceAxisRendererOptions();s.fontSize!==this._fontSize&&(this._fontSize=s.fontSize,this._textWidthCache.reset()),this._panePriceAxisViewRenderer.setParams(this._priceAxisView.paneRenderer(),s,t,e,i),this._renderer=this._panePriceAxisViewRenderer,this._invalidated=!1}_priceScale(){return this._dataSource.priceScale()}}},82386:(e,t,i)=>{"use strict";i.d(t,{AreaBackgroundItem:()=>l,AreaBackgroundItemsGroup:()=>o, AreaBackgroundRenderer:()=>c,CachedMap:()=>a});var s=i(50151),r=i(59590),n=i(77173);class o extends n.CachedContainer{constructor(e){super(),this.color=e}}class a{constructor(){this._map=new Map,this._usedKeys=new Set,this._invalidations=0}invalidateCache(){this._invalidations+=1,50===this._invalidations&&(this._deleteUnused(),this._invalidations=0),this._usedKeys.clear(),this._map.forEach(((e,t)=>e.invalidateCache()))}get(e){const t=this._map.get(e);return void 0!==t&&this._usedKeys.add(e),t}set(e,t){this._usedKeys.add(e),this._map.set(e,t)}[Symbol.iterator](){const e=Array.from(this._usedKeys)[Symbol.iterator]();return{[Symbol.iterator](){return this},next:()=>{const t=e.next();return t.value?{value:[t.value,(0,s.ensureDefined)(this._map.get(t.value))],done:!1}:{value:void 0,done:!0}}}}forEach(e){this._map.forEach(((t,i)=>{this._usedKeys.has(i)&&e(t,i)}))}delete(e){const t=this._map.get(e);void 0!==t&&t.invalidateCache(),this._usedKeys.delete(e)}_deleteUnused(){const e=[];this._map.forEach(((t,i)=>{this._usedKeys.has(i)||e.push(i)}));for(const t of e)this._map.delete(t)}}class l extends n.CachedContainer{constructor(){super(),this.points1=new n.CachedContainer,this.points2=new n.CachedContainer,this.push(this.points1),this.push(this.points2)}addPoints1Point(e,t){let i=this.points1.newItem();null!==i?(i.x=e,i.y=t):i={x:e,y:t},this.points1.push(i)}addPoints2Point(e,t){let i=this.points2.newItem();null!==i?(i.x=e,i.y=t):i={x:e,y:t},this.points2.push(i)}invalidateCache(){this.points1.invalidateCache(),this.points2.invalidateCache()}}class c extends r.BitmapCoordinatesPaneRenderer{constructor(e){super(),this._data=null,this._data=null!=e?e:null}setData(e){this._data=e}hitTest(e,t){return null}_drawImpl(e){var t,i;if(null===this._data)return;const{context:s,horizontalPixelRatio:r,verticalPixelRatio:n}=e,o=.25*this._data.barSpacing;for(const[,e]of this._data.colorAreas){s.beginPath();for(let t=0;t{"use strict";i.d(t,{PaneRendererArea:()=>o});var s=i(1149),r=i(45197),n=i(68441);class o extends s.PaneRendererLine{constructor(e){e.forceLineColor=!1,super(e)}_drawImpl(e){var t,i,o,a,l;const c=this._data;if(0===c.items.length)return ;let h=null!==(i=null===(t=this._data.visibleItemsRange)||void 0===t?void 0:t.startItemIndex)&&void 0!==i?i:0,d=(null!==(a=null===(o=this._data.visibleItemsRange)||void 0===o?void 0:o.endItemIndex)&&void 0!==a?a:this._data.items.length)-1;for(;h=0&&!(0,r.coordinateIsValid)(c.items[d].y);)d--;if(h>d)return;const{context:u,horizontalPixelRatio:p,verticalPixelRatio:_}=e;u.save(),u.scale(p,_),u.lineCap="round",u.strokeStyle=c.lineColor,u.lineWidth=c.lineWidth,(0,n.setLineStyle)(u,c.lineStyle),u.lineWidth=1;const m={},g=new s.PaneRendererLineItemsIterator(this._data.items,h,d+1,this._data.skipHoles);for(;g.next();){const e=g.currentValue();let t;t=(0,s.isValidPoint)(e)&&e.style?e.style.color:c.lineColor;const i=g.nextValue();if((0,s.isValidPoint)(i)&&(null==i?void 0:i.style)){const s=i.style.color;if(t!==s){const t=m[s]||[];t.push(e),m[s]=t}}const r=m[t]||[];r.push(e),m[t]=r}for(const e of Object.keys(m)){const t=m[e];u.beginPath();let i=0;for(let r=0;r{"use strict";i.d(t,{BitmapCoordinatesPaneRenderer:()=>r});var s=i(27714);class r{draw(e,t){new s.CanvasRenderingTarget2D(e,(0,s.size)({width:t.cssWidth,height:t.cssHeight}),(0,s.size)({width:t.physicalWidth,height:t.physicalHeight})).useBitmapCoordinateSpace((e=>this._drawImpl(e)))}drawBackground(e,t){new s.CanvasRenderingTarget2D(e,(0,s.size)({width:t.cssWidth,height:t.cssHeight}),(0,s.size)({width:t.physicalWidth,height:t.physicalHeight})).useBitmapCoordinateSpace((e=>this._drawBackgroundImpl(e)))}_drawBackgroundImpl(e){}}},19266:(e,t,i)=>{"use strict";i.d(t,{CompositeRenderer:()=>s});class s{constructor(){this._renderers=[],this._globalAlpha=1}setGlobalAlpha(e){this._globalAlpha=e}append(e){this._renderers.push(e)}insert(e,t){this._renderers.splice(t,0,e)}clear(){this._renderers.length=0}isEmpty(){return 0===this._renderers.length}draw(e,t){for(let i=0;i=0;s--){const r=this._renderers[s].hitTest(e,t);null!==r&&(null===i||r.target()>i.target())&&(i=r)}return i}doesIntersectWithBox(e){return this._renderers.some((t=>!!t.doesIntersectWithBox&&t.doesIntersectWithBox(e)))}}},68441:(e,t,i)=>{"use strict";i.r(t),i.d(t,{ addHorizontalLineToPath:()=>h,addLineToPath:()=>P,addPixelPerfectLineToPath:()=>T,addVerticalLineToPath:()=>u,clearRectWithGradient:()=>l,clipPolygonByEdge:()=>M,computeDashPattern:()=>C,createCircle:()=>S,drawHorizontalLine:()=>d,drawLine:()=>x,drawPixelPerfectLine:()=>I,drawPoly:()=>b,drawRoundRect:()=>g,drawRoundRectWithInnerBorder:()=>f,drawVerticalLine:()=>p,fillRectInnerBorder:()=>c,fillRectWithBorder:()=>y,scaleDrawRoundRectRadii:()=>_,scaledDashPattern:()=>v,setLineStyle:()=>w});var s=i(86441),r=i(5531),n=i(79849),o=i(95586),a=i(74359);function l(e,t,i,s,r,n,o){e.save(),e.globalCompositeOperation="copy";const a=e.createLinearGradient(0,0,0,r);a.addColorStop(0,n),a.addColorStop(1,o),e.fillStyle=a,e.fillRect(t,i,s,r),e.restore()}function c(e,t,i,s,r,n){e.fillRect(t+n,i,s-2*n,n),e.fillRect(t+n,i+r-n,s-2*n,n),e.fillRect(t,i,n,r),e.fillRect(t+s-n,i,n,r)}function h(e,t,i,s){const r=e.lineWidth%2?.5:0;e.moveTo(i,t+r),e.lineTo(s,t+r)}function d(e,t,i,s){e.beginPath(),h(e,t,i,s),e.stroke()}function u(e,t,i,s){const r=e.lineWidth%2?.5:0;e.moveTo(t+r,i),e.lineTo(t+r,s)}function p(e,t,i,s){e.beginPath(),u(e,t,i,s),e.stroke()}function _(e,t){return Array.isArray(e)?e.map((e=>Math.round(e*t))):Math.round(e*t)}function m(e,t){return Array.isArray(e)?e.map((e=>0===e?e:e+t)):e+t}function g(e,t,i,s,r,n,o){let a,l,c,h;if(Array.isArray(n))if(2===n.length){const e=Math.max(0,n[0]),t=Math.max(0,n[1]);a=e,l=e,c=t,h=t}else{if(4!==n.length)throw new Error("Wrong border radius - it should be like css border radius");a=Math.max(0,n[0]),l=Math.max(0,n[1]),c=Math.max(0,n[2]),h=Math.max(0,n[3])}else{const e=Math.max(0,n);a=e,l=e,c=e,h=e}o||e.beginPath(),e.moveTo(t+a,i),e.lineTo(t+s-l,i),0!==l&&e.arcTo(t+s,i,t+s,i+l,l),e.lineTo(t+s,i+r-c),0!==c&&e.arcTo(t+s,i+r,t+s-c,i+r,c),e.lineTo(t+h,i+r),0!==h&&e.arcTo(t,i+r,t,i+r-h,h),e.lineTo(t,i+a),0!==a&&e.arcTo(t,i,t+a,i,a)}function f(e,t,i,s,r,n,a=0,l=0,c="",h=o.LineStyle.Solid){if(e.save(),!l||!c||c===n)return g(e,t,i,s,r,a),e.fillStyle=n,e.fill(),void e.restore();const d=l/2;if("transparent"!==n){const d="transparent"!==c&&h!==o.LineStyle.Solid;g(e,d?t:t+l,d?i:i+l,d?s:s-2*l,d?r:r-2*l,d?a:m(a,-l)),e.fillStyle=n,e.fill()}if("transparent"!==c){g(e,t+d,i+d,s-l,r-l,m(a,-d)),e.lineWidth=l,e.strokeStyle=c,w(e,h),e.closePath(),e.stroke()}e.restore()}function v(e,t){return t=Math.max(1,t),e.map((e=>e*t))}function y(e,t,i,s,r,o,l,c,h){const{context:u}=e,p=o%2/2,_=t+p,m=s+p;let g,f;if(c){const{borderMode:e,borderWidth:a,color:l,dashPattern:h,lineStyle:d}=c;switch(e){case"outer":{const e=-o/2-a/2,t=-a/2;f={left:_+e,right:m-e,top:i+t,bottom:r-t};break}case"center":{const e=a%2/2;f={left:t+e,right:s+e,top:i+e,bottom:r+e};break}case"inner":{const e=-o/2+a/2,t=a/2;f={left:_+e,right:m-e,top:i+t,bottom:r-t}}}u.strokeStyle=l,u.lineWidth=a;let p=-1;h?u.setLineDash(v(h,a)):void 0!==d&&(w(u,d),d===n.LINESTYLE_SOLID&&(p=1)),g={left:f.left+p*a/2,top:f.top+p*a/2,right:f.right-p*a/2,bottom:f.bottom-p*a/2}}if(l&&(u.fillStyle=l.color,g||(g={left:_-o/2,right:m+o/2,top:i,bottom:r}), @@ -706,7 +706,7 @@ volFootprintStyle:this._volFootprintStyle,formattingDeps:this._formattingDeps};c _onSeriesError(e){this._loading=!1;let t=e.error;const i=e.ctx;if(i){const e={};Object.keys(i).forEach((t=>{e[t]=i[t].toString()})),t=t.format(e)}Gt&&$t.logNormal("Error reason: "+t),this._seriesErrorMessage=t;const s="unknown_symbol"!==t?12:jt&&this._symbolInfo?10:4;this._setStatus(s),this._seriesLoaded=!0,this._enablePriceRangeReady()}_onSeriesLoading(e){this._loading=!0,this._setStatus(2)}_onDataUpdated(e,t,i,r){var n;t?this._requestMoreDataAvailable=!0:this._lastPriceAnimationActive&&this._seriesLoaded&&this._lineStyleLastPriceCirclePaneView.update((0,me.sourceChangeEvent)(this.id())),this._lastBarCloseTime=e&&e.closeTime||null,this._boxSizeValue.setValue(this.data().boxSize),this._statusView.update(),this.clearAveragePriceCache(),this.clearHighLowPriceCache();const o=this.model(),a=(0,s.ensureNotNull)(o.paneForSource(this));o.recalculatePane(a,(0,me.sourceChangeEvent)({sourceId:this.id(),realtime:!t,firstUpdatedTimePointIndex:null!==(n=null==i?void 0:i.index)&&void 0!==n?n:void 0})),o.updateSource(this)}_setStatus(e){this._status=e,this._statusView.update(),this.model().updateSource(this),this._onStatusChanged.fire()}_onBarReceived(e){this.model().recalcVisibleRangeStudies(!0)}_recreateFormatter(){var e,t,i,s;let r=null;r=null!==(t=null===(e=null===Bt.customFormatters||void 0===Bt.customFormatters?void 0:Bt.customFormatters.priceFormatterFactory)||void 0===e?void 0:e.call(Bt.customFormatters,this.symbolInfo(),this.properties().childs().minTick.value()))&&void 0!==t?t:null,null!==r?(this._formatter=r,this._ignoreMinMoveFormatter=r):(this._formatter=(0,m.createSeriesFormatter)(null!==(i=this.symbolInfo())&&void 0!==i?i:this._formattingDeps,this.properties().childs().minTick.value()),this._ignoreMinMoveFormatter=(0,m.createSeriesFormatter)(this.symbolInfo(),this.properties().childs().minTick.value(),!0)),null===(s=this._priceScale)||void 0===s||s.updateFormatter(),this._formatterChanged.fire()}_recreatePriceStep(){const{minMove:e,priceScale:t}=(0,m.getSeriesPriceFormattingState)(this.symbolInfo()),i=e/t;this._ignoreMinMovePriceStep=1/t,this._priceStep!==i&&(this._priceStep=i,this._priceStepChanged.fire())}_recreatePriceFormattingDependencies(){this._recreateFormatter(),this._recreatePriceStep()}_onQuotesUpdate(e,t){void 0!==e.values.current_session&&e.values.current_session!==this._currentSession&&(this._currentSession=e.values.current_session,this._updateLastPriceAnimationActive())}_updateIsPrePostMarketPricesForbiddenProperty(){const e=(0,m.symbolHasPreOrPostMarket)(this._symbolInfo)&&(this.isDWM()||(0,m.isRegularSessionId)(this.sessionIdProxyProperty().value()));this._isPrePostMarketPricesAvailableProperty.setValue(e)}_updateSettlementAsCloseForbiddenProperty(){}_updateBackAdjustmentForbiddenProperty(){}_removeReplaySubscriber(){throw new Error("Not implemented")}_getSymbolForApi(){return this.symbol()}_getSymbolObject(e){const t=this._getExtendedSymbolObject(e),i=this.properties().childs().style.value();if(v.SYMBOL_STRING_DATA.hasOwnProperty(i)&&17!==i){return{symbol:t, type:this.styleStudyInfo(this.getStyleShortName()+"Style").studyId+"!",inputs:this.getInputsProperties().state()}}return t}_getExtendedSymbolObject(e){const t={symbol:null!=e?e:this._getSymbolForApi()},i=this.properties().childs();null!==this.currency()&&(t["currency-id"]=this.currency());const s=this.unit();return this._model.unitConversionEnabled()&&null!==s&&(t["unit-id"]=s),!this.isDWM()&&Yt&&(t.session=i.sessionId.value()),t}_checkChartStyle(){const e=this.style();(0,m.isCloseBasedSymbol)(this.symbolInfo())?(0,m.isSingleValueBasedStyle)(e)||(this.requestingStyleIsNotSupported.fire(),this._styleToRecover={correctedStyle:this.style(),originalStyle:e}):null!==this._styleToRecover&&(this.requestingStyleSupportRecovered.fire(this._styleToRecover.originalStyle),this._styleToRecover=null)}_updateSymbolInfo(e){if(this._symbolInfo=e,e){const t=this._properties.childs();t.shortName.setValue(e.name);const i=(0,m.extractSymbolNameFromSymbolInfo)(e,this.symbol());i&&t.symbol.setValue(i);const s=(0,m.symbolCurrency)(e),r=(0,m.symbolUnit)(e,this._model.unitConversionEnabled());"alwaysOff"===(0,Y.currencyUnitVisibilityProperty)().value()||s===t.currencyId.value()&&r===t.unitId.value()||this._model.fullUpdate(),t.currencyId.setValue(s),t.unitId.setValue(r),this._updateSessionIdProxyProperty(!0)}this._base=e?e.pricescale/e.minmov:100,this._pointValue=e&&e.pointvalue||1;const t=(0,Ge.encodeExtendedSymbolOrGetSimpleSymbolString)(this._getExtendedSymbolObject());this._quotesProvider.setQuotesSessionSymbol(t),this._marketStatusModel.setSymbolInfo(e),e&&this._recreatePriceFormattingDependencies(),this._statusView.update(),this.priceScale().updateFormatter(),this._symbolResolvingActive.setValue(!e),Yt&&this._updateIsPrePostMarketPricesForbiddenProperty()}_createHighLowAvgViews(){const e=this.properties().childs().highLowAvgPrice,t=this._getHighLowPrice.bind(this),i=function(e,t,i,s){const r=i.childs(),n=Be(e,t,{label:Ee,labelVisible:r.highLowPriceLabelsVisible,lineVisible:r.highLowPriceLinesVisible,lineColor:r.highLowPriceLinesColor,lineWidth:r.highLowPriceLinesWidth},(()=>s(0))),o=Be(e,t,{label:Ve,labelVisible:r.highLowPriceLabelsVisible,lineVisible:r.highLowPriceLinesVisible,lineColor:r.highLowPriceLinesColor,lineWidth:r.highLowPriceLinesWidth},(()=>s(1)));return{paneViews:[n.paneView,o.paneView],panePriceAxisViews:[n.panePriceAxisView,o.panePriceAxisView],priceAxisViews:[n.priceAxisView,o.priceAxisView],priceLineAxisViews:[n.priceLineAxisView,o.priceLineAxisView]}}(this._model,this,e,t);this._highLowAvgPaneViews.push(...i.paneViews),this._labelPaneViews.push(...i.panePriceAxisViews),this._priceAxisViews.push(...i.priceAxisViews),this._priceLineAxisViews.push(...i.priceLineAxisViews)}_createAverageViews(){const e=this.properties().childs().highLowAvgPrice,t=this._getAveragePrice.bind(this),i=ze(this._model,this,e,t);this._averagePaneViews.push(...i.paneViews),this._labelPaneViews.push(...i.panePriceAxisViews),this._priceAxisViews.push(...i.priceAxisViews),this._priceLineAxisViews.push(...i.priceLineAxisViews)}_getHighLowPrice(e){ if(!this._highLowPriceCache.has(e)){const e=this._model.timeScale().visibleBarsStrictRange();if(null===e)return null;const t=function(e,t,i){return e.minMaxOnRangeCached(t,i,[{name:"low",offset:0},{name:"high",offset:0}])}(this._model.mainSeries().bars(),e.firstBar(),e.lastBar());if(null===t)return null;this._highLowPriceCache.set(1,t.min),this._highLowPriceCache.set(0,t.max)}return this._highLowPriceCache.get(e)}_getAveragePrice(e){if(!this._averagePriceCache.has(e)){const e=this._model.timeScale().visibleBarsStrictRange();if(null===e)return null;const t=function(e,t,i){0;const s=(0,h.barFunction)("close");let r=0,n=0;for(let o=t;o<=i;o++){const t=e.valueAt(o);null!==t&&(r+=s(t),n++)}return n?r/n:null}(this._model.mainSeries().bars(),e.firstBar(),e.lastBar());if(null===t)return null;this._averagePriceCache.set(0,t)}return this._averagePriceCache.get(e)}_onSeriesCompleted(e){var t;this._loading=!1,this._seriesErrorMessage=null;let i=e.updateMode;switch("pulsed"===i&&(i="delayed"),i){case"streaming":this._setStatus(3);break;case"endofday":this._setStatus(6);break;case"delayed":this._setStatus(8);break;case"replay":this._setStatus(11)}i.match(/delayed_streaming/)&&this._setStatus(9),this._lastCompleteFlags=null!==(t=e.flags)&&void 0!==t?t:null;const r=(0,s.ensureNotNull)(this._model.paneForSource(this));r.recalculatePriceScale(this.priceScale(),(0,me.sourceChangeEvent)(this.id()));const n=Qe.InvalidationMask.full();null!==this._model.appliedTimeFrame().value()&&n.lockVisibleTimeRangeOnResize(),this._model.invalidate(n),!this.priceScale().isLockScale()||this.model().timeScale().isEmpty()||this._seriesLoaded||(this.model().timeScale().correctOffset(),this.model().timeScale().correctBarSpacing(),this.model().resetPriceScale(r,this.priceScale())),this._seriesLoaded=!0,this._seriesCompleted=!0,this.model().recalcVisibleRangeStudies(!0),this.model().recalcStudyBasedLineTools(),this._enablePriceRangeReady()}_notifyIntervalChanged(e){var t,i;const s={timeframe:null!==(t=this._pendingTimeRange)&&void 0!==t?t:void 0};this._intervalChanged.fire(e,s),this._pendingTimeRange=null!==(i=s.timeframe)&&void 0!==i?i:null}_onCurrencyChanged(){this._currencyChanged.fire()}_onUnitChanged(){this._unitChanged.fire()}_applySymbolParamsChanges(e){this._lastCompleteFlags=null,this.clearGotoDateResult();const t=this.interval();this.currency(),this.unit();K.Interval.isRange(t)&&this._properties.childs().rangeStyle.childs().inputs.childs().range.setValue(K.Interval.parse(t).multiplier());const{symbolChanged:i,intervalChanged:s,currencyChanged:r,unitChanged:n,force:o}=e,a=Yt&&s&&K.Interval.parse(t).isDWM()!=K.Interval.parse(t).isDWM();if(this._syncModel=null,this._prevRequestedInterval=t,5!==this._status&&(!this._seriesSource.isStarted()||i||r||n||a)&&this._updateSymbolInfo(null),5===this._status)return void this._model.realignLineTools();this._loading=!0,this._setStatus(1),Yt&&this._updateIsPrePostMarketPricesForbiddenProperty(),this._symbolIntervalChanged.fire(),s&&this._notifyIntervalChanged(t),this._onRestarted.fire(),this._seriesLoaded=!1, -this._seriesCompleted=!1,this._lineStyleLastPriceCirclePaneView.stopAnimation();let l=null;this._pendingTimeRange&&(l=this._pendingTimeRange,this._pendingTimeRange=null),this._onTimeFrameApplied.fire(l),this._onBeforeModifySeries(this.getSymbolString(),t);const c=this._shouldDefineNumberOfBarsForModifySeries(e)&&this._visibleBarsCount()||null;this.model().recalcVisibleRangeStudies(!0),this._data=null,this._seriesSource.modifySeries(this._getResolvingSymbolObject(),(0,pt.getServerInterval)(t),l,o,c),this._seriesSource.isStarted()||(this._predictBars=0,this._seriesSource.start()),(i||r||n)&&this.disablePriceRangeReady(),this.updateAllViews((0,me.sourceChangeEvent)(this.id())),this._model.lightUpdate()}_isIntervalSupported(e){return!0}_onBeforeModifySeries(e,t){0}_getResolvingSymbolObject(){return this._getSymbolObject(this._symbolForResolve())}_onSessionIdPropertyChanged(){this._sessionIdChanged.fire(),this.isDWM()||(this.restart(),this._updateLastPriceAnimationActive())}_subscribeRestartToSessionIdChange(){this.properties().childs().sessionId.subscribe(this,this._onSessionIdPropertyChangedBound)}_unsubscribeRestartToSessionIdChange(){this.properties().childs().sessionId.unsubscribe(this,this._onSessionIdPropertyChangedBound)}_updateLastPriceAnimationActive(){if(!this._options.lastPriceAnimationEnabled)return;const e=this._lastPriceAnimationActive,t=this.properties().childs(),i=t.style.value(),s=3===i||10===i||2===i||14===i||15===i;if(!this._model.isSnapshot()&&t.visible.value()&&s){const e=this.currentSession(),t=!(0,m.isRegularSessionId)(this.sessionIdProxyProperty().value())&&!this.isDWM();this._lastPriceAnimationActive="market"===e||t&&("pre_market"===e||"post_market"===e)}else this._lastPriceAnimationActive=!1;this._lastPriceAnimationActive&&e!==this._lastPriceAnimationActive&&this.model().invalidate(Qe.InvalidationMask.cursor())}_onPropertiesChanged(e){const t=this._properties.childs();e!==t.symbol&&e!==t.interval&&e!==t.timeframe&&(this._tagsChanged.fire(),this.createPaneView(),this.updateAllViews((0,me.sourceChangeEvent)(this._id)),this.model().updateSource(this),(0,o.emit)("series_properties_changed",this._id))}_recalcSymbolTextSourceProxyProperty(){this._textSourceIsAlwaysTickerRestrictionEnabled?this._symbolTextSourceProxyProperty.setValue("ticker"):this._symbolTextSourceProxyProperty.setValue(this._properties.childs().statusViewStyle.childs().symbolTextSource.value())}_clearStylePlot(e,t){if(0===e.size())return;if(void 0===t&&e!==this.nsBars())return void(this._precomputedBarStyles=new WeakMap);const i=null!=t?t:(0,s.ensureNotNull)(e.firstIndex()),r=(0,s.ensureNotNull)(e.lastIndex())+1;e.range(i,r).each(((e,t)=>(this._precomputedBarStyles.delete(t),!1)))}_visibleBarsCount(){const e=this._model.timeScale().visibleBarsStrictRange();return null==e?void 0:e.count()}_symbolForResolve(){var e;const t=this.symbol();return this._seriesSource.symbolSameAsResolved(t)&&null!==(e=this._seriesSource.resolvedSymbol())&&void 0!==e?e:t}_shouldDefineNumberOfBarsForModifySeries(e){ +this._seriesCompleted=!1,this._lineStyleLastPriceCirclePaneView.stopAnimation();let l=null;this._pendingTimeRange&&(l=this._pendingTimeRange,this._pendingTimeRange=null),this._onTimeFrameApplied.fire(l),this._onBeforeModifySeries(this.getSymbolString(),t);const c=this._shouldDefineNumberOfBarsForModifySeries(e)&&this._visibleBarsCount()||null;this.model().recalcVisibleRangeStudies(!0),this._data=null,this._seriesSource.modifySeries(this._getResolvingSymbolObject(),(0,pt.getServerInterval)(t),l,o,c),this._seriesSource.isStarted()||(this._predictBars=0,this._seriesSource.start()),(i||r||n)&&this.disablePriceRangeReady(),this.updateAllViews((0,me.sourceChangeEvent)(this.id())),this._model.lightUpdate()}_isIntervalSupported(e){return!0}_onBeforeModifySeries(e,t){0}_getResolvingSymbolObject(){return this._getSymbolObject(this._symbolForResolve())}_onSessionIdPropertyChanged(){this._sessionIdChanged.fire(),this.isDWM()||(this.restart(),this._updateLastPriceAnimationActive())}_subscribeRestartToSessionIdChange(){this.properties().childs().sessionId.subscribe(this,this._onSessionIdPropertyChangedBound)}_unsubscribeRestartToSessionIdChange(){this.properties().childs().sessionId.unsubscribe(this,this._onSessionIdPropertyChangedBound)}_updateLastPriceAnimationActive(){if(!this._options.lastPriceAnimationEnabled||b.enabled("disable_pulse_animation"))return;const e=this._lastPriceAnimationActive,t=this.properties().childs(),i=t.style.value(),s=3===i||10===i||2===i||14===i||15===i;if(!this._model.isSnapshot()&&t.visible.value()&&s){const e=this.currentSession(),t=!(0,m.isRegularSessionId)(this.sessionIdProxyProperty().value())&&!this.isDWM();this._lastPriceAnimationActive="market"===e||t&&("pre_market"===e||"post_market"===e)}else this._lastPriceAnimationActive=!1;this._lastPriceAnimationActive&&e!==this._lastPriceAnimationActive&&this.model().invalidate(Qe.InvalidationMask.cursor())}_onPropertiesChanged(e){const t=this._properties.childs();e!==t.symbol&&e!==t.interval&&e!==t.timeframe&&(this._tagsChanged.fire(),this.createPaneView(),this.updateAllViews((0,me.sourceChangeEvent)(this._id)),this.model().updateSource(this),(0,o.emit)("series_properties_changed",this._id))}_recalcSymbolTextSourceProxyProperty(){this._textSourceIsAlwaysTickerRestrictionEnabled?this._symbolTextSourceProxyProperty.setValue("ticker"):this._symbolTextSourceProxyProperty.setValue(this._properties.childs().statusViewStyle.childs().symbolTextSource.value())}_clearStylePlot(e,t){if(0===e.size())return;if(void 0===t&&e!==this.nsBars())return void(this._precomputedBarStyles=new WeakMap);const i=null!=t?t:(0,s.ensureNotNull)(e.firstIndex()),r=(0,s.ensureNotNull)(e.lastIndex())+1;e.range(i,r).each(((e,t)=>(this._precomputedBarStyles.delete(t),!1)))}_visibleBarsCount(){const e=this._model.timeScale().visibleBarsStrictRange();return null==e?void 0:e.count()}_symbolForResolve(){var e;const t=this.symbol();return this._seriesSource.symbolSameAsResolved(t)&&null!==(e=this._seriesSource.resolvedSymbol())&&void 0!==e?e:t}_shouldDefineNumberOfBarsForModifySeries(e){ return b.enabled("request_only_visible_range_on_reset")&&e.force||!1}_syncFootprintStudy(){}_onMinTickChanged(){this._recreateFormatter(),this._model.fullUpdate()}}},88732:(e,t,i)=>{"use strict";i.r(t),i.d(t,{SERIES_STATUS_TEXT:()=>g,STATUS_DELAYED:()=>d,STATUS_DELAYED_STREAMING:()=>u,STATUS_EOD:()=>c,STATUS_ERROR:()=>m,STATUS_INVALID_SYMBOL:()=>a,STATUS_LOADING:()=>n,STATUS_NO_BARS:()=>p,STATUS_OFFLINE:()=>s,STATUS_PULSE:()=>h,STATUS_READY:()=>o,STATUS_REPLAY:()=>_,STATUS_RESOLVING:()=>r,STATUS_SNAPSHOT:()=>l,STYLE_AREA:()=>S,STYLE_BARS:()=>f,STYLE_BASELINE:()=>I,STYLE_CANDLES:()=>v,STYLE_COLUMNS:()=>L,STYLE_HEIKEN_ASHI:()=>x,STYLE_HILO:()=>A,STYLE_HLC_AREA:()=>E,STYLE_HOLLOW_CANDLES:()=>T,STYLE_KAGI:()=>w,STYLE_LINE:()=>y,STYLE_LINE_WITH_MARKERS:()=>k,STYLE_PB:()=>P,STYLE_PNF:()=>C,STYLE_RANGE:()=>M,STYLE_RENKO:()=>b,STYLE_SHORT_NAMES:()=>V,STYLE_STEPLINE:()=>D,SYMBOL_STRING_DATA:()=>B});const s=0,r=1,n=2,o=3,a=4,l=5,c=6,h=7,d=8,u=9,p=10,_=11,m=12,g={[s]:"connecting",[r]:"loading",[n]:"loading",[o]:"realtime",[a]:"invalid",[l]:"snapshot",[c]:"endofday",[h]:"endofday",[d]:"delayed",[u]:"delayed_streaming",[p]:"forbidden",[_]:"replay",[m]:"error"},f=0,v=1,y=2,S=3,b=4,w=5,C=6,P=7,x=8,T=9,I=10,M=11,A=12,L=13,k=14,D=15,E=16,V={0:"bar",1:"candle",9:"hollowCandle",2:"line",14:"lineWithMarkers",15:"stepline",3:"area",16:"hlcArea",4:"renko",7:"pb",5:"kagi",6:"pnf",8:"ha",10:"baseline",11:"range",12:"hilo",13:"column",17:"volFootprint"},B={4:{type:"BarSetRenko@tv-prostudies",basicStudyVersion:64},7:{type:"BarSetPriceBreak@tv-prostudies",basicStudyVersion:34},5:{type:"BarSetKagi@tv-prostudies",basicStudyVersion:34},6:{type:"BarSetPnF@tv-prostudies",basicStudyVersion:34},8:{type:"BarSetHeikenAshi@tv-basicstudies",basicStudyVersion:60},11:{type:"BarSetRange@tv-basicstudies",basicStudyVersion:72},17:{type:"Footprint@tv-volumebyprice",basicStudyVersion:104}}},13497:(e,t,i)=>{"use strict";i.d(t,{SeriesData:()=>p,barFunction:()=>h,seriesPlotFunctionMap:()=>c});var s,r=i(50151),n=i(97034),o=i(78071);!function(e){e[e.FromLeft=-1]="FromLeft",e[e.FromRight=1]="FromRight"}(s||(s={}));const a={open:e=>e[1],high:e=>e[2],low:e=>e[3],close:e=>e[4],hl2:e=>(e[2]+e[3])/2,hlc3:e=>(e[2]+e[3]+e[4])/3,ohlc4:e=>(e[1]+e[2]+e[3]+e[4])/4},l=["open","high","low","close","hl2","hlc3","ohlc4"];function c(){const e=new Map;return l.forEach(((t,i)=>{e.set(t,h(t))})),e}function h(e,t,i){const s=a[null!=t?t:e],r=a[e],n=a[null!=i?i:e];return(e,t)=>{switch(t){case 0:return s(e);case 2:return n(e);default:return r(e)}}}function d(e,t){return null==e[t]}const u=[{barsToMerge:10,forBarspacingLargerThen:.03},{barsToMerge:30,forBarspacingLargerThen:.01},{barsToMerge:100,forBarspacingLargerThen:.003},{barsToMerge:500,forBarspacingLargerThen:0}];class p{constructor(){this._pressedChunks={chunks:new Map,priceSource:"uninitialized"},this.m_bars=new n.PlotList(c(),d),this.m_nsBars=new n.PlotList(c(),d),this._clearPressedChunks()}bars(){return this.m_bars}nsBars(){return this.m_nsBars}pressedChunks(e,t){if(t!==this._pressedChunks.priceSource){ this._pressedChunks.priceSource=t;const e=this.m_bars.first();e&&(this._clearPressedChunks(),this._rebuildPressedChunks(e))}const i=(0,r.ensureDefined)(u.find((t=>t.forBarspacingLargerThen<=e)));return(0,r.ensureDefined)(this._pressedChunks.chunks.get(i.barsToMerge))}mergeRegularBars(e){const t=this.m_bars.size(),i=this.m_bars.merge(e);return i&&"uninitialized"!==this._pressedChunks.priceSource&&(t===this.m_bars.size()&&i.index===this.m_bars.lastIndex()?this._updateLatestChunks():this._rebuildPressedChunks(i)),i}size(){return this.m_bars.size()+this.m_nsBars.size()}each(e){this.m_bars.each(e),this.m_nsBars.each(e)}clear(){this.m_bars.clear(),this.m_nsBars.clear(),this.lastProjectionPrice=void 0,this._clearPressedChunks()}isEmpty(){return this.m_bars.isEmpty()&&this.m_nsBars.isEmpty()}first(){return this.m_bars.isEmpty()?this.m_nsBars.first():this.m_bars.first()}last(){return this.m_nsBars.isEmpty()?this.m_bars.last():this.m_nsBars.last()}search(e,t,i){return this.nsBars().isEmpty()?this.bars().search(e,t,i):this.bars().isEmpty()||(0,r.ensureNotNull)(this.nsBars().firstIndex())<=e?this.nsBars().search(e,t,i):this.bars().search(e,t,i)}valueAt(e){const t=this.search(e);return null!==t?t.value:null}plotValueToTimePointIndex(e,t,i){if(i===s.FromRight){const i=(i,s)=>{const r=s[t];return null!=r&&e>=r},s=this.m_bars.findLast(i);if(null!==s)return s.index;const r=this.m_nsBars.findLast(i);return null!==r?r.index:this.m_bars.firstIndex()}if(i===s.FromLeft){const i=(i,s)=>{const r=s[t];return null!=r&&e<=r},s=this.m_bars.findFirst(i);if(null!==s)return s.index;const r=this.m_nsBars.findFirst(i);return null!==r?r.index:this.m_bars.lastIndex()}throw new Error("plotValueToTimePointIndex: unsupported search mode")}moveData(e){this.m_bars.move(e),this.m_nsBars.move(e),this.m_bars.size()>0&&this._rebuildPressedChunks((0,r.ensureNotNull)(this.m_bars.first()))}_rebuildPressedChunks(e){const t=this._pressedChunks.priceSource;if("uninitialized"===t)return;const i=e.index,s=a[t],n=(e,t,i)=>{let r=null;for(const n of e){const e=s(n.value);r&&n.index-r.startTime>=i.barsToMerge&&(t.push(r),r=null),r?(r.endTime=n.index,r.high=Math.max(r.high,e),r.low=Math.min(r.low,e),r.close=e):r={startTime:n.index,endTime:n.index,open:e,high:e,low:e,close:e}}r&&t.push(r)};u.forEach((e=>{const t=(0,r.ensureDefined)(this._pressedChunks.chunks.get(e.barsToMerge)),s=(0,o.lowerbound)(t,i,((e,t)=>e.endTime0){const i=t[0].startTime-1,s=(0,r.ensureNotNull)(this.m_bars.firstIndex()),o=this.m_bars.rangeIterator(s,i),a=[];n(o,a,e);const l=a.concat(t);this._pressedChunks.chunks.set(e.barsToMerge,l)}else{const i=(0,r.ensureNotNull)(this.m_bars.lastIndex());t.splice(s);let o=(0,r.ensureNotNull)(this.m_bars.firstIndex());t.length&&(o=t[t.length-1].endTime+1);const a=this.m_bars.rangeIterator(o,i);n(a,t,e)}}))}_updateLatestChunks(){const e=(0,r.ensureNotNull)(this.m_bars.last());u.forEach((t=>{const i=(0,r.ensureDefined)(this._pressedChunks.chunks.get(t.barsToMerge)),s=e.value[4],n=i[i.length-1];n.high=Math.max(n.high,s),n.low=Math.min(n.low,s), n.close=s,n.endTime=e.index}))}_clearPressedChunks(){u.forEach((e=>this._pressedChunks.chunks.set(e.barsToMerge,[])))}}},96280:(e,t,i)=>{"use strict";i.d(t,{SeriesTimeRangeVolumeCalculator:()=>s});class s{constructor(e){this._value=null,this._series=e,this._series.dataEvents().dataUpdated().subscribe(this,this._onSeriesUpdated)}destroy(){this._series.dataEvents().dataUpdated().unsubscribeAll(this)}volume(e,t){if(null!==this._value&&this._value.from===e&&this._value.to===t)return this._value.value;let i=0;const s=this._series.data().bars(),r=s.firstIndex(),n=s.lastIndex();if(null!==r&&en&&t>n)i=NaN;else{const s=this._series.data().bars().rangeIterator(Math.min(e,t),Math.max(e,t));for(const e of s){const t=e.value[5];if(void 0===t){i=NaN;break}i+=t}}return this._value={from:e,to:t,value:i},i}_onSeriesUpdated(e,t){if(null===this._value)return;if(t)return void(this._value=null);const i=this._series.data().bars().lastIndex();(null===i||i<=this._value.to)&&(this._value=null)}}},42960:(e,t,i)=>{"use strict";i.r(t),i.d(t,{actualSymbol:()=>ge,chartStyleStudyId:()=>H,createSeriesFormatter:()=>$,displayedSymbolExchange:()=>me,displayedSymbolName:()=>_e,extractLineToolSymbolFromSymbolInfo:()=>ce,extractSymbolNameFromSymbolInfo:()=>le,getChartStyleByResolution:()=>F,getDefaultStyle:()=>O,getLastUsedRawDataStyle:()=>N,getLastUsedSingleValueBasedStyle:()=>R,getLastUsedStyle:()=>B,getSeriesDisplayErrorWV:()=>Ie,getSeriesPriceFormattingState:()=>q,getSourceForEconomySymbol:()=>ue,getSymbolExchange:()=>Pe,getTranslatedChartStyleName:()=>P,hasProjection:()=>j,hasVolume:()=>we,isCloseBasedSymbol:()=>ye,isConvertedToOtherCurrency:()=>J,isConvertedToOtherUnit:()=>ie,isEconomicSymbol:()=>Ce,isFutureContinuousSymbolWithBackajustment:()=>xe,isFuturesContractSymbol:()=>Te,isMeasureUnitSymbol:()=>Se,isPriceSourceStyle:()=>G,isRangeBasedStyle:()=>T,isRangeStyle:()=>M,isRawDataStyle:()=>D,isRegularSessionId:()=>ve,isRequiringRestartSeriesStyles:()=>x,isSingleValueBasedStyle:()=>k,isTimeBasedStyle:()=>A,isValidStyle:()=>L,isVolumeWeightedStyle:()=>W,measureUnitId:()=>be,preparePriceAxisProperties:()=>z,proSymbol:()=>fe,setLastUsedRawDataStyle:()=>V,setLastUsedStyle:()=>E,styleChangeRequiresRestart:()=>I,symbolBaseCurrency:()=>X,symbolCurrency:()=>K,symbolCurrencyConvertible:()=>Y,symbolCurrentContract:()=>re,symbolHasEconomicEvents:()=>ae,symbolHasPreOrPostMarket:()=>ne,symbolHasSeveralSessions:()=>oe,symbolOriginalCurrency:()=>Z,symbolOriginalUnit:()=>te,symbolTitle:()=>pe,symbolTitleSeparator:()=>de,symbolToSaveInState:()=>he,symbolUnit:()=>ee,symbolUnitConvertible:()=>Q,symbolUnitConvertibleGroupsIfExist:()=>se});var s=i(11542),r=i(56840),n=(i(49483),i(88145)),o=i(88732),a=i(36274),l=i(71766),c=i(14483),h=i(98596),d=i(93572),u=i(91349),p=i(97906),_=i(28986) diff --git a/charting_library/bundles/runtime.13083b9d6b700c731a94.js b/charting_library/bundles/runtime.c40b52a0e272d23ced6d.js similarity index 98% rename from charting_library/bundles/runtime.13083b9d6b700c731a94.js rename to charting_library/bundles/runtime.c40b52a0e272d23ced6d.js index 51036492..d1896d1a 100644 --- a/charting_library/bundles/runtime.13083b9d6b700c731a94.js +++ b/charting_library/bundles/runtime.c40b52a0e272d23ced6d.js @@ -1,6 +1,6 @@ (()=>{"use strict";var e,a,d,c,t,f={},b={};function r(e){var a=b[e];if(void 0!==a)return a.exports;var d=b[e]={id:e,loaded:!1,exports:{}};return f[e].call(d.exports,d,d.exports,r),d.loaded=!0,d.exports}r.m=f,r.c=b,e=[],r.O=(a,d,c,t)=>{if(!d){var f=1/0;for(i=0;i=t)&&Object.keys(r.O).every((e=>r.O[e](d[n])))?d.splice(n--,1):(b=!1,t0&&e[i-1][2]>t;i--)e[i]=e[i-1];e[i]=[d,c,t]},r.n=e=>{var a=e&&e.__esModule?()=>e.default:()=>e;return r.d(a,{a}),a},d=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,r.t=function(e,c){if(1&c&&(e=this(e)),8&c)return e;if("object"==typeof e&&e){if(4&c&&e.__esModule)return e;if(16&c&&"function"==typeof e.then)return e}var t=Object.create(null);r.r(t);var f={};a=a||[null,d({}),d([]),d(d)];for(var b=2&c&&e;"object"==typeof b&&!~a.indexOf(b);b=d(b))Object.getOwnPropertyNames(b).forEach((a=>f[a]=()=>e[a]));return f.default=()=>e,r.d(t,f),t},r.d=(e,a)=>{for(var d in a)r.o(a,d)&&!r.o(e,d)&&Object.defineProperty(e,d,{enumerable:!0,get:a[d]})},r.f={},r.e=e=>Promise.all(Object.keys(r.f).reduce(((a,d)=>(r.f[d](e,a),a)),[])),r.u=e=>9417===e?"__LANG__.9417.7ff64779d43389a1bb41.js":3175===e?"__LANG__.3175.e0a2c845c5cba23f42fb.js":3951===e?"__LANG__.3951.babac9be598102fb0d92.js":5362===e?"__LANG__.5362.311bfba5d2c84b13ec2b.js":2578===e?"__LANG__.2578.ab3178e0160c259eac53.js":2547===e?"__LANG__.2547.28b713bedf796244795d.js":2285===e?"__LANG__.2285.1268ecef367debd2960b.js":344===e?"__LANG__.344.a9e566fa1091368f40c7.js":178===e?"__LANG__.178.dd03c0163a8373c0fc5b.js":6306===e?"__LANG__.6306.b88dcc3f0d7db89ebfc1.js":3236===e?"__LANG__.3236.e12bb9a536432e97ec0c.js":({92:"chart-screenshot-hint",139:"get-error-card",507:"study-pane-views",607:"study-property-pages-with-definitions",731:"add-compare-dialog",1583:"lt-pane-views",1584:"context-menu-renderer",1702:"manage-drawings-dialog",1754:"symbol-search-dialog",1859:"go-to-date-dialog-impl",1890:"line-tools-icons",2077:"change-interval-dialog",2183:"study-inputs-pane-views",2306:"floating-toolbars",2377:"hammerjs",2616:"svg-renderer",2704:"currency-label-menu",2878:"drawing-toolbar",3005:"header-toolbar",3030:"new-confirm-inputs-dialog",3596:"general-property-page",4013:"custom-intervals-add-dialog",4079:"series-pane-views",4389:"take-chart-image-impl",4665:"share-chart-to-social-utils",4862:"object-tree-dialog",5009:"load-chart-dialog",5093:"chart-widget-gui",5516:"restricted-toolset",5551:"favorite-drawings-api",5565:"ichart-storage",5598:"lt-stickers-atlas",6124:"chart-storage-library-http",6166:"chart-event-hint",6265:"new-edit-object-dialog",6456:"study-market",6631:"study-template-dialog",6780:"source-properties-editor",7078:"general-chart-properties-dialog",7129:"line-tools-synchronizer",7260:"chart-bottom-toolbar",7271:"compare-model",7648:"show-theme-save-dialog",7987:"lt-icons-atlas",8020:"user-defined-bars-marks-tooltip",8313:"chart-storage-external-adapter", 8537:"lt-property-pages-with-definitions",8643:"full-tooltips-popup",8890:"simple-dialog",9039:"lollipop-tooltip-renderer",9374:"symbol-info-dialog-impl",9498:"export-data",9685:"series-icons-map",9754:"global-search-dialog"}[e]||e)+"."+{6:"a03a8ff024d47ed075c6",92:"795900ef9e075c847a64",139:"83ba0cba4c0538851e0a",507:"51d0897ba74454ec3423",524:"2b350163c328ac8dce2e",607:"1d3c58ff151a9c7c19a3",731:"5039a5ac2f3556b18cb1",750:"e16edadfacd60574d861",826:"906374d84a8e6c40c6e8",855:"61db310932f8af2c5989",898:"b63568700f1380e37b1a",956:"a325fc0a9a24da09a622",962:"9f54d549868e21286372",1033:"bb804c64fe58de0bace7",1109:"845f0f111ff830ab93c8",1553:"c076714f5e24887f0b94",1583:"077de067da0763f84cb2",1584:"4170e3d150582097504c",1702:"5f8ccee744105adf029e",1740:"4c61de525e940eee4f3c",1754:"e5850d7e02343ee54c52",1762:"9511e5b410d7d629bc49",1803:"5799aa316db71b2f13e5",1859:"851f6bf2bf36fe8fbac4",1890:"ecc8d3a4af49afed6b6d",2052:"e9d07fdfb896fca26166",2077:"ebdeefbf84f9e033ed5b",2109:"291fa715b6ded706c3dd",2183:"6caf467f12b1d6ee408a",2191:"2197cc1b66a1db8969cc",2260:"95dc0a20b147b6b2eeed",2306:"96ac7a46b7738535bc92",2377:"6e30e0c48af40bf2f6c0",2443:"66f44a8bfe8d49aaeaee",2486:"2b718a16270e4168ea54",2544:"225f38946afc6ad55a35",2587:"615babc52637decdb6e2",2616:"f065beaf6b5b37da27d9",2639:"a55d77a7912be54f7b9d",2666:"d28c0fa0a323b8118f22",2676:"a9a5ede4d514162164fa",2704:"8bac01cc43d3f2cbf903",2731:"55eed17fefac5e82c077",2846:"fbbd62afe04b4f9387f2",2878:"37a00c1b0c7a68cc1d44",3005:"df1a95078c18a5da785c",3030:"5ce0d1c060e0d28cde15",3066:"8b1d2ceb22d9fedde67b",3263:"238cd2d620e004adee5a",3353:"de1d5e3e034ab68aa9fc",3502:"1985af3fa836c4248178",3596:"e4f9354142134a911ace",3610:"c79c6bddd919cb78428a",3717:"6f65e91a870250a6e450",3780:"ef366b87d104534e68d8",3842:"8758110ab553b5368121",3896:"14d9e7509c300245c219",3914:"33b17e48eb923e015932",3939:"2ee1e71dbe0bc0d85625",3980:"9d7eeb2bacce45c508b3",3986:"b50fcad4f1b77533bda7",4013:"1aa54900370f7317d3f0",4015:"9b6607a6f543f077c5a5",4062:"9229fac3ef3db26fd5bc",4079:"d3299bca6e9fad2c340a",4102:"67b3d1107a6ec8d571eb",4215:"8934b190aaed2663c300",4370:"18ca7d93e5073f0446c0",4389:"600804a9c180df6a83b1",4403:"bf44a542113a4440984b",4648:"7172f75bb866b3438c6f",4665:"d7331dbca4a2aa0909e7",4713:"d82fc553d710da1606f0",4781:"e8294ba5c7c6aef1fce7",4788:"d3e8ad5f514051fcc835",4862:"0b6cab4cb55e2cef2c40",4894:"035fecc664874bb752b0",4987:"a23484dfcca6d5fae195",5009:"9a37c608b4849a6f8a11",5057:"5382614553878fcf337d",5093:"75a373be3b6816e8b55a",5128:"57de9f218989cee8119d",5145:"da831552b3b54ca47682",5163:"953e65e04ed31b0ea0b3",5164:"a45b25a7ca6a0c16f810",5166:"979eb8cba5281ffcb38b",5516:"78732f5a01aa118efb81",5551:"340e60e2342b0d93ebe7",5565:"1144e5a1b4f8503ee572",5598:"52ad6e6d7d7b134ab0ba",5649:"5c1e55c9dad604880876",5664:"87e81959e880fa8ba65d",5866:"039e25226b82968cca61",5940:"c058b0e0ef421f740684",5983:"3c0ae13972f5d3433a77",5993:"0e5f49179c6a516963de",6025:"d669a0315da9d6fda6b3",6036:"5b373caaaa6e1ba4495f",6106:"1d31df88e63bf542ea7b",6124:"f1f53155460ee314f062",6166:"9fb712c61440c609af69", -6214:"5a578175aab923a979dc",6221:"56c4d15c823c019ddb39",6265:"b3553940c9159e24d8aa",6408:"e58aaf98d9306e8d9b77",6456:"b04732ea1491ac587015",6494:"7f264af8142cb9910c06",6625:"364cf21fe24d7e675de8",6631:"711ba6ae5b343ace8691",6639:"a1bd5bf1d51c681561a1",6747:"ae7a7ec28d22057d6d0d",6752:"912872ffa56a7243d664",6780:"3b96f58f66e0caa61b15",6884:"07642217627127113fb0",6918:"c8f3265e9286a784038b",6925:"665969c4af4481df0691",6949:"f50051a55eaa8dd5e780",6985:"8d289318ce5fe6dc7763",7051:"ba50ecafb4527628fb40",7078:"cddce4ed266fd9e0629e",7111:"4716f3208dc337521c10",7129:"0bc2d3617dda7143f094",7149:"d450e8145ad7e6fbd67f",7194:"098c1a8da1ddbbda98f6",7260:"90c0a4f4e79f0973fd8f",7271:"f7e796a37129a93179ee",7350:"aa555ff9e17c4029aedd",7391:"c63bd39c42093cc4130c",7413:"3a52b91975b98e6fe8e4",7550:"087936b2aa6ea51cd6bf",7555:"ea682716c26bc13db765",7648:"02c87d9b20f743b5cf16",7663:"6fabc58c7ddf7c2b076f",7807:"6adfcf6c0792dc9c9363",7871:"df6a9177c293c0c53e80",7987:"5d7c9d668ac98bd5bce1",8020:"71213c4f755723965a80",8056:"c06a1c8fb4a1f18cf217",8149:"9fb525d10e5c8ba95701",8167:"3edae41386acc976c9f8",8287:"7a7977ba76726177fb3c",8313:"9c1267d07e48b8d8f53f",8450:"757d38443ea38bd0165f",8537:"ae758430950906d90d11",8643:"3a92633d0497afb5344c",8882:"9838a8b1e0e6766b6408",8890:"6a6e7744cd3263ce2887",8904:"87e94e93ade13962a48f",9039:"19bbb3fc39665da2e3e6",9138:"f516266ddcf6ca8c7064",9327:"0c38440ca52f144413ac",9374:"6ef1056ef156ddb4caf1",9403:"61498701a4dae3f700c2",9465:"ca5284cff2560957cdd6",9498:"f43b3c60275506b2198a",9685:"f25fb7b89b7e831b726c",9754:"91018047180ff0d9e40b",9789:"458feb5c8c0263b0618b",9842:"581808dd4a8651b16779",9916:"0c2cb2d12479a20efce1"}[e]+".js",r.miniCssF=e=>e+"."+{6:"362fa6a7ab1f3e3b06c4",524:"ef662c4bc3e57dd91171",826:"2effba57f47544e58368",855:"56a5e53c97d91a9f96f7",898:"f909d7c1efc95f635922",956:"1e89775cfd644d656c56",1033:"5197f9f8b8500206d06c",1109:"b1ced88f4a839badfff1",1762:"7ff6b353c441db2276da",1803:"4653bb65d2b0d594d6af",2109:"4d5de3fbde1cd7dc5e9f",2191:"bb0aa12f5e562fd483f3",2260:"b98824e4829a1aa9b444",2486:"82c7dba4839761a57f28",2587:"1f1100dc01693edfe269",2639:"7b1d42eef7b89e0e96d3",2666:"fbb750fd312778403036",2676:"2d3cabbd39a3b0d6e9ea",2731:"ec19f123cabf8efd03a4",3066:"58a325f25b087530293d",3353:"860146c59230ab4bd938",3502:"c49903f7222870ff8aca",3610:"11b7ad14e26429fdfa5d",3717:"856421c70a4dff35762a",3780:"a289557f2e0bcabcc4ca",3842:"8cf6b523fd5a5b6fb022",3896:"96db838d3467bcf68051",3914:"d2b6c577f350629b6837",3939:"4d0187960a564ff5a557",3980:"b2ff45a2d8bb6a131d7c",4015:"1d0e3a62a59d173c81f3",4102:"4abd8542fa3aa3e7fd5d",4215:"d24836a292b1969ab4bb",4781:"cf1365a3bf51d9989978",4788:"3cff897925f7a8dbc837",4894:"99d4c2794da9feef3c70",4987:"ca5d16a7e990d39bfb0e",5145:"a2b224fd27ab2941c565",5163:"950dd1d584f76da1ed3b",5166:"a12c50ad6225ca6de843",5649:"b60ed09c5ea8c55827d4",5866:"f164dd2a584ab0f493cf",5940:"aedc1bdbd324e6042b17",5993:"4705829d0834140ee3f2",6025:"263b457b1a7f9ca139b2",6036:"3b493a9f0ab052e6447c",6106:"f01163745d787b60c86c",6214:"65b7dbf8be6cca5ac143",6221:"bc53670dfb8f982908a2", +6214:"5a578175aab923a979dc",6221:"56c4d15c823c019ddb39",6265:"b3553940c9159e24d8aa",6408:"e58aaf98d9306e8d9b77",6456:"6dd3b88a86eba6172f5c",6494:"7f264af8142cb9910c06",6625:"364cf21fe24d7e675de8",6631:"711ba6ae5b343ace8691",6639:"a1bd5bf1d51c681561a1",6747:"ae7a7ec28d22057d6d0d",6752:"912872ffa56a7243d664",6780:"3b96f58f66e0caa61b15",6884:"07642217627127113fb0",6918:"c8f3265e9286a784038b",6925:"665969c4af4481df0691",6949:"f50051a55eaa8dd5e780",6985:"8d289318ce5fe6dc7763",7051:"ba50ecafb4527628fb40",7078:"cddce4ed266fd9e0629e",7111:"4716f3208dc337521c10",7129:"0bc2d3617dda7143f094",7149:"d450e8145ad7e6fbd67f",7194:"098c1a8da1ddbbda98f6",7260:"4d02fadc540256bf733e",7271:"f7e796a37129a93179ee",7350:"aa555ff9e17c4029aedd",7391:"c63bd39c42093cc4130c",7413:"3a52b91975b98e6fe8e4",7550:"087936b2aa6ea51cd6bf",7555:"ea682716c26bc13db765",7648:"02c87d9b20f743b5cf16",7663:"6fabc58c7ddf7c2b076f",7807:"6adfcf6c0792dc9c9363",7871:"df6a9177c293c0c53e80",7987:"5d7c9d668ac98bd5bce1",8020:"71213c4f755723965a80",8056:"c06a1c8fb4a1f18cf217",8149:"9fb525d10e5c8ba95701",8167:"3edae41386acc976c9f8",8287:"7a7977ba76726177fb3c",8313:"9c1267d07e48b8d8f53f",8450:"757d38443ea38bd0165f",8537:"ae758430950906d90d11",8643:"3a92633d0497afb5344c",8882:"9838a8b1e0e6766b6408",8890:"6a6e7744cd3263ce2887",8904:"87e94e93ade13962a48f",9039:"19bbb3fc39665da2e3e6",9138:"f516266ddcf6ca8c7064",9327:"0c38440ca52f144413ac",9374:"6ef1056ef156ddb4caf1",9403:"61498701a4dae3f700c2",9465:"ca5284cff2560957cdd6",9498:"f43b3c60275506b2198a",9685:"f25fb7b89b7e831b726c",9754:"91018047180ff0d9e40b",9789:"458feb5c8c0263b0618b",9842:"581808dd4a8651b16779",9916:"0c2cb2d12479a20efce1"}[e]+".js",r.miniCssF=e=>e+"."+{6:"362fa6a7ab1f3e3b06c4",524:"ef662c4bc3e57dd91171",826:"2effba57f47544e58368",855:"56a5e53c97d91a9f96f7",898:"f909d7c1efc95f635922",956:"1e89775cfd644d656c56",1033:"5197f9f8b8500206d06c",1109:"b1ced88f4a839badfff1",1762:"7ff6b353c441db2276da",1803:"4653bb65d2b0d594d6af",2109:"4d5de3fbde1cd7dc5e9f",2191:"bb0aa12f5e562fd483f3",2260:"b98824e4829a1aa9b444",2486:"82c7dba4839761a57f28",2587:"1f1100dc01693edfe269",2639:"7b1d42eef7b89e0e96d3",2666:"fbb750fd312778403036",2676:"2d3cabbd39a3b0d6e9ea",2731:"ec19f123cabf8efd03a4",3066:"58a325f25b087530293d",3353:"860146c59230ab4bd938",3502:"c49903f7222870ff8aca",3610:"11b7ad14e26429fdfa5d",3717:"856421c70a4dff35762a",3780:"a289557f2e0bcabcc4ca",3842:"8cf6b523fd5a5b6fb022",3896:"96db838d3467bcf68051",3914:"d2b6c577f350629b6837",3939:"4d0187960a564ff5a557",3980:"b2ff45a2d8bb6a131d7c",4015:"1d0e3a62a59d173c81f3",4102:"4abd8542fa3aa3e7fd5d",4215:"d24836a292b1969ab4bb",4781:"cf1365a3bf51d9989978",4788:"3cff897925f7a8dbc837",4894:"99d4c2794da9feef3c70",4987:"ca5d16a7e990d39bfb0e",5145:"a2b224fd27ab2941c565",5163:"950dd1d584f76da1ed3b",5166:"a12c50ad6225ca6de843",5649:"b60ed09c5ea8c55827d4",5866:"f164dd2a584ab0f493cf",5940:"aedc1bdbd324e6042b17",5993:"4705829d0834140ee3f2",6025:"263b457b1a7f9ca139b2",6036:"3b493a9f0ab052e6447c",6106:"f01163745d787b60c86c",6214:"65b7dbf8be6cca5ac143",6221:"bc53670dfb8f982908a2", 6494:"4c212043f24336e170d5",6625:"0ed88fc3a989c98408cc",6639:"885b5577e3fb71ee2bea",6747:"c7d403ae692f88568278",6752:"207eb3cc75b3ed2c6754",6884:"bb7d30a7bbbe5af36556",6925:"a3a09d7303a96edb77cb",6949:"19355e81a60b640ea097",6985:"2cd225354e2fd236e8e9",7111:"b16b4eb739a7e8577559",7149:"12adbb19fdefe9b66b18",7194:"e04f69c8933166966874",7350:"00632eec360f0cf2d9a0",7391:"9c809fa91ed0c8f75bc0",7413:"f830ad1ad6ee6f9b1cb3",7555:"8c1e3939e7666b0f8c69",7807:"8577632fdab29ee53ddf",7871:"fff454908cba03863eb7",8056:"1f54f717d8e522c55c89",8149:"21f2b01074a4d082e268",8287:"2b6f71ec5c0064590ffd",8450:"f75ab24e1ecb22d29183",8904:"a302177fe7e3ccd50cb0",9138:"03b8fbcfabcae851949a",9327:"97be240031495a68333f",9403:"db9859ab09623682562c",9465:"fd61e82b3c912f2e9fad",9789:"cb5ad20bc727d3820b6c",9842:"ceaeabba258d065497c8",9916:"60c48148a54dba9504a0"}[e]+".css",r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.hmd=e=>((e=Object.create(e)).children||(e.children=[]),Object.defineProperty(e,"exports",{enumerable:!0,set:()=>{throw new Error("ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead: "+e.id)}}),e),r.o=(e,a)=>Object.prototype.hasOwnProperty.call(e,a),c={},t="tradingview:",r.l=(e,a,d,f)=>{if(c[e])c[e].push(a);else{var b,n;if(void 0!==d)for(var o=document.getElementsByTagName("script"),i=0;i{b.onerror=b.onload=null,clearTimeout(u);var t=c[e];if(delete c[e],b.parentNode&&b.parentNode.removeChild(b),t&&t.forEach((e=>e(d))),a)return a(d)},u=setTimeout(s.bind(null,void 0,{type:"timeout",target:b}),12e4);b.onerror=s.bind(null,b.onerror),b.onload=s.bind(null,b.onload),n&&document.head.appendChild(b)}},r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),(()=>{var e;r.g.importScripts&&(e=r.g.location+"");var a=r.g.document;if(!e&&a&&(a.currentScript&&(e=a.currentScript.src),!e)){var d=a.getElementsByTagName("script");d.length&&(e=d[d.length-1].src)}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),r.p=e})(),r.g.location&&r.p.startsWith(r.g.location.origin)&&(r.p=r.p.slice(r.g.location.origin.length)),(()=>{const e=r.u;r.u=a=>e(a).replace("__LANG__",r.g.language)})(),(()=>{const e={ca_ES:(e=1)=>+(1!=e),cs:(e=1)=>+(1==e?0:e>=2&&e<=4?1:2),el:(e=1)=>+(1!=e),da_DK:(e=1)=>+(1!=e),en:(e=1)=>+(1!=e),et_EE:(e=1)=>+(1!=e),fa:(e=1)=>0,hu_HU:(e=1)=>0,id_ID:(e=1)=>0,it:(e=1)=>+(1!=e),ms_MY:(e=1)=>0, no:(e=1)=>+(1!=e),nl_NL:(e=1)=>+(1!=e),ro:(e=1)=>+(1==e?0:e%100>19||e%100==0&&0!=e?2:1),sk_SK:(e=1)=>+(1==e?0:e>=2&&e<=4?1:2),sv:(e=1)=>+(1!=e),zh:(e=1)=>0,zh_TW:(e=1)=>0,de:(e=1)=>+(1!=e),es:(e=1)=>+(1!=e),fr:(e=1)=>+(e>1),he_IL:(e=1)=>+(1==e?0:2==e?1:e>10&&e%10==0?2:3),ko:(e=1)=>0,ja:(e=1)=>0,pl:(e=1)=>+(1==e?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2),pt:(e=1)=>+(1!=e),tr:(e=1)=>+(1!=e),vi:(e=1)=>0,ar:(e=1)=>+(0==e?0:1==e?1:2==e?2:e%100>=3&&e%100<=10?3:e%100>=11&&e%100<=99?4:5),ru:(e=1)=>+(e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2),th:(e=1)=>0};r.tf=(a,d={},c)=>{if(null===a){if(Array.isArray(c)){if(r.g.customTranslateFunction){const e=r.g.customTranslateFunction(c[0],d.plural?{...d,plural:c.length>2?c.slice(1):c[1]}:d,!0);if(null!==e)return e}return(c[e[r.g.language](d.count)]||c[0]).replace(/{(\w+)}/g,((e,a)=>void 0!==(d.replace||d)[a]?(d.replace||d)[a]:e))}return"object"==typeof c?r.tf(null,d,c[r.g.language||"en"]):r.tf(c,d)}if(c&&a){const e=`${a}${d.context?`_${d.context}`:""}`;if(c[e])return r.tf(null,d,c[e])}if("number"==typeof a)return a.toString();if("string"!=typeof a)return"";if(r.g.customTranslateFunction){const e=r.g.customTranslateFunction(a,d,!1);if(null!==e)return e}return(d.plural&&1!=+d.count?d.plural:a).replace(/{(\w+)}/g,((e,a)=>void 0!==(d.replace||d)[a]?(d.replace||d)[a]:e))}})(),r.p=r.g.WEBPACK_PUBLIC_PATH||r.p;var n=r.e,o=Object.create(null);function i(e,a){return n(e).catch((function(){return new Promise((function(d){var c=function(){self.removeEventListener("online",c,!1),!1===navigator.onLine?self.addEventListener("online",c,!1):d(a<2?i(e,a+1):n(e))};setTimeout(c,a*a*1e3)}))}))}r.e=function(e){if(!o[e]){o[e]=i(e,0);var a=function(){delete o[e]};o[e].then(a,a)}return o[e]},(()=>{if("undefined"!=typeof document){var e=e=>new Promise(((a,d)=>{var c=r.miniCssF(e),t=r.p+c;if(((e,a)=>{for(var d=document.getElementsByTagName("link"),c=0;c{var f=document.createElement("link");f.rel="stylesheet",f.type="text/css",f.onerror=f.onload=d=>{if(f.onerror=f.onload=null,"load"===d.type)c();else{var b=d&&("load"===d.type?"missing":d.type),r=d&&d.target&&d.target.href||a,n=new Error("Loading CSS chunk "+e+" failed.\n("+r+")");n.code="CSS_CHUNK_LOAD_FAILED",n.type=b,n.request=r,f.parentNode&&f.parentNode.removeChild(f),t(n)}},f.href=a,0!==f.href.indexOf(window.location.origin+"/")&&(f.crossOrigin="anonymous"),d?d.parentNode.insertBefore(f,d.nextSibling):document.head.appendChild(f)})(e,t,null,a,d)})),a={3666:0};r.f.miniCss=(d,c)=>{a[d]?c.push(a[d]):0!==a[d]&&{6:1,524:1,826:1,855:1,898:1,956:1,1033:1,1109:1,1762:1,1803:1,2109:1,2191:1,2260:1,2486:1,2587:1,2639:1,2666:1,2676:1,2731:1,3066:1,3353:1,3502:1,3610:1,3717:1,3780:1,3842:1,3896:1,3914:1,3939:1,3980:1,4015:1,4102:1,4215:1,4781:1, 4788:1,4894:1,4987:1,5145:1,5163:1,5166:1,5649:1,5866:1,5940:1,5993:1,6025:1,6036:1,6106:1,6214:1,6221:1,6494:1,6625:1,6639:1,6747:1,6752:1,6884:1,6925:1,6949:1,6985:1,7111:1,7149:1,7194:1,7350:1,7391:1,7413:1,7555:1,7807:1,7871:1,8056:1,8149:1,8287:1,8450:1,8904:1,9138:1,9327:1,9403:1,9465:1,9789:1,9842:1,9916:1}[d]&&c.push(a[d]=e(d).then((()=>{a[d]=0}),(e=>{throw delete a[d],e})))}}})(),(()=>{var e={3666:0,6150:0};r.f.j=(a,d)=>{var c=r.o(e,a)?e[a]:void 0;if(0!==c)if(c)d.push(c[2]);else if(/^(1(033|109|762|803)|2(6(39|66|76)|109|191|260|486|587|731)|3(9(14|39|80)|(06|66|89)6|353|502|610|717|780|842)|4(78[18]|[02]15|102|894|987)|5(1(45|63|66)|24|649|866|940|993)|6(9(25|49|85)|[06]25|(21|49|88)4||036|106|150|221|639|747|752)|7(1(11|49|94)|350|391|413|555|807|871)|8(056|149|26|287|450|55|904|98)|9(138|327|403|465|56|789|842|916))$/.test(a))e[a]=0;else{var t=new Promise(((d,t)=>c=e[a]=[d,t]));d.push(c[2]=t);var f=r.p+r.u(a),b=new Error;r.l(f,(d=>{if(r.o(e,a)&&(0!==(c=e[a])&&(e[a]=void 0),c)){var t=d&&("load"===d.type?"missing":d.type),f=d&&d.target&&d.target.src;b.message="Loading chunk "+a+" failed.\n("+t+": "+f+")",b.name="ChunkLoadError",b.type=t,b.request=f,c[1](b)}}),"chunk-"+a,a)}},r.O.j=a=>0===e[a];var a=(a,d)=>{var c,t,[f,b,n]=d,o=0;if(f.some((a=>0!==e[a]))){for(c in b)r.o(b,c)&&(r.m[c]=b[c]);if(n)var i=n(r)}for(a&&a(d);o{const{miniCssF:e}=r;r.miniCssF=a=>self.document&&"rtl"===self.document.dir?e(a).replace(/\.css$/,".rtl.css"):e(a)})()})(); \ No newline at end of file diff --git a/charting_library/bundles/study-market.b04732ea1491ac587015.js b/charting_library/bundles/study-market.6dd3b88a86eba6172f5c.js similarity index 50% rename from charting_library/bundles/study-market.b04732ea1491ac587015.js rename to charting_library/bundles/study-market.6dd3b88a86eba6172f5c.js index 1d2a8915..557ac750 100644 --- a/charting_library/bundles/study-market.b04732ea1491ac587015.js +++ b/charting_library/bundles/study-market.6dd3b88a86eba6172f5c.js @@ -1,14 +1,14 @@ (self.webpackChunktradingview=self.webpackChunktradingview||[]).push([[6456],{1414:e=>{e.exports={button:"button-D4RPB3ZC",content:"content-D4RPB3ZC","icon-only":"icon-only-D4RPB3ZC",link:"link-D4RPB3ZC","color-brand":"color-brand-D4RPB3ZC","variant-primary":"variant-primary-D4RPB3ZC","variant-secondary":"variant-secondary-D4RPB3ZC","color-gray":"color-gray-D4RPB3ZC","color-green":"color-green-D4RPB3ZC","color-red":"color-red-D4RPB3ZC","color-black":"color-black-D4RPB3ZC","color-black-friday":"color-black-friday-D4RPB3ZC","color-cyber-monday":"color-cyber-monday-D4RPB3ZC","size-xsmall":"size-xsmall-D4RPB3ZC","start-icon-wrap":"start-icon-wrap-D4RPB3ZC","end-icon-wrap":"end-icon-wrap-D4RPB3ZC","with-start-icon":"with-start-icon-D4RPB3ZC","with-end-icon":"with-end-icon-D4RPB3ZC","size-small":"size-small-D4RPB3ZC","size-medium":"size-medium-D4RPB3ZC","size-large":"size-large-D4RPB3ZC","size-xlarge":"size-xlarge-D4RPB3ZC",animated:"animated-D4RPB3ZC",stretch:"stretch-D4RPB3ZC",grouped:"grouped-D4RPB3ZC","adjust-position":"adjust-position-D4RPB3ZC","first-row":"first-row-D4RPB3ZC","first-col":"first-col-D4RPB3ZC","no-corner-top-left":"no-corner-top-left-D4RPB3ZC","no-corner-top-right":"no-corner-top-right-D4RPB3ZC","no-corner-bottom-right":"no-corner-bottom-right-D4RPB3ZC","no-corner-bottom-left":"no-corner-bottom-left-D4RPB3ZC","text-wrap":"text-wrap-D4RPB3ZC","multiline-content":"multiline-content-D4RPB3ZC","secondary-text":"secondary-text-D4RPB3ZC","primary-text":"primary-text-D4RPB3ZC"}},88803:e=>{e.exports={"tablet-normal-breakpoint":"screen and (max-width: 768px)","small-height-breakpoint":"screen and (max-height: 360px)","tablet-small-breakpoint":"screen and (max-width: 430px)"}},40281:e=>{e.exports={container:"container-qm7Rg5MB",inputContainer:"inputContainer-qm7Rg5MB",withCancel:"withCancel-qm7Rg5MB",input:"input-qm7Rg5MB",icon:"icon-qm7Rg5MB",cancel:"cancel-qm7Rg5MB"}},54829:e=>{e.exports={wrapper:"wrapper-nGEmjtaX",container:"container-nGEmjtaX",tab:"tab-nGEmjtaX",active:"active-nGEmjtaX",title:"title-nGEmjtaX",icon:"icon-nGEmjtaX",withoutIcon:"withoutIcon-nGEmjtaX",titleText:"titleText-nGEmjtaX",nested:"nested-nGEmjtaX",isTablet:"isTablet-nGEmjtaX",isMobile:"isMobile-nGEmjtaX",accessible:"accessible-nGEmjtaX"}},61098:e=>{e.exports={title:"title-z9fs4j4t",small:"small-z9fs4j4t",normal:"normal-z9fs4j4t",large:"large-z9fs4j4t"}},76797:e=>{e.exports={container:"container-XOHpda28"}},95988:e=>{e.exports={title:"title-cIIj4HrJ",disabled:"disabled-cIIj4HrJ",icon:"icon-cIIj4HrJ",locked:"locked-cIIj4HrJ",open:"open-cIIj4HrJ",actionIcon:"actionIcon-cIIj4HrJ",selected:"selected-cIIj4HrJ",codeIcon:"codeIcon-cIIj4HrJ",solutionIcon:"solutionIcon-cIIj4HrJ"}},60430:e=>{e.exports={"tablet-small-breakpoint":"screen and (max-width: 430px)",container:"container-WeNdU0sq",selected:"selected-WeNdU0sq",disabled:"disabled-WeNdU0sq",favorite:"favorite-WeNdU0sq",highlighted:"highlighted-WeNdU0sq",light:"light-WeNdU0sq","highlight-animation-theme-light":"highlight-animation-theme-light-WeNdU0sq",dark:"dark-WeNdU0sq", -"highlight-animation-theme-dark":"highlight-animation-theme-dark-WeNdU0sq",badge:"badge-WeNdU0sq",main:"main-WeNdU0sq",paddingLeft:"paddingLeft-WeNdU0sq",author:"author-WeNdU0sq",likes:"likes-WeNdU0sq",actions:"actions-WeNdU0sq",isActive:"isActive-WeNdU0sq"}},60030:e=>{e.exports={container:"container-hrZZtP0J"}},4567:e=>{e.exports={"tablet-small-breakpoint":"screen and (max-width: 430px)",dialog:"dialog-I087YV6b",dialogLibrary:"dialogLibrary-I087YV6b",contentContainer:"contentContainer-I087YV6b",listContainer:"listContainer-I087YV6b",scroll:"scroll-I087YV6b",sidebarContainer:"sidebarContainer-I087YV6b",noContentBlock:"noContentBlock-I087YV6b",tabWithHint:"tabWithHint-I087YV6b",solution:"solution-I087YV6b"}},70722:e=>{e.exports={container:"container-QcG0kDOU",image:"image-QcG0kDOU",title:"title-QcG0kDOU",description:"description-QcG0kDOU",button:"button-QcG0kDOU"}},14877:e=>{e.exports={favorite:"favorite-_FRQhM5Y",hovered:"hovered-_FRQhM5Y",disabled:"disabled-_FRQhM5Y",active:"active-_FRQhM5Y",checked:"checked-_FRQhM5Y"}},75623:e=>{e.exports={highlighted:"highlighted-cwp8YRo6"}},94720:(e,t,n)=>{"use strict";n.d(t,{Button:()=>C});var r=n(50959),i=n(97754),o=n(95604),a=n(9745),s=n(1414),l=n.n(s);const c="apply-overflow-tooltip apply-overflow-tooltip--check-children-recursively apply-overflow-tooltip--allow-text";function d(e){const{color:t="brand",size:n="medium",variant:r="primary",stretch:a=!1,icon:s,startIcon:d,endIcon:u,iconOnly:h=!1,className:p,isGrouped:m,cellState:v,disablePositionAdjustment:f=!1,primaryText:g,secondaryText:y,isAnchor:_=!1}=e,b=function(e){let t="";return 0!==e&&(1&e&&(t=i(t,l()["no-corner-top-left"])),2&e&&(t=i(t,l()["no-corner-top-right"])),4&e&&(t=i(t,l()["no-corner-bottom-right"])),8&e&&(t=i(t,l()["no-corner-bottom-left"]))),t}((0,o.getGroupCellRemoveRoundBorders)(v));return i(p,l().button,l()[`size-${n}`],l()[`color-${t}`],l()[`variant-${r}`],a&&l().stretch,(s||d)&&l()["with-start-icon"],u&&l()["with-end-icon"],h&&l()["icon-only"],b,m&&l().grouped,m&&!f&&l()["adjust-position"],m&&v.isTop&&l()["first-row"],m&&v.isLeft&&l()["first-col"],g&&y&&l()["multiline-content"],_&&l().link,c)}function u(e){const{startIcon:t,icon:n,iconOnly:o,children:s,endIcon:d,primaryText:u,secondaryText:h}=e,p=null!=t?t:n,m=!(t||n||d||o)&&!s&&u&&h;return r.createElement(r.Fragment,null,p&&r.createElement(a.Icon,{icon:p,className:l()["start-icon-wrap"]}),s&&r.createElement("span",{className:l().content},s),d&&!o&&r.createElement(a.Icon,{icon:d,className:l()["end-icon-wrap"]}),m&&function(e){return e.primaryText&&e.secondaryText&&r.createElement("div",{className:i(l()["text-wrap"],c)},r.createElement("span",{className:l()["primary-text"]}," ",e.primaryText," "),"string"==typeof e.secondaryText?r.createElement("span",{className:l()["secondary-text"]}," ",e.secondaryText," "):r.createElement("span",{className:l()["secondary-text"]},r.createElement("span",null,e.secondaryText.firstLine),r.createElement("span",null,e.secondaryText.secondLine)))}(e))}var h=n(34094),p=n(86332),m=n(90186);function v(e){ -const{className:t,color:n,variant:r,size:i,stretch:o,animated:a,icon:s,iconOnly:l,startIcon:c,endIcon:d,primaryText:u,secondaryText:h,...p}=e;return{...p,...(0,m.filterDataProps)(e),...(0,m.filterAriaProps)(e)}}function f(e){const{reference:t,tooltipText:n,...i}=e,{isGrouped:o,cellState:a,disablePositionAdjustment:s}=(0,r.useContext)(p.ControlGroupContext),l=d({...i,isGrouped:o,cellState:a,disablePositionAdjustment:s});return r.createElement("button",{...v(i),className:l,ref:t,"data-overflow-tooltip-text":null!=n?n:e.primaryText?[e.primaryText,e.secondaryText].join(" "):(0,h.getTextForTooltip)(e.children)},r.createElement(u,{...i}))}function g(e="default"){switch(e){case"default":return"primary";case"stroke":return"secondary"}}function y(e="primary"){switch(e){case"primary":return"brand";case"success":return"green";case"default":return"gray";case"danger":return"red"}}function _(e="m"){switch(e){case"s":return"xsmall";case"m":return"small";case"l":return"large"}}function b(e){const{intent:t,size:n,appearance:r,useFullWidth:i,icon:o,...a}=e;return{...a,color:y(t),size:_(n),variant:g(r),stretch:i,startIcon:o}}function C(e){return r.createElement(f,{...b(e)})}},86332:(e,t,n)=>{"use strict";n.d(t,{ControlGroupContext:()=>r});const r=n(50959).createContext({isGrouped:!1,cellState:{isTop:!0,isRight:!0,isBottom:!0,isLeft:!0}})},95604:(e,t,n)=>{"use strict";function r(e){let t=0;return e.isTop&&e.isLeft||(t+=1),e.isTop&&e.isRight||(t+=2),e.isBottom&&e.isLeft||(t+=8),e.isBottom&&e.isRight||(t+=4),t}n.d(t,{getGroupCellRemoveRoundBorders:()=>r})},27267:(e,t,n)=>{"use strict";function r(e,t,n,r,i){function o(i){if(e>i.timeStamp)return;const o=i.target;void 0!==n&&null!==t&&null!==o&&o.ownerDocument===r&&(t.contains(o)||n(i))}return i.click&&r.addEventListener("click",o,!1),i.mouseDown&&r.addEventListener("mousedown",o,!1),i.touchEnd&&r.addEventListener("touchend",o,!1),i.touchStart&&r.addEventListener("touchstart",o,!1),()=>{r.removeEventListener("click",o,!1),r.removeEventListener("mousedown",o,!1),r.removeEventListener("touchend",o,!1),r.removeEventListener("touchstart",o,!1)}}n.d(t,{addOutsideEventListener:()=>r})},36383:(e,t,n)=>{"use strict";n.d(t,{useOutsideEvent:()=>o});var r=n(50959),i=n(27267);function o(e){const{click:t,mouseDown:n,touchEnd:o,touchStart:a,handler:s,reference:l,ownerDocument:c=document}=e,d=(0,r.useRef)(null),u=(0,r.useRef)(new CustomEvent("timestamp").timeStamp);return(0,r.useLayoutEffect)((()=>{const e={click:t,mouseDown:n,touchEnd:o,touchStart:a},r=l?l.current:d.current;return(0,i.addOutsideEventListener)(u.current,r,s,c,e)}),[t,n,o,a,s]),l||d}},9745:(e,t,n)=>{"use strict";n.d(t,{Icon:()=>i});var r=n(50959);const i=r.forwardRef(((e,t)=>{const{icon:n="",...i}=e;return r.createElement("span",{...i,ref:t,dangerouslySetInnerHTML:{__html:n}})}))},99663:(e,t,n)=>{"use strict";n.d(t,{Slot:()=>i,SlotContext:()=>o});var r=n(50959);class i extends r.Component{shouldComponentUpdate(){return!1}render(){return r.createElement("div",{style:{position:"fixed",zIndex:150,left:0,top:0},ref:this.props.reference})}} +"highlight-animation-theme-dark":"highlight-animation-theme-dark-WeNdU0sq",badge:"badge-WeNdU0sq",main:"main-WeNdU0sq",paddingLeft:"paddingLeft-WeNdU0sq",author:"author-WeNdU0sq",likes:"likes-WeNdU0sq",actions:"actions-WeNdU0sq",isActive:"isActive-WeNdU0sq"}},60030:e=>{e.exports={container:"container-hrZZtP0J"}},4567:e=>{e.exports={"tablet-small-breakpoint":"screen and (max-width: 430px)",dialog:"dialog-I087YV6b",dialogLibrary:"dialogLibrary-I087YV6b",contentContainer:"contentContainer-I087YV6b",listContainer:"listContainer-I087YV6b",scroll:"scroll-I087YV6b",sidebarContainer:"sidebarContainer-I087YV6b",noContentBlock:"noContentBlock-I087YV6b",tabWithHint:"tabWithHint-I087YV6b",solution:"solution-I087YV6b"}},70722:e=>{e.exports={container:"container-QcG0kDOU",image:"image-QcG0kDOU",title:"title-QcG0kDOU",description:"description-QcG0kDOU",button:"button-QcG0kDOU"}},14877:e=>{e.exports={favorite:"favorite-_FRQhM5Y",hovered:"hovered-_FRQhM5Y",disabled:"disabled-_FRQhM5Y",active:"active-_FRQhM5Y",checked:"checked-_FRQhM5Y"}},75623:e=>{e.exports={highlighted:"highlighted-cwp8YRo6"}},94720:(e,t,n)=>{"use strict";n.d(t,{Button:()=>C});var r=n(50959),i=n(97754),o=n(95604),a=n(9745),s=n(1414),l=n.n(s);const c="apply-overflow-tooltip apply-overflow-tooltip--check-children-recursively apply-overflow-tooltip--allow-text";function d(e){const{color:t="brand",size:n="medium",variant:r="primary",stretch:a=!1,icon:s,startIcon:d,endIcon:u,iconOnly:h=!1,className:m,isGrouped:p,cellState:v,disablePositionAdjustment:f=!1,primaryText:g,secondaryText:y,isAnchor:_=!1}=e,b=function(e){let t="";return 0!==e&&(1&e&&(t=i(t,l()["no-corner-top-left"])),2&e&&(t=i(t,l()["no-corner-top-right"])),4&e&&(t=i(t,l()["no-corner-bottom-right"])),8&e&&(t=i(t,l()["no-corner-bottom-left"]))),t}((0,o.getGroupCellRemoveRoundBorders)(v));return i(m,l().button,l()[`size-${n}`],l()[`color-${t}`],l()[`variant-${r}`],a&&l().stretch,(s||d)&&l()["with-start-icon"],u&&l()["with-end-icon"],h&&l()["icon-only"],b,p&&l().grouped,p&&!f&&l()["adjust-position"],p&&v.isTop&&l()["first-row"],p&&v.isLeft&&l()["first-col"],g&&y&&l()["multiline-content"],_&&l().link,c)}function u(e){const{startIcon:t,icon:n,iconOnly:o,children:s,endIcon:d,primaryText:u,secondaryText:h}=e,m=null!=t?t:n,p=!(t||n||d||o)&&!s&&u&&h;return r.createElement(r.Fragment,null,m&&r.createElement(a.Icon,{icon:m,className:l()["start-icon-wrap"]}),s&&r.createElement("span",{className:l().content},s),d&&!o&&r.createElement(a.Icon,{icon:d,className:l()["end-icon-wrap"]}),p&&function(e){return e.primaryText&&e.secondaryText&&r.createElement("div",{className:i(l()["text-wrap"],c)},r.createElement("span",{className:l()["primary-text"]}," ",e.primaryText," "),"string"==typeof e.secondaryText?r.createElement("span",{className:l()["secondary-text"]}," ",e.secondaryText," "):r.createElement("span",{className:l()["secondary-text"]},r.createElement("span",null,e.secondaryText.firstLine),r.createElement("span",null,e.secondaryText.secondLine)))}(e))}var h=n(34094),m=n(86332),p=n(90186);function v(e){ +const{className:t,color:n,variant:r,size:i,stretch:o,animated:a,icon:s,iconOnly:l,startIcon:c,endIcon:d,primaryText:u,secondaryText:h,...m}=e;return{...m,...(0,p.filterDataProps)(e),...(0,p.filterAriaProps)(e)}}function f(e){const{reference:t,tooltipText:n,...i}=e,{isGrouped:o,cellState:a,disablePositionAdjustment:s}=(0,r.useContext)(m.ControlGroupContext),l=d({...i,isGrouped:o,cellState:a,disablePositionAdjustment:s});return r.createElement("button",{...v(i),className:l,ref:t,"data-overflow-tooltip-text":null!=n?n:e.primaryText?[e.primaryText,e.secondaryText].join(" "):(0,h.getTextForTooltip)(e.children)},r.createElement(u,{...i}))}function g(e="default"){switch(e){case"default":return"primary";case"stroke":return"secondary"}}function y(e="primary"){switch(e){case"primary":return"brand";case"success":return"green";case"default":return"gray";case"danger":return"red"}}function _(e="m"){switch(e){case"s":return"xsmall";case"m":return"small";case"l":return"large"}}function b(e){const{intent:t,size:n,appearance:r,useFullWidth:i,icon:o,...a}=e;return{...a,color:y(t),size:_(n),variant:g(r),stretch:i,startIcon:o}}function C(e){return r.createElement(f,{...b(e)})}},86332:(e,t,n)=>{"use strict";n.d(t,{ControlGroupContext:()=>r});const r=n(50959).createContext({isGrouped:!1,cellState:{isTop:!0,isRight:!0,isBottom:!0,isLeft:!0}})},95604:(e,t,n)=>{"use strict";function r(e){let t=0;return e.isTop&&e.isLeft||(t+=1),e.isTop&&e.isRight||(t+=2),e.isBottom&&e.isLeft||(t+=8),e.isBottom&&e.isRight||(t+=4),t}n.d(t,{getGroupCellRemoveRoundBorders:()=>r})},27267:(e,t,n)=>{"use strict";function r(e,t,n,r,i){function o(i){if(e>i.timeStamp)return;const o=i.target;void 0!==n&&null!==t&&null!==o&&o.ownerDocument===r&&(t.contains(o)||n(i))}return i.click&&r.addEventListener("click",o,!1),i.mouseDown&&r.addEventListener("mousedown",o,!1),i.touchEnd&&r.addEventListener("touchend",o,!1),i.touchStart&&r.addEventListener("touchstart",o,!1),()=>{r.removeEventListener("click",o,!1),r.removeEventListener("mousedown",o,!1),r.removeEventListener("touchend",o,!1),r.removeEventListener("touchstart",o,!1)}}n.d(t,{addOutsideEventListener:()=>r})},36383:(e,t,n)=>{"use strict";n.d(t,{useOutsideEvent:()=>o});var r=n(50959),i=n(27267);function o(e){const{click:t,mouseDown:n,touchEnd:o,touchStart:a,handler:s,reference:l,ownerDocument:c=document}=e,d=(0,r.useRef)(null),u=(0,r.useRef)(new CustomEvent("timestamp").timeStamp);return(0,r.useLayoutEffect)((()=>{const e={click:t,mouseDown:n,touchEnd:o,touchStart:a},r=l?l.current:d.current;return(0,i.addOutsideEventListener)(u.current,r,s,c,e)}),[t,n,o,a,s]),l||d}},9745:(e,t,n)=>{"use strict";n.d(t,{Icon:()=>i});var r=n(50959);const i=r.forwardRef(((e,t)=>{const{icon:n="",...i}=e;return r.createElement("span",{...i,ref:t,dangerouslySetInnerHTML:{__html:n}})}))},99663:(e,t,n)=>{"use strict";n.d(t,{Slot:()=>i,SlotContext:()=>o});var r=n(50959);class i extends r.Component{shouldComponentUpdate(){return!1}render(){return r.createElement("div",{style:{position:"fixed",zIndex:150,left:0,top:0},ref:this.props.reference})}} const o=r.createContext(null)},90186:(e,t,n)=>{"use strict";function r(e){return o(e,a)}function i(e){return o(e,s)}function o(e,t){const n=Object.entries(e).filter(t),r={};for(const[e,t]of n)r[e]=t;return r}function a(e){const[t,n]=e;return 0===t.indexOf("data-")&&"string"==typeof n}function s(e){return 0===e[0].indexOf("aria-")}n.d(t,{filterAriaProps:()=>i,filterDataProps:()=>r,filterProps:()=>o,isAriaAttribute:()=>s,isDataAttribute:()=>a})},34094:(e,t,n)=>{"use strict";n.d(t,{getTextForTooltip:()=>a});var r=n(50959);const i=e=>(0,r.isValidElement)(e)&&Boolean(e.props.children),o=e=>null==e||"boolean"==typeof e||"{}"===JSON.stringify(e)?"":e.toString()+" ",a=e=>Array.isArray(e)||(0,r.isValidElement)(e)?r.Children.toArray(e).reduce(((e,t)=>{let n="";return n=(0,r.isValidElement)(t)&&i(t)?a(t.props.children):(0,r.isValidElement)(t)&&!i(t)?"":o(t),e.concat(n)}),"").trim():o(e)},67961:(e,t,n)=>{"use strict";n.d(t,{OverlapManager:()=>o,getRootOverlapManager:()=>s});var r=n(50151);class i{constructor(){this._storage=[]}add(e){this._storage.push(e)}remove(e){this._storage=this._storage.filter((t=>e!==t))}has(e){return this._storage.includes(e)}getItems(){return this._storage}}class o{constructor(e=document){this._storage=new i,this._windows=new Map,this._index=0,this._document=e,this._container=e.createDocumentFragment()}setContainer(e){const t=this._container,n=null===e?this._document.createDocumentFragment():e;!function(e,t){Array.from(e.childNodes).forEach((e=>{e.nodeType===Node.ELEMENT_NODE&&t.appendChild(e)}))}(t,n),this._container=n}registerWindow(e){this._storage.has(e)||this._storage.add(e)}ensureWindow(e,t={position:"fixed",direction:"normal"}){const n=this._windows.get(e);if(void 0!==n)return n;this.registerWindow(e);const r=this._document.createElement("div");if(r.style.position=t.position,r.style.zIndex=this._index.toString(),r.dataset.id=e,void 0!==t.index){const e=this._container.childNodes.length;if(t.index>=e)this._container.appendChild(r);else if(t.index<=0)this._container.insertBefore(r,this._container.firstChild);else{const e=this._container.childNodes[t.index];this._container.insertBefore(r,e)}}else"reverse"===t.direction?this._container.insertBefore(r,this._container.firstChild):this._container.appendChild(r);return this._windows.set(e,r),++this._index,r}unregisterWindow(e){this._storage.remove(e);const t=this._windows.get(e);void 0!==t&&(null!==t.parentElement&&t.parentElement.removeChild(t),this._windows.delete(e))}getZindex(e){const t=this.ensureWindow(e);return parseInt(t.style.zIndex||"0")}moveToTop(e){if(this.getZindex(e)!==this._index){this.ensureWindow(e).style.zIndex=(++this._index).toString()}}removeWindow(e){this.unregisterWindow(e)}}const a=new WeakMap;function s(e=document){const t=e.getElementById("overlap-manager-root");if(null!==t)return(0,r.ensureDefined)(a.get(t));{const t=new o(e),n=function(e){const t=e.createElement("div");return t.style.position="absolute",t.style.zIndex=150..toString(),t.style.top="0px",t.style.left="0px",t.id="overlap-manager-root",t}(e);return a.set(n,t), -t.setContainer(n),e.body.appendChild(n),t}}},99054:(e,t,n)=>{"use strict";n.d(t,{setFixedBodyState:()=>c});const r=(()=>{let e;return()=>{var t;if(void 0===e){const n=document.createElement("div"),r=n.style;r.visibility="hidden",r.width="100px",r.msOverflowStyle="scrollbar",document.body.appendChild(n);const i=n.offsetWidth;n.style.overflow="scroll";const o=document.createElement("div");o.style.width="100%",n.appendChild(o);const a=o.offsetWidth;null===(t=n.parentNode)||void 0===t||t.removeChild(n),e=i-a}return e}})();function i(e,t,n){null!==e&&e.style.setProperty(t,n)}function o(e,t){return getComputedStyle(e,null).getPropertyValue(t)}function a(e,t){return parseInt(o(e,t))}let s=0,l=!1;function c(e){const{body:t}=document,n=t.querySelector(".widgetbar-wrap");if(e&&1==++s){const e=o(t,"overflow"),s=a(t,"padding-right");"hidden"!==e.toLowerCase()&&t.scrollHeight>t.offsetHeight&&(i(n,"right",`${r()}px`),t.style.paddingRight=`${s+r()}px`,l=!0),t.classList.add("i-no-scroll")}else if(!e&&s>0&&0==--s&&(t.classList.remove("i-no-scroll"),l)){i(n,"right","0px");let e=0;0,t.scrollHeight<=t.clientHeight&&(e-=r()),t.style.paddingRight=(e<0?0:e)+"px",l=!1}}},24437:(e,t,n)=>{"use strict";n.d(t,{DialogBreakpoints:()=>i});var r=n(88803);const i={SmallHeight:r["small-height-breakpoint"],TabletSmall:r["tablet-small-breakpoint"],TabletNormal:r["tablet-normal-breakpoint"]}},69654:(e,t,n)=>{"use strict";n.d(t,{DialogSearch:()=>d});var r=n(50959),i=n(97754),o=n.n(i),a=n(11542),s=n(9745),l=n(69859),c=n(40281);function d(e){const{children:t,renderInput:i,onCancel:d,containerClassName:h,inputContainerClassName:p,iconClassName:m,...v}=e;return r.createElement("div",{className:o()(c.container,h)},r.createElement("div",{className:o()(c.inputContainer,p,d&&c.withCancel)},i||r.createElement(u,{...v})),t,r.createElement(s.Icon,{className:o()(c.icon,m),icon:l}),d&&r.createElement("div",{className:c.cancel,onClick:d},a.t(null,void 0,n(20036))))}function u(e){const{className:t,reference:n,value:i,onChange:a,onFocus:s,onBlur:l,onKeyDown:d,onSelect:u,placeholder:h,...p}=e;return r.createElement("input",{...p,ref:n,type:"text",className:o()(t,c.input),autoComplete:"off","data-role":"search",placeholder:h,value:i,onChange:a,onFocus:s,onBlur:l,onSelect:u,onKeyDown:d})}},22265:(e,t,n)=>{"use strict";n.d(t,{DialogSidebarContainer:()=>d,DialogSidebarItem:()=>h,DialogSidebarWrapper:()=>u});var r=n(50959),i=n(97754),o=n.n(i),a=n(9745),s=n(65631),l=n(68648),c=n(54829);function d(e){const{mode:t,className:n,...i}=e,{isMobile:a,isTablet:l}=(0,s.getSidebarMode)(t),d=o()(c.container,l&&c.isTablet,a&&c.isMobile,n);return r.createElement("div",{...i,className:d,"data-role":"dialog-sidebar"})}function u(e){return r.createElement("div",{className:c.wrapper,...e})}function h(e){const{mode:t,title:n,icon:i,isActive:d,onClick:u,tag:h="div",reference:p,className:m,...v}=e,{isMobile:f,isTablet:g}=(0,s.getSidebarMode)(t),y=d?null==i?void 0:i.active:null==i?void 0:i.default;return r.createElement(h,{...v,ref:p,className:o()(c.tab,g&&c.isTablet,f&&c.isMobile,d&&c.active,m), -onClick:u},i&&r.createElement(a.Icon,{className:c.icon,icon:y}),!g&&r.createElement("span",{className:o()(c.title,!i&&c.withoutIcon)},r.createElement("span",{className:c.titleText},n),f&&r.createElement(a.Icon,{className:c.nested,icon:l})))}},65631:(e,t,n)=>{"use strict";function r(e){return{isMobile:"mobile"===e,isTablet:"tablet"===e}}n.d(t,{getSidebarMode:()=>r})},57979:(e,t,n)=>{"use strict";n.r(t),n.d(t,{IndicatorsLibraryContainer:()=>de});var r=n(50959),i=n(962),o=n(11542),a=n(88348);const s=o.t(null,void 0,n(44463));var l=n(42856),c=n(14483),d=n(92249);function u(e,t){const n=e.title.toLowerCase(),r=t.title.toLowerCase();return nr?1:0}const h={earning:new RegExp("EPS"),earnings:new RegExp("EPS"),"trailing twelve months":new RegExp("TTM")};function p(e){var t;const{id:r,description:i,shortDescription:a,description_localized:d,is_hidden_study:u,version:h,extra:p,tags:v}=e,f=c.enabled("graying_disabled_tools_enabled")&&(null===(t=window.ChartApiInstance)||void 0===t?void 0:t.studiesAccessController.isToolGrayed(i));return{id:r,title:d||o.t(i,{context:"study"},n(68716)),shortDescription:a,shortTitle:a,isStrategy:l.StudyMetaInfo.isScriptStrategy(e),isHidden:u,isNew:null==p?void 0:p.isNew,isUpdated:null==p?void 0:p.isUpdated,isBeta:null==p?void 0:p.isBeta,isPro:null==p?void 0:p.isPro,proBadgeTitle:s,isFundamental:!1,isOverlay:e.is_price_study,studyData:{id:r,version:h,descriptor:{type:"java",studyId:e.id},packageName:m(r,p)},isGrayed:f,tags:v}}function m(e,t){return(null==t?void 0:t.isChartPattern)?"tv-chart_patterns":(null==t?void 0:t.isAuto)?"auto-java":l.StudyMetaInfo.getPackageName(e)}var v=n(97754),f=n.n(v),g=n(63932),y=n(35057),_=n(49483),b=n(69654),C=n(22265),x=n(60030);function k(e){const{reference:t,className:n,...i}=e;return r.createElement("div",{ref:t,className:f()(x.container,n),...i,"data-role":"dialog-content"})}var E=n(95988);function w(e){const{children:t,className:n,disabled:i}=e;return r.createElement("span",{className:f()(E.title,i&&E.disabled,n)},t)}const I=r.createContext(null);var P=n(24637),N=n(77975),S=n(45345),D=n(26843),R=n(36189),T=n(68335),B=n(60430);function L(e){const t=(0,r.useContext)(I),{style:i,layoutMode:a,item:s,query:l,regExpRules:c,isBeta:d,isNew:u,isUpdated:h,isSelected:p,isHighlighted:m,reference:v,onClick:g,renderActions:y,isPro:_,proBadgeTitle:b,onItemActionsClick:C,favoriteClickHandler:x,hideEP:k}=e,{isFavorite:E,isLocked:T,public:L,editorsPick:F}=s,M=void 0!==E,j=z(g,s),W=(0,r.useCallback)((e=>{e.stopPropagation(),null==C||C()}),[C]),A=(0,r.useCallback)((e=>{if(x)return null==C||C(),void x(e);if(null==t?void 0:t.toggleFavorite){z((e=>{null==C||C(),t.toggleFavorite(e)}),s)(e)}}),[x,C,null==t?void 0:t.toggleFavorite]),H=(0,N.useWatchedValueReadonly)({watchedValue:S.watchedTheme})===D.StdTheme.Dark?B.dark:B.light,Z=f()(B.container,s.isGrayed&&B.disabled,p&&B.selected,m&&B.highlighted,m&&H);return r.createElement("div",{ref:v,className:Z,onClick:j,style:i,"data-role":"list-item","data-disabled":s.isGrayed,"data-title":s.title,"data-id":s.id},r.createElement("div",{ -className:f()(B.main,!M&&B.paddingLeft)},M&&r.createElement(R.FavoriteButton,{className:f()(B.favorite,E&&B.isActive),isFilled:E,onClick:A}),r.createElement(w,{disabled:s.isGrayed},r.createElement(P.HighlightedText,{queryString:l,rules:c,text:s.title})),!1,d&&r.createElement(BadgeIndicator,{type:"beta",className:B.badge}),u&&r.createElement(BadgeIndicator,{type:"new",className:B.badge}),h&&r.createElement(BadgeIndicator,{type:"updated",className:B.badge}),Boolean(F&&!k)&&r.createElement(BadgeIndicator,{type:"ep",className:B.badge,tooltip:o.t(null,void 0,n(92490))}),!1),L&&r.createElement("a",{href:L.authorLink,className:B.author,target:"_blank",onClick:W},L.authorName),"mobile"!==a&&L&&r.createElement("span",{className:B.likes},L.likesCount),!1)}function z(e,t){return n=>{const r=0===(0,T.modifiersFromEvent)(n)&&0===n.button;!n.defaultPrevented&&e&&r&&(n.preventDefault(),e(t))}}var F=n(61098);function M(e){const{title:t,type:n,className:i}=e;return r.createElement("h3",{className:f()(F.title,"Small"===n&&F.small,"Normal"===n&&F.normal,"Large"===n&&F.large,i)},t)}var j=n(76797);function W(e){const{style:t,children:n}=e;return r.createElement("div",{style:t,className:j.container},n)}var A=n(9745),H=n(94720),Z=n(70722);function q(e){const{className:t,icon:n,title:i,description:o,buttonText:a,buttonAction:s}=e;return r.createElement("div",{className:f()(Z.container,t)},n&&r.createElement(A.Icon,{icon:n,className:Z.image}),i&&r.createElement("h3",{className:Z.title},i),o&&r.createElement("p",{className:Z.description},o),a&&s&&r.createElement(H.Button,{onClick:s,className:Z.button},a))}function O(e){const[t,n]=(0,r.useState)(null);function i(e){return e.findIndex((e=>(null==t?void 0:t.id)===e.id))}return[t,n,function(){n(function(){var n;const r=i(e),o=r===e.length-1;return null===t||-1===r?null!==(n=e[0])&&void 0!==n?n:null:o?e[r]:e[r+1]}())},function(){n(function(){var n;const r=i(e);return null===t||0===r||-1===r?null!==(n=e[0])&&void 0!==n?n:null:e[r-1]}())}]}var U=n(19785),G=n(4567),V=n(57898),Y=n(56840);const K=new V.Delegate,J=new V.Delegate,X=new V.Delegate;let $=[];function Q(e){return-1===te(e)?(function(e){!ee(e)&&($.push(e),re(),K.fire(e))}(e),!0):(function(e){const t=te(e);-1!==t&&($.splice(t,1),re(),J.fire(e))}(e),!1)}function ee(e){return-1!==te(e)}function te(e){return $.indexOf(e)}function ne(){var e,t;$=[];const n=Boolean(void 0===(0,Y.getValue)("chart.favoriteLibraryIndicators")),r=(0,Y.getJSON)("chart.favoriteLibraryIndicators",[]);if($.push(...r),0===$.length&&n&&"undefined"!=typeof window){const n=JSON.parse(null!==(t=null===(e=window.urlParams)||void 0===e?void 0:e.favorites)&&void 0!==t?t:"{}").indicators;n&&Array.isArray(n)&&$.push(...n)}X.fire()}function re(){const e=$.slice();(0,Y.setJSON)("chart.favoriteLibraryIndicators",e)}function ie(e){const{reference:t,data:i,isOpened:a,onClose:s,applyStudy:l,shouldReturnFocus:c}=e,[d,u]=(0,r.useState)(""),p=(0,r.useMemo)((()=>(0,U.createRegExpList)(d,h)),[d]),m=(0,r.useMemo)((()=>d?(0,U.rankedSearch)({data:i,rules:p,queryString:d, -primaryKey:"shortDescription",secondaryKey:"title",optionalPrimaryKey:"shortTitle",tertiaryKey:"tags"}):i),[d,p,i]),{highlightedItem:v,selectedItem:x,selectedNodeReference:E,scrollContainerRef:w,searchInputRef:I,onClickStudy:P,handleKeyDown:N}=function(e,t,n,i){let o=0;const[a,s]=(0,r.useState)(null),l=(0,r.useRef)(null),c=(0,r.useRef)(null),[d,u,h,p]=O(t),m=(0,r.useRef)(null);return(0,r.useEffect)((()=>{e?v(0):u(null)}),[e]),(0,r.useEffect)((()=>{void 0!==i&&(v(0),u(null))}),[i]),(0,r.useEffect)((()=>(a&&(o=setTimeout((()=>{s(null)}),1500)),()=>{clearInterval(o)})),[a]),{highlightedItem:a,scrollContainerRef:l,selectedNodeReference:c,selectedItem:d,searchInputRef:m,onClickStudy:function(e){n&&(n(e),u(e),s(e))},handleKeyDown:function(e){const[t,r]=function(e,t){if(null===e.current||null===t.current)return[0,0];const n=e.current.getBoundingClientRect(),r=t.current.getBoundingClientRect(),{height:i}=n,o=n.top-r.top,a=n.bottom-r.bottom+i<0?0:i,s=o-i>0?0:i,{scrollTop:l}=t.current;return[l-s,l+a]}(c,l);if(40===(0,T.hashFromEvent)(e)&&(e.preventDefault(),h(),v(r)),38===(0,T.hashFromEvent)(e)&&(e.preventDefault(),p(),v(t)),13===(0,T.hashFromEvent)(e)&&d){if(!n)return;n(d),s(d)}}};function v(e){null!==l.current&&l.current.scrollTo&&l.current.scrollTo(0,e)}}(a,m,l),S=""===d&&!m.length;return(0,r.useEffect)((()=>{var e;a||u(""),_.CheckMobile.any()||null===(e=I.current)||void 0===e||e.focus()}),[a]),r.createElement(y.AdaptivePopupDialog,{isOpened:a,onClose:s,onClickOutside:s,className:f()(G.dialogLibrary),render:function(){return r.createElement(r.Fragment,null,r.createElement(b.DialogSearch,{reference:I,placeholder:o.t(null,void 0,n(52298)),onChange:D,onFocus:R}),r.createElement(C.DialogSidebarWrapper,null,r.createElement(k,{reference:w,className:G.scroll},S?r.createElement(g.Spinner,null):m.length?r.createElement(r.Fragment,null,r.createElement(W,null,r.createElement(M,{title:o.t(null,void 0,n(15491))})),m.slice().sort(oe).map((e=>{const t=(null==x?void 0:x.id)===e.id;return r.createElement(L,{key:e.id,item:e,onClick:()=>P(e),query:d,regExpRules:p,reference:t?E:void 0,isSelected:(null==x?void 0:x.id)===e.id,isHighlighted:(null==v?void 0:v.id)===e.id,favoriteClickHandler:t=>{t.stopPropagation(),Q(e.title)}})}))):r.createElement(q,{className:G.noContentBlock,description:o.t(null,void 0,n(53170))}))))},title:o.t(null,void 0,n(61142)),dataName:"indicators-dialog",onKeyDown:N,shouldReturnFocus:c,ref:t});function D(e){u(e.target.value)}function R(){var e;d.length>0&&(null===(e=I.current)||void 0===e||e.select())}}function oe(e,t){return e.isFavorite===t.isFavorite?0:e.isFavorite?-1:1}ne(),Y.onSync.subscribe(null,ne);var ae=n(76422),se=n(74970),le=n(97145);function ce(e,t){return e[t]||[]}class de extends class{constructor(e){this._searchInputRef=r.createRef(),this._dialog=r.createRef(),this._visibility=new le.WatchedValue(!1),this._container=document.createElement("div"),this._isForceRender=!1,this._parentSources=[],this._isDestroyed=!1,this._deepFundamentalsHistoryNotificationHasBeenShown=!1, -this._showDeepFundamentalsHistoryNotification=()=>{},this._chartWidgetCollection=e}isDestroyed(){return this._isDestroyed}visible(){return this._visibility.readonly()}resetAllStudies(){}updateFavorites(){}open(e,t,n,r,i){this._parentSources=e,this._updateSymbol(),this._setProps({isOpened:!0,shouldReturnFocus:null==i?void 0:i.shouldReturnFocus}),this._visibility.setValue(!0),ae.emit("indicators_dialog")}show(e){this.open([],void 0,void 0,void 0,e)}hide(){this._parentSources=[],this._setProps({isOpened:!1}),this._visibility.setValue(!1)}destroy(){this._isDestroyed=!0,i.unmountComponentAtNode(this._container)}_shouldPreventRender(){return this._isDestroyed||!this._isForceRender&&!this._getProps().value().isOpened}_getRenderData(){return{props:this._getProps().value(),container:this._getContainer()}}_applyStudy(e,t){var n;e.isGrayed?ae.emit("onGrayedObjectClicked",{type:"study",name:e.shortDescription}):(_.CheckMobile.any()||null===(n=this._searchInputRef.current)||void 0===n||n.select(),async function(e,t,n,r,i){const o=e.activeChartWidget.value();if(!o)return null;const{studyData:s}=t;if(!s)return Promise.resolve(null);const l=s.descriptor;if("java"===l.type){const e=(0,d.tryFindStudyLineToolNameByStudyId)(l.studyId);if(null!==e)return a.tool.setValue(e),null}return o.insertStudy(s.descriptor,n,{stubTitle:t.shortDescription,isFundamental:t.isFundamental,isOverlay:t.isOverlay})}(this._chartWidgetCollection,e,this._parentSources,0,this._symbol).then((()=>{var e;window.is_authenticated;_.CheckMobile.any()||(null===document.activeElement||document.activeElement===document.body||null!==this._dialog.current&&this._dialog.current.contains(document.activeElement))&&(null===(e=this._searchInputRef.current)||void 0===e||e.focus())})))}_setProps(e){const t=this._getProps().value(),{isOpened:n}=t;this._isForceRender=n&&"isOpened"in e&&!e.isOpened;const r={...t,...e};this._getProps().setValue(r)}_requestBuiltInJavaStudies(){return(0,se.studyMetaInfoRepository)().findAllJavaStudies()}_focus(){var e;this._getProps().value().isOpened&&(null===(e=this._dialog.current)||void 0===e||e.focus())}_getContainer(){return this._container}_getDialog(){return this._dialog}_getSymbol(){return this._symbol}_updateSymbol(){this._symbol=void 0}}{constructor(e,t){super(e),this._options={onWidget:!1},this._indicatorData=[],t&&(this._options=t),this._props=new le.WatchedValue({data:[],applyStudy:this._applyStudy.bind(this),isOpened:!1,reference:this._getDialog(),onClose:this.hide.bind(this)}),this._getProps().subscribe(this._render.bind(this)),this._init()}_getProps(){return this._props}async _init(){const e=function(e){const t={};return e.forEach((e=>{const{studyData:n}=e;if(!n)return;const{packageName:r}=n;r in t?t[r].push(e):t[r]=[e]})),t}(function(e,t=!0){return e.filter((e=>{const n=!!t||!function(e){return e.isStrategy}(e);return!e.isHidden&&n}))}((await this._requestBuiltInJavaStudies()).map(p)));this._indicatorData=await async function(e,t){let n={...t} -;return[...ce(n,"tv-basicstudies"),...ce(n,"Script$STD"),...ce(n,"tv-volumebyprice")].filter((e=>!e.isStrategy)).sort(u)}(this._options.onWidget,e),this._setFavorites(),this._setProps({data:this._indicatorData}),K.subscribe(null,(()=>this._refreshFavorites())),J.subscribe(null,(()=>this._refreshFavorites()))}_setFavorites(){c.enabled("items_favoriting")&&this._indicatorData.forEach((e=>{e.isFavorite=ee(e.title)}))}_refreshFavorites(){this._setFavorites(),this._setProps({data:this._indicatorData})}_render(){if(this._shouldPreventRender())return;const{props:e,container:t}=this._getRenderData();i.render(r.createElement(ie,{...e}),t)}}},36189:(e,t,n)=>{"use strict";n.d(t,{FavoriteButton:()=>u});var r=n(11542),i=n(50959),o=n(97754),a=n(9745),s=n(39146),l=n(48010),c=n(14877);const d={add:r.t(null,void 0,n(44629)),remove:r.t(null,void 0,n(72482))};function u(e){const{className:t,isFilled:n,isActive:r,onClick:u,...h}=e;return i.createElement(a.Icon,{...h,className:o(c.favorite,"apply-common-tooltip",n&&c.checked,r&&c.active,t),icon:n?s:l,onClick:u,title:n?d.remove:d.add})}},19785:(e,t,n)=>{"use strict";n.d(t,{createRegExpList:()=>o,getHighlightedChars:()=>a,rankedSearch:()=>i});var r=n(1722);function i(e){const{data:t,rules:n,queryString:i,isPreventedFromFiltering:o,primaryKey:a,secondaryKey:s=a,optionalPrimaryKey:l,tertiaryKey:c}=e;return t.map((e=>{const t=l&&e[l]?e[l]:e[a],o=e[s],d=c&&e[c];let u,h=0;return n.forEach((e=>{var n,a,s,l,c;const{re:p,fullMatch:m}=e;if(p.lastIndex=0,(0,r.isString)(t)&&t&&t.toLowerCase()===i.toLowerCase())return h=4,void(u=null===(n=t.match(m))||void 0===n?void 0:n.index);if((0,r.isString)(t)&&m.test(t))return h=3,void(u=null===(a=t.match(m))||void 0===a?void 0:a.index);if((0,r.isString)(o)&&m.test(o))return h=2,void(u=null===(s=o.match(m))||void 0===s?void 0:s.index);if((0,r.isString)(o)&&p.test(o))return h=2,void(u=null===(l=o.match(p))||void 0===l?void 0:l.index);if(Array.isArray(d))for(const e of d)if(m.test(e))return h=1,void(u=null===(c=e.match(m))||void 0===c?void 0:c.index)})),{matchPriority:h,matchIndex:u,item:e}})).filter((e=>o||e.matchPriority)).sort(((e,t)=>{if(e.matchPriorityt.matchPriority)return-1;if(e.matchPriority===t.matchPriority){if(void 0===e.matchIndex||void 0===t.matchIndex)return 0;if(e.matchIndex>t.matchIndex)return 1;if(e.matchIndexe))}function o(e,t){const n=[],r=e.toLowerCase(),i=e.split("").map(((e,t)=>`(${0!==t?`[/\\s-]${s(e)}`:s(e)})`)).join("(.*?)")+"(.*)";return n.push({fullMatch:new RegExp(`(${s(e)})`,"i"),re:new RegExp(`^${i}`,"i"),reserveRe:new RegExp(i,"i"),fuzzyHighlight:!0}),t&&t.hasOwnProperty(r)&&n.push({fullMatch:t[r],re:t[r],fuzzyHighlight:!1}),n}function a(e,t,n){const r=[];return e&&n?(n.forEach((e=>{const{fullMatch:n,re:i,reserveRe:o}=e;n.lastIndex=0,i.lastIndex=0;const a=n.exec(t),s=a||i.exec(t)||o&&o.exec(t);if(e.fuzzyHighlight=!a,s)if(e.fuzzyHighlight){let e=s.index;for(let t=1;t{"use strict";n.d(t,{HighlightedText:()=>s});var r=n(50959),i=n(97754),o=n(19785),a=n(75623);function s(e){const{queryString:t,rules:n,text:s,className:l}=e,c=(0,r.useMemo)((()=>(0,o.getHighlightedChars)(t,s,n)),[t,n,s]);return r.createElement(r.Fragment,null,c.length?s.split("").map(((e,t)=>r.createElement(r.Fragment,{key:t},c[t]?r.createElement("span",{className:i(a.highlighted,l)},e):r.createElement("span",null,e)))):s)}},77975:(e,t,n)=>{"use strict";n.d(t,{useWatchedValueReadonly:()=>i});var r=n(50959);const i=(e,t=!1)=>{const n="watchedValue"in e?e.watchedValue:void 0,i="defaultValue"in e?e.defaultValue:e.watchedValue.value(),[o,a]=(0,r.useState)(n?n.value():i);return(t?r.useLayoutEffect:r.useEffect)((()=>{if(n){a(n.value());const e=e=>a(e);return n.subscribe(e),()=>n.unsubscribe(e)}return()=>{}}),[n]),o}},90692:(e,t,n)=>{"use strict";n.d(t,{MatchMedia:()=>i});var r=n(50959);class i extends r.PureComponent{constructor(e){super(e),this._handleChange=()=>{this.forceUpdate()},this.state={query:window.matchMedia(this.props.rule)}}componentDidMount(){this._subscribe(this.state.query)}componentDidUpdate(e,t){this.state.query!==t.query&&(this._unsubscribe(t.query),this._subscribe(this.state.query))}componentWillUnmount(){this._unsubscribe(this.state.query)}render(){return this.props.children(this.state.query.matches)}static getDerivedStateFromProps(e,t){return e.rule!==t.query.media?{query:window.matchMedia(e.rule)}:null}_subscribe(e){e.addListener(this._handleChange)}_unsubscribe(e){e.removeListener(this._handleChange)}}},42842:(e,t,n)=>{"use strict";n.d(t,{Portal:()=>l,PortalContext:()=>c});var r=n(50959),i=n(962),o=n(25931),a=n(67961),s=n(99663);class l extends r.PureComponent{constructor(){super(...arguments),this._uuid=(0,o.nanoid)()}componentWillUnmount(){this._manager().removeWindow(this._uuid)}render(){const e=this._manager().ensureWindow(this._uuid,this.props.layerOptions);return e.style.top=this.props.top||"",e.style.bottom=this.props.bottom||"",e.style.left=this.props.left||"",e.style.right=this.props.right||"",e.style.pointerEvents=this.props.pointerEvents||"",this.props.className&&e.classList.add(this.props.className),this.props["aria-hidden"]&&e.setAttribute("aria-hidden","true"),i.createPortal(r.createElement(c.Provider,{value:this},this.props.children),e)}moveToTop(){this._manager().moveToTop(this._uuid)}_manager(){return null===this.context?(0,a.getRootOverlapManager)():this.context}}l.contextType=s.SlotContext;const c=r.createContext(null)},63932:(e,t,n)=>{"use strict";n.d(t,{Spinner:()=>a});var r=n(50959),i=n(97754),o=n(58096);n(83135);function a(e){const t=i(e.className,"tv-spinner","tv-spinner--shown",`tv-spinner--size_${o.spinnerSizeMap[e.size||o.DEFAULT_SIZE]}`);return r.createElement("div",{className:t,style:e.style,role:"progressbar"})}},68648:e=>{ -e.exports=''},69859:e=>{e.exports=''},39146:e=>{e.exports=''},48010:e=>{e.exports=''},25931:(e,t,n)=>{"use strict";n.d(t,{nanoid:()=>r});let r=(e=21)=>crypto.getRandomValues(new Uint8Array(e)).reduce(((e,t)=>e+=(t&=63)<36?t.toString(36):t<62?(t-26).toString(36).toUpperCase():t>62?"-":"_"),"")},20036:e=>{e.exports={ar:["إلغاء"],ca_ES:["Cancel·la"],cs:["Zrušit"],de:["Abbrechen"],el:["Άκυρο"],en:"Cancel",es:["Cancelar"],fa:["لغو"],fr:["Annuler"],he_IL:["ביטול"],hu_HU:["Törlés"],id_ID:["Batal"],it:["Annulla"],ja:["キャンセル"],ko:["취소"],ms_MY:["Batal"],nl_NL:["Annuleren"],pl:["Anuluj"],pt:["Cancelar"],ro:"Cancel",ru:["Отмена"],sv:["Avbryt"],th:["ยกเลิก"],tr:["İptal"],vi:["Hủy bỏ"],zh:["取消"],zh_TW:["取消"]}},80395:e=>{e.exports={ar:["إغلاق القائمة"],ca_ES:"Close menu",cs:"Close menu",de:["Menü schließen"],el:"Close menu",en:"Close menu",es:["Cerrar menú"],fa:"Close menu",fr:["Fermer le menu"],he_IL:["סגור תפריט"],hu_HU:"Close menu",id_ID:["Pilih menu"],it:["Chiudere menù"],ja:["メニューを閉じる"],ko:["메뉴 닫기"],ms_MY:["Tutup menu"],nl_NL:"Close menu",pl:["Zamknij menu"],pt:["Fechar menu"],ro:"Close menu",ru:["Закрыть меню"],sv:["Stäng menyn"],th:["ปิดเมนู"],tr:["Menüyü kapat"],vi:["Đóng menu"],zh:["关闭菜单"],zh_TW:["關閉選單"]}},44629:e=>{e.exports={ar:["اضف إلى القائمة التفضيلات"],ca_ES:["Afegeix a preferits"],cs:["Přidat do oblíbených"],de:["Zu Favoriten hinzufügen"],el:["Προσθήκη στα αγαπημένα"],en:"Add to favorites",es:["Añadir a favoritos"],fa:["افزودن به موارد مورد علاقه"],fr:["Ajouter aux favoris"],he_IL:["הוסף למועדפים"],hu_HU:["Hozzáadás kedvencekhez"],id_ID:["Tambah ke daftar favorit"],it:["Aggiungi ai preferiti"],ja:["お気に入りに追加"],ko:["즐겨찾기에 넣기"],ms_MY:["Tambah kepada kegemaran"],nl_NL:["Voeg toe aan favorieten"],pl:["Dodaj do ulubionych"],pt:["Adicionar aos favoritos"],ro:"Add to favorites",ru:["Добавить в избранное"],sv:["Lägg till som favorit"],th:["เพิ่มลงรายการโปรด"],tr:["Favorilere ekle"],vi:["Thêm vào mục yêu thích"],zh:["添加到收藏"],zh_TW:["加入收藏"]}},44463:e=>{e.exports={ar:["متاح لحسابات Pro"],ca_ES:"Available for Pro accounts",cs:"Available for Pro accounts",de:["Erhältlich für Pro-Konten"],el:"Available for Pro accounts",en:"Available for Pro accounts", -es:["Disponible para las cuentas Pro"],fa:"Available for Pro accounts",fr:["Disponible pour les comptes Pro"],he_IL:["זמין עבור חשבונות Pro"],hu_HU:"Available for Pro accounts",id_ID:["Tersedia untuk akun Pro"],it:["Disponibile per gli account Pro"],ja:["Proアカウントでご利用いただけます"],ko:["프로 계정에서 사용 가능"],ms_MY:["Tersedia untuk akaun Pro"],nl_NL:"Available for Pro accounts",pl:["Dostępne dla kont Pro"],pt:["Disponível para contas Pro"],ro:"Available for Pro accounts",ru:["Доступно для подписок Pro"],sv:["Tillgängligt för Proabonnenter"],th:["มีให้สำหรับบัญชี Pro"],tr:["Pro hesaplar için kullanılabilir"],vi:["Dành cho các tài khoản Pro"],zh:["适用于Pro账户"],zh_TW:["適用於Pro帳戶"]}},92490:e=>{e.exports={ar:["مختارات المحرر"],ca_ES:["Seleccions dels editors"],cs:"Editors' picks",de:["Editor's Picks"],el:"Editors' picks",en:"Editors' picks",es:["Selecciones de los editores"],fa:"Editors' picks",fr:["Choix de la rédaction"],he_IL:["בחירות העורכים"],hu_HU:"Editors' picks",id_ID:["Pilihan editor"],it:["Selezione editoriale"],ja:["エディターズ・ピック"],ko:["에디터즈 픽"],ms_MY:["Pilihan Editor"],nl_NL:"Editors' picks",pl:["Wybór Redakcji"],pt:["Sugestão da Casa"],ro:"Editors' picks",ru:["Выбор редакции"],sv:["Redaktörens val"],th:["คัดสรรโดยบรรณาธิการ"],tr:["Editörün Seçtikleri"],vi:["Biên tập viên chọn"],zh:["编辑精选"],zh_TW:["編輯精選"]}},61142:e=>{e.exports={ar:["مؤشرات"],ca_ES:["Indicadors"],cs:["Indikátory"],de:["Indikatoren"],el:["Τέχν. Δείκτες"],en:"Indicators",es:["Indicadores"],fa:["اندیکاتورها"],fr:["Indicateurs"],he_IL:["אינדיקטורים"],hu_HU:["Indikátorok"],id_ID:["Indikator"],it:["Indicatori"],ja:["インジケーター"],ko:["지표"],ms_MY:["Penunjuk"],nl_NL:["Indicatoren"],pl:["Wskaźniki"],pt:["Indicadores"],ro:"Indicators",ru:["Индикаторы"],sv:["Indikatorer"],th:["อินดิเคเตอร์"],tr:["Göstergeler"],vi:["Các chỉ báo"],zh:["指标"],zh_TW:["技術指標"]}},53170:e=>{e.exports={ar:["لا توجد مؤشرات تتوافق مع معاييرك."],ca_ES:["Cap indicador coincideix amb els vostres criteris"],cs:["Indikátory nevyhovující vaším požadavkům"],de:["Keine passenden Indikatoren zu Ihren Kriterien gefunden"],el:["Δε βρέθηκαν Τέχνικο. Δείκτες που να ταιριάζουν με τα κριτήρια αναζήτησης"],en:"No indicators matched your criteria",es:["Ningún indicador coincide con sus criterios"],fa:["هیچ اندیکاتوری با شرط شما مطابقت ندارد."],fr:["Aucuns indicateurs ne correspondent à vos critères."],he_IL:["לא נמצאו התאמות לאינדקטור"],hu_HU:["Egyetlen indikátor se felel meg a kritériumoknak."],id_ID:["Tidak ada indikator yang cocok dengan kriteria anda."],it:["Nessun indicatore corrisponde ai criteri"],ja:["条件に合致するインジケーターはありません"],ko:["찾는 지표가 없습니다."],ms_MY:["Tiada penunjuk yang sepadan dengan kriteria anda."],nl_NL:["Geen indicator voldeed aan je criteria"],pl:["Brak wskaźników spełniających twoje kryteria"],pt:["Não foram encontrados indicadores que correspondam à escolha selecionada."],ro:["No indicators matched your criteria."],ru:["Нет подходящих индикаторов."],sv:["Inga indikatorer överensstämde med dina kriterier."],th:["ไม่พบตัวชี้วัดตามเกณฑ์ของคุณ"],tr:["Kriterinize uygun gösterge bulunamadı."], -vi:["Không có chỉ số nào khớp với tiêu chí của bạn."],zh:["没有符合您搜索条件的指标."],zh_TW:["沒有指標符合您的搜尋條件。"]}},15491:e=>{e.exports={ar:["اسم النص البرمجي"],ca_ES:["Nom de l'script"],cs:"Script name",de:["Skripname"],el:"Script name",en:"Script name",es:["Nombre del script"],fa:"Script name",fr:["Nom du script"],he_IL:["שם הסקריפט"],hu_HU:["Szkript név"],id_ID:["Nama skrip"],it:["Nome script"],ja:["スクリプト名"],ko:["스크립트 이름"],ms_MY:["Nama skrip"],nl_NL:"Script name",pl:["Nazwa skryptu"],pt:["Nome do script"],ro:"Script name",ru:["Имя скрипта"],sv:["Skriptets namn"],th:["ชื่อชุดคำสั่ง"],tr:["Komut adı"],vi:["Tên Script"],zh:["脚本名称"],zh_TW:["腳本名稱"]}},52298:e=>{e.exports={ar:["بحث"],ca_ES:["Cercar"],cs:["Hledat"],de:["Suche"],el:["Αναζήτησή"],en:"Search",es:["Buscar"],fa:["جستجو"],fr:["Chercher"],he_IL:["חפש"],hu_HU:["Keresés"],id_ID:["Cari"],it:["Cerca"],ja:["検索"],ko:["찾기"],ms_MY:["Cari"],nl_NL:["Zoeken"],pl:["Szukaj"],pt:["Pesquisar"],ro:"Search",ru:["Поиск"],sv:["Sök"],th:["ค้นหา"],tr:["Ara"],vi:["Tìm kiếm"],zh:["搜索"],zh_TW:["搜尋"]}},72482:e=>{e.exports={ar:["حذف من القائمة المفضلة"],ca_ES:["Treure de preferits"],cs:["Odebrat z oblíbených"],de:["Aus Favoriten entfernen"],el:["Διαγραφή απο τα αγαπημένα"],en:"Remove from favorites",es:["Quitar de favoritos"],fa:["حذف از موارد مورد علاقه"],fr:["Retirer des favoris"],he_IL:["הסר ממועדפים"],hu_HU:["Eltávolít kedvencek közül"],id_ID:["Hilangkan dari favorit"],it:["Rimuovi dai preferiti"],ja:["お気に入りから削除"],ko:["즐겨찾기지움"],ms_MY:["Buang dari kegemaran"],nl_NL:["Verwijder van favorieten"],pl:["Usuń z ulubionych"],pt:["Remover dos favoritos"],ro:"Remove from favorites",ru:["Удалить из предпочтений"],sv:["Ta bort från favoriter"],th:["ลบออกจากรายการโปรด"],tr:["Favorilerimden çıkar"],vi:["Loại bỏ khỏi mục yêu thích"],zh:["从收藏中移除"],zh_TW:["從收藏移除"]}}}]); \ No newline at end of file +t.setContainer(n),e.body.appendChild(n),t}}},99054:(e,t,n)=>{"use strict";n.d(t,{setFixedBodyState:()=>c});const r=(()=>{let e;return()=>{var t;if(void 0===e){const n=document.createElement("div"),r=n.style;r.visibility="hidden",r.width="100px",r.msOverflowStyle="scrollbar",document.body.appendChild(n);const i=n.offsetWidth;n.style.overflow="scroll";const o=document.createElement("div");o.style.width="100%",n.appendChild(o);const a=o.offsetWidth;null===(t=n.parentNode)||void 0===t||t.removeChild(n),e=i-a}return e}})();function i(e,t,n){null!==e&&e.style.setProperty(t,n)}function o(e,t){return getComputedStyle(e,null).getPropertyValue(t)}function a(e,t){return parseInt(o(e,t))}let s=0,l=!1;function c(e){const{body:t}=document,n=t.querySelector(".widgetbar-wrap");if(e&&1==++s){const e=o(t,"overflow"),s=a(t,"padding-right");"hidden"!==e.toLowerCase()&&t.scrollHeight>t.offsetHeight&&(i(n,"right",`${r()}px`),t.style.paddingRight=`${s+r()}px`,l=!0),t.classList.add("i-no-scroll")}else if(!e&&s>0&&0==--s&&(t.classList.remove("i-no-scroll"),l)){i(n,"right","0px");let e=0;0,t.scrollHeight<=t.clientHeight&&(e-=r()),t.style.paddingRight=(e<0?0:e)+"px",l=!1}}},24437:(e,t,n)=>{"use strict";n.d(t,{DialogBreakpoints:()=>i});var r=n(88803);const i={SmallHeight:r["small-height-breakpoint"],TabletSmall:r["tablet-small-breakpoint"],TabletNormal:r["tablet-normal-breakpoint"]}},69654:(e,t,n)=>{"use strict";n.d(t,{DialogSearch:()=>d});var r=n(50959),i=n(97754),o=n.n(i),a=n(11542),s=n(9745),l=n(69859),c=n(40281);function d(e){const{children:t,renderInput:i,onCancel:d,containerClassName:h,inputContainerClassName:m,iconClassName:p,...v}=e;return r.createElement("div",{className:o()(c.container,h)},r.createElement("div",{className:o()(c.inputContainer,m,d&&c.withCancel)},i||r.createElement(u,{...v})),t,r.createElement(s.Icon,{className:o()(c.icon,p),icon:l}),d&&r.createElement("div",{className:c.cancel,onClick:d},a.t(null,void 0,n(20036))))}function u(e){const{className:t,reference:n,value:i,onChange:a,onFocus:s,onBlur:l,onKeyDown:d,onSelect:u,placeholder:h,...m}=e;return r.createElement("input",{...m,ref:n,type:"text",className:o()(t,c.input),autoComplete:"off","data-role":"search",placeholder:h,value:i,onChange:a,onFocus:s,onBlur:l,onSelect:u,onKeyDown:d})}},22265:(e,t,n)=>{"use strict";n.d(t,{DialogSidebarContainer:()=>d,DialogSidebarItem:()=>h,DialogSidebarWrapper:()=>u});var r=n(50959),i=n(97754),o=n.n(i),a=n(9745),s=n(65631),l=n(68648),c=n(54829);function d(e){const{mode:t,className:n,...i}=e,{isMobile:a,isTablet:l}=(0,s.getSidebarMode)(t),d=o()(c.container,l&&c.isTablet,a&&c.isMobile,n);return r.createElement("div",{...i,className:d,"data-role":"dialog-sidebar"})}function u(e){return r.createElement("div",{className:c.wrapper,...e})}function h(e){const{mode:t,title:n,icon:i,isActive:d,onClick:u,tag:h="div",reference:m,className:p,...v}=e,{isMobile:f,isTablet:g}=(0,s.getSidebarMode)(t),y=d?null==i?void 0:i.active:null==i?void 0:i.default;return r.createElement(h,{...v,ref:m,className:o()(c.tab,g&&c.isTablet,f&&c.isMobile,d&&c.active,p), +onClick:u},i&&r.createElement(a.Icon,{className:c.icon,icon:y}),!g&&r.createElement("span",{className:o()(c.title,!i&&c.withoutIcon)},r.createElement("span",{className:c.titleText},n),f&&r.createElement(a.Icon,{className:c.nested,icon:l})))}},65631:(e,t,n)=>{"use strict";function r(e){return{isMobile:"mobile"===e,isTablet:"tablet"===e}}n.d(t,{getSidebarMode:()=>r})},57979:(e,t,n)=>{"use strict";n.r(t),n.d(t,{IndicatorsLibraryContainer:()=>de});var r=n(50959),i=n(962),o=n(11542),a=n(88348);const s=o.t(null,void 0,n(44463));var l=n(42856),c=n(14483),d=n(92249);function u(e,t){const n=e.title.toLowerCase(),r=t.title.toLowerCase();return nr?1:0}const h={earning:new RegExp("EPS"),earnings:new RegExp("EPS"),"trailing twelve months":new RegExp("TTM")};function m(e){var t;const{id:r,description:i,shortDescription:a,description_localized:d,is_hidden_study:u,version:h,extra:m,tags:v}=e,f=c.enabled("graying_disabled_tools_enabled")&&(null===(t=window.ChartApiInstance)||void 0===t?void 0:t.studiesAccessController.isToolGrayed(i));return{id:r,title:d||o.t(i,{context:"study"},n(68716)),shortDescription:a,shortTitle:a,isStrategy:l.StudyMetaInfo.isScriptStrategy(e),isHidden:u,isNew:null==m?void 0:m.isNew,isUpdated:null==m?void 0:m.isUpdated,isBeta:null==m?void 0:m.isBeta,isPro:null==m?void 0:m.isPro,proBadgeTitle:s,isFundamental:!1,isOverlay:e.is_price_study,studyData:{id:r,version:h,descriptor:{type:"java",studyId:e.id},packageName:p(r,m)},isGrayed:f,tags:v}}function p(e,t){return(null==t?void 0:t.isChartPattern)?"tv-chart_patterns":(null==t?void 0:t.isAuto)?"auto-java":l.StudyMetaInfo.getPackageName(e)}var v=n(97754),f=n.n(v),g=n(63932),y=n(35057),_=n(49483),b=n(69654),C=n(22265),x=n(60030);function k(e){const{reference:t,className:n,...i}=e;return r.createElement("div",{ref:t,className:f()(x.container,n),...i,"data-role":"dialog-content"})}var E=n(95988);function w(e){const{children:t,className:n,disabled:i}=e;return r.createElement("span",{className:f()(E.title,i&&E.disabled,n)},t)}const I=r.createContext(null);var P=n(24637),N=n(77975),S=n(45345),D=n(26843),R=n(36189),T=n(68335),B=n(60430);function L(e){const t=(0,r.useContext)(I),{style:i,layoutMode:a,item:s,query:l,regExpRules:c,isBeta:d,isNew:u,isUpdated:h,isSelected:m,isHighlighted:p,reference:v,onClick:g,renderActions:y,isPro:_,proBadgeTitle:b,onItemActionsClick:C,favoriteClickHandler:x,hideEP:k}=e,{isFavorite:E,isLocked:T,public:L,editorsPick:M}=s,F=void 0!==E,j=z(g,s),W=(0,r.useCallback)((e=>{e.stopPropagation(),null==C||C()}),[C]),A=(0,r.useCallback)((e=>{if(x)return null==C||C(),void x(e);if(null==t?void 0:t.toggleFavorite){z((e=>{null==C||C(),t.toggleFavorite(e)}),s)(e)}}),[x,C,null==t?void 0:t.toggleFavorite]),H=(0,N.useWatchedValueReadonly)({watchedValue:S.watchedTheme})===D.StdTheme.Dark?B.dark:B.light,Z=f()(B.container,s.isGrayed&&B.disabled,m&&B.selected,p&&B.highlighted,p&&H);return r.createElement("div",{ref:v,className:Z,onClick:j,style:i,"data-role":"list-item","data-disabled":s.isGrayed,"data-title":s.title,"data-id":s.id},r.createElement("div",{ +className:f()(B.main,!F&&B.paddingLeft)},F&&r.createElement(R.FavoriteButton,{className:f()(B.favorite,E&&B.isActive),isFilled:E,onClick:A}),r.createElement(w,{disabled:s.isGrayed},r.createElement(P.HighlightedText,{queryString:l,rules:c,text:s.title})),!1,d&&r.createElement(BadgeIndicator,{type:"beta",className:B.badge}),u&&r.createElement(BadgeIndicator,{type:"new",className:B.badge}),h&&r.createElement(BadgeIndicator,{type:"updated",className:B.badge}),Boolean(M&&!k)&&r.createElement(BadgeIndicator,{type:"ep",className:B.badge,tooltip:o.t(null,void 0,n(92490))}),!1),L&&r.createElement("a",{href:L.authorLink,className:B.author,target:"_blank",onClick:W},L.authorName),"mobile"!==a&&L&&r.createElement("span",{className:B.likes},L.likesCount),!1)}function z(e,t){return n=>{const r=0===(0,T.modifiersFromEvent)(n)&&0===n.button;!n.defaultPrevented&&e&&r&&(n.preventDefault(),e(t))}}var M=n(61098);function F(e){const{title:t,type:n,className:i}=e;return r.createElement("h3",{className:f()(M.title,"Small"===n&&M.small,"Normal"===n&&M.normal,"Large"===n&&M.large,i)},t)}var j=n(76797);function W(e){const{style:t,children:n}=e;return r.createElement("div",{style:t,className:j.container},n)}var A=n(9745),H=n(94720),Z=n(70722);function q(e){const{className:t,icon:n,title:i,description:o,buttonText:a,buttonAction:s}=e;return r.createElement("div",{className:f()(Z.container,t)},n&&r.createElement(A.Icon,{icon:n,className:Z.image}),i&&r.createElement("h3",{className:Z.title},i),o&&r.createElement("p",{className:Z.description},o),a&&s&&r.createElement(H.Button,{onClick:s,className:Z.button},a))}function O(e){const[t,n]=(0,r.useState)(null);function i(e){return e.findIndex((e=>(null==t?void 0:t.id)===e.id))}return[t,n,function(){n(function(){var n;const r=i(e),o=r===e.length-1;return null===t||-1===r?null!==(n=e[0])&&void 0!==n?n:null:o?e[r]:e[r+1]}())},function(){n(function(){var n;const r=i(e);return null===t||0===r||-1===r?null!==(n=e[0])&&void 0!==n?n:null:e[r-1]}())}]}var U=n(19785),G=n(57898),V=n(56840);const Y=new G.Delegate,K=new G.Delegate,J=new G.Delegate;let X=[];function $(e){return-1===ee(e)?(function(e){!Q(e)&&(X.push(e),ne(),Y.fire(e))}(e),!0):(function(e){const t=ee(e);-1!==t&&(X.splice(t,1),ne(),K.fire(e))}(e),!1)}function Q(e){return-1!==ee(e)}function ee(e){return X.indexOf(e)}function te(){var e,t;X=[];const n=Boolean(void 0===(0,V.getValue)("chart.favoriteLibraryIndicators")),r=(0,V.getJSON)("chart.favoriteLibraryIndicators",[]);if(X.push(...r),0===X.length&&n&&"undefined"!=typeof window){const n=JSON.parse(null!==(t=null===(e=window.urlParams)||void 0===e?void 0:e.favorites)&&void 0!==t?t:"{}").indicators;n&&Array.isArray(n)&&X.push(...n)}J.fire()}function ne(){const e=X.slice();(0,V.setJSON)("chart.favoriteLibraryIndicators",e)}te(),V.onSync.subscribe(null,te);var re=n(4567);function ie(e){const{reference:t,data:i,isOpened:a,onClose:s,applyStudy:l,shouldReturnFocus:c}=e,[d,u]=(0,r.useState)(""),m=(0,r.useMemo)((()=>(0,U.createRegExpList)(d,h)),[d]),p=(0,r.useMemo)((()=>d?(0,U.rankedSearch)({data:i,rules:m, +queryString:d,primaryKey:"shortDescription",secondaryKey:"title",optionalPrimaryKey:"shortTitle",tertiaryKey:"tags"}):i),[d,m,i]),v=(0,r.useMemo)((()=>p.slice().sort(oe)),[p]),{highlightedItem:x,selectedItem:E,selectedNodeReference:w,scrollContainerRef:I,searchInputRef:P,onClickStudy:N,handleKeyDown:S}=function(e,t,n,i){let o=0;const[a,s]=(0,r.useState)(null),l=(0,r.useRef)(null),c=(0,r.useRef)(null),[d,u,h,m]=O(t),p=(0,r.useRef)(null);return(0,r.useEffect)((()=>{e?v(0):u(null)}),[e]),(0,r.useEffect)((()=>{void 0!==i&&(v(0),u(null))}),[i]),(0,r.useEffect)((()=>(a&&(o=setTimeout((()=>{s(null)}),1500)),()=>{clearInterval(o)})),[a]),{highlightedItem:a,scrollContainerRef:l,selectedNodeReference:c,selectedItem:d,searchInputRef:p,onClickStudy:function(e){n&&(n(e),u(e),s(e))},handleKeyDown:function(e){const[t,r]=function(e,t){if(null===e.current||null===t.current)return[0,0];const n=e.current.getBoundingClientRect(),r=t.current.getBoundingClientRect(),{height:i}=n,o=n.top-r.top,a=n.bottom-r.bottom+i<0?0:i,s=o-i>0?0:i,{scrollTop:l}=t.current;return[l-s,l+a]}(c,l);if(40===(0,T.hashFromEvent)(e)&&(e.preventDefault(),h(),v(r)),38===(0,T.hashFromEvent)(e)&&(e.preventDefault(),m(),v(t)),13===(0,T.hashFromEvent)(e)&&d){if(!n)return;n(d),s(d)}}};function v(e){null!==l.current&&l.current.scrollTo&&l.current.scrollTo(0,e)}}(a,v,l),D=""===d&&!v.length;return(0,r.useEffect)((()=>{var e;a||u(""),_.CheckMobile.any()||null===(e=P.current)||void 0===e||e.focus()}),[a]),r.createElement(y.AdaptivePopupDialog,{className:f()(re.dialogLibrary),isOpened:a,onClose:s,onClickOutside:s,title:o.t(null,void 0,n(61142)),dataName:"indicators-dialog",onKeyDown:S,shouldReturnFocus:c,ref:t,render:()=>r.createElement(r.Fragment,null,r.createElement(b.DialogSearch,{reference:P,placeholder:o.t(null,void 0,n(52298)),onChange:R,onFocus:B}),r.createElement(C.DialogSidebarWrapper,null,r.createElement(k,{reference:I,className:re.scroll},D?r.createElement(g.Spinner,null):v.length?r.createElement(r.Fragment,null,r.createElement(W,null,r.createElement(F,{title:o.t(null,void 0,n(15491))})),v.map((e=>r.createElement(L,{key:e.id,item:e,onClick:()=>N(e),query:d,regExpRules:m,reference:(null==E?void 0:E.id)===e.id?w:void 0,isSelected:(null==E?void 0:E.id)===e.id,isHighlighted:(null==x?void 0:x.id)===e.id,favoriteClickHandler:t=>{t.stopPropagation(),$(e.title)}})))):r.createElement(q,{className:re.noContentBlock,description:o.t(null,void 0,n(53170))}))))});function R(e){u(e.target.value)}function B(){var e;d.length>0&&(null===(e=P.current)||void 0===e||e.select())}}function oe(e,t){return e.isFavorite===t.isFavorite?0:e.isFavorite?-1:1}var ae=n(76422),se=n(74970),le=n(97145);function ce(e,t){return e[t]||[]}class de extends class{constructor(e){this._searchInputRef=r.createRef(),this._dialog=r.createRef(),this._visibility=new le.WatchedValue(!1),this._container=document.createElement("div"),this._isForceRender=!1,this._parentSources=[],this._isDestroyed=!1,this._deepFundamentalsHistoryNotificationHasBeenShown=!1,this._showDeepFundamentalsHistoryNotification=()=>{}, +this._chartWidgetCollection=e}isDestroyed(){return this._isDestroyed}visible(){return this._visibility.readonly()}resetAllStudies(){}updateFavorites(){}open(e,t,n,r,i){this._parentSources=e,this._updateSymbol(),this._setProps({isOpened:!0,shouldReturnFocus:null==i?void 0:i.shouldReturnFocus}),this._visibility.setValue(!0),ae.emit("indicators_dialog")}show(e){this.open([],void 0,void 0,void 0,e)}hide(){this._parentSources=[],this._setProps({isOpened:!1}),this._visibility.setValue(!1)}destroy(){this._isDestroyed=!0,i.unmountComponentAtNode(this._container)}_shouldPreventRender(){return this._isDestroyed||!this._isForceRender&&!this._getProps().value().isOpened}_getRenderData(){return{props:this._getProps().value(),container:this._getContainer()}}_applyStudy(e,t){var n;e.isGrayed?ae.emit("onGrayedObjectClicked",{type:"study",name:e.shortDescription}):(_.CheckMobile.any()||null===(n=this._searchInputRef.current)||void 0===n||n.select(),async function(e,t,n,r,i){const o=e.activeChartWidget.value();if(!o)return null;const{studyData:s}=t;if(!s)return Promise.resolve(null);const l=s.descriptor;if("java"===l.type){const e=(0,d.tryFindStudyLineToolNameByStudyId)(l.studyId);if(null!==e)return a.tool.setValue(e),null}return o.insertStudy(s.descriptor,n,{stubTitle:t.shortDescription,isFundamental:t.isFundamental,isOverlay:t.isOverlay})}(this._chartWidgetCollection,e,this._parentSources,0,this._symbol).then((()=>{var e;window.is_authenticated;_.CheckMobile.any()||(null===document.activeElement||document.activeElement===document.body||null!==this._dialog.current&&this._dialog.current.contains(document.activeElement))&&(null===(e=this._searchInputRef.current)||void 0===e||e.focus())})))}_setProps(e){const t=this._getProps().value(),{isOpened:n}=t;this._isForceRender=n&&"isOpened"in e&&!e.isOpened;const r={...t,...e};this._getProps().setValue(r)}_requestBuiltInJavaStudies(){return(0,se.studyMetaInfoRepository)().findAllJavaStudies()}_focus(){var e;this._getProps().value().isOpened&&(null===(e=this._dialog.current)||void 0===e||e.focus())}_getContainer(){return this._container}_getDialog(){return this._dialog}_getSymbol(){return this._symbol}_updateSymbol(){this._symbol=void 0}}{constructor(e,t){super(e),this._options={onWidget:!1},this._indicatorData=[],t&&(this._options=t),this._props=new le.WatchedValue({data:[],applyStudy:this._applyStudy.bind(this),isOpened:!1,reference:this._getDialog(),onClose:this.hide.bind(this)}),this._getProps().subscribe(this._render.bind(this)),this._init()}_getProps(){return this._props}async _init(){const e=function(e){const t={};return e.forEach((e=>{const{studyData:n}=e;if(!n)return;const{packageName:r}=n;r in t?t[r].push(e):t[r]=[e]})),t}(function(e,t=!0){return e.filter((e=>{const n=!!t||!function(e){return e.isStrategy}(e);return!e.isHidden&&n}))}((await this._requestBuiltInJavaStudies()).map(m)));this._indicatorData=await async function(e,t){let n={...t};return[...ce(n,"tv-basicstudies"),...ce(n,"Script$STD"),...ce(n,"tv-volumebyprice")].filter((e=>!e.isStrategy)).sort(u) +}(this._options.onWidget,e),this._setFavorites(),this._setProps({data:this._indicatorData}),Y.subscribe(null,(()=>this._refreshFavorites())),K.subscribe(null,(()=>this._refreshFavorites()))}_setFavorites(){c.enabled("items_favoriting")&&this._indicatorData.forEach((e=>{e.isFavorite=Q(e.title)}))}_refreshFavorites(){this._setFavorites(),this._setProps({data:this._indicatorData})}_render(){if(this._shouldPreventRender())return;const{props:e,container:t}=this._getRenderData();i.render(r.createElement(ie,{...e}),t)}}},36189:(e,t,n)=>{"use strict";n.d(t,{FavoriteButton:()=>u});var r=n(11542),i=n(50959),o=n(97754),a=n(9745),s=n(39146),l=n(48010),c=n(14877);const d={add:r.t(null,void 0,n(44629)),remove:r.t(null,void 0,n(72482))};function u(e){const{className:t,isFilled:n,isActive:r,onClick:u,...h}=e;return i.createElement(a.Icon,{...h,className:o(c.favorite,"apply-common-tooltip",n&&c.checked,r&&c.active,t),icon:n?s:l,onClick:u,title:n?d.remove:d.add})}},19785:(e,t,n)=>{"use strict";n.d(t,{createRegExpList:()=>o,getHighlightedChars:()=>a,rankedSearch:()=>i});var r=n(1722);function i(e){const{data:t,rules:n,queryString:i,isPreventedFromFiltering:o,primaryKey:a,secondaryKey:s=a,optionalPrimaryKey:l,tertiaryKey:c}=e;return t.map((e=>{const t=l&&e[l]?e[l]:e[a],o=e[s],d=c&&e[c];let u,h=0;return n.forEach((e=>{var n,a,s,l,c;const{re:m,fullMatch:p}=e;if(m.lastIndex=0,(0,r.isString)(t)&&t&&t.toLowerCase()===i.toLowerCase())return h=4,void(u=null===(n=t.match(p))||void 0===n?void 0:n.index);if((0,r.isString)(t)&&p.test(t))return h=3,void(u=null===(a=t.match(p))||void 0===a?void 0:a.index);if((0,r.isString)(o)&&p.test(o))return h=2,void(u=null===(s=o.match(p))||void 0===s?void 0:s.index);if((0,r.isString)(o)&&m.test(o))return h=2,void(u=null===(l=o.match(m))||void 0===l?void 0:l.index);if(Array.isArray(d))for(const e of d)if(p.test(e))return h=1,void(u=null===(c=e.match(p))||void 0===c?void 0:c.index)})),{matchPriority:h,matchIndex:u,item:e}})).filter((e=>o||e.matchPriority)).sort(((e,t)=>{if(e.matchPriorityt.matchPriority)return-1;if(e.matchPriority===t.matchPriority){if(void 0===e.matchIndex||void 0===t.matchIndex)return 0;if(e.matchIndex>t.matchIndex)return 1;if(e.matchIndexe))}function o(e,t){const n=[],r=e.toLowerCase(),i=e.split("").map(((e,t)=>`(${0!==t?`[/\\s-]${s(e)}`:s(e)})`)).join("(.*?)")+"(.*)";return n.push({fullMatch:new RegExp(`(${s(e)})`,"i"),re:new RegExp(`^${i}`,"i"),reserveRe:new RegExp(i,"i"),fuzzyHighlight:!0}),t&&t.hasOwnProperty(r)&&n.push({fullMatch:t[r],re:t[r],fuzzyHighlight:!1}),n}function a(e,t,n){const r=[];return e&&n?(n.forEach((e=>{const{fullMatch:n,re:i,reserveRe:o}=e;n.lastIndex=0,i.lastIndex=0;const a=n.exec(t),s=a||i.exec(t)||o&&o.exec(t);if(e.fuzzyHighlight=!a,s)if(e.fuzzyHighlight){let e=s.index;for(let t=1;t{"use strict";n.d(t,{HighlightedText:()=>s});var r=n(50959),i=n(97754),o=n(19785),a=n(75623);function s(e){const{queryString:t,rules:n,text:s,className:l}=e,c=(0,r.useMemo)((()=>(0,o.getHighlightedChars)(t,s,n)),[t,n,s]);return r.createElement(r.Fragment,null,c.length?s.split("").map(((e,t)=>r.createElement(r.Fragment,{key:t},c[t]?r.createElement("span",{className:i(a.highlighted,l)},e):r.createElement("span",null,e)))):s)}},77975:(e,t,n)=>{"use strict";n.d(t,{useWatchedValueReadonly:()=>i});var r=n(50959);const i=(e,t=!1)=>{const n="watchedValue"in e?e.watchedValue:void 0,i="defaultValue"in e?e.defaultValue:e.watchedValue.value(),[o,a]=(0,r.useState)(n?n.value():i);return(t?r.useLayoutEffect:r.useEffect)((()=>{if(n){a(n.value());const e=e=>a(e);return n.subscribe(e),()=>n.unsubscribe(e)}return()=>{}}),[n]),o}},90692:(e,t,n)=>{"use strict";n.d(t,{MatchMedia:()=>i});var r=n(50959);class i extends r.PureComponent{constructor(e){super(e),this._handleChange=()=>{this.forceUpdate()},this.state={query:window.matchMedia(this.props.rule)}}componentDidMount(){this._subscribe(this.state.query)}componentDidUpdate(e,t){this.state.query!==t.query&&(this._unsubscribe(t.query),this._subscribe(this.state.query))}componentWillUnmount(){this._unsubscribe(this.state.query)}render(){return this.props.children(this.state.query.matches)}static getDerivedStateFromProps(e,t){return e.rule!==t.query.media?{query:window.matchMedia(e.rule)}:null}_subscribe(e){e.addListener(this._handleChange)}_unsubscribe(e){e.removeListener(this._handleChange)}}},42842:(e,t,n)=>{"use strict";n.d(t,{Portal:()=>l,PortalContext:()=>c});var r=n(50959),i=n(962),o=n(25931),a=n(67961),s=n(99663);class l extends r.PureComponent{constructor(){super(...arguments),this._uuid=(0,o.nanoid)()}componentWillUnmount(){this._manager().removeWindow(this._uuid)}render(){const e=this._manager().ensureWindow(this._uuid,this.props.layerOptions);return e.style.top=this.props.top||"",e.style.bottom=this.props.bottom||"",e.style.left=this.props.left||"",e.style.right=this.props.right||"",e.style.pointerEvents=this.props.pointerEvents||"",this.props.className&&e.classList.add(this.props.className),this.props["aria-hidden"]&&e.setAttribute("aria-hidden","true"),i.createPortal(r.createElement(c.Provider,{value:this},this.props.children),e)}moveToTop(){this._manager().moveToTop(this._uuid)}_manager(){return null===this.context?(0,a.getRootOverlapManager)():this.context}}l.contextType=s.SlotContext;const c=r.createContext(null)},63932:(e,t,n)=>{"use strict";n.d(t,{Spinner:()=>a});var r=n(50959),i=n(97754),o=n(58096);n(83135);function a(e){const t=i(e.className,"tv-spinner","tv-spinner--shown",`tv-spinner--size_${o.spinnerSizeMap[e.size||o.DEFAULT_SIZE]}`);return r.createElement("div",{className:t,style:e.style,role:"progressbar"})}},68648:e=>{e.exports='' +},69859:e=>{e.exports=''},39146:e=>{e.exports=''},48010:e=>{e.exports=''},25931:(e,t,n)=>{"use strict";n.d(t,{nanoid:()=>r});let r=(e=21)=>crypto.getRandomValues(new Uint8Array(e)).reduce(((e,t)=>e+=(t&=63)<36?t.toString(36):t<62?(t-26).toString(36).toUpperCase():t>62?"-":"_"),"")},20036:e=>{e.exports={ar:["إلغاء"],ca_ES:["Cancel·la"],cs:["Zrušit"],de:["Abbrechen"],el:["Άκυρο"],en:"Cancel",es:["Cancelar"],fa:["لغو"],fr:["Annuler"],he_IL:["ביטול"],hu_HU:["Törlés"],id_ID:["Batal"],it:["Annulla"],ja:["キャンセル"],ko:["취소"],ms_MY:["Batal"],nl_NL:["Annuleren"],pl:["Anuluj"],pt:["Cancelar"],ro:"Cancel",ru:["Отмена"],sv:["Avbryt"],th:["ยกเลิก"],tr:["İptal"],vi:["Hủy bỏ"],zh:["取消"],zh_TW:["取消"]}},80395:e=>{e.exports={ar:["إغلاق القائمة"],ca_ES:"Close menu",cs:"Close menu",de:["Menü schließen"],el:"Close menu",en:"Close menu",es:["Cerrar menú"],fa:"Close menu",fr:["Fermer le menu"],he_IL:["סגור תפריט"],hu_HU:"Close menu",id_ID:["Pilih menu"],it:["Chiudere menù"],ja:["メニューを閉じる"],ko:["메뉴 닫기"],ms_MY:["Tutup menu"],nl_NL:"Close menu",pl:["Zamknij menu"],pt:["Fechar menu"],ro:"Close menu",ru:["Закрыть меню"],sv:["Stäng menyn"],th:["ปิดเมนู"],tr:["Menüyü kapat"],vi:["Đóng menu"],zh:["关闭菜单"],zh_TW:["關閉選單"]}},44629:e=>{e.exports={ar:["اضف إلى القائمة التفضيلات"],ca_ES:["Afegeix a preferits"],cs:["Přidat do oblíbených"],de:["Zu Favoriten hinzufügen"],el:["Προσθήκη στα αγαπημένα"],en:"Add to favorites",es:["Añadir a favoritos"],fa:["افزودن به موارد مورد علاقه"],fr:["Ajouter aux favoris"],he_IL:["הוסף למועדפים"],hu_HU:["Hozzáadás kedvencekhez"],id_ID:["Tambah ke daftar favorit"],it:["Aggiungi ai preferiti"],ja:["お気に入りに追加"],ko:["즐겨찾기에 넣기"],ms_MY:["Tambah kepada kegemaran"],nl_NL:["Voeg toe aan favorieten"],pl:["Dodaj do ulubionych"],pt:["Adicionar aos favoritos"],ro:"Add to favorites",ru:["Добавить в избранное"],sv:["Lägg till som favorit"],th:["เพิ่มลงรายการโปรด"],tr:["Favorilere ekle"],vi:["Thêm vào mục yêu thích"],zh:["添加到收藏"],zh_TW:["加入收藏"]}},44463:e=>{e.exports={ar:["متاح لحسابات Pro"],ca_ES:"Available for Pro accounts",cs:"Available for Pro accounts",de:["Erhältlich für Pro-Konten"],el:"Available for Pro accounts",en:"Available for Pro accounts",es:["Disponible para las cuentas Pro"],fa:"Available for Pro accounts",fr:["Disponible pour les comptes Pro"],he_IL:["זמין עבור חשבונות Pro"],hu_HU:"Available for Pro accounts", +id_ID:["Tersedia untuk akun Pro"],it:["Disponibile per gli account Pro"],ja:["Proアカウントでご利用いただけます"],ko:["프로 계정에서 사용 가능"],ms_MY:["Tersedia untuk akaun Pro"],nl_NL:"Available for Pro accounts",pl:["Dostępne dla kont Pro"],pt:["Disponível para contas Pro"],ro:"Available for Pro accounts",ru:["Доступно для подписок Pro"],sv:["Tillgängligt för Proabonnenter"],th:["มีให้สำหรับบัญชี Pro"],tr:["Pro hesaplar için kullanılabilir"],vi:["Dành cho các tài khoản Pro"],zh:["适用于Pro账户"],zh_TW:["適用於Pro帳戶"]}},92490:e=>{e.exports={ar:["مختارات المحرر"],ca_ES:["Seleccions dels editors"],cs:"Editors' picks",de:["Editor's Picks"],el:"Editors' picks",en:"Editors' picks",es:["Selecciones de los editores"],fa:"Editors' picks",fr:["Choix de la rédaction"],he_IL:["בחירות העורכים"],hu_HU:"Editors' picks",id_ID:["Pilihan editor"],it:["Selezione editoriale"],ja:["エディターズ・ピック"],ko:["에디터즈 픽"],ms_MY:["Pilihan Editor"],nl_NL:"Editors' picks",pl:["Wybór Redakcji"],pt:["Sugestão da Casa"],ro:"Editors' picks",ru:["Выбор редакции"],sv:["Redaktörens val"],th:["คัดสรรโดยบรรณาธิการ"],tr:["Editörün Seçtikleri"],vi:["Biên tập viên chọn"],zh:["编辑精选"],zh_TW:["編輯精選"]}},61142:e=>{e.exports={ar:["مؤشرات"],ca_ES:["Indicadors"],cs:["Indikátory"],de:["Indikatoren"],el:["Τέχν. Δείκτες"],en:"Indicators",es:["Indicadores"],fa:["اندیکاتورها"],fr:["Indicateurs"],he_IL:["אינדיקטורים"],hu_HU:["Indikátorok"],id_ID:["Indikator"],it:["Indicatori"],ja:["インジケーター"],ko:["지표"],ms_MY:["Penunjuk"],nl_NL:["Indicatoren"],pl:["Wskaźniki"],pt:["Indicadores"],ro:"Indicators",ru:["Индикаторы"],sv:["Indikatorer"],th:["อินดิเคเตอร์"],tr:["Göstergeler"],vi:["Các chỉ báo"],zh:["指标"],zh_TW:["技術指標"]}},53170:e=>{e.exports={ar:["لا توجد مؤشرات تتوافق مع معاييرك."],ca_ES:["Cap indicador coincideix amb els vostres criteris"],cs:["Indikátory nevyhovující vaším požadavkům"],de:["Keine passenden Indikatoren zu Ihren Kriterien gefunden"],el:["Δε βρέθηκαν Τέχνικο. Δείκτες που να ταιριάζουν με τα κριτήρια αναζήτησης"],en:"No indicators matched your criteria",es:["Ningún indicador coincide con sus criterios"],fa:["هیچ اندیکاتوری با شرط شما مطابقت ندارد."],fr:["Aucuns indicateurs ne correspondent à vos critères."],he_IL:["לא נמצאו התאמות לאינדקטור"],hu_HU:["Egyetlen indikátor se felel meg a kritériumoknak."],id_ID:["Tidak ada indikator yang cocok dengan kriteria anda."],it:["Nessun indicatore corrisponde ai criteri"],ja:["条件に合致するインジケーターはありません"],ko:["찾는 지표가 없습니다."],ms_MY:["Tiada penunjuk yang sepadan dengan kriteria anda."],nl_NL:["Geen indicator voldeed aan je criteria"],pl:["Brak wskaźników spełniających twoje kryteria"],pt:["Não foram encontrados indicadores que correspondam à escolha selecionada."],ro:["No indicators matched your criteria."],ru:["Нет подходящих индикаторов."],sv:["Inga indikatorer överensstämde med dina kriterier."],th:["ไม่พบตัวชี้วัดตามเกณฑ์ของคุณ"],tr:["Kriterinize uygun gösterge bulunamadı."],vi:["Không có chỉ số nào khớp với tiêu chí của bạn."],zh:["没有符合您搜索条件的指标."],zh_TW:["沒有指標符合您的搜尋條件。"]}},15491:e=>{e.exports={ar:["اسم النص البرمجي"],ca_ES:["Nom de l'script"],cs:"Script name", +de:["Skripname"],el:"Script name",en:"Script name",es:["Nombre del script"],fa:"Script name",fr:["Nom du script"],he_IL:["שם הסקריפט"],hu_HU:["Szkript név"],id_ID:["Nama skrip"],it:["Nome script"],ja:["スクリプト名"],ko:["스크립트 이름"],ms_MY:["Nama skrip"],nl_NL:"Script name",pl:["Nazwa skryptu"],pt:["Nome do script"],ro:"Script name",ru:["Имя скрипта"],sv:["Skriptets namn"],th:["ชื่อชุดคำสั่ง"],tr:["Komut adı"],vi:["Tên Script"],zh:["脚本名称"],zh_TW:["腳本名稱"]}},52298:e=>{e.exports={ar:["بحث"],ca_ES:["Cercar"],cs:["Hledat"],de:["Suche"],el:["Αναζήτησή"],en:"Search",es:["Buscar"],fa:["جستجو"],fr:["Chercher"],he_IL:["חפש"],hu_HU:["Keresés"],id_ID:["Cari"],it:["Cerca"],ja:["検索"],ko:["찾기"],ms_MY:["Cari"],nl_NL:["Zoeken"],pl:["Szukaj"],pt:["Pesquisar"],ro:"Search",ru:["Поиск"],sv:["Sök"],th:["ค้นหา"],tr:["Ara"],vi:["Tìm kiếm"],zh:["搜索"],zh_TW:["搜尋"]}},72482:e=>{e.exports={ar:["حذف من القائمة المفضلة"],ca_ES:["Treure de preferits"],cs:["Odebrat z oblíbených"],de:["Aus Favoriten entfernen"],el:["Διαγραφή απο τα αγαπημένα"],en:"Remove from favorites",es:["Quitar de favoritos"],fa:["حذف از موارد مورد علاقه"],fr:["Retirer des favoris"],he_IL:["הסר ממועדפים"],hu_HU:["Eltávolít kedvencek közül"],id_ID:["Hilangkan dari favorit"],it:["Rimuovi dai preferiti"],ja:["お気に入りから削除"],ko:["즐겨찾기지움"],ms_MY:["Buang dari kegemaran"],nl_NL:["Verwijder van favorieten"],pl:["Usuń z ulubionych"],pt:["Remover dos favoritos"],ro:"Remove from favorites",ru:["Удалить из предпочтений"],sv:["Ta bort från favoriter"],th:["ลบออกจากรายการโปรด"],tr:["Favorilerimden çıkar"],vi:["Loại bỏ khỏi mục yêu thích"],zh:["从收藏中移除"],zh_TW:["從收藏移除"]}}}]); \ No newline at end of file diff --git a/charting_library/charting_library.cjs.js b/charting_library/charting_library.cjs.js index debc013d..3cc4c4c9 100644 --- a/charting_library/charting_library.cjs.js +++ b/charting_library/charting_library.cjs.js @@ -1 +1 @@ -"use strict";function t(e,n){const i={...e};for(const o in n)"object"!=typeof e[o]||null===e[o]||Array.isArray(e[o])?void 0!==n[o]&&(i[o]=n[o]):i[o]=t(e[o],n[o]);return i}Object.defineProperty(exports,"__esModule",{value:!0});const e={width:800,height:500,interval:"1D",timezone:"Etc/UTC",container:"",library_path:"",locale:"en",widgetbar:{details:!1,watchlist:!1,news:!1,datawindow:!1,watchlist_settings:{default_symbols:[]}},overrides:{"mainSeriesProperties.showCountdown":!1},studies_overrides:{},trading_customization:{position:{},order:{}},brokerConfig:{configFlags:{}},fullscreen:!1,autosize:!1,disabled_features:[],enabled_features:[],debug:!1,logo:{},time_frames:[{text:"5y",resolution:"1W"},{text:"1y",resolution:"1W"},{text:"6m",resolution:"120"},{text:"3m",resolution:"60"},{text:"1m",resolution:"30"},{text:"5d",resolution:"5"},{text:"1d",resolution:"1"}],client_id:"0",user_id:"0",charts_storage_api_version:"1.0",favorites:{intervals:[],chartTypes:[],indicators:[],drawingTools:[]}},n=JSON.parse('[{"iso":"ar","dir":"rtl","language":"ar"},{"iso":"pt","dir":"ltr","language":"pt"},{"iso":"ca","dir":"ltr","language":"ca_ES"},{"iso":"cs","dir":"ltr","language":"cs"},{"iso":"de","dir":"ltr","language":"de"},{"iso":"en","dir":"ltr","language":"en"},{"iso":"es","dir":"ltr","language":"es"},{"iso":"fa","dir":"rtl","language":"fa"},{"iso":"fr","dir":"ltr","language":"fr"},{"iso":"he","dir":"rtl","language":"he_IL"},{"iso":"hu","dir":"ltr","language":"hu_HU"},{"iso":"id","dir":"ltr","language":"id_ID"},{"iso":"en","dir":"ltr","language":"en"},{"iso":"it","dir":"ltr","language":"it"},{"iso":"ja","dir":"ltr","language":"ja"},{"iso":"ko","dir":"ltr","language":"ko"},{"iso":"ms","dir":"ltr","language":"ms_MY"},{"iso":"pl","dir":"ltr","language":"pl"},{"iso":"ru","dir":"ltr","language":"ru"},{"iso":"sv","dir":"ltr","language":"sv"},{"iso":"th","dir":"ltr","language":"th"},{"iso":"tr","dir":"ltr","language":"tr"},{"iso":"vi","dir":"ltr","language":"vi"},{"iso":"zh-Hans","dir":"ltr","language":"zh"},{"iso":"zh-Hant","dir":"ltr","language":"zh_TW"},{"iso":"el","dir":"ltr","language":"el"},{"iso":"nl","dir":"ltr","language":"nl_NL"},{"iso":"ro","dir":"ltr","language":"ro"}]');let i=!1;function o(){return"CL v27.003 (internal id d1c8c1a5 @ 2024-03-14T16:58:45.558Z)"}const s=class{constructor(n){var o,s;if(this._id=`tradingview_${(1048576*(1+Math.random())|0).toString(16).substring(1)}`,this._ready=!1,this._readyHandlers=[],this._onWindowResize=this._autoResizeChart.bind(this),!n.datafeed)throw new Error("Datafeed is not defined");(null===(o=n.overrides)||void 0===o?void 0:o["mainSeriesProperties.priceAxisProperties.lockScale"])&&(console.warn("mainSeriesProperties.priceAxisProperties.lockScale can not be set to true within the widget constructor"),delete n.overrides["mainSeriesProperties.priceAxisProperties.lockScale"]),this._options=t(e,n);"dark"===(null!==(s=this._options.theme)&&void 0!==s?s:"light").toLowerCase()&&void 0===this._options.loading_screen&&(this._options.loading_screen={backgroundColor:"#131722"}),this._options.debug&&(i||(i=!0,console.log("Using CL v27.003 (internal id d1c8c1a5 @ 2024-03-14T16:58:45.558Z)"))),this._create()}setDebugMode(t){this._innerAPI().setDebugMode(t)}onChartReady(t){this._ready?t.call(this):this._readyHandlers.push(t)}headerReady(){return this._innerWindowLoaded.then((()=>this._innerWindow().headerReady()))}onGrayedObjectClicked(t){this._doWhenInnerApiLoaded((e=>{e.onGrayedObjectClicked(t)}))}onShortcut(t,e){this._doWhenInnerWindowLoaded((n=>{n.createShortcutAction(t,e)}))}subscribe(t,e){this._doWhenInnerApiLoaded((n=>{n.subscribe(t,e)}))}unsubscribe(t,e){this._doWhenInnerApiLoaded((n=>{n.unsubscribe(t,e)}))}chart(t){return this._innerAPI().chart(t)}getLanguage(){return this._options.locale}setSymbol(t,e,n){this._innerAPI().changeSymbol(t,e,n)}remove(){window.removeEventListener("resize",this._onWindowResize),this._readyHandlers.splice(0,this._readyHandlers.length),delete window[this._id],this._iFrame.parentNode&&this._iFrame.parentNode.removeChild(this._iFrame)}closePopupsAndDialogs(){this._doWhenInnerApiLoaded((t=>{t.closePopupsAndDialogs()}))}selectLineTool(t,e){this._innerAPI().selectLineTool(t,e)}selectedLineTool(){return this._innerAPI().selectedLineTool()}save(t,e){this._innerAPI().saveChart(t,e)}load(t,e){this._innerAPI().loadChart({json:t,extendedData:e})}getSavedCharts(t){this._innerAPI().getSavedCharts(t)}loadChartFromServer(t){this._innerAPI().loadChartFromServer(t)}saveChartToServer(t,e,n){this._innerAPI().saveChartToServer(t,e,n)}removeChartFromServer(t,e){this._innerAPI().removeChartFromServer(t,e)}onContextMenu(t){this._doWhenInnerApiLoaded((e=>{e.onContextMenu(t)}))}createButton(t){return this._innerWindow().createButton(t)}createDropdown(t){return this._innerWindow().createDropdown(t)}showNoticeDialog(t){this._doWhenInnerApiLoaded((e=>{e.showNoticeDialog(t)}))}showConfirmDialog(t){this._doWhenInnerApiLoaded((e=>{e.showConfirmDialog(t)}))}showLoadChartDialog(){this._innerAPI().showLoadChartDialog()}showSaveAsChartDialog(){this._innerAPI().showSaveAsChartDialog()}symbolInterval(){return this._innerAPI().getSymbolInterval()}mainSeriesPriceFormatter(){return this._innerAPI().mainSeriesPriceFormatter()}getIntervals(){return this._innerAPI().getIntervals()}getStudiesList(){return this._innerAPI().getStudiesList()}getStudyInputs(t){return this._innerAPI().getStudyInputs(t)}getStudyStyles(t){return this._innerAPI().getStudyStyles(t)}addCustomCSSFile(t){this._innerWindow().addCustomCSSFile(t)}applyOverrides(e){this._options=t(this._options,{overrides:e}),this._doWhenInnerWindowLoaded((t=>{t.applyOverrides(e)}))}applyStudiesOverrides(t){this._doWhenInnerWindowLoaded((e=>{e.applyStudiesOverrides(t)}))}watchList(){return this._innerAPI().watchlist()}news(){return this._innerAPI().news()}widgetbar(){return this._innerAPI().widgetbar()}activeChart(){return this._innerAPI().activeChart()}activeChartIndex(){return this._innerAPI().activeChartIndex()}setActiveChart(t){return this._innerAPI().setActiveChart(t)}chartsCount(){return this._innerAPI().chartsCount()}layout(){return this._innerAPI().layout()}setLayout(t){this._innerAPI().setLayout(t)}layoutName(){return this._innerAPI().layoutName()}resetLayoutSizes(t){this._innerAPI().resetLayoutSizes(t)}changeTheme(t,e){return this._innerWindow().changeTheme(t,e)}getTheme(){return this._innerWindow().getTheme()}takeScreenshot(){this._doWhenInnerApiLoaded((t=>{t.takeScreenshot()}))}lockAllDrawingTools(){return this._innerAPI().lockAllDrawingTools()}hideAllDrawingTools(){return this._innerAPI().hideAllDrawingTools()}drawOnAllChartsEnabled(){return this._innerAPI().drawOnAllChartsEnabled()}drawOnAllCharts(t){this._innerAPI().drawOnAllCharts(t)}magnetEnabled(){return this._innerAPI().magnetEnabled()}magnetMode(){return this._innerAPI().magnetMode()}undoRedoState(){return this._innerAPI().undoRedoState()}setIntervalLinkingEnabled(t){this._innerAPI().setIntervalLinkingEnabled(t)}setDateRangeLinkingEnabled(t){this._innerAPI().setDateRangeLinkingEnabled(t)}setTimeFrame(t){this._innerAPI().setTimeFrame(t)}symbolSync(){return this._innerAPI().symbolSync()}intervalSync(){return this._innerAPI().intervalSync()}crosshairSync(){return this._innerAPI().crosshairSync()}timeSync(){return this._innerAPI().timeSync()}dateRangeSync(){return this._innerAPI().dateRangeSync()}setFeatureEnabled(t,e){this._innerAPI().setFeatureEnabled(t,e)}getAllFeatures(){return this._innerWindow().getAllFeatures()}clearUndoHistory(){return this._innerAPI().clearUndoHistory()}undo(){return this._innerAPI().undo()}redo(){return this._innerAPI().redo()}startFullscreen(){this._innerAPI().startFullscreen()}exitFullscreen(){this._innerAPI().exitFullscreen()}takeClientScreenshot(t){return this._innerAPI().takeClientScreenshot(t)}navigationButtonsVisibility(){return this._innerWindow().getNavigationButtonsVisibility()}paneButtonsVisibility(){return this._innerWindow().getPaneButtonsVisibility()}dateFormat(){return this._innerWindow().getDateFormat()}timeHoursFormat(){return this._innerWindow().getTimeHoursFormat()}currencyAndUnitVisibility(){return this._innerWindow().getCurrencyAndUnitVisibility()}supportedChartTypes(){return this._innerAPI().supportedChartTypes()}watermark(){return this._innerAPI().watermark()}customSymbolStatus(){return this._innerWindow().customSymbolStatus()}setCSSCustomProperty(t,e){if(!1===t.startsWith("--"))throw new Error("customPropertyName should begin with a double hyphen");this._innerWindow().document.body.style.setProperty(t,e)}getCSSCustomPropertyValue(t){if(!1===t.startsWith("--"))throw new Error("customPropertyName should begin with a double hyphen");const e=this._innerWindow().document.body,n=e.style.getPropertyValue(t);if(n)return n;return getComputedStyle(e).getPropertyValue(t)}unloadUnusedCharts(){this._innerAPI().unloadUnusedCharts()}linking(){return this._innerAPI().linking}_innerAPI(){return this._innerWindow().tradingViewApi}_innerWindow(){return this._iFrame.contentWindow}_doWhenInnerWindowLoaded(t){this._ready?t(this._innerWindow()):this._innerWindowLoaded.then((()=>{t(this._innerWindow())}))}_doWhenInnerApiLoaded(t){this._doWhenInnerWindowLoaded((e=>{e.doWhenApiIsReady((()=>t(this._innerAPI())))}))}_autoResizeChart(){this._options.fullscreen&&(this._iFrame.style.height=window.innerHeight+"px",r&&setTimeout((()=>{this._iFrame.style.height=window.innerHeight+"px"}),30))}_create(){var t,e;const n=null!==(e=null===(t=this._options.enabled_features)||void 0===t?void 0:t.includes("iframe_loading_compatibility_mode"))&&void 0!==e&&e,[i,o]=this._render(!n),s=this._options.container,r="string"==typeof s?document.getElementById(s):s;if(null===r)throw new Error(`There is no such element - #${this._options.container}`);r.innerHTML=i,this._iFrame=r.querySelector(`#${this._id}`);const a=this._iFrame;this._innerWindowLoaded=new Promise((t=>{const e=()=>{a.removeEventListener("load",e,!1),t()};a.addEventListener("load",e,!1)})),n&&(a.contentWindow?(a.contentWindow.document.open(),a.contentWindow.document.write(o),a.contentWindow.document.close()):console.warn("Unable to locate contentWindow for the created iframe. Please try disabling the `iframe_loading_compatibility_mode` featureset.")),(this._options.autosize||this._options.fullscreen)&&(a.style.width="100%",this._options.fullscreen||(a.style.height="100%")),window.addEventListener("resize",this._onWindowResize),this._onWindowResize(),this._innerWindowLoaded.then((()=>{try{this._innerWindow().widgetReady((()=>{this._ready=!0;for(const t of this._readyHandlers)try{t.call(this)}catch(t){console.error(t)}this._innerWindow().initializationFinished()}))}catch(t){if(t instanceof Error&&/widgetReady is not a function/.test(t.message))throw new Error(`There was an error when loading the library. Usually this error means the library failed to load its static files. Check that the library files are available at ${window.location.host}/${this._options.library_path||""} or correct the library_path option.`)}}))}_render(t){const e=window;if(e[this._id]={datafeed:this._options.datafeed,customFormatters:this._options.custom_formatters,brokerFactory:this._options.broker_factory,overrides:this._options.overrides,studiesOverrides:this._options.studies_overrides,tradingCustomization:this._options.trading_customization,disabledFeatures:this._options.disabled_features,enabledFeatures:this._options.enabled_features,brokerConfig:this._options.broker_config||this._options.brokerConfig,restConfig:this._options.restConfig,favorites:this._options.favorites,logo:this._options.logo,numeric_formatting:this._options.numeric_formatting,rss_news_feed:this._options.rss_news_feed,rss_news_title:this._options.rss_news_title,newsProvider:this._options.news_provider,loadLastChart:this._options.load_last_chart,saveLoadAdapter:this._options.save_load_adapter,loading_screen:this._options.loading_screen,settingsAdapter:this._options.settings_adapter,getCustomIndicators:this._options.custom_indicators_getter,additionalSymbolInfoFields:this._options.additional_symbol_info_fields,headerWidgetButtonsMode:this._options.header_widget_buttons_mode,customTranslateFunction:this._options.custom_translate_function,symbolSearchComplete:this._options.symbol_search_complete,contextMenu:this._options.context_menu,settingsOverrides:this._options.settings_overrides,timeframe:this._options.timeframe,customTimezones:this._options.custom_timezones,customChartDescriptionFunction:this._options.custom_chart_description_function},this._options.saved_data)e[this._id].chartContent={json:this._options.saved_data},this._options.saved_data_meta_info&&(e[this._id].chartContentExtendedData=this._options.saved_data_meta_info);else if(!this._options.load_last_chart&&!this._options.symbol)throw new Error("Symbol is not defined: either 'symbol' or 'load_last_chart' option must be set");if(this._options.library_path&&!this._options.library_path.endsWith("/")&&console.warn("library_path option should contain a trailing forward slash"),this._options.locale){const t=encodeURIComponent(this._options.locale);n.findIndex((e=>e.language===t))>=0||(console.warn("locale isn't supported. Using default of `en`."),this._options.locale="en")}const i=function(t,e){var i;const o=new URL(`${t||""}`,location.href).href,s=JSON.parse('["bundles/runtime.13083b9d6b700c731a94.js","bundles/__LANG__.4716.e4ac74dfc9ec5374b00c.js","bundles/6150.bda60280b05cea478076.css","bundles/5142.2c34c8656148cc5203b7.js","bundles/library.73b161994e130a790de4.js"]'),r=encodeURIComponent(e),a=null!==(i=n.find((t=>t.language===r)))&&void 0!==i?i:{iso:"en",dir:"ltr"},d=`lang="${a.iso}" dir="${a.dir}"`,l=`\n${function(t,e,n){if(void 0===t)return"";const i=[],o=[];for(const s of t)s.endsWith(".js")?i.push(`