From a1585eb225ea4d5f82dd2ce815b3467af2f8d7f9 Mon Sep 17 00:00:00 2001 From: jenkins Date: Fri, 2 Feb 2024 14:52:43 +0000 Subject: [PATCH] Release v27.001 (from 3eb6c0e5) --- changelog.md | 22 + ...438c6f.js => 4648.af8e7c4b04b18b9156b0.js} | 2 +- ...28fb40.js => 7051.cff4509091dbd0706ebe.js} | 6 +- ...floating-toolbars.96ac7a46b7738535bc92.js} | 16 +- ...291.js => library.97ddeff81f861d17f06e.js} | 447 +++++++++--------- ...80b.js => runtime.b283dc97286bf865cf08.js} | 12 +- ...y-template-dialog.45bca887c7f2c0d84601.js} | 4 +- charting_library/charting_library.cjs.js | 2 +- charting_library/charting_library.d.ts | 34 +- charting_library/charting_library.esm.js | 2 +- charting_library/charting_library.js | 2 +- .../charting_library.standalone.js | 2 +- charting_library/datafeed-api.d.ts | 7 +- charting_library/package.json | 2 +- datafeeds/udf/dist/bundle.js | 2 +- datafeeds/udf/lib/symbols-storage.js | 3 +- .../udf/lib/udf-compatible-datafeed-base.js | 41 +- datafeeds/udf/src/symbols-storage.ts | 3 +- .../udf/src/udf-compatible-datafeed-base.ts | 3 +- package.json | 2 +- 20 files changed, 315 insertions(+), 299 deletions(-) rename charting_library/bundles/{4648.7172f75bb866b3438c6f.js => 4648.af8e7c4b04b18b9156b0.js} (99%) rename charting_library/bundles/{7051.ba50ecafb4527628fb40.js => 7051.cff4509091dbd0706ebe.js} (99%) rename charting_library/bundles/{floating-toolbars.d32b5098422df02a6688.js => floating-toolbars.96ac7a46b7738535bc92.js} (85%) rename charting_library/bundles/{library.b0e1bc71bddeb9026291.js => library.97ddeff81f861d17f06e.js} (77%) rename charting_library/bundles/{runtime.fb41253a64dfb129780b.js => runtime.b283dc97286bf865cf08.js} (84%) rename charting_library/bundles/{study-template-dialog.711ba6ae5b343ace8691.js => study-template-dialog.45bca887c7f2c0d84601.js} (99%) diff --git a/changelog.md b/changelog.md index c9772f03..3337c708 100644 --- a/changelog.md +++ b/changelog.md @@ -4,6 +4,26 @@ + +## Version 27.001 + +*Date: Fri Feb 2 2024* + +**Improvements** + +- **Custom indicators can now dynamically hide indicator inputs in the legend when plots are hidden.** The `hideWhenPlotsHidden` option has been added for a custom indicator's input. It enables you to hide an input's value in the legend text when the user hides all of the specified plots. + +**Bug Fixes** + +- **Allow studies that extend the time scale to load historic bars before the leftmost bar of the main series.** + +**Documentation** + +- **New articles** + - [Context menu](https://www.tradingview.com/charting-library-docs/latest/ui_elements/context-menu) + - [Orders](https://www.tradingview.com/charting-library-docs/latest/trading_terminal/trading-concepts/orders) + - [Snapshots](https://www.tradingview.com/charting-library-docs/latest/ui_elements/Snapshots) + ## Version 27 *Date: Wed Jan 17 2024* @@ -45,6 +65,7 @@ To open this dialog, users should click the _Quick Search_ button on the top too - **Added ability to show daily change in the chart legend.** New _Last day change values_ option allows users to show/hide the last day change values in the main series legend. To make this option available in the _Chart Settings_ dialog, use the [`legend_last_day_change`](https://www.tradingview.com/charting-library-docs/latest/customization/Featuresets#legend_last_day_change) featureset. [#8193](https://github.com/tradingview/charting_library/issues/8193) - **Updated drawing icons.** New icons for the _Text_, _Anchored Text_, _Note_, and _Anchored Note_ drawings. [#8181](https://github.com/tradingview/charting_library/issues/8181) +- **Drawings can now be saved separately to the chart layout**. See [Saving Drawings Separately](https://www.tradingview.com/charting-library-docs/latest/saving_loading/saving_drawings_separately) for more details. **Improvements** @@ -110,6 +131,7 @@ and [`broker_factory`](https://www.tradingview.com/charting-library-docs/latest/ - **The price source text is visible in the screenshot.** - **Fix display of price sources in Overlay study.** Price sources for symbols in the Overlay study were not being shown when the main series symbol did not have the same price source - **Both Trend Strength Index and Linear Regression Slope indicators were missing their zero-based property to properly plot them using a histogram.** +- **onChartReady inconsistency on Safari.** Fixed an issue where `onChartReady` wouldn't reliably get called on specific versions of Safari. **Documentation** diff --git a/charting_library/bundles/4648.7172f75bb866b3438c6f.js b/charting_library/bundles/4648.af8e7c4b04b18b9156b0.js similarity index 99% rename from charting_library/bundles/4648.7172f75bb866b3438c6f.js rename to charting_library/bundles/4648.af8e7c4b04b18b9156b0.js index 16477e78..3cf8441b 100644 --- a/charting_library/bundles/4648.7172f75bb866b3438c6f.js +++ b/charting_library/bundles/4648.af8e7c4b04b18b9156b0.js @@ -13,7 +13,7 @@ const{definition:{id:t,properties:{checked:n,option:i,disabled:r,visible:s},titl className:Ze.rangePointerWrap},o.createElement("div",{className:c(Ze.pointer,s&&Ze.dragged),style:{[h]:100*p+"%"}}))))}_dragSubscribe(){const e=(0,g.ensureNotNull)(this._container).ownerDocument;e&&(e.addEventListener("mouseup",this._mouseUp),e.addEventListener("mousemove",this._mouseMove))}_dragUnsubscribe(){const e=(0,g.ensureNotNull)(this._container).ownerDocument;e&&(e.removeEventListener("mousemove",this._mouseMove),e.removeEventListener("mouseup",this._mouseUp))}_getNewPosition(e){const{min:t,max:n}=this.props,o=n-t,i=(0,g.ensureNotNull)(this._container),r=(0,g.ensureNotNull)(this._pointer),a=i.getBoundingClientRect(),l=r.offsetWidth;let s=e.clientX-l/2-a.left;return(0,$e.isRtl)()&&(s=a.width-s-l),(0,D.clamp)(s/(a.width-l),0,1)*o+t}_detectPointerMode(e){const{from:t,to:n}=this.props,{pointerDragMode:o}=this.state;if(0!==o)return o;const i=this._getNewPosition(e),r=Math.abs(t-i),a=Math.abs(n-i),l=r===a?io.createElement(K,{breakPoint:"Medium"},o.createElement(o.Fragment,null,o.createElement("span",{className:qe.valueInput},o.createElement(S,{className:qe.input,sharedBuffer:T,min:E,max:v(I)?D:I,step:1,disabled:L,name:"from-input",mode:"integer",defaultValue:E}),e?o.createElement("span",{className:qe.rangeSlider},"—"):o.createElement(je,{className:d()(qe.rangeSlider,A&&qe.rangeSlider_mixed),from:A?E:V,to:A?D:I,min:E,max:D,onChange:z,onCommit:W,disabled:L}))),o.createElement(o.Fragment,null,o.createElement("span",{className:qe.valueInput},o.createElement(S,{className:qe.input,sharedBuffer:M,min:v(V)?E:V,max:D,step:1,disabled:L,name:"to-input",mode:"integer",defaultValue:D}),u&&!1)))))}()));function z(e,t){N(Math.round(e)),B(Math.round(t))}function W(){R.flushed||(k(),F(),R.flushed=!0)}}var et=n(86067),tt=n(53424),nt=n(54970);function ot(e){const{definitions:t,name:n,offset:i}=e,r=d()(nt.cell,nt.fragmentCell,t.some((e=>void 0!==e.solutionId))&&nt.largeWidth) ;return o.createElement(Ve.PropertyTable.Row,null,o.createElement(Ve.PropertyTable.Cell,{className:r,offset:i,placement:"first",verticalAlign:"adaptive",colSpan:2,"data-section-name":n,checkableTitle:!0},t.map((e=>o.createElement("div",{className:nt.item,key:e.id,"data-section-name":e.id},o.createElement(rt,{definition:e}))))))}function it(e){const{definition:t,offset:n}=e;return o.createElement(Ve.PropertyTable.Row,null,o.createElement(Ve.PropertyTable.Cell,{className:nt.cell,offset:n,placement:"first",verticalAlign:"adaptive",colSpan:2,checkableTitle:!0},o.createElement(rt,{definition:t})))}function rt(e){const{definition:{id:t,properties:{disabled:n,checked:i,color:r,level:l,width:s,style:c},solutionId:p,title:m,widthValues:f,styleValues:g}}=e,[v]=(0,a.useDefinitionProperty)({property:i,defaultValue:!0}),[y]=(0,a.useDefinitionProperty)({property:n,defaultValue:!1}),b=y||!v;return o.createElement(o.Fragment,null,o.createElement(tt.CheckableTitle,{name:`is-enabled-${t}`,className:d()(m&&nt.withTitle),title:m&&o.createElement("span",{className:nt.title},m),property:i,disabled:y}),l&&o.createElement(C,{className:d()(nt.input,nt.control),property:l,disabled:b}),r&&o.createElement(R,{className:nt.control,disabled:b,color:r,thickness:s,thicknessItems:f}),c&&o.createElement(h,{id:(0,u.createDomId)(t,"leveled-line-style-select"),className:nt.control,property:c,disabled:b,allowedLineStyles:g}),p&&!1)}var at=n(27394);function lt(e){const{definition:{id:t,properties:{option1:n,option2:i,checked:r,disabled:s},title:c,solutionId:d,optionsItems1:p,optionsItems2:h},offset:m}=e,[f]=(0,a.useDefinitionProperty)({property:r,defaultValue:!0}),[g]=(0,a.useDefinitionProperty)({property:s,defaultValue:!1}),v=e.disabled||!f;return o.createElement(l.CommonSection,{id:t,offset:m,checked:r,title:c,solutionId:d,disabled:e.disabled||g},o.createElement(K,{className:at.twoOptions},o.createElement(re,{id:(0,u.createDomId)(t,"two-options-dropdown-1"),"data-name":"two-options-dropdown-1",className:at.dropdown,menuClassName:at.menu,property:n,disabled:v,options:p}),o.createElement(re,{id:(0,u.createDomId)(t,"two-options-dropdown-2"),"data-name":"two-options-dropdown-2",className:at.dropdown,menuClassName:at.menu,property:i,disabled:v,options:h})))}var st=n(22332);function ct(e){const{definition:{id:t,properties:{color1:n,color2:i,option:r},options:a,color1Visible:s,color2Visible:c,title:p,noAlpha1:h,noAlpha2:m,solutionId:f},offset:g}=e,v=(0,Q.useWatchedValueReadonly)({watchedValue:s,defaultValue:!1}),y=(0,Q.useWatchedValueReadonly)({watchedValue:c,defaultValue:!1}),b=(0,o.useContext)(ye.ControlCustomWidthContext);return o.createElement(l.CommonSection,{id:t,offset:g,solutionId:f,title:p},o.createElement(Z.CellWrap,{className:st.optionalTwoColors},o.createElement(K,null,o.createElement(re,{id:(0,u.createDomId)(t,"options-dropdown"),"data-name":"options-dropdown",className:d()(st.dropdown,b[t]&&st[b[t]]),menuClassName:d()(st.dropdownMenu,b[t]&&st[b[t]]),property:r,options:a}),o.createElement(o.Fragment,null,v&&E(n,h),y&&E(i,m)))));function E(e,t){ return o.createElement("span",{className:st.colorPicker},o.createElement(R,{color:e,noAlpha:t}))}}var dt=n(39828),ut=n(22497);function pt(e){const{source:t,inputs:n,model:i,inputsTabProperty:r,studyMetaInfo:a}=e.definition;return o.createElement(dt.InputsTabContent,{className:ut.withoutPadding,property:r,model:i,study:t,studyMetaInfo:a,inputs:n})}var ht=n(56840),mt=n(38297),ft=n(83682),gt=n(173);var vt=n(20520),yt=n(37558),bt=n(41590),Et=n(27317),Dt=n(40173);function _t(e){!function(e,t){(0,o.useEffect)((()=>{const n=t||document;return n.addEventListener("scroll",e),()=>n.removeEventListener("scroll",e)}),[e])}(e,document)}var wt=n(12811),Ct=n(24437),St=n(38446);function xt(e){const{children:t,highlight:n,disabled:i,reference:r,...a}=e,l=n?"primary":"default";return o.createElement("div",{...a,ref:r,className:d()(St.wrapper,St[`intent-${l}`],St["border-thin"],St["size-medium"],n&&St.highlight,n&&St.focused,i&&St.disabled),"data-role":"button"},o.createElement("div",{className:d()(St.childrenContainer,i&&St.disabled)},t),n&&o.createElement("span",{className:St.shadow}))}var Pt=n(64104);const Tt=()=>null,Vt=(0,Dt.mergeThemes)(Et.DEFAULT_MENU_THEME,{menuBox:Pt.menuBox});function Nt(e){const{value:t,disabled:n,onSelect:i}=e,r=(0,o.useRef)(null),{current:a}=(0,o.useRef)(ht.getJSON("RecentlyUsedEmojis",[t])),[l,s]=(0,o.useState)(a),[c,d]=(0,o.useState)(!1),u=(0,o.useCallback)((()=>d(!1)),[]);_t(u);const p=(0,o.useCallback)((e=>{const t=Array.from(new Set([e,...l])).slice(0,18);ht.setJSON("RecentlyUsedEmojis",t),s(t),i(e),u()}),[l,i]),h=(m=l,(0,o.useMemo)((()=>(gt.emojiGroups[0].emojis=m,[...gt.emojiGroups])),[m]));var m;return o.createElement(o.Fragment,null,o.createElement(xt,{reference:r,highlight:c,disabled:n,"data-name":"emoji-picker"},o.createElement(ft.EmojiWrap,{emoji:t,onClick:function(){n||d(!0)}})),o.createElement(Ke.MatchMedia,{rule:Ct.DialogBreakpoints.TabletSmall},(e=>c&&o.createElement(yt.DrawerManager,null,e?o.createElement(bt.Drawer,{className:Pt.drawer,position:"Bottom",onClose:u},o.createElement(mt.EmojiList,{emojis:h,onSelect:p,height:378})):o.createElement(vt.PopupMenu,{theme:Vt,isOpened:!0,position:(0,wt.getPopupPositioner)(r.current,{horizontalDropDirection:wt.HorizontalDropDirection.FromLeftToRight,horizontalAttachEdge:wt.HorizontalAttachEdge.Left}),onClickOutside:u,onClose:Tt},o.createElement(mt.EmojiList,{className:Pt.desktopSize,emojis:h,onSelect:p,height:378}))))))}var kt=n(35199);function Mt(e){const{definition:{id:t,title:n,properties:i,solutionId:r},offset:s}=e,{checked:c,emoji:d,backgroundColor:u}=i,[p]=(0,a.useDefinitionProperty)({property:c,defaultValue:!1}),[h,m]=(0,a.useDefinitionProperty)({property:d,defaultValue:"🙂"}),[f,g]=(0,a.useDefinitionProperty)({property:u,defaultValue:ue.colorsPalette["color-tv-blue-a600"]}),[v]=(0,a.useDefinitionProperty)({property:i.disabled,defaultValue:!1}),y=e.disabled||!p;return o.createElement(l.CommonSection,{id:t,offset:s,checked:c,title:n,solutionId:r,disabled:e.disabled||v},o.createElement(Nt,{value:h,disabled:y,onSelect:m -}),o.createElement(A.ColorSelect,{className:kt.colorSelect,disabled:y,color:function(){if("mixed"===f)return f;return(0,F.rgbToHexString)((0,F.parseRgb)(f))}(),opacity:f&&"mixed"!==f?(0,F.parseRgba)(f)[3]:void 0,onColorChange:function(e){const t=f&&"mixed"!==f?(0,L.alphaToTransparency)((0,F.parseRgba)(f)[3]):0;g((0,L.generateColor)(String(e),t,!0))},onOpacityChange:function(e){g((0,L.generateColor)(f,(0,L.alphaToTransparency)(e),!0))}}))}function It(e){const{definition:{id:t,properties:{disabled:n,visible:i},childrenDefinitions:r,title:s},offset:c}=e,[d]=(0,a.useDefinitionProperty)({property:n,defaultValue:!1}),[u]=(0,a.useDefinitionProperty)({property:i,defaultValue:!0}),p=e.disabled;return u?o.createElement(o.Fragment,null,s&&o.createElement(l.CommonSection,{id:t,offset:c,title:s,disabled:e.disabled||d}),r.map((e=>o.createElement(tn,{key:e.id,disabled:p,definition:e,offset:Boolean(s)})))):null}var Bt=n(38528),Ft=n(36104),At=n(3343),Lt=n(26597),Rt=n(59054),zt=n(50238),Wt=n(16838),Gt=n(16396),Ht=n(15294),Ot=n(54583);function Ut(e){const{isDisabled:t,hint:n,label:i,isChecked:r,checkboxClassName:a,labelClassName:l,indeterminate:s,isActive:d,checkboxTabIndex:u,checkboxReference:p,checkboxDataRole:h,...m}=e;return o.createElement(Gt.PopupMenuItem,{...m,isDisabled:t,shortcut:n,dontClosePopup:!0,labelRowClassName:l,label:o.createElement(Ht.Checkbox,{reference:p,disabled:t,label:i,checked:r,indeterminate:s,className:c(Ot.checkbox,a),tabIndex:u,"data-role":h})})}var Jt=n(81091);function Yt(e){const[t,n]=(0,zt.useRovingTabindexElement)(null);return o.createElement(Ut,{...e,className:Jt.item,checkboxClassName:Jt.checkbox,checkboxReference:t,checkboxTabIndex:n,checkboxDataRole:Wt.PLATFORM_ACCESSIBILITY_ENABLED?"menuitem":void 0,onKeyDown:function(e){if(!Wt.PLATFORM_ACCESSIBILITY_ENABLED)return;const n=(0,At.hashFromEvent)(e);13!==n&&32!==n||(e.preventDefault(),t.current instanceof HTMLElement&&t.current.click())},"aria-disabled":Wt.PLATFORM_ACCESSIBILITY_ENABLED&&e.isDisabled||void 0})}var Xt=n(81261),$t=n(58516);function Zt(e){return!e.readonly&&!e.disabled}function jt(e){const{selectedItems:t,placeholder:n}=e;if(!t.length)return o.createElement("span",null,n);const i=t.map((e=>{var t,n,o;return null!==(n=null!==(t=e.selectedContent)&&void 0!==t?t:e.content)&&void 0!==n?n:null===(o=e.value)||void 0===o?void 0:o.toString()})).reduce(((e,t,n)=>t?(e.push(o.createElement("span",{key:n,className:$t.contentPart},t)),e.push(o.createElement("span",{key:`separator_${n}`},","," ")),e):e),[]);return i.length&&i.splice(-1),o.createElement("span",{className:$t.btnContent},i)}function Kt(e,t){ +}),o.createElement(A.ColorSelect,{className:kt.colorSelect,disabled:y,color:function(){if("mixed"===f)return f;return(0,F.rgbToHexString)((0,F.parseRgb)(f))}(),opacity:f&&"mixed"!==f?(0,F.parseRgba)(f)[3]:void 0,onColorChange:function(e){const t=f&&"mixed"!==f?(0,L.alphaToTransparency)((0,F.parseRgba)(f)[3]):0;g((0,L.generateColor)(String(e),t,!0))},onOpacityChange:function(e){g((0,L.generateColor)(f,(0,L.alphaToTransparency)(e),!0))}}))}function It(e){const{definition:{id:t,properties:{disabled:n,visible:i},childrenDefinitions:r,title:s},offset:c}=e,[d]=(0,a.useDefinitionProperty)({property:n,defaultValue:!1}),[u]=(0,a.useDefinitionProperty)({property:i,defaultValue:!0}),p=e.disabled;return u?o.createElement(o.Fragment,null,s&&o.createElement(l.CommonSection,{id:t,offset:c,title:s,disabled:e.disabled||d}),r.map((e=>o.createElement(tn,{key:e.id,disabled:p,definition:e,offset:Boolean(s)})))):null}var Bt=n(38528),Ft=n(36104),At=n(3343),Lt=n(26597),Rt=n(59054),zt=n(50238),Wt=n(16838),Gt=n(16396),Ht=n(32389),Ot=n(54583);function Ut(e){const{isDisabled:t,hint:n,label:i,isChecked:r,checkboxClassName:a,labelClassName:l,indeterminate:s,isActive:d,checkboxTabIndex:u,checkboxReference:p,checkboxDataRole:h,...m}=e;return o.createElement(Gt.PopupMenuItem,{...m,isDisabled:t,shortcut:n,dontClosePopup:!0,labelRowClassName:l,label:o.createElement(Ht.Checkbox,{reference:p,disabled:t,label:i,checked:r,indeterminate:s,className:c(Ot.checkbox,a),tabIndex:u,"data-role":h})})}var Jt=n(81091);function Yt(e){const[t,n]=(0,zt.useRovingTabindexElement)(null);return o.createElement(Ut,{...e,className:Jt.item,checkboxClassName:Jt.checkbox,checkboxReference:t,checkboxTabIndex:n,checkboxDataRole:Wt.PLATFORM_ACCESSIBILITY_ENABLED?"menuitem":void 0,onKeyDown:function(e){if(!Wt.PLATFORM_ACCESSIBILITY_ENABLED)return;const n=(0,At.hashFromEvent)(e);13!==n&&32!==n||(e.preventDefault(),t.current instanceof HTMLElement&&t.current.click())},"aria-disabled":Wt.PLATFORM_ACCESSIBILITY_ENABLED&&e.isDisabled||void 0})}var Xt=n(81261),$t=n(58516);function Zt(e){return!e.readonly&&!e.disabled}function jt(e){const{selectedItems:t,placeholder:n}=e;if(!t.length)return o.createElement("span",null,n);const i=t.map((e=>{var t,n,o;return null!==(n=null!==(t=e.selectedContent)&&void 0!==t?t:e.content)&&void 0!==n?n:null===(o=e.value)||void 0===o?void 0:o.toString()})).reduce(((e,t,n)=>t?(e.push(o.createElement("span",{key:n,className:$t.contentPart},t)),e.push(o.createElement("span",{key:`separator_${n}`},","," ")),e):e),[]);return i.length&&i.splice(-1),o.createElement("span",{className:$t.btnContent},i)}function Kt(e,t){ const{id:n,items:i,menuClassName:r,menuItemClassName:a,tabIndex:l,disabled:s,highlight:c,intent:d,hideArrowButton:p,placeholder:h,value:m,"aria-labelledby":f,onFocus:g,onBlur:v,onClick:y,onChange:b,onKeyDown:E,openMenuOnEnter:D=!0,"aria-describedby":_,"aria-invalid":w,...C}=e,{listboxId:S,isOpened:x,isFocused:P,buttonTabIndex:T,highlight:V,intent:N,open:k,onOpen:M,close:I,toggle:B,buttonFocusBindings:F,onButtonClick:A,buttonRef:L,listboxRef:R,listboxTabIndex:z,buttonAria:W}=(0,Ft.useControlDisclosure)({id:n,disabled:s,buttonTabIndex:l,intent:d,highlight:c,onFocus:g,onBlur:v,onClick:y}),G=i.filter(Zt).filter((e=>m.some((t=>e.value===t)))),H=(0,u.joinDomIds)(f,n),O=H.length>0?H:void 0,U=(0,o.useMemo)((()=>({role:"listbox","aria-labelledby":f})),[f]),J=(0,Lt.useKeyboardToggle)(B,x||D),Y=(0,Lt.useKeyboardOpen)(x,k),X=(0,Lt.useKeyboardEventHandler)([J,Y]),$=(0,Bt.useMergedRefs)([L,t]);return o.createElement(Rt.ControlDisclosureView,{...C,...W,...F,id:n,role:"button",tabIndex:T,"aria-owns":W["aria-controls"],"aria-haspopup":"listbox","aria-labelledby":O,disabled:s,hideArrowButton:p,isFocused:P,isOpened:x,highlight:V,intent:N,ref:$,onClick:A,onClose:I,onKeyDown:X,onOpen:M,listboxTabIndex:z,listboxId:S,listboxClassName:r,listboxAria:U,"aria-describedby":_,"aria-invalid":w,listboxReference:R,onListboxKeyDown:function(e){switch((0,At.hashFromEvent)(e)){case 27:case 9:return void(x&&(e.preventDefault(),I()))}(0,Xt.handleAccessibleMenuKeyDown)(e)},onListboxFocus:e=>(0,Xt.handleAccessibleMenuFocus)(e,L),buttonChildren:o.createElement(jt,{selectedItems:null!=G?G:null,placeholder:h})},i.map(((e,t)=>{var i,r,l;if(e.readonly)return o.createElement(o.Fragment,{key:`readonly_item_${t}`},e.content);const s=function(e,t){var n;return null!==(n=null==t?void 0:t.id)&&void 0!==n?n:(0,u.createDomId)(e,"item",null==t?void 0:t.value)}(n,e);return o.createElement(Yt,{key:s,id:s,className:a,"aria-selected":m===e.value,isChecked:m.includes(e.value),label:null!==(l=null!==(i=e.content)&&void 0!==i?i:null===(r=e.value)||void 0===r?void 0:r.toString())&&void 0!==l?l:"",onClick:()=>function(e){const t=new Set(m);t.has(e)?t.delete(e):t.add(e);b(Array.from(t))}(e.value),isDisabled:e.disabled})})))}Kt.displayName="Multiselect";const qt=o.forwardRef(Kt);var Qt=n(85357);function en(e){const{definition:t}=e,{checkableListOptions:r,definitions:a}=t,[l,s]=(0,o.useState)(p());(0,o.useEffect)((()=>{const e={},t=()=>{const e=p();s(e)};return t(),r.forEach((n=>{var o;n.properties.checked&&(null===(o=n.properties.checked)||void 0===o||o.subscribe(e,t))})),()=>{r.forEach((n=>{var o;n.properties.checked&&(null===(o=n.properties.checked)||void 0===o||o.unsubscribe(e,t))}))}}),[t]);const c=[],d=[],u=[];return a.value().forEach((e=>{(0,i.isPropertyDefinition)(e)&&((0,i.isColorDefinition)(e)?c.push(e):(0,i.isLineDefinition)(e)?d.push(e):(0,i.isOptionsDefinition)(e)&&u.push(e))})),o.createElement(o.Fragment,null,o.createElement(Ve.PropertyTable.Row,null,o.createElement(Ve.PropertyTable.Cell,{verticalAlign:"topCenter",placement:"first" },t.title),o.createElement(Ve.PropertyTable.Cell,{placement:"last"},o.createElement("div",{className:Qt.wrap},o.createElement(qt,{className:Qt.select,placeholder:z.t(null,void 0,n(45044)),onChange:function(e){const t=new Set(e);r.forEach((e=>{var n,o;!t.has(e.id)||(null===(n=e.properties.checked)||void 0===n?void 0:n.value())?!t.has(e.id)&&(null===(o=e.properties.checked)||void 0===o?void 0:o.value())&&e.properties.checked.setValue(!1):(0,g.ensureDefined)(e.properties.checked).setValue(!0)}))},value:l,matchButtonAndListboxWidths:!0,items:r.map((e=>({id:e.id,content:(0,g.ensureDefined)(e.title),value:e.id})))}),c.length||d.length?o.createElement("div",{className:Qt.colorsWrap},d.map((e=>o.createElement(R,{key:e.id,color:(0,g.ensureDefined)(e.properties.color),thickness:e.properties.width,thicknessItems:e.widthValues}))),c.map((e=>o.createElement(R,{key:e.id,color:e.properties.color})))):null))),u.map((e=>o.createElement(Ve.PropertyTable.Row,{key:e.id},o.createElement(Ve.PropertyTable.Cell,{placement:"first"}),o.createElement(Ve.PropertyTable.Cell,{placement:"last"},o.createElement(re,{className:Qt.select,property:e.properties.option,options:e.options}))))));function p(){return r.filter((e=>{var t;return(0,g.ensureDefined)(null===(t=e.properties)||void 0===t?void 0:t.checked).value()})).map((e=>e.id))}}function tn(e){const{definition:t,offset:n,disabled:a}=e;if(function(e){(0,o.useEffect)((()=>{if(void 0===e)return;const t={...e.properties};return Object.entries(t).forEach((([n,o])=>{void 0!==o&&o.subscribe(t,(()=>Xe.logger.logNormal(`Property "${n}" in definition "${e.id}" was updated to value "${o.value()}"`)))})),()=>{Object.entries(t).forEach((([,e])=>{null==e||e.unsubscribeAll(t)}))}}),[e])}((0,i.isPropertyDefinitionsGroup)(t)?void 0:t),(0,i.isPropertyDefinitionsGroup)(t))return o.createElement(nn,{definition:t,offset:n,disabled:a});switch(t.propType){case"line":return o.createElement(te,{...e,definition:t});case"checkable":return o.createElement(s,{...e,definition:t});case"color":return o.createElement(ce,{...e,definition:t});case"transparency":return o.createElement(fe,{...e,definition:t});case"twoColors":return o.createElement(ve,{...e,definition:t});case"optionalTwoColors":return o.createElement(ct,{...e,definition:t});case"fourColors":case"soundSelect":case"image":default:return null;case"number":return o.createElement(Ee,{...e,definition:t});case"symbol":return o.createElement(r.SymbolInputsButton,{...e,definition:t});case"text":return o.createElement(Le,{...e,definition:t});case"checkableSet":return o.createElement(De,{...e,definition:t});case"set":return o.createElement(It,{...e,definition:t});case"options":return o.createElement(Ye,{...e,definition:t});case"range":return o.createElement(Qe,{...e,definition:t});case"coordinates":case"selectionCoordinates":return o.createElement(He,{...e,definition:t});case"twoOptions":return o.createElement(lt,{...e,definition:t});case"leveledLine":return o.createElement(it,{...e,definition:t});case"emoji":return o.createElement(Mt,{...e,definition:t});case"studyInputs": return o.createElement(pt,{...e,definition:t})}}function nn(e){const{definition:t}=e,n=(0,Q.useWatchedValueReadonly)({watchedValue:t.definitions});return(0,Q.useWatchedValueReadonly)({watchedValue:t.visible,defaultValue:!0})?(0,i.isCheckableListOptionsDefinition)(t)?o.createElement(en,{definition:t}):o.createElement(o.Fragment,null,t.title&&o.createElement(et.GroupTitleSection,{title:t.title,name:t.id}),n&&function(e){const t=[];return e.reduce(((e,t)=>{if((0,i.isPropertyDefinitionsGroup)(t)||"leveledLine"!==t.propType)e.push(t);else{const n=e[e.length-1];Array.isArray(n)?n.push(t):e.push([t])}return e}),t)}(n).map((n=>Array.isArray(n)?o.createElement(ot,{key:n[0].id,name:t.id,definitions:n}):o.createElement(tn,{key:n.id,...e,definition:n}))),"general"===t.groupType&&o.createElement(Ve.PropertyTable.GroupSeparator,{size:1})):null}},95711:(e,t,n)=>{"use strict";n.d(t,{PopupContext:()=>o});const o=n(50959).createContext(null)},16181:(e,t,n)=>{"use strict";n.d(t,{PopupDialog:()=>x});var o=n(50959),i=n(97754),r=n(50151),a=n(99663),l=n(67961),s=n(90186),c=n(5734);class d extends o.PureComponent{constructor(){super(...arguments),this._manager=new l.OverlapManager,this._handleSlot=e=>{this._manager.setContainer(e)}}render(){const{rounded:e=!0,shadowed:t=!0,fullscreen:n=!1,darker:r=!1,className:l,backdrop:d,containerTabIndex:u=-1}=this.props,p=i(l,c.dialog,e&&c.rounded,t&&c.shadowed,n&&c.fullscreen,r&&c.darker),h=(0,s.filterDataProps)(this.props),m=this.props.style?{...this._createStyles(),...this.props.style}:this._createStyles();return o.createElement(o.Fragment,null,o.createElement(a.SlotContext.Provider,{value:this._manager},d&&o.createElement("div",{onClick:this.props.onClickBackdrop,className:c.backdrop}),o.createElement("div",{...h,className:p,style:m,ref:this.props.reference,onFocus:this.props.onFocus,onMouseDown:this.props.onMouseDown,onMouseUp:this.props.onMouseUp,onClick:this.props.onClick,onKeyDown:this.props.onKeyDown,tabIndex:u,"aria-label":this.props.containerAriaLabel},this.props.children)),o.createElement(a.Slot,{reference:this._handleSlot}))}_createStyles(){const{bottom:e,left:t,width:n,right:o,top:i,zIndex:r,height:a}=this.props;return{bottom:e,left:t,right:o,top:i,zIndex:r,maxWidth:n,height:a}}}var u=n(86431),p=n(52778),h=n(37160);function m(e,t,n,o){return e+t>o&&(e=o-t),e{if(0!==e.button||this._isTargetNoDraggable(e))return;e.preventDefault(),document.addEventListener("mousemove",this._onMouseDragMove),document.addEventListener("mouseup",this._onMouseDragEnd);const t=f(g(e));this._dragStart(t)},this._onTouchDragStart=e=>{if(this._isTargetNoDraggable(e))return;this._canBeTouchClick=!0,e.preventDefault(), diff --git a/charting_library/bundles/7051.ba50ecafb4527628fb40.js b/charting_library/bundles/7051.cff4509091dbd0706ebe.js similarity index 99% rename from charting_library/bundles/7051.ba50ecafb4527628fb40.js rename to charting_library/bundles/7051.cff4509091dbd0706ebe.js index 5c54800c..2ac7840a 100644 --- a/charting_library/bundles/7051.ba50ecafb4527628fb40.js +++ b/charting_library/bundles/7051.cff4509091dbd0706ebe.js @@ -2,7 +2,7 @@ dropped:"dropped-PYEOTd6i"}},45350:e=>{e.exports={"nav-button":"nav-button-znwuaSC1",link:"link-znwuaSC1",background:"background-znwuaSC1",icon:"icon-znwuaSC1","flip-icon":"flip-icon-znwuaSC1","size-large":"size-large-znwuaSC1","preserve-paddings":"preserve-paddings-znwuaSC1","size-medium":"size-medium-znwuaSC1","size-small":"size-small-znwuaSC1","size-xsmall":"size-xsmall-znwuaSC1","size-xxsmall":"size-xxsmall-znwuaSC1","visually-hidden":"visually-hidden-znwuaSC1"}},70048:e=>{e.exports={wrapper:"wrapper-GZajBGIm",input:"input-GZajBGIm",box:"box-GZajBGIm",icon:"icon-GZajBGIm",noOutline:"noOutline-GZajBGIm","intent-danger":"intent-danger-GZajBGIm",check:"check-GZajBGIm",dot:"dot-GZajBGIm"}},69789:e=>{e.exports={checkbox:"checkbox-vyj6oJxw",reverse:"reverse-vyj6oJxw",label:"label-vyj6oJxw",baseline:"baseline-vyj6oJxw"}},22623:e=>{e.exports={"textarea-container":"textarea-container-x5KHDULU","change-highlight":"change-highlight-x5KHDULU",focused:"focused-x5KHDULU","resize-vertical":"resize-vertical-x5KHDULU","resize-horizontal":"resize-horizontal-x5KHDULU","resize-both":"resize-both-x5KHDULU",textarea:"textarea-x5KHDULU","with-icon":"with-icon-x5KHDULU",endslot:"endslot-x5KHDULU"}},78370:e=>{e.exports={"intent-default":"intent-default-EZuD3gZZ","intent-danger":"intent-danger-EZuD3gZZ","intent-warning":"intent-warning-EZuD3gZZ","intent-success":"intent-success-EZuD3gZZ","icon-wrapper-size-small":"icon-wrapper-size-small-EZuD3gZZ","icon-wrapper-size-medium":"icon-wrapper-size-medium-EZuD3gZZ","icon-wrapper-size-large":"icon-wrapper-size-large-EZuD3gZZ","icon-wrapper":"icon-wrapper-EZuD3gZZ",icon:"icon-EZuD3gZZ"}},88400:e=>{e.exports={radio:"radio-ALqkCUvs",input:"input-ALqkCUvs",box:"box-ALqkCUvs",reverse:"reverse-ALqkCUvs",label:"label-ALqkCUvs",wrapper:"wrapper-ALqkCUvs",noOutline:"noOutline-ALqkCUvs"}},52272:e=>{e.exports={wrap:"wrap-QStmZL8l",thicknessItem:"thicknessItem-QStmZL8l",checked:"checked-QStmZL8l",accessible:"accessible-QStmZL8l",focusVisible:"focusVisible-QStmZL8l",radio:"radio-QStmZL8l",bar:"bar-QStmZL8l"}},12863:e=>{e.exports={innerLabel:"innerLabel-DjbvBF5Y"}},21234:e=>{e.exports={controlWrapper:"controlWrapper-DBTazUk2",hidden:"hidden-DBTazUk2",control:"control-DBTazUk2",controlIncrease:"controlIncrease-DBTazUk2",controlDecrease:"controlDecrease-DBTazUk2",controlIcon:"controlIcon-DBTazUk2",title:"title-DBTazUk2"}},55596:e=>{e.exports={dialog:"dialog-b8SxMnzX",wrapper:"wrapper-b8SxMnzX",separator:"separator-b8SxMnzX",bounded:"bounded-b8SxMnzX"}},69827:e=>{e.exports={"small-height-breakpoint":"screen and (max-height: 360px)",container:"container-BZKENkhT",unsetAlign:"unsetAlign-BZKENkhT",title:"title-BZKENkhT",subtitle:"subtitle-BZKENkhT",textWrap:"textWrap-BZKENkhT",ellipsis:"ellipsis-BZKENkhT",close:"close-BZKENkhT",icon:"icon-BZKENkhT"}},60015:e=>{e.exports={wrap:"wrap-ne5qGlZh",icon:"icon-ne5qGlZh",text:"text-ne5qGlZh",disabled:"disabled-ne5qGlZh"}},28685:e=>{e.exports={colorPickerWrap:"colorPickerWrap-Sw_a4qpB",focused:"focused-Sw_a4qpB",readonly:"readonly-Sw_a4qpB",disabled:"disabled-Sw_a4qpB", "size-small":"size-small-Sw_a4qpB","size-medium":"size-medium-Sw_a4qpB","size-large":"size-large-Sw_a4qpB","font-size-small":"font-size-small-Sw_a4qpB","font-size-medium":"font-size-medium-Sw_a4qpB","font-size-large":"font-size-large-Sw_a4qpB","border-none":"border-none-Sw_a4qpB",shadow:"shadow-Sw_a4qpB","border-thin":"border-thin-Sw_a4qpB","border-thick":"border-thick-Sw_a4qpB","intent-default":"intent-default-Sw_a4qpB","intent-success":"intent-success-Sw_a4qpB","intent-warning":"intent-warning-Sw_a4qpB","intent-danger":"intent-danger-Sw_a4qpB","intent-primary":"intent-primary-Sw_a4qpB","corner-top-left":"corner-top-left-Sw_a4qpB","corner-top-right":"corner-top-right-Sw_a4qpB","corner-bottom-right":"corner-bottom-right-Sw_a4qpB","corner-bottom-left":"corner-bottom-left-Sw_a4qpB",colorPicker:"colorPicker-Sw_a4qpB",swatch:"swatch-Sw_a4qpB",placeholderContainer:"placeholderContainer-Sw_a4qpB",placeholder:"placeholder-Sw_a4qpB",mixedColor:"mixedColor-Sw_a4qpB",white:"white-Sw_a4qpB",opacitySwatch:"opacitySwatch-Sw_a4qpB",colorLine:"colorLine-Sw_a4qpB",multiWidth:"multiWidth-Sw_a4qpB",line:"line-Sw_a4qpB",thicknessContainer:"thicknessContainer-Sw_a4qpB",thicknessTitle:"thicknessTitle-Sw_a4qpB"}},86536:e=>{e.exports={thicknessContainer:"thicknessContainer-C05zSid7",thicknessTitle:"thicknessTitle-C05zSid7"}},69006:e=>{e.exports={hasTooltip:"hasTooltip-DcvaoxPU",uppercase:"uppercase-DcvaoxPU"}},2746:e=>{e.exports={wrap:"wrap-Q2NZ0gvI"}},25679:e=>{e.exports={checkbox:"checkbox-FG0u1J5p",title:"title-FG0u1J5p"}},41125:e=>{e.exports={hintButton:"hintButton-qEI9XsjF"}},69750:e=>{e.exports={titleWrap:"titleWrap-SexRbl__",title:"title-SexRbl__"}},63581:e=>{e.exports={button:"button-HBcDEU4c",accessible:"accessible-HBcDEU4c"}},93402:e=>{e.exports={container:"container-mdcOkvbj",sectionTitle:"sectionTitle-mdcOkvbj",separator:"separator-mdcOkvbj",customButton:"customButton-mdcOkvbj",accessible:"accessible-mdcOkvbj"}},80679:e=>{e.exports={container:"container-iiEYaqPD",form:"form-iiEYaqPD",swatch:"swatch-iiEYaqPD",inputWrap:"inputWrap-iiEYaqPD",inputHash:"inputHash-iiEYaqPD",input:"input-iiEYaqPD",buttonWrap:"buttonWrap-iiEYaqPD",hueSaturationWrap:"hueSaturationWrap-iiEYaqPD",saturation:"saturation-iiEYaqPD",hue:"hue-iiEYaqPD"}},1369:e=>{e.exports={hue:"hue-r4uo5Wn6",pointer:"pointer-r4uo5Wn6",accessible:"accessible-r4uo5Wn6",pointerContainer:"pointerContainer-r4uo5Wn6"}},30099:e=>{e.exports={opacity:"opacity-EnWts7Xu",opacitySlider:"opacitySlider-EnWts7Xu",opacitySliderGradient:"opacitySliderGradient-EnWts7Xu",pointer:"pointer-EnWts7Xu",dragged:"dragged-EnWts7Xu",opacityPointerWrap:"opacityPointerWrap-EnWts7Xu",opacityInputWrap:"opacityInputWrap-EnWts7Xu",opacityInput:"opacityInput-EnWts7Xu",opacityInputPercent:"opacityInputPercent-EnWts7Xu",accessible:"accessible-EnWts7Xu"}},35257:e=>{e.exports={saturation:"saturation-NFNfqP2w",pointer:"pointer-NFNfqP2w",accessible:"accessible-NFNfqP2w"}},87466:e=>{e.exports={swatches:"swatches-sfn7Lezv",swatch:"swatch-sfn7Lezv",hover:"hover-sfn7Lezv",empty:"empty-sfn7Lezv",white:"white-sfn7Lezv", selected:"selected-sfn7Lezv",contextItem:"contextItem-sfn7Lezv",row:"row-sfn7Lezv"}},66986:e=>{e.exports={button:"button-tFul0OhX","button-children":"button-children-tFul0OhX",hiddenArrow:"hiddenArrow-tFul0OhX",invisibleFocusHandler:"invisibleFocusHandler-tFul0OhX"}},42335:e=>{e.exports={"icon-wrapper":"icon-wrapper-dikdewwx","with-tooltip":"with-tooltip-dikdewwx","no-active-state":"no-active-state-dikdewwx"}},60673:e=>{e.exports={placeholder:"placeholder-V6ceS6BN"}},40191:e=>{e.exports={menuWrap:"menuWrap-Kq3ruQo8",isMeasuring:"isMeasuring-Kq3ruQo8",scrollWrap:"scrollWrap-Kq3ruQo8",momentumBased:"momentumBased-Kq3ruQo8",menuBox:"menuBox-Kq3ruQo8",isHidden:"isHidden-Kq3ruQo8"}},45719:e=>{e.exports={separator:"separator-Pf4rIzEt"}},57340:(e,t,n)=>{"use strict";n.d(t,{CloseButton:()=>d});var o=n(50959),s=n(64388),r=n(17105),i=n(15130),a=n(38822),l=n(63346),c=n(34983);function u(e="large"){switch(e){case"large":return r;case"medium":default:return i;case"small":return a;case"xsmall":return l;case"xxsmall":return c}}const d=o.forwardRef(((e,t)=>o.createElement(s.NavButton,{...e,ref:t,icon:u(e.size)})))},64388:(e,t,n)=>{"use strict";n.d(t,{NavButton:()=>c});var o=n(50959),s=n(97754),r=n(9745),i=n(45350);function a(e){const{size:t="large",preservePaddings:n,isLink:o,flipIconOnRtl:r,className:a}=e;return s(i["nav-button"],i[`size-${t}`],n&&i["preserve-paddings"],r&&i["flip-icon"],o&&i.link,a)}function l(e){const{children:t,icon:n}=e;return o.createElement(o.Fragment,null,o.createElement("span",{className:i.background}),o.createElement(r.Icon,{icon:n,className:i.icon,"aria-hidden":!0}),t&&o.createElement("span",{className:i["visually-hidden"]},t))}const c=(0,o.forwardRef)(((e,t)=>{const{icon:n,type:s="button",preservePaddings:r,flipIconOnRtl:i,size:c,"aria-label":u,...d}=e;return o.createElement("button",{...d,className:a({...e,children:u}),ref:t,type:s},o.createElement(l,{icon:n},u))}));c.displayName="NavButton";var u=n(21593),d=n(53017);(0,o.forwardRef)(((e,t)=>{const{icon:n,renderComponent:s,"aria-label":r,...i}=e,c=null!=s?s:u.CustomComponentDefaultLink;return o.createElement(c,{...i,className:a({...e,children:r,isLink:!0}),reference:(0,d.isomorphicRef)(t)},o.createElement(l,{icon:n},r))})).displayName="NavAnchorButton"},70673:(e,t,n)=>{"use strict";n.d(t,{CheckboxInput:()=>u});var o=n(50959),s=n(97754),r=n(90186),i=n(9745),a=n(65890),l=n(70048),c=n.n(l);function u(e){const t=s(c().box,c()[`intent-${e.intent}`],{[c().check]:!Boolean(e.indeterminate),[c().dot]:Boolean(e.indeterminate),[c().noOutline]:-1===e.tabIndex}),n=s(c().wrapper,e.className);return o.createElement("span",{className:n,title:e.title,style:e.style},o.createElement("input",{id:e.id,tabIndex:e.tabIndex,className:c().input,type:"checkbox",name:e.name,checked:e.checked,disabled:e.disabled,value:e.value,autoFocus:e.autoFocus,role:e.role,onChange:function(){e.onChange&&e.onChange(e.value)},ref:e.reference,"aria-required":e["aria-required"],"aria-describedby":e["aria-describedby"],"aria-invalid":e["aria-invalid"],...(0,r.filterDataProps)(e) -}),o.createElement("span",{className:t},o.createElement(i.Icon,{icon:a,className:c().icon})))}},15294:(e,t,n)=>{"use strict";n.d(t,{Checkbox:()=>c});var o=n(50959),s=n(97754),r=n(59416),i=n(70673),a=n(69789),l=n.n(a);class c extends o.PureComponent{render(){const{inputClassName:e,labelClassName:t,...n}=this.props,r=s(this.props.className,l().checkbox,{[l().reverse]:Boolean(this.props.labelPositionReverse),[l().baseline]:Boolean(this.props.labelAlignBaseline)}),a=s(l().label,t,{[l().disabled]:this.props.disabled});let c=null;return this.props.label&&(c=o.createElement("span",{className:a,title:this.props.title},this.props.label)),o.createElement("label",{className:r},o.createElement(i.CheckboxInput,{...n,className:e}),c)}}c.defaultProps={value:"on"};(0,r.makeSwitchGroupItem)(c)},2568:(e,t,n)=>{"use strict";n.d(t,{Textarea:()=>C});var o,s=n(50959),r=n(97754),i=n(38528),a=n(29202),l=n(48027),c=n(45812),u=n(47201),d=n(48907),p=n(67029),h=n(78274),m=n(22623),v=n.n(m);!function(e){e.None="none",e.Vertical="vertical",e.Horizontal="horizontal",e.Both="both"}(o||(o={}));const f=s.forwardRef(((e,t)=>{const{id:n,title:o,tabIndex:i,containerTabIndex:a,role:l,inputClassName:c,autoComplete:u,autoFocus:d,cols:m,disabled:f,isFocused:g,form:b,maxLength:C,minLength:y,name:E,placeholder:w,readonly:_,required:S,rows:x,value:N,defaultValue:T,wrap:I,containerReference:k,onChange:B,onSelect:P,onFocus:D,onContainerFocus:M,onBlur:O,onPaste:R,"aria-describedby":L,"aria-required":A,"aria-invalid":F,hasIcon:W,endSlot:V,hasAttachImage:z,...q}=e,K={id:n,title:o,tabIndex:i,role:l,autoComplete:u,autoFocus:d,cols:m,disabled:f,form:b,maxLength:C,minLength:y,name:E,placeholder:w,readOnly:_,required:S,rows:x,value:N,defaultValue:T,wrap:I,onChange:B,onSelect:P,onFocus:D,onBlur:O,onPaste:R,"aria-describedby":L,"aria-required":A,"aria-invalid":F};return s.createElement(p.ControlSkeleton,{...q,tabIndex:a,disabled:f,readonly:_,isFocused:g,ref:k,onFocus:M,middleSlot:s.createElement(h.MiddleSlot,null,s.createElement("textarea",{...K,className:r(v().textarea,c,V&&v().endslot),ref:t})),...V&&{endSlot:s.createElement("span",{className:r(!z&&v()["with-icon"])},V)}})}));f.displayName="TextareaView";const g=(e,t,n)=>t?void 0:e?-1:n,b=(e,t,n)=>t?void 0:e?n:-1,C=s.forwardRef(((e,t)=>{e=(0,l.useControl)(e);const{className:n,disabled:p,autoSelectOnFocus:h,tabIndex:m=0,borderStyle:C,highlight:y,resize:E,containerReference:w=null,onFocus:_,onBlur:S,hasIcon:x,...N}=e,T=(0,s.useRef)(null),I=(0,s.useRef)(null),{isMouseDown:k,handleMouseDown:B,handleMouseUp:P}=(0,c.useIsMouseDown)(),[D,M]=(0,a.useFocus)(),O=(0,u.createSafeMulticastEventHandler)(M.onFocus,(function(e){h&&!k.current&&(0,d.selectAllContent)(e.currentTarget)}),_),R=(0,u.createSafeMulticastEventHandler)(M.onBlur,S),L=void 0!==E&&E!==o.None,A=null!=C?C:L?y?"thick":"thin":void 0,F=null!=y?y:!L&&void 0;return s.createElement(f,{...N,className:r(v()["textarea-container"],L&&v()["change-highlight"],E&&E!==o.None&&v()[`resize-${E}`],D&&v().focused,n),disabled:p,isFocused:D,containerTabIndex:g(D,p,m),tabIndex:b(D,p,m), +}),o.createElement("span",{className:t},o.createElement(i.Icon,{icon:a,className:c().icon})))}},32389:(e,t,n)=>{"use strict";n.d(t,{Checkbox:()=>c});var o=n(50959),s=n(97754),r=n(59416),i=n(70673),a=n(69789),l=n.n(a);class c extends o.PureComponent{render(){const{inputClassName:e,labelClassName:t,...n}=this.props,r=s(this.props.className,l().checkbox,{[l().reverse]:Boolean(this.props.labelPositionReverse),[l().baseline]:Boolean(this.props.labelAlignBaseline)}),a=s(l().label,t,{[l().disabled]:this.props.disabled});let c=null;return this.props.label&&(c=o.createElement("span",{className:a,title:this.props.title},this.props.label)),o.createElement("label",{className:r},o.createElement(i.CheckboxInput,{...n,className:e}),c)}}c.defaultProps={value:"on"};(0,r.makeSwitchGroupItem)(c)},2568:(e,t,n)=>{"use strict";n.d(t,{Textarea:()=>C});var o,s=n(50959),r=n(97754),i=n(38528),a=n(29202),l=n(48027),c=n(45812),u=n(47201),d=n(48907),p=n(67029),h=n(78274),m=n(22623),v=n.n(m);!function(e){e.None="none",e.Vertical="vertical",e.Horizontal="horizontal",e.Both="both"}(o||(o={}));const f=s.forwardRef(((e,t)=>{const{id:n,title:o,tabIndex:i,containerTabIndex:a,role:l,inputClassName:c,autoComplete:u,autoFocus:d,cols:m,disabled:f,isFocused:g,form:b,maxLength:C,minLength:y,name:E,placeholder:w,readonly:_,required:S,rows:x,value:N,defaultValue:T,wrap:I,containerReference:k,onChange:B,onSelect:P,onFocus:D,onContainerFocus:M,onBlur:O,onPaste:R,"aria-describedby":L,"aria-required":A,"aria-invalid":F,hasIcon:W,endSlot:V,hasAttachImage:z,...q}=e,K={id:n,title:o,tabIndex:i,role:l,autoComplete:u,autoFocus:d,cols:m,disabled:f,form:b,maxLength:C,minLength:y,name:E,placeholder:w,readOnly:_,required:S,rows:x,value:N,defaultValue:T,wrap:I,onChange:B,onSelect:P,onFocus:D,onBlur:O,onPaste:R,"aria-describedby":L,"aria-required":A,"aria-invalid":F};return s.createElement(p.ControlSkeleton,{...q,tabIndex:a,disabled:f,readonly:_,isFocused:g,ref:k,onFocus:M,middleSlot:s.createElement(h.MiddleSlot,null,s.createElement("textarea",{...K,className:r(v().textarea,c,V&&v().endslot),ref:t})),...V&&{endSlot:s.createElement("span",{className:r(!z&&v()["with-icon"])},V)}})}));f.displayName="TextareaView";const g=(e,t,n)=>t?void 0:e?-1:n,b=(e,t,n)=>t?void 0:e?n:-1,C=s.forwardRef(((e,t)=>{e=(0,l.useControl)(e);const{className:n,disabled:p,autoSelectOnFocus:h,tabIndex:m=0,borderStyle:C,highlight:y,resize:E,containerReference:w=null,onFocus:_,onBlur:S,hasIcon:x,...N}=e,T=(0,s.useRef)(null),I=(0,s.useRef)(null),{isMouseDown:k,handleMouseDown:B,handleMouseUp:P}=(0,c.useIsMouseDown)(),[D,M]=(0,a.useFocus)(),O=(0,u.createSafeMulticastEventHandler)(M.onFocus,(function(e){h&&!k.current&&(0,d.selectAllContent)(e.currentTarget)}),_),R=(0,u.createSafeMulticastEventHandler)(M.onBlur,S),L=void 0!==E&&E!==o.None,A=null!=C?C:L?y?"thick":"thin":void 0,F=null!=y?y:!L&&void 0;return s.createElement(f,{...N,className:r(v()["textarea-container"],L&&v()["change-highlight"],E&&E!==o.None&&v()[`resize-${E}`],D&&v().focused,n),disabled:p,isFocused:D,containerTabIndex:g(D,p,m),tabIndex:b(D,p,m), borderStyle:A,highlight:F,onContainerFocus:function(e){I.current===e.target&&null!==T.current&&T.current.focus()},onFocus:O,onBlur:R,onMouseDown:B,onMouseUp:P,ref:function(e){T.current=e,"function"==typeof t?t(e):t&&(t.current=e)},containerReference:(0,i.useMergedRefs)([w,I]),hasIcon:x})}));C.displayName="Textarea"},38952:(e,t,n)=>{"use strict";function o(e){const{reference:t,...n}=e;return{...n,ref:t}}n.d(t,{renameRef:()=>o})},21593:(e,t,n)=>{"use strict";n.d(t,{CustomComponentDefaultLink:()=>r});var o=n(50959),s=n(38952);function r(e){return o.createElement("a",{...(0,s.renameRef)(e)})}o.PureComponent},36104:(e,t,n)=>{"use strict";n.d(t,{useControlDisclosure:()=>s});var o=n(7953);function s(e){const{intent:t,highlight:n,...s}=e,{isFocused:r,...i}=(0,o.useDisclosure)(s);return{...i,isFocused:r,highlight:null!=n?n:r,intent:null!=t?t:r?"primary":"default"}}},36383:(e,t,n)=>{"use strict";n.d(t,{useOutsideEvent:()=>r});var o=n(50959),s=n(27267);function r(e){const{click:t,mouseDown:n,touchEnd:r,touchStart:i,handler:a,reference:l,ownerDocument:c=document}=e,u=(0,o.useRef)(null),d=(0,o.useRef)(new CustomEvent("timestamp").timeStamp);return(0,o.useLayoutEffect)((()=>{const e={click:t,mouseDown:n,touchEnd:r,touchStart:i},o=l?l.current:u.current;return(0,s.addOutsideEventListener)(d.current,o,a,c,e)}),[t,n,r,i,a]),l||u}},9745:(e,t,n)=>{"use strict";n.d(t,{Icon:()=>s});var o=n(50959);const s=o.forwardRef(((e,t)=>{const{icon:n="",...s}=e;return o.createElement("span",{...s,ref:t,dangerouslySetInnerHTML:{__html:n}})}))},83021:(e,t,n)=>{"use strict";n.d(t,{SubmenuContext:()=>s,SubmenuHandler:()=>r});var o=n(50959);const s=o.createContext(null);function r(e){const[t,n]=(0,o.useState)(null),r=(0,o.useRef)(null),i=(0,o.useRef)(new Map);return(0,o.useEffect)((()=>()=>{null!==r.current&&clearTimeout(r.current)}),[]),o.createElement(s.Provider,{value:{current:t,setCurrent:function(e){null!==r.current&&(clearTimeout(r.current),r.current=null);null===t?n(e):r.current=setTimeout((()=>{r.current=null,n(e)}),100)},registerSubmenu:function(e,t){return i.current.set(e,t),()=>{i.current.delete(e)}},isSubmenuNode:function(e){return Array.from(i.current.values()).some((t=>t(e)))}}},e.children)}},99663:(e,t,n)=>{"use strict";n.d(t,{Slot:()=>s,SlotContext:()=>r});var o=n(50959);class s extends o.Component{shouldComponentUpdate(){return!1}render(){return o.createElement("div",{style:{position:"fixed",zIndex:150,left:0,top:0},ref:this.props.reference})}}const r=o.createContext(null)},59416:(e,t,n)=>{"use strict";n.d(t,{SwitchGroup:()=>i,makeSwitchGroupItem:()=>a});var o=n(50959),s=n(74786);const r=(0,o.createContext)({getName:()=>"",getValues:()=>[],getOnChange:()=>s.default,subscribe:s.default,unsubscribe:s.default});class i extends o.PureComponent{constructor(e){super(e),this._subscriptions=new Set,this._getName=()=>this.props.name,this._getValues=()=>this.props.values,this._getOnChange=()=>this.props.onChange,this._subscribe=e=>{this._subscriptions.add(e)},this._unsubscribe=e=>{this._subscriptions.delete(e)},this.state={switchGroupContext:{ getName:this._getName,getValues:this._getValues,getOnChange:this._getOnChange,subscribe:this._subscribe,unsubscribe:this._unsubscribe}}}render(){return o.createElement(r.Provider,{value:this.state.switchGroupContext},this.props.children)}componentDidUpdate(e){this._notify(this._getUpdates(this.props.values,e.values))}_notify(e){this._subscriptions.forEach((t=>t(e)))}_getUpdates(e,t){return[...t,...e].filter((n=>t.includes(n)?!e.includes(n):e.includes(n)))}}function a(e){var t;return t=class extends o.PureComponent{constructor(){super(...arguments),this._onChange=e=>{this.context.getOnChange()(e)},this._onUpdate=e=>{e.includes(this.props.value)&&this.forceUpdate()}}componentDidMount(){this.context.subscribe(this._onUpdate)}render(){return o.createElement(e,{...this.props,name:this._getName(),onChange:this._onChange,checked:this._isChecked()})}componentWillUnmount(){this.context.unsubscribe(this._onUpdate)}_getName(){return this.context.getName()}_isChecked(){return this.context.getValues().includes(this.props.value)}},t.contextType=r,t}},67961:(e,t,n)=>{"use strict";n.d(t,{OverlapManager:()=>r,getRootOverlapManager:()=>a});var o=n(50151);class s{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 r{constructor(e=document){this._storage=new s,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 o=this._document.createElement("div");if(o.style.position=t.position,o.style.zIndex=this._index.toString(),o.dataset.id=e,void 0!==t.index){const e=this._container.childNodes.length;if(t.index>=e)this._container.appendChild(o);else if(t.index<=0)this._container.insertBefore(o,this._container.firstChild);else{const e=this._container.childNodes[t.index];this._container.insertBefore(o,e)}}else"reverse"===t.direction?this._container.insertBefore(o,this._container.firstChild):this._container.appendChild(o);return this._windows.set(e,o),++this._index,o}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 i=new WeakMap;function a(e=document){const t=e.getElementById("overlap-manager-root");if(null!==t)return(0,o.ensureDefined)(i.get(t));{const t=new r(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 i.set(n,t),t.setContainer(n),e.body.appendChild(n),t}}},92399:(e,t,n)=>{"use strict";n.d(t,{NumberInputView:()=>I});var o=n(50959),s=n(32563),r=n(97754),i=n(67029),a=n(78274),l=n(86623),c=n(95263),u=n(1405),d=n(12863);const p={large:i.InputClasses.FontSizeLarge,medium:i.InputClasses.FontSizeMedium},h={attachment:u.anchors.top.attachment,targetAttachment:u.anchors.top.targetAttachment,attachmentOffsetY:-4};function m(e){const{className:t,inputClassName:n,stretch:s=!0,errorMessage:i,fontSizeStyle:u="large",endSlot:m,button:v,error:f,warning:g,innerLabel:b,inputReference:C,children:y,...E}=e,w=f&&void 0!==i?[i]:void 0,_=g&&void 0!==i?[i]:void 0,S=r(d.inputContainer,p[u],t),x=b?o.createElement(a.StartSlot,{className:d.innerLabel,interactive:!1},b):void 0,N=m||v||y?o.createElement(a.EndSlot,null,m,v,y):void 0;return o.createElement(l.FormInput,{...E,className:S,inputClassName:n,errors:w,warnings:_,hasErrors:f,hasWarnings:g,messagesPosition:c.MessagesPosition.Attached,customErrorsAttachment:h,messagesRoot:"document",inheritMessagesWidthFromTarget:!0,disableMessagesRtlStyles:!0,iconHidden:!0,stretch:s,reference:C,startSlot:x,endSlot:N})}var v=n(38528),f=n(11542),g=n(9745),b=n(21861),C=n(2948),y=n(21234);function E(e){const t=r(y.control,y.controlIncrease),s=r(y.control,y.controlDecrease);return o.createElement(o.Fragment,null,void 0!==e.title&&o.createElement("div",{className:y.title},e.title),o.createElement("div",{className:y.controlWrapper},(e.defaultButtonsVisible||e.title)&&o.createElement(o.Fragment,null,o.createElement("button",{type:"button",tabIndex:-1,"aria-label":f.t(null,void 0,n(46812)),className:t,onClick:e.increaseValue,onMouseDown:b.preventDefault},o.createElement(g.Icon,{icon:C,className:y.controlIcon})),o.createElement("button",{type:"button",tabIndex:-1,"aria-label":f.t(null,void 0,n(56095)),className:s,onClick:e.decreaseValue,onMouseDown:b.preventDefault},o.createElement(g.Icon,{icon:C,className:y.controlIcon})))))}var w=n(70412),_=n(29202),S=n(47201),x=n(68335);const N=[38],T=[40];function I(e){const[t,n]=(0,w.useHover)(),[r,i]=(0,_.useFocus)(),a=(0,o.useRef)(null),l=(0,S.createSafeMulticastEventHandler)(i.onFocus,e.onFocus),c=(0,S.createSafeMulticastEventHandler)(i.onBlur,e.onBlur),u=(0,o.useCallback)((t=>{!e.disabled&&r&&(t.preventDefault(),t.deltaY<0?e.onValueByStepChange(1):e.onValueByStepChange(-1))}),[r,e.disabled,e.onValueByStepChange]);return o.createElement(m,{...n,id:e.id,name:e.name,pattern:e.pattern,borderStyle:e.borderStyle,fontSizeStyle:e.fontSizeStyle,value:e.value,className:e.className,inputClassName:e.inputClassName,autoComplete:e.autoComplete,button:function(){const{button:n,forceShowControls:i,disabled:a,title:l}=e,c=!a&&!s.mobiletouch&&(i||r||t);return a?void 0:o.createElement(o.Fragment,null,null!=n?n:o.createElement(E,{increaseValue:d,decreaseValue:p,defaultButtonsVisible:c,title:l}))}(),disabled:e.disabled, @@ -13,7 +13,7 @@ onFocus:x.onFocus,onBlur:x.onBlur,disabled:b},"function"==typeof t?t(w,S):t),o.c const{className:t,selectOpacity:n=void 0!==e.opacity,thickness:s,color:i,disabled:a,opacity:l=1,onColorChange:c,onOpacityChange:u,onThicknessChange:d,thicknessItems:p,onPopupClose:h,"data-name":m}=e,[g,b,C]=(0,f.useCustomColors)();return o.createElement(v,{className:t,disabled:a,color:"mixed"!==i?i:null,selectOpacity:n,opacity:l,selectCustom:!0,customColors:g,onColorChange:c,onOpacityChange:i?u:void 0,onAddColor:b,onRemoveCustomColor:C,button:function(e,t){const n=e||t,c=n?"primary":"default";return o.createElement("div",{className:r()(T.colorPickerWrap,T[`intent-${c}`],T["border-thin"],T["size-medium"],n&&T.highlight,n&&T.focused,a&&T.disabled),"data-role":"button","data-name":s?"color-with-thickness-select":"color-select"},o.createElement("div",{className:r()(T.colorPicker,a&&T.disabled)},i&&"mixed"!==i?function(){const e=k(i,l),t=l>=.95&&B(i);return o.createElement("div",{className:T.opacitySwatch},o.createElement("div",{style:{backgroundColor:e},className:r()(T.swatch,t&&T.white)}))}():o.createElement("div",{className:T.placeholderContainer},o.createElement("div",{className:"mixed"===i?T.mixedColor:T.placeholder})),s&&function(){const e=i&&"mixed"!==i?k(i,l):void 0;if("mixed"===s)return o.createElement("div",{className:T.multiWidth},o.createElement("div",{style:{backgroundColor:e},className:T.line}),o.createElement("div",{style:{backgroundColor:e},className:T.line}),o.createElement("div",{style:{backgroundColor:e},className:T.line}));return o.createElement("span",{className:r()(T.colorLine,B(i)&&T.white),style:{height:s,backgroundColor:e}})}()),n&&o.createElement("span",{className:T.shadow}))},onPopupClose:h,"data-name":m},s&&p&&o.createElement(N,{value:s,items:p,onChange:function(e){d&&d(e)}}))}function k(e,t){return e?(0,g.generateColor)(e,(0,g.alphaToTransparency)(t),!0):"#000000"}function B(e){return!!e&&e.toLowerCase()===b.white}},48897:(e,t,n)=>{"use strict";n.d(t,{SymbolInputsButton:()=>x});var o=n(50959),s=n(97754),r=n.n(s),i=n(11542),a=n(50151),l=n(50655),c=n(95711),u=n(14483),d=n(55141),p=n(65106),h=n(1861),m=n(9745),v=n(10600),f=n(60015);function g(e){const{value:t,onClick:n,className:r,startSlot:i,disabled:a=!1}=e;return o.createElement("div",{className:s(f.wrap,a&&f.disabled,r),onClick:n,"data-name":"edit-button"},o.createElement("div",{className:s(f.text,"apply-overflow-tooltip")},void 0!==i&&i,o.createElement("span",null,t)),o.createElement(m.Icon,{icon:v,className:f.icon}))}var b=n(31356),C=n(78260),y=n(44254),E=n(15983),w=n(82708),_=n(69006);function S(e){const{symbol:t,onSymbolChanged:s,disabled:a,className:d}=e,[m,v]=(0,o.useState)(t),f=(0,o.useContext)(l.SlotContext),b=(0,o.useContext)(c.PopupContext);return o.createElement(g,{value:m,onClick:function(){const e=function(e){const t=(0,y.tokenize)(e);return(0,E.isSpread)(t)}(m)?m:(0,w.safeShortName)(m),t=(0,p.getSymbolSearchCompleteOverrideFunction)();(0,h.showSymbolSearchItemsDialog)({onSearchComplete:e=>{t(e[0].symbol,e[0].result).then((e=>{s(e.symbol),v(e.name)}))},dialogTitle:i.t(null,void 0,n(23398)),defaultValue:e,manager:f,onClose:()=>{ b&&b.focus()},showSpreadActions:u.enabled("show_spread_operators")&&u.enabled("studies_symbol_search_spread_operators")})},disabled:a,className:r()(d,u.enabled("uppercase_instrument_names")&&_.uppercase)})}function x(e){if("definition"in e){const{propType:t,properties:n,id:s,title:r="",solutionId:i}=e.definition,l=n[t],c=l.value()||"",u=e=>{l.setValue(e)};return o.createElement(b.CommonSection,{id:s,title:r,solutionId:i},o.createElement(C.CellWrap,null,o.createElement(S,{symbol:(0,a.ensureDefined)(c),onSymbolChanged:u})))}{const{study:t,value:n,input:{id:s,name:i},onChange:l,disabled:c,hasTooltip:u}=e,p=e=>{const n=(0,d.getInternalSymbolName)(e,t);l(n,s,i)};return o.createElement(S,{symbol:(0,a.ensureDefined)(n),onSymbolChanged:p,disabled:c,className:r()(u&&_.hasTooltip)})}}},1861:(e,t,n)=>{"use strict";n.d(t,{showSymbolSearchItemsDialog:()=>l});var o=n(50959),s=n(962),r=n(50655),i=n(51826),a=n(22350);function l(e){const{initialMode:t="symbolSearch",autofocus:n=!0,defaultValue:l,showSpreadActions:c,selectSearchOnInit:u,onSearchComplete:d,dialogTitle:p,placeholder:h,fullscreen:m,initialScreen:v,wrapper:f,dialog:g,contentItem:b,onClose:C,onOpen:y,footer:E,symbolTypes:w,searchInput:_,emptyState:S,hideMarkedListFlag:x,dialogWidth:N="auto",manager:T,shouldReturnFocus:I,onSymbolFiltersParamsChange:k,onEmptyResults:B}=e;if(i.dialogsOpenerManager.isOpened("SymbolSearch")||i.dialogsOpenerManager.isOpened("ChangeIntervalDialog"))return;const P=document.createElement("div"),D=o.createElement(r.SlotContext.Provider,{value:null!=T?T:null},o.createElement(a.SymbolSearchItemsDialog,{onClose:M,initialMode:t,defaultValue:l,showSpreadActions:c,hideMarkedListFlag:x,selectSearchOnInit:u,onSearchComplete:d,dialogTitle:p,placeholder:h,fullscreen:m,initialScreen:v,wrapper:f,dialog:g,contentItem:b,footer:E,symbolTypes:w,searchInput:_,emptyState:S,autofocus:n,dialogWidth:N,shouldReturnFocus:I,onSymbolFiltersParamsChange:k,onEmptyResults:B}));function M(){s.unmountComponentAtNode(P),i.dialogsOpenerManager.setAsClosed("SymbolSearch"),C&&C()}return s.render(D,P),i.dialogsOpenerManager.setAsOpened("SymbolSearch"),y&&y(),{close:M}}},50238:(e,t,n)=>{"use strict";n.d(t,{useRovingTabindexElement:()=>i});var o=n(50959),s=n(39416),r=n(16838);function i(e,t=[]){const[n,i]=(0,o.useState)(!1),a=(0,s.useFunctionalRefObject)(e);return(0,o.useLayoutEffect)((()=>{if(!r.PLATFORM_ACCESSIBILITY_ENABLED)return;const e=a.current;if(null===e)return;const t=e=>{switch(e.type){case"roving-tabindex:main-element":i(!0);break;case"roving-tabindex:secondary-element":i(!1)}};return e.addEventListener("roving-tabindex:main-element",t),e.addEventListener("roving-tabindex:secondary-element",t),()=>{e.removeEventListener("roving-tabindex:main-element",t),e.removeEventListener("roving-tabindex:secondary-element",t)}}),t),[a,r.PLATFORM_ACCESSIBILITY_ENABLED?n?0:-1:void 0]}},59369:(e,t,n)=>{"use strict";n.d(t,{useRowsNavigation:()=>c});var o=n(50959),s=n(50151),r=n(16838),i=n(68335),a=n(71468);const l=[37,39,38,40];function c(e){const t=(0,o.useRef)(null);return(0, o.useLayoutEffect)((()=>{if(!r.PLATFORM_ACCESSIBILITY_ENABLED)return;const e=(0,s.ensureNotNull)(t.current),n=()=>{const n=(0,r.queryTabbableElements)(e).sort(r.navigationOrderComparator);if(0===n.length||n[0].parentElement&&!p(n[0].parentElement,(0,s.ensureNotNull)(t.current))){const o=function(e){const n=d(e).sort(r.navigationOrderComparator).find((e=>p(e,(0,s.ensureNotNull)(t.current))));if(!n)return null;const o=Array.from(n.children);if(!o.length)return null;return o[0]}(e);if(null===o)return;if((0,a.becomeMainElement)(o),n.length>0)for(const e of n)(0,a.becomeSecondaryElement)(e)}};return window.addEventListener("keyboard-navigation-activation",n),n(),()=>window.removeEventListener("keyboard-navigation-activation",n)}),[]),[t,function(t){if(!r.PLATFORM_ACCESSIBILITY_ENABLED)return;if(t.defaultPrevented)return;const n=(0,i.hashFromEvent)(t);if(!l.includes(n))return;const o=document.activeElement;if(!(o instanceof HTMLElement))return;const s=t.currentTarget;let a,c;if(e){const e=o.parentElement;a=e?Array.from(e.children):[],c=a.indexOf(o)}else a=(p=s,Array.from(p.querySelectorAll("button:not([disabled]):not([aria-disabled])")).filter((0,r.createScopedVisibleElementFilter)(p))).sort(r.navigationOrderComparator),c=a.indexOf(o);var p;if(0===a.length||-1===c)return;const m=(0,r.mapKeyCodeToDirection)(n);switch(m){case"inlinePrev":if(t.preventDefault(),!e&&0===c)break;h(u(a,c,-1));break;case"inlineNext":if(t.preventDefault(),!e&&c===a.length-1)break;h(u(a,c,1));break;case"blockPrev":case"blockNext":(n=>{if(!document.activeElement)return;const o=d(s),r=document.activeElement.parentElement;if(!r)return;const i=Array.from(r.children).indexOf(document.activeElement);if(-1===i)return;const a=o["blockNext"===n?o.indexOf(r)+1:o.indexOf(r)-1];if(!a)return;t.preventDefault();const l=Array.from(a.children);l.length&&(!e&&i<=l.length-1?h(l[i]):h(l[0]))})(m)}}]}function u(e,t,n){return e[(t+e.length+n)%e.length]}function d(e){return Array.from(e.querySelectorAll('[data-role="row"]')).filter((0,r.createScopedVisibleElementFilter)(e))}function p(e,t){const n=(0,s.ensureNotNull)(e.parentElement).offsetTop,o=n+(0,s.ensureNotNull)(e.parentElement).clientHeight,r=t.scrollTop,i=r+t.clientHeight;return n>=r&&o<=i}function h(e){document.activeElement&&(0,a.becomeSecondaryElement)(document.activeElement),(0,a.becomeMainElement)(e),e.focus()}},73146:(e,t,n)=>{"use strict";n.d(t,{createAdapter:()=>r});var o=n(92249),s=n(28853);function r(e){if((0,o.isLineTool)(e))return{isPine:()=>!1,isStandardPine:()=>!1,canOverrideMinTick:()=>!1,resolvedSymbolInfoBySymbol:()=>{throw new TypeError("Only study is supported.")},symbolsResolved:()=>{throw new TypeError("Only study is supported.")},parentSources:()=>{throw new TypeError("Only study is supported.")},getAllChildren:()=>[],sourceId:()=>{throw new TypeError("Only study is supported.")},inputs:()=>({}),parentSourceForInput:()=>{throw new TypeError("Only study is supported.")}};if((0,s.isStudy)(e))return e;if("isInputsStudy"in e)return e;throw new TypeError("Unsupported source type.")}}, -45560:(e,t,n)=>{"use strict";n.d(t,{useDefinitionProperty:()=>r});var o=n(50959),s=n(71953);const r=e=>{const t="property"in e?e.property:void 0,n="defaultValue"in e?e.defaultValue:e.property.value(),[r,i]=(0,o.useState)(t?t.value():n);(0,o.useEffect)((()=>{if(t){const n={};return i(t.value()),t.subscribe(n,(t=>{const n=t.value();e.handler&&e.handler(n),i(n)})),()=>{t.unsubscribeAll(n)}}return()=>{}}),[t]);return[r,e=>{if(void 0!==t){const n=t.value();s.logger.logNormal(`Changing property value from "${n}" to "${e}"`),t.setValue(e)}}]}},78260:(e,t,n)=>{"use strict";n.d(t,{CellWrap:()=>a});var o=n(50959),s=n(97754),r=n.n(s),i=n(2746);function a(e){return o.createElement("div",{className:r()(i.wrap,e.className)},e.children)}},53424:(e,t,n)=>{"use strict";n.d(t,{CheckableTitle:()=>c});var o=n(50959),s=n(15294),r=n(45560);function i(e){const{property:t,...n}=e,[i,a]=(0,r.useDefinitionProperty)({property:t}),l="mixed"===i;return o.createElement(s.Checkbox,{...n,name:"toggle-enabled",checked:l||i,indeterminate:l,onChange:function(){a("mixed"===i||!i)}})}var a=n(78260),l=n(25679);function c(e){const{property:t,disabled:n,title:s,className:r,name:c}=e,u=o.createElement("span",{className:l.title},s);return o.createElement(a.CellWrap,{className:r},t?o.createElement(i,{name:c,className:l.checkbox,property:t,disabled:n,label:u,labelAlignBaseline:!0}):u)}},31356:(e,t,n)=>{"use strict";n.d(t,{CommonSection:()=>i});var o=n(50959),s=n(11062),r=n(53424);n(41125);function i(e){const{id:t,offset:n,disabled:i,checked:a,title:l,children:c,solutionId:u}=e;return o.createElement(s.PropertyTable.Row,null,o.createElement(s.PropertyTable.Cell,{placement:"first",verticalAlign:"adaptive",offset:n,"data-section-name":t,colSpan:Boolean(c)?void 0:2,checkableTitle:!0},o.createElement(r.CheckableTitle,{name:`is-enabled-${t}`,title:l,disabled:i,property:a}),u&&!Boolean(c)&&!1),Boolean(c)&&o.createElement(s.PropertyTable.Cell,{placement:"last","data-section-name":t},c,u&&!1))}},86067:(e,t,n)=>{"use strict";n.d(t,{GroupTitleSection:()=>a});var o=n(50959),s=n(11062),r=n(53424),i=n(69750);function a(e){return o.createElement(s.PropertyTable.Row,null,o.createElement(s.PropertyTable.Cell,{className:i.titleWrap,placement:"first",verticalAlign:"adaptive",colSpan:2,"data-section-name":e.name,checkableTitle:!0},o.createElement(r.CheckableTitle,{title:e.title,name:`is-enabled-${e.name}`,className:i.title})))}},71953:(e,t,n)=>{"use strict";n.d(t,{logger:()=>o});const o=(0,n(59224).getLogger)("Platform.GUI.PropertyDefinitionTrace")},35789:(e,t,n)=>{"use strict";n.d(t,{ColorPicker:()=>U});var o=n(50959),s=n(97754),r=n.n(s),i=n(11542),a=n(16838),l=n(59369),c=n(43688),u=n(93532),d=n(45582),p=Math.ceil,h=Math.max;const m=function(e,t,n){t=(n?(0,u.default)(e,t,n):void 0===t)?1:h((0,d.default)(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var s=0,r=0,i=Array(p(o/t));s{"use strict";n.d(t,{useDefinitionProperty:()=>r});var o=n(50959),s=n(71953);const r=e=>{const t="property"in e?e.property:void 0,n="defaultValue"in e?e.defaultValue:e.property.value(),[r,i]=(0,o.useState)(t?t.value():n);(0,o.useEffect)((()=>{if(t){const n={};return i(t.value()),t.subscribe(n,(t=>{const n=t.value();e.handler&&e.handler(n),i(n)})),()=>{t.unsubscribeAll(n)}}return()=>{}}),[t]);return[r,e=>{if(void 0!==t){const n=t.value();s.logger.logNormal(`Changing property value from "${n}" to "${e}"`),t.setValue(e)}}]}},78260:(e,t,n)=>{"use strict";n.d(t,{CellWrap:()=>a});var o=n(50959),s=n(97754),r=n.n(s),i=n(2746);function a(e){return o.createElement("div",{className:r()(i.wrap,e.className)},e.children)}},53424:(e,t,n)=>{"use strict";n.d(t,{CheckableTitle:()=>c});var o=n(50959),s=n(32389),r=n(45560);function i(e){const{property:t,...n}=e,[i,a]=(0,r.useDefinitionProperty)({property:t}),l="mixed"===i;return o.createElement(s.Checkbox,{...n,name:"toggle-enabled",checked:l||i,indeterminate:l,onChange:function(){a("mixed"===i||!i)}})}var a=n(78260),l=n(25679);function c(e){const{property:t,disabled:n,title:s,className:r,name:c}=e,u=o.createElement("span",{className:l.title},s);return o.createElement(a.CellWrap,{className:r},t?o.createElement(i,{name:c,className:l.checkbox,property:t,disabled:n,label:u,labelAlignBaseline:!0}):u)}},31356:(e,t,n)=>{"use strict";n.d(t,{CommonSection:()=>i});var o=n(50959),s=n(11062),r=n(53424);n(41125);function i(e){const{id:t,offset:n,disabled:i,checked:a,title:l,children:c,solutionId:u}=e;return o.createElement(s.PropertyTable.Row,null,o.createElement(s.PropertyTable.Cell,{placement:"first",verticalAlign:"adaptive",offset:n,"data-section-name":t,colSpan:Boolean(c)?void 0:2,checkableTitle:!0},o.createElement(r.CheckableTitle,{name:`is-enabled-${t}`,title:l,disabled:i,property:a}),u&&!Boolean(c)&&!1),Boolean(c)&&o.createElement(s.PropertyTable.Cell,{placement:"last","data-section-name":t},c,u&&!1))}},86067:(e,t,n)=>{"use strict";n.d(t,{GroupTitleSection:()=>a});var o=n(50959),s=n(11062),r=n(53424),i=n(69750);function a(e){return o.createElement(s.PropertyTable.Row,null,o.createElement(s.PropertyTable.Cell,{className:i.titleWrap,placement:"first",verticalAlign:"adaptive",colSpan:2,"data-section-name":e.name,checkableTitle:!0},o.createElement(r.CheckableTitle,{title:e.title,name:`is-enabled-${e.name}`,className:i.title})))}},71953:(e,t,n)=>{"use strict";n.d(t,{logger:()=>o});const o=(0,n(59224).getLogger)("Platform.GUI.PropertyDefinitionTrace")},35789:(e,t,n)=>{"use strict";n.d(t,{ColorPicker:()=>U});var o=n(50959),s=n(97754),r=n.n(s),i=n(11542),a=n(16838),l=n(59369),c=n(43688),u=n(93532),d=n(45582),p=Math.ceil,h=Math.max;const m=function(e,t,n){t=(n?(0,u.default)(e,t,n):void 0===t)?1:h((0,d.default)(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var s=0,r=0,i=Array(p(o/t));so.createElement("div",{className:_.row,"data-role":"row",key:t},e.map(((e,n)=>o.createElement(S,{key:String(e)+n,color:e,selected:a&&(0,v.areEqualRgb)(a,(0,v.parseRgb)(String(e))),onSelect:c,onSwatchRemove:i?()=>function(e,t){const n=10*e+t;null==i||i(n)}(t,n):void 0})))))),s);function c(e){r&&r(e)}}var N=n(54368),T=n(94720);function I(e){const t=`Invalid RGB color: ${e}`;if(null===e)throw new Error(t);const n=e.match(/^#?([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})$/i);if(null===n)throw new Error(t);const[,o,s,r]=n;if(!o||!s||!r)throw new Error(t);const i=parseInt(o,16)/255,a=parseInt(s,16)/255,l=parseInt(r,16)/255,c=Math.max(i,a,l),u=Math.min(i,a,l);let d;const p=c,h=c-u,m=0===c?0:h/c;if(c===u)d=0;else{switch(c){case i:d=(a-l)/h+(a{this._container=e},this._handlePosition=e=>{const{hsv:{h:t},onChange:n}=this.props;if(!n)return;const o=(0,f.ensureNotNull)(this._container).getBoundingClientRect(),s=e.clientX-o.left,r=e.clientY-o.top;n({h:t,s:(0,P.clamp)(s/o.width,0,1),v:(0,P.clamp)(1-r/o.height,0,1)})},this._handleKeyDown=e=>{const{hsv:{h:t,s:n,v:o},onChange:s}=this.props,r=(0,B.hashFromEvent)(e);if(!s||!M.includes(r))return;if(37===r||39===r){return void s({h:t,s:(0,P.clamp)(37===r?n-O:n+O,0,1),v:o})}s({h:t,s:n,v:(0,P.clamp)(40===r?o-O:o+O,0,1)})},this._mouseDown=e=>{window.addEventListener("mouseup",this._mouseUp),window.addEventListener("mousemove",this._mouseMove)},this._mouseUp=e=>{window.removeEventListener("mousemove",this._mouseMove),window.removeEventListener("mouseup",this._mouseUp),this._handlePosition(e)},this._mouseMove=(0,k.default)(this._handlePosition,100),this._handleTouch=e=>{this._handlePosition(e.nativeEvent.touches[0])}}render(){ const{className:e,hsv:{h:t,s:n,v:s}}=this.props,i=`hsl(${360*t}, 100%, 50%)`;return o.createElement("div",{tabIndex:a.PLATFORM_ACCESSIBILITY_ENABLED?0:-1,className:r()(a.PLATFORM_ACCESSIBILITY_ENABLED&&D.accessible,e),onKeyDown:this._handleKeyDown},o.createElement("div",{className:D.saturation,style:{backgroundColor:i},ref:this._refContainer,onMouseDown:this._mouseDown,onTouchStart:this._handleTouch,onTouchMove:this._handleTouch},o.createElement("div",{className:D.pointer,style:{left:100*n+"%",top:100*(1-s)+"%"}})))}}var L=n(1369);class A extends o.PureComponent{constructor(){super(...arguments),this._container=null,this._refContainer=e=>{this._container=e},this._handlePosition=e=>{const{hsv:{s:t,v:n},onChange:o}=this.props;if(!o)return;const s=(0,f.ensureNotNull)(this._container).getBoundingClientRect(),r=e.clientY-s.top;o({h:(0,P.clamp)(r/s.height,0,1),s:t,v:n})},this._handleKeyDown=e=>{const{hsv:{h:t,s:n,v:o},onChange:s}=this.props,r=(0,B.hashFromEvent)(e);if(!s||38!==r&&40!==r)return;s({h:(0,P.clamp)(38===r?t-.01:t+.01,0,1),s:n,v:o})},this._mouseDown=e=>{window.addEventListener("mouseup",this._mouseUp),window.addEventListener("mousemove",this._mouseMove)},this._mouseUp=e=>{window.removeEventListener("mousemove",this._mouseMove),window.removeEventListener("mouseup",this._mouseUp),this._handlePosition(e)},this._mouseMove=(0,k.default)(this._handlePosition,100),this._handleTouch=e=>{this._handlePosition(e.nativeEvent.touches[0])}}render(){const{className:e,hsv:{h:t}}=this.props;return o.createElement("div",{className:r()(L.hue,a.PLATFORM_ACCESSIBILITY_ENABLED&&L.accessible,e),tabIndex:a.PLATFORM_ACCESSIBILITY_ENABLED?0:-1,onKeyDown:this._handleKeyDown},o.createElement("div",{className:L.pointerContainer,ref:this._refContainer,onMouseDown:this._mouseDown,onTouchStart:this._handleTouch,onTouchMove:this._handleTouch},o.createElement("div",{className:L.pointer,style:{top:100*t+"%"}})))}}var F=n(80679);const W="#000000",V=i.t(null,{context:"Color Picker"},n(40276));class z extends o.PureComponent{constructor(e){super(e),this._inputRef=o.createRef(),this._handleHSV=e=>{const t=function(e){const{h:t,s:n,v:o}=e;let s,r,i;const a=Math.floor(6*t),l=6*t-a,c=o*(1-n),u=o*(1-l*n),d=o*(1-(1-l)*n);switch(a%6){case 0:s=o,r=d,i=c;break;case 1:s=u,r=o,i=c;break;case 2:s=c,r=o,i=d;break;case 3:s=c,r=u,i=o;break;case 4:s=d,r=c,i=o;break;case 5:s=o,r=c,i=u;break;default:s=0,r=0,i=0}return"#"+[255*s,255*r,255*i].map((e=>("0"+Math.round(e).toString(16)).replace(/.+?([a-f0-9]{2})$/i,"$1"))).join("")}(e)||W;this.setState({color:t,inputColor:t.replace(/^#/,""),hsv:e}),this.props.onSelect(t)},this._handleInput=e=>{const t=e.currentTarget.value;try{const e=I(t),n=`#${t}`;this.setState({color:n,inputColor:t,hsv:e}),this.props.onSelect(n)}catch(e){this.setState({inputColor:t})}},this._handleAddColor=()=>this.props.onAdd(this.state.color);const t=e.color||W;this.state={color:t,inputColor:t.replace(/^#/,""),hsv:I(t)}}componentDidMount(){var e ;a.PLATFORM_ACCESSIBILITY_ENABLED&&!g.CheckMobile.any()&&(null===(e=this._inputRef.current)||void 0===e||e.focus())}render(){const{color:e,hsv:t,inputColor:n}=this.state;return o.createElement("div",{className:F.container},o.createElement("div",{className:F.form},o.createElement("div",{className:F.swatch,style:{backgroundColor:e}}),o.createElement("div",{className:F.inputWrap},o.createElement("span",{className:F.inputHash},"#"),o.createElement("input",{ref:this._inputRef,type:"text",className:F.input,value:n,onChange:this._handleInput})),o.createElement("div",{className:F.buttonWrap},o.createElement(T.Button,{size:"s",onClick:this._handleAddColor},V))),o.createElement("div",{className:F.hueSaturationWrap},o.createElement(R,{className:F.saturation,hsv:t,onChange:this._handleHSV}),o.createElement(A,{className:F.hue,hsv:t,onChange:this._handleHSV})))}}var q=n(93402);const K=i.t(null,{context:"Color Picker"},n(53585)),H=i.t(null,{context:"Color Picker"},n(81865));function U(e){const{color:t,opacity:n,selectCustom:s,selectOpacity:i,customColors:c,onRemoveCustomColor:u,onToggleCustom:d,onOpacityChange:p,menu:h}=e,[m,v]=(0,o.useState)(!1),f="number"==typeof n?n:1,[g,b]=(0,l.useRowsNavigation)();return(0,o.useLayoutEffect)((()=>{h&&h.update()}),[i,h]),m?o.createElement(z,{color:t,onSelect:C,onAdd:function(t){v(!1),null==d||d(!1);const{onAddColor:n}=e;n&&n(t)}}):o.createElement("div",{className:q.container},o.createElement("div",{ref:g,onKeyDown:b},o.createElement(x,{colors:y.basic,color:t,onSelect:C}),o.createElement(x,{colors:y.extended,color:t,onSelect:C}),o.createElement("div",{className:q.separator}),o.createElement(x,{colors:c,color:t,onSelect:C,onRemoveCustomColor:u},s&&o.createElement(o.Fragment,null,a.PLATFORM_ACCESSIBILITY_ENABLED?(null==c?void 0:c.length)?o.createElement("button",{title:K,onClick:E,className:r()(q.customButton,q.accessible,"apply-common-tooltip"),tabIndex:-1}):o.createElement("div",{"data-role":"row"},o.createElement("button",{title:K,onClick:E,className:r()(q.customButton,q.accessible,"apply-common-tooltip"),tabIndex:-1})):o.createElement("div",{className:r()(q.customButton,"apply-common-tooltip"),onClick:E,title:K,tabIndex:-1})))),i&&o.createElement(o.Fragment,null,o.createElement("div",{className:q.sectionTitle},H),o.createElement(N.Opacity,{color:t,opacity:f,onChange:function(e){p&&p(e)}})));function C(t){const{onColorChange:n}=e;n&&n(t,m)}function E(e){v(!0),null==d||d(!0)}}},54368:(e,t,n)=>{"use strict";n.d(t,{Opacity:()=>u});var o=n(50959),s=n(97754),r=n(50151),i=n(37160),a=n(68335),l=n(16838),c=n(30099);class u extends o.PureComponent{constructor(e){super(e),this._container=null,this._pointer=null,this._raf=null,this._refContainer=e=>{this._container=e},this._refPointer=e=>{this._pointer=e},this._handlePosition=e=>{null===this._raf&&(this._raf=requestAnimationFrame((()=>{const t=(0,r.ensureNotNull)(this._container),n=(0,r.ensureNotNull)(this._pointer),o=t.getBoundingClientRect(),s=n.offsetWidth,a=e.clientX-s/2-o.left,l=(0,i.clamp)(a/(o.width-s),0,1);this.setState({ @@ -31,7 +31,7 @@ className:d()(v.input,v.sessionInputContainer),name:"start",value:(0,r.ensureDef const{input:e,value:t,disabled:r,hasTooltip:i}=this.props,a=A.Interval.parse(void 0===t?e.defval:t),l=a.isValid()?a.value():t,c=W?W.get().filter((e=>!A.Interval.parse(e).isRange())):[],u=(0,F.mergeResolutions)(V,(0,F.isSecondsEnabled)()?z:[],(0,F.isTicksEnabled)()?q:[],c);return u.unshift(""),s.createElement(B.Select,{id:e.id,className:d()(v.input,v.resolution,i&&v.hasTooltip),menuClassName:d()(v.dropdownMenu,v.resolution),items:(p=u,p.map((e=>({value:e,content:""===e?o.t(null,void 0,n(94551)):(0,F.getTranslatedResolutionModel)(e).hint})))),value:l,onChange:this._onChange,disabled:r});var p}}const H=(0,h.bind)(K);var U=n(41552),Z=n(41594);class G extends s.PureComponent{render(){return s.createElement(k.PropertyContext.Consumer,null,(e=>e?this._getColorInputWithContext(e):null))}_getColorInputWithContext(e){var t;const{input:{id:n},disabled:o,hasTooltip:r}=this.props,{model:i,study:a}=e;if("properties"in a||"tempProperties"in a){const e="properties"in a?a.properties().inputs[n]:null===(t=a.tempProperties)||void 0===t?void 0:t.inputs.child(n);return s.createElement(Z.StylePropertyContainer,{model:i,property:e},s.createElement(U.ColorWithThicknessSelect,{className:d()(r&&v.hasTooltip),color:e,disabled:o}))}return null}}var Y=n(85528),$=n(76056),j=n(23935),Q=n(27365),X=n(93071);const J=(0,h.bind)((function(e){const{value:t,onChange:n,input:o,tzName:r,hasTooltip:i}=e,{id:a,name:l,defval:c}=o,u=(0,s.useMemo)((()=>Number(null!=t?t:c)),[t,c]),p=(0,s.useMemo)((()=>(0,Q.getChartTimezoneOffsetMs)(u,r)),[u,r]),h=(0,s.useMemo)((()=>{const e=new Date(u+p+v(u));return e.setSeconds(0),e}),[u,p]),m=(0,s.useMemo)((()=>(0,j.twoDigitsFormat)(h.getHours())+":"+(0,j.twoDigitsFormat)(h.getMinutes())),[h]);return s.createElement("div",{className:d()(X.container,i&&X.hasTooltip)},s.createElement("div",{className:X.datePickerWrapper},s.createElement(Y.DatePicker,{InputComponent:$.DateInput,initial:h,onPick:function(e){if(null===e)return;const t=new Date(h);t.setFullYear(e.getFullYear()),t.setMonth(e.getMonth()),t.setDate(e.getDate()),n(f(t),a,l)},revertInvalidData:!0})),s.createElement("div",{className:X.timePickerWrapper},s.createElement(w.TimeInput,{value:m,onChange:function(e){const[t,o]=e.split(":"),s=new Date(h);s.setHours(Number(t)),s.setMinutes(Number(o)),n(f(s),a,l)}})));function v(e){return 60*new Date(e).getTimezoneOffset()*1e3}function f(e){return e.valueOf()-p-v(u)}}));class ee extends s.PureComponent{render(){const{input:e,disabled:t,onChange:n,tzName:o,hasTooltip:r}=this.props;if((0,i.isStudyInputOptionsInfo)(e))return s.createElement(D,{input:e,disabled:t,onChange:n,hasTooltip:r});switch(e.type){case"integer":return s.createElement(a.IntegerInput,{input:e,disabled:t,onChange:n,hasTooltip:r});case"float":case"price":return s.createElement(l.FloatInput,{input:e,disabled:t,onChange:n,hasTooltip:r});case"bool":return s.createElement(c.BoolInput,{input:e,disabled:t,onChange:n,hasTooltip:r});case"text":return s.createElement(b,{input:e,disabled:t,onChange:n,hasTooltip:r});case"symbol":return s.createElement(C.SymbolInput,{input:e, disabled:t,onChange:n,hasTooltip:r});case"session":return s.createElement(x,{input:e,disabled:t,onChange:n,hasTooltip:r});case"source":return s.createElement(L,{input:e,disabled:t,onChange:n,hasTooltip:r});case"resolution":return s.createElement(H,{input:e,disabled:t,onChange:n,hasTooltip:r});case"time":return s.createElement(J,{input:e,tzName:o,onChange:n,hasTooltip:r});case"color":return s.createElement(G,{input:e,disabled:t,onChange:n,hasTooltip:r});default:return null}}}var te=n(24150),ne=n(76694);class oe extends s.PureComponent{render(){const{label:e,children:t,input:i,disabled:a,onChange:l,labelAlign:c,grouped:u,tooltip:d,solutionId:p,offset:h}=this.props,m=Boolean(d);return s.createElement(y.PropertyTable.Row,null,s.createElement(y.PropertyTable.Cell,{"data-study-input-name":(null==i?void 0:i.id)&&`${i.id}-label`,placement:"first",verticalAlign:c,grouped:u,offset:h},void 0!==e?e:o.t((0,r.ensureDefined)(i).name,{context:"input"},n(88601))),s.createElement(y.PropertyTable.Cell,{"data-study-input-name":(null==i?void 0:i.id)&&`${i.id}-input`,placement:"last",grouped:u},t||s.createElement(ee,{input:(0,r.ensureDefined)(i),onChange:l,disabled:a,hasTooltip:m}),m&&s.createElement(ne.IconGroupWrapper,null,d&&s.createElement(te.InputTooltip,{title:d}),!1)))}}},39828:(e,t,n)=>{"use strict";n.d(t,{InputsTabContent:()=>V});var o,s=n(50959),r=n(50151),i=n(11542),a=n(76917),l=n(11062),c=n(59416),u=n(97754),d=n.n(u),p=n(88400),h=n.n(p);const m=(0,c.makeSwitchGroupItem)(((o=class extends s.PureComponent{constructor(){super(...arguments),this._onChange=()=>{this.props.onChange&&this.props.onChange(this.props.value)}}render(){const e=u(this.props.className,h().radio,{[h().reverse]:Boolean(this.props.labelPositionReverse)}),t=u(h().label,{[h().disabled]:this.props.disabled}),n=u(h().box,{[h().noOutline]:-1===this.props.tabIndex});let o=null;return this.props.label&&(o=s.createElement("span",{className:t},this.props.label)),s.createElement("label",{className:e},s.createElement("span",{className:h().wrapper,title:this.props.title},s.createElement("input",{id:this.props.id,tabIndex:this.props.tabIndex,autoFocus:this.props.autoFocus,role:this.props.role,className:h().input,type:"radio",name:this.props.name,checked:this.props.checked,disabled:this.props.disabled,value:this.props.value,onChange:this._onChange,ref:this.props.reference,"aria-describedby":this.props["aria-describedby"],"aria-invalid":this.props["aria-invalid"]}),s.createElement("span",{className:n})),o)}}).defaultProps={value:"on"},o));var v=n(55141),f=n(83207),g=n(24150),b=n(76694),C=n(27698);function y(e){const{children:t,input:o,disabled:u,onChange:d,grouped:p,tooltip:h,solutionId:y}=e,E=(0,s.useContext)(a.PropertyContext),{values:w,setValue:_}=(0,r.ensureNotNull)(E),S=w[o.id],[x,N]=(0,s.useState)(S?"another-symbol":"main-symbol"),[T,I]=(0,s.useState)(S),k=Boolean(h);return(0,s.useEffect)((()=>{S&&I(S)}),[S]),s.createElement(c.SwitchGroup,{name:`symbol-source-${o.id}`,values:[x],onChange:function(e){N(e),"main-symbol"===e?(0, f.setter)(_)("",o.id,o.name):"another-symbol"===e&&T&&(0,f.setter)(_,d)(T,o.id,o.name)}},s.createElement(l.PropertyTable.Row,null,s.createElement(l.PropertyTable.Cell,{colSpan:2,placement:"first",grouped:p,"data-study-input-name":(null==o?void 0:o.id)&&`${o.id}-main-symbol`},s.createElement(m,{value:"main-symbol",className:C.checkbox,disabled:u,label:s.createElement("span",{className:C.label},i.t(null,{context:"input"},n(88046)))}))),s.createElement(l.PropertyTable.Row,null,s.createElement(l.PropertyTable.Cell,{placement:"first",grouped:p,"data-study-input-name":(null==o?void 0:o.id)&&`${o.id}-another-symbol-label`},s.createElement(m,{value:"another-symbol",className:C.checkbox,disabled:u,label:s.createElement("span",{className:C.label},i.t(null,{context:"input"},n(73755)))})),s.createElement(l.PropertyTable.Cell,{placement:"last",grouped:p,"data-study-input-name":(null==o?void 0:o.id)&&`${o.id}-another-symbol-input`},t||s.createElement(v.SymbolInput,{input:(0,r.ensureDefined)(o),onChange:d,disabled:u||"main-symbol"===x,hasTooltip:k}),k&&s.createElement(b.IconGroupWrapper,null,h&&s.createElement(g.InputTooltip,{title:h}),!1))))}var E=n(4781);class w extends s.PureComponent{render(){const{label:e,input:t,tooltip:n,solutionId:o}=this.props,r=Boolean(n);return s.createElement(l.PropertyTable.Row,null,s.createElement(l.PropertyTable.Cell,{placement:"first",colSpan:2,"data-study-input-name":(null==t?void 0:t.id)&&`${t.id}-checkbox`},s.createElement(E.BoolInput,{label:e,input:t,hasTooltip:r}),r&&s.createElement(b.IconGroupWrapper,null,n&&s.createElement(g.InputTooltip,{title:n}),!1)))}}var _=n(12949),S=n(2568),x=n(67029),N=n(90009);class T extends s.PureComponent{constructor(){super(...arguments),this._onChange=e=>{const{input:{id:t,name:n},onChange:o}=this.props;o(e.currentTarget.value,t,n)}}render(){const{input:{defval:e},value:t,disabled:n,onBlur:o,onKeyDown:r}=this.props;return s.createElement(S.Textarea,{className:d()(C.input,C.textarea,x.InputClasses.FontSizeMedium),value:void 0===t?e:t,onChange:this._onChange,onBlur:o,onKeyDown:r,disabled:n,maxLength:4096})}}const I=(0,N.debounced)(T),k=(0,f.bind)(I);var B=n(80128);function P(e){const{input:t,label:n,tooltip:o,solutionId:r}=e,i=Boolean(o);return s.createElement(l.PropertyTable.Row,null,s.createElement(l.PropertyTable.Cell,{placement:"first",colSpan:2,className:B.wrap,"data-study-input-name":(null==t?void 0:t.id)&&`${t.id}-textarea`},s.createElement("div",{className:B.labelWrap},s.createElement("span",{className:d()(B.label,i&&B.hasTooltip)},n),i&&s.createElement(b.IconGroupWrapper,null,o&&s.createElement(g.InputTooltip,{title:o}),!1)),s.createElement(k,{input:t})))}function D(e){const{input:t,tooltip:o,solutionId:r}=e;return"symbol"===t.type&&t.optional?s.createElement(y,{input:t,tooltip:o,solutionId:r}):"bool"===t.type?s.createElement(w,{label:i.t(t.name,{context:"input"},n(88601)),input:t,tooltip:o,solutionId:r}):"text_area"===t.type?s.createElement(P,{label:i.t(t.name,{context:"input"},n(88601)),input:t,tooltip:o,solutionId:r}):s.createElement(_.InputRow,{ -labelAlign:function(e){switch(e){case"session":return"adaptive";case"time":return"topCenter";default:return}}(t.type),input:t,tooltip:o,solutionId:r})}var M=n(86067),O=n(17611);function R(e){const{content:t}=e;let n;return s.createElement(l.PropertyTable.InlineRowContext.Provider,{value:!0},s.createElement("div",{className:O.inlineRow},t.children.map(((e,o)=>(void 0!==e.tooltip&&(n=e.tooltip),s.createElement(D,{key:e.id,input:e,tooltip:o===t.children.length-1?n:void 0}))))))}var L=n(64420),A=n(26278);function F(e){const{content:t}=e;return(0,L.isGroup)(t)?(0,L.isInputInlines)(t)?s.createElement(R,{content:t}):s.createElement(s.Fragment,null,s.createElement("div",{className:A.titleWrap},s.createElement(M.GroupTitleSection,{title:i.t(t.id,{context:"input"},n(88601)),name:t.id})),t.children.map((e=>(0,L.isGroup)(e)?s.createElement(R,{key:e.id,content:e}):s.createElement(D,{key:e.id,input:e,tooltip:e.tooltip,solutionId:e.solutionId}))),s.createElement("div",{className:A.groupFooter})):s.createElement(D,{input:t,tooltip:t.tooltip,solutionId:t.solutionId})}const W={offset:i.t(null,void 0,n(89298))};class V extends s.PureComponent{render(){const{reference:e,inputs:t,property:n,study:o,studyMetaInfo:i,model:a,onStudyInputChange:c,className:u}=this.props,{offset:d,offsets:p}=n;return s.createElement(l.PropertyTable,{reference:e,className:u},s.createElement(z,{study:o,model:a,property:n.inputs,inputs:t,onStudyInputChange:c}),d&&this._createOffsetSection(d,(0,r.ensureDefined)(i.offset)),p&&p.childNames().map((e=>{var t;const n=p.childs()[e];return this._createOffsetSection(n,(0,r.ensureDefined)(null===(t=i.offsets)||void 0===t?void 0:t[e]))})))}_createOffsetSection(e,t){const n=e.childs();return s.createElement(z,{key:`offset_${t.title}`,study:this.props.study,model:this.props.model,inputs:[q(n,t)],property:e})}}function z(e){const{study:t,model:n,inputs:o,property:r,onStudyInputChange:i}=e,l=o,c=(0,s.useMemo)((()=>(0,L.getInputGroups)(l)),[l]);return s.createElement(a.PropertyContainer,{property:r,study:t,model:n,onStudyInputChange:i},!1,!1,c.map((e=>s.createElement(s.Fragment,{key:e.id},s.createElement(F,{content:e}),!1))))}function q(e,t){return{id:"val",name:t.title||W.offset,defval:e.val.value(),type:"integer",min:t.min,max:t.max}}},4781:(e,t,n)=>{"use strict";n.d(t,{BoolInput:()=>u,BoolInputComponent:()=>c});var o=n(50959),s=n(15294),r=n(97754),i=n.n(r),a=n(83207),l=n(27698);class c extends o.PureComponent{constructor(){super(...arguments),this._onChange=()=>{const{input:{id:e,name:t},value:n,onChange:o}=this.props;o(!n,e,t)}}render(){const{input:{defval:e},value:t,disabled:n,label:r,hasTooltip:a}=this.props,c=void 0===t?e:t;return o.createElement(s.Checkbox,{className:i()(l.checkbox,a&&l.hasTooltip),disabled:n,checked:c,onChange:this._onChange,label:o.createElement("span",{className:l.label},r),labelAlignBaseline:!0})}}const u=(0,a.bind)(c)},90009:(e,t,n)=>{"use strict";n.d(t,{debounced:()=>r});var o=n(50959);const s={blur:0,commit:0,change:1/0};function r(e,t=s){return class extends o.PureComponent{constructor(e){ +labelAlign:function(e){switch(e){case"session":return"adaptive";case"time":return"topCenter";default:return}}(t.type),input:t,tooltip:o,solutionId:r})}var M=n(86067),O=n(17611);function R(e){const{content:t}=e;let n;return s.createElement(l.PropertyTable.InlineRowContext.Provider,{value:!0},s.createElement("div",{className:O.inlineRow},t.children.map(((e,o)=>(void 0!==e.tooltip&&(n=e.tooltip),s.createElement(D,{key:e.id,input:e,tooltip:o===t.children.length-1?n:void 0}))))))}var L=n(64420),A=n(26278);function F(e){const{content:t}=e;return(0,L.isGroup)(t)?(0,L.isInputInlines)(t)?s.createElement(R,{content:t}):s.createElement(s.Fragment,null,s.createElement("div",{className:A.titleWrap},s.createElement(M.GroupTitleSection,{title:i.t(t.id,{context:"input"},n(88601)),name:t.id})),t.children.map((e=>(0,L.isGroup)(e)?s.createElement(R,{key:e.id,content:e}):s.createElement(D,{key:e.id,input:e,tooltip:e.tooltip,solutionId:e.solutionId}))),s.createElement("div",{className:A.groupFooter})):s.createElement(D,{input:t,tooltip:t.tooltip,solutionId:t.solutionId})}const W={offset:i.t(null,void 0,n(89298))};class V extends s.PureComponent{render(){const{reference:e,inputs:t,property:n,study:o,studyMetaInfo:i,model:a,onStudyInputChange:c,className:u}=this.props,{offset:d,offsets:p}=n;return s.createElement(l.PropertyTable,{reference:e,className:u},s.createElement(z,{study:o,model:a,property:n.inputs,inputs:t,onStudyInputChange:c}),d&&this._createOffsetSection(d,(0,r.ensureDefined)(i.offset)),p&&p.childNames().map((e=>{var t;const n=p.childs()[e];return this._createOffsetSection(n,(0,r.ensureDefined)(null===(t=i.offsets)||void 0===t?void 0:t[e]))})))}_createOffsetSection(e,t){const n=e.childs();return s.createElement(z,{key:`offset_${t.title}`,study:this.props.study,model:this.props.model,inputs:[q(n,t)],property:e})}}function z(e){const{study:t,model:n,inputs:o,property:r,onStudyInputChange:i}=e,l=o,c=(0,s.useMemo)((()=>(0,L.getInputGroups)(l)),[l]);return s.createElement(a.PropertyContainer,{property:r,study:t,model:n,onStudyInputChange:i},!1,!1,c.map((e=>s.createElement(s.Fragment,{key:e.id},s.createElement(F,{content:e}),!1))))}function q(e,t){return{id:"val",name:t.title||W.offset,defval:e.val.value(),type:"integer",min:t.min,max:t.max}}},4781:(e,t,n)=>{"use strict";n.d(t,{BoolInput:()=>u,BoolInputComponent:()=>c});var o=n(50959),s=n(32389),r=n(97754),i=n.n(r),a=n(83207),l=n(27698);class c extends o.PureComponent{constructor(){super(...arguments),this._onChange=()=>{const{input:{id:e,name:t},value:n,onChange:o}=this.props;o(!n,e,t)}}render(){const{input:{defval:e},value:t,disabled:n,label:r,hasTooltip:a}=this.props,c=void 0===t?e:t;return o.createElement(s.Checkbox,{className:i()(l.checkbox,a&&l.hasTooltip),disabled:n,checked:c,onChange:this._onChange,label:o.createElement("span",{className:l.label},r),labelAlignBaseline:!0})}}const u=(0,a.bind)(c)},90009:(e,t,n)=>{"use strict";n.d(t,{debounced:()=>r});var o=n(50959);const s={blur:0,commit:0,change:1/0};function r(e,t=s){return class extends o.PureComponent{constructor(e){ super(e),this._onChange=(e,n,o)=>{const s=t.change;s?(clearTimeout(this._timeout),this.setState({value:e},(()=>{s!==1/0&&(this._timeout=setTimeout((()=>this._flush()),s))}))):this._flush(e)},this._onBlur=()=>{this._debounce(t.blur);const{onBlur:e}=this.props;e&&e()},this._onKeyDown=e=>{13===e.keyCode&&this._debounce(t.commit)},this.state={prevValue:e.value,value:e.value}}componentWillUnmount(){this._flush()}render(){const{value:t}=this.state;return o.createElement(e,{...this.props,value:t,onChange:this._onChange,onBlur:this._onBlur,onKeyDown:this._onKeyDown})}static getDerivedStateFromProps(e,t){return e.value===t.prevValue?t:{prevValue:e.value,value:e.value}}_debounce(e){e?(clearTimeout(this._timeout),e!==1/0&&(this._timeout=setTimeout((()=>this._flush()),e))):this.setState((e=>{this._flush(e.value)}))}_flush(e){const{input:{id:t,name:n},onChange:o}=this.props,{prevValue:s,value:r}=this.state;clearTimeout(this._timeout);const i=void 0!==e?e:r;void 0!==i&&i!==s&&o(i,t,n)}}}},47510:(e,t,n)=>{"use strict";n.d(t,{FloatInput:()=>p,FloatInputComponent:()=>d});var o=n(50959),s=n(97754),r=n.n(s),i=n(95052),a=n(83207),l=n(90009),c=n(27698);class u extends o.PureComponent{render(){const{hasTooltip:e}=this.props;return o.createElement(i.NumericInput,{...this.props,className:r()(c.input,e&&c.hasTooltip),stretch:!1})}}const d=(0,l.debounced)(u,{change:1/0,commit:0,blur:0}),p=(0,a.bind)(d)},96438:(e,t,n)=>{"use strict";n.d(t,{IntegerInput:()=>p,IntegerInputComponent:()=>d});var o=n(50959),s=n(97754),r=n.n(s),i=n(83207),a=n(90009),l=n(95052),c=n(27698);class u extends o.PureComponent{render(){const{hasTooltip:e}=this.props;return o.createElement(l.NumericInput,{...this.props,mode:"integer",className:r()(c.input,e&&c.hasTooltip),stretch:!1})}}const d=(0,a.debounced)(u,{change:1/0,commit:0,blur:0}),p=(0,i.bind)(d)},95052:(e,t,n)=>{"use strict";n.d(t,{NumericInput:()=>C});var o=n(50959),s=n(50151),r=n(11542),i=n(60521),a=n(49483),l=n(92399),c=n(82161),u=n(38223);var d=n(87663),p=n(37160);const h=new class{constructor(e=" "){this._divider=e}format(e){const t=(0,c.splitThousands)(e,this._divider);return(0,u.isRtl)()?(0,u.startWithLTR)(t):t}parse(e){const t=(0,u.stripLTRMarks)(e).split(this._divider).join(""),n=Number(t);return isNaN(n)||/e/i.test(t)?{res:!1}:{res:!0,value:n,suggest:this.format(n)}}},m=/^-?[0-9]*$/,v=9e15;class f extends o.PureComponent{constructor(e){super(e),this._onFocus=e=>{this.setState({focused:!0}),this.props.onFocus&&this.props.onFocus(e)},this._onBlur=e=>{this.setState({focused:!1}),!1!==this.props.shouldApplyValueOnBlur&&(this.setState({displayValue:g(this.props,this.props.value)}),this.props.errorHandler&&this.props.errorHandler(!1)),this.props.onBlur&&this.props.onBlur(e)},this._onValueChange=e=>{const t=e.target.value;if(void 0!==this.props.onEmptyString&&""===t&&this.props.onEmptyString(),"integer"===this.props.mode&&!m.test(t))return;const n=b(t,this.props.formatter),o=n.res?this._checkValueBoundaries(n.value):{isPassed:!1,msg:void 0 },s=n.res&&!o.isPassed,r=n.res&&n.suggest&&!this.state.focused?n.suggest:t,i=s&&o.msg?o.msg:this._errMsg;this.setState({displayValue:r,errorMsg:i}),n.res&&o.isPassed&&this.props.onValueChange(n.value,"input"),this.props.errorHandler&&this.props.errorHandler(!n.res||s)},this._onValueByStepChange=e=>{const{roundByStep:t=!0,step:n=1,uiStep:o,min:s=n,formatter:r}=this.props,a=b(this.state.displayValue,r),l=null!=o?o:n;let c=n;if(a.res){const o=new i.Big(a.value),r=o.minus(s).mod(n);let u=o.plus(e*l);!r.eq(0)&&t&&(u=u.plus((e>0?0:1)*l).minus(r)),c=u.toNumber()}const{isPassed:u,clampedValue:d}=this._checkValueBoundaries(c);c=u?c:d,this.setState({displayValue:g(this.props,c)}),this.props.onValueChange(c,"step"),this.props.errorHandler&&this.props.errorHandler(!1)};const{value:t}=e;this._errMsg=r.t(null,void 0,n(35563)),this.state={value:t,displayValue:g(e,t),focused:!1,errorMsg:this._errMsg}}render(){var e;return o.createElement(l.NumberInputView,{id:this.props.id,inputMode:null!==(e=this.props.inputMode)&&void 0!==e?e:this.state.inputMode,borderStyle:this.props.borderStyle,fontSizeStyle:this.props.fontSizeStyle,value:this.state.displayValue,forceShowControls:this.props.forceShowControls,className:this.props.className,inputClassName:this.props.inputClassName,button:this.props.button,placeholder:this.props.placeholder,innerLabel:this.props.innerLabel,endSlot:this.props.endSlot,disabled:this.props.disabled,warning:this.props.warning,error:this.props.error,autoComplete:this.props.autoComplete,errorMessage:this.props.errorMessage||this.state.errorMsg,onValueChange:this._onValueChange,onValueByStepChange:this._onValueByStepChange,containerReference:this.props.containerReference,inputReference:this.props.inputReference,onClick:this.props.onClick,onFocus:this._onFocus,onBlur:this._onBlur,onKeyDown:this.props.onKeyDown,controlDecKeyCodes:this.props.controlDecKeyCodes,controlIncKeyCodes:this.props.controlIncKeyCodes,title:this.props.title,intent:this.props.intent,highlight:this.props.highlight,highlightRemoveRoundBorder:this.props.highlightRemoveRoundBorder,stretch:this.props.stretch,autoSelectOnFocus:!a.CheckMobile.any(),"data-name":this.props["data-name"]})}componentDidMount(){this.setState({inputMode:a.CheckMobile.iOS()?void 0:"numeric"})}getClampedValue(){const{min:e=-1/0,max:t=v}=this.props,n=b(this.state.displayValue,this.props.formatter);return n.res?(0,p.clamp)(n.value,e,t):null}static getDerivedStateFromProps(e,t){const{alwaysUpdateValueFromProps:n,value:o}=e;return t.focused&&!n||t.value===o?null:{value:o,displayValue:g(e,o)}}_checkValueBoundaries(e){var t,o,s,i;const{min:a=-1/0,max:l=v}=this.props,c=function(e,t,n){const o=e>=t,s=e<=n;return{passMin:o,passMax:s,pass:o&&s,clamped:(0,p.clamp)(e,t,n)}}(e,a,l);let u;return c.passMax||(u=null!==(o=null===(t=this.props.boundariesErrorMessages)||void 0===t?void 0:t.greaterThanMax)&&void 0!==o?o:r.t(null,{replace:{max:String(l)}},n(2607))),c.passMin||(u=null!==(i=null===(s=this.props.boundariesErrorMessages)||void 0===s?void 0:s.lessThanMin)&&void 0!==i?i:r.t(null,{replace:{ min:String(a)}},n(53669))),{isPassed:c.pass,msg:u,clampedValue:c.clamped}}}function g(e,t){const{useFormatter:n=!0,formatter:o,mode:s}=e;return n&&"integer"!==s?function(e,t=h){return null!==e?t.format(e):""}(t,o):function(e){if(null===e)return"";return d.NumericFormatter.formatNoE(e)}(t)}function b(e,t=h){return t.parse?t.parse(e):{res:!1,error:"Formatter does not support parse"}}class C extends o.PureComponent{constructor(){super(...arguments),this._container=null,this._handleContainerRef=e=>this._container=e,this._onChange=(e,t)=>{const{input:{id:n,name:o},onChange:s,onBlur:r}=this.props;s(e,n,o),"step"===t&&r&&r()},this._onBlur=e=>{const{onBlur:t}=this.props;if(t){const n=(0,s.ensureNotNull)(this._container);n.contains(document.activeElement)||n.contains(e.relatedTarget)||t()}}}render(){const{input:{defval:e,min:t,max:n,step:s},value:r,disabled:i,onKeyDown:a,className:l,mode:c,stretch:u}=this.props;return o.createElement(f,{className:l,value:Number(void 0===r?e:r),min:t,max:n,step:s,mode:c,onBlur:this._onBlur,onValueChange:this._onChange,onKeyDown:a,disabled:i,containerReference:this._handleContainerRef,fontSizeStyle:"medium",roundByStep:!1,stretch:u})}}},55141:(e,t,n)=>{"use strict";n.d(t,{SymbolInput:()=>d,getInternalSymbolName:()=>c});var o=n(50959),s=n(50151),r=n(76917),i=n(83207),a=n(73146),l=n(48897);function c(e,t){const n=(0,a.createAdapter)(t).resolvedSymbolInfoBySymbol(e);return n&&(n.ticker||n.full_name)?n.ticker||n.full_name:e}function u(e,t){const n=(0,a.createAdapter)(t).resolvedSymbolInfoBySymbol(e);return null===n?e:n.name}const d=(0,i.bind)((function(e){const t=(0,o.useContext)(r.PropertyContext),{study:n}=(0,s.ensureNotNull)(t),{input:{defval:i},value:a}=e;return o.createElement(l.SymbolInputsButton,{...e,value:u(a||i||"",n),study:n})}))},41552:(e,t,n)=>{"use strict";n.d(t,{ColorWithThicknessSelect:()=>f});var o=n(50959),s=n(24377),r=n(11542),i=n(36298),a=n(87095),l=n(41594),c=n(58593),u=n(17948),d=n(51768);const p=new i.TranslatedString("change thickness",r.t(null,void 0,n(95657))),h=new i.TranslatedString("change color",r.t(null,void 0,n(13066))),m=new i.TranslatedString("change opacity",r.t(null,void 0,n(17023))),v=[1,2,3,4];class f extends o.PureComponent{constructor(){super(...arguments),this._trackEventLabel=null,this._getTransparencyValue=()=>{const{transparency:e}=this.props;return e?e.value():0},this._getOpacityValue=()=>{const{color:e}=this.props,t=(0,u.getPropertyValue)(e);if(t)return(0,a.isHexColor)(t)?(0,a.transparencyToAlpha)(this._getTransparencyValue()):(0,s.parseRgba)(t)[3]},this._getColorValueInHex=()=>{const{color:e}=this.props,t=(0,u.getPropertyValue)(e);return t?(0,a.isHexColor)(t)?t:(0,s.rgbToHexString)((0,s.parseRgb)(t)):null},this._onThicknessChange=e=>{const{thickness:t}=this.props;void 0!==t&&this._setProperty(t,e,p)},this._onColorChange=e=>{const{color:t,isPaletteColor:n}=this.props,o=(0,u.getPropertyValue)(t);let r=0;o&&(r=(0,a.isHexColor)(o)?this._getTransparencyValue():(0,a.alphaToTransparency)((0,s.parseRgba)(o)[3])),this._setProperty(t,(0, diff --git a/charting_library/bundles/floating-toolbars.d32b5098422df02a6688.js b/charting_library/bundles/floating-toolbars.96ac7a46b7738535bc92.js similarity index 85% rename from charting_library/bundles/floating-toolbars.d32b5098422df02a6688.js rename to charting_library/bundles/floating-toolbars.96ac7a46b7738535bc92.js index ae2482b5..b2fe9617 100644 --- a/charting_library/bundles/floating-toolbars.d32b5098422df02a6688.js +++ b/charting_library/bundles/floating-toolbars.96ac7a46b7738535bc92.js @@ -14,14 +14,14 @@ return this._canBeShownValue.readonly()}_onFavoriteAdded(e){this.addWidget(this. this._containment=e.containment}destroy(){const e=this._source;e.classList.remove("ui-draggable"),e.classList.remove("ui-draggable-dragging");this._handle.classList.remove("ui-draggable-handle"),this._backend.destroy(),null!==this._helper&&(this._helper.raf&&cancelAnimationFrame(this._helper.raf),this._helper=null)}}class g{constructor(e){this._initial=null,this._handlePointerDown=e=>{if(null!==this._initial)return;if(!(e.target instanceof Element&&this._handle.contains(e.target)))return;if(this._initial=e,!this._dispatchEvent(this._createEvent("pointer-drag-start",e)))return void(this._initial=null);e.preventDefault();const t=this._getEventTarget();t.addEventListener("pointermove",this._handlePointerMove),t.addEventListener("pointerup",this._handlePointerUp),t.addEventListener("pointercancel",this._handlePointerUp),t.addEventListener("lostpointercapture",this._handlePointerUp),t.setPointerCapture(e.pointerId)},this._handlePointerMove=e=>{null!==this._initial&&this._initial.pointerId===e.pointerId&&(e.preventDefault(),this._dispatchEvent(this._createEvent("pointer-drag-move",e)))},this._handlePointerUp=e=>{if(null===this._initial||this._initial.pointerId!==e.pointerId)return;e.preventDefault();const t=this._getEventTarget();t.removeEventListener("pointermove",this._handlePointerMove),t.removeEventListener("pointerup",this._handlePointerUp),t.removeEventListener("pointercancel",this._handlePointerUp),t.removeEventListener("lostpointercapture",this._handlePointerUp),t.releasePointerCapture(this._initial.pointerId),this._dispatchEvent(this._createEvent("pointer-drag-stop",e)),this._initial=null};const t=this._handle=e.handle;this._onDragStart=e.onDragStart,this._onDragMove=e.onDragMove,this._onDragStop=e.onDragStop,t.style.touchAction="none";this._getEventTarget().addEventListener("pointerdown",this._handlePointerDown)}destroy(){this._handle.style.touchAction="";const e=this._getEventTarget();e.removeEventListener("pointerdown",this._handlePointerDown),e.removeEventListener("pointermove",this._handlePointerMove),e.removeEventListener("pointerup",this._handlePointerUp),e.removeEventListener("pointercancel",this._handlePointerUp),e.removeEventListener("lostpointercapture",this._handlePointerUp),null!==this._initial&&(e.releasePointerCapture(this._initial.pointerId),this._initial=null)}_getEventTarget(){return p.CheckMobile.iOS()||(0,p.isMac)()&&n.touch?window.document.documentElement:this._handle}_dispatchEvent(e){switch(e.type){case"pointer-drag-start":this._onDragStart(e);break;case"pointer-drag-move":this._onDragMove(e);break;case"pointer-drag-stop":this._onDragStop(e)}return!e.defaultPrevented}_createEvent(e,t){return(0,d.assert)(null!==this._initial),new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:{backend:this,initial:this._initial,current:t}})}}var v=o(70027),_=o(25388);o(19619) ;const w="floating-toolbar-react-widgets",f=`
${_}
`;class y{constructor(e){this._widget=document.createElement("div"),this._isVertical=!1,this._hiddingTimeoutId=null,this._visibility=new l.WatchedValue(!1),this._windowResizeListener=this._onWindowResize.bind(this),this._responsiveResizeFunction=null,this._showTimeStamp=null,this._draggable=null,this._preventClickUntilAnimation=e=>{null!==this._showTimeStamp&&performance.now()-this._showTimeStamp{this.isVisible()&&this._widget.classList.remove("i-closed")}))):this._widget.classList.remove("i-closed"),this._onWindowResize())}hide(e=!1){if(!this.isVisible())return;const t=this._widget.classList.contains("i-closed");if(this._widget.classList.add("i-closed"),this._visibility.setValue(!1),e||t)this._setHiddingTimeout(null),this._widget.classList.add("i-hidden");else{const e=setTimeout((()=>{this._setHiddingTimeout(null),this._widget.classList.add("i-hidden")}),this.hideDuration());this._setHiddingTimeout(e)}window.removeEventListener("resize",this._windowResizeListener)}raise(){y._toolbars.length+y._startZIndex!==this._zIndex()&&(y._toolbars.splice(y._toolbars.indexOf(this),1),y._toolbars.push(this),y._updateAllZIndexes())}hideDuration(){ return.75*r.dur}addWidget(e,t={}){const o=this.widgetsCount();if(void 0===t.index&&(t.index=o),t.index<0||t.index>o)throw new Error(`Index must be in [0, ${o}]`);const i=document.createElement("div");i.className="tv-floating-toolbar__widget js-widget",i.appendChild(e);const n=t.index===o?null:this._content.childNodes.item(t.index);this._content.insertBefore(i,n),this._onWindowResize()}getReactWidgetContainer(){return this._reactWidgetsContainer}removeWidget(e){const t=this._findWrapperForWidget(e);t&&(this._content.removeChild(t),this._onWindowResize())}widgetsCount(){return this._content.childNodes.length}showWidget(e){const t=this._findWrapperForWidget(e);t&&t.classList.remove("i-hidden")}hideWidget(e){const t=this._findWrapperForWidget(e);t&&t.classList.add("i-hidden")}removeWidgets(){for(;this._content.firstChild;)this._content.removeChild(this._content.firstChild);this._onWindowResize()}onContextMenu(e){if(n.mobiletouch){(new c).load().then((t=>{const o=new t(this._widget);o.get("press").set({time:500}),o.on("press",(t=>{this._preventWidgetTouchEndEvent(),e(t.srcEvent)}))}))}else this._widget.addEventListener("contextmenu",e)}checkPosition(){const e=this._getCorrectedWidgetRect(),t={left:e.left,top:e.top};this._correctPosition(t),e.left===t.left&&e.top===t.top||(this._widget.style.left=t.left+"px",this._widget.style.top=t.top+"px")}_determineCurrentLayoutVertical(e){const t=this._isVertical?e.height:e.width;return window.innerWidthe.left&&(e.left=Math.min(e.left+i,o.left)),n<0?e.top=Math.max(0,window.innerHeight-t.height):o&&o.top>e.top&&(e.top=Math.min(e.top+n,o.top))}_getCorrectedWidgetRect(){const e=this._widget.getBoundingClientRect();if(this._widget.classList.contains("i-closed")){const t=1/.925-1,o=e.width*t,i=e.height*t;return{bottom:e.bottom+i/2,height:e.height+i,left:e.left-o/2,right:e.right+o/2,top:e.top-i/2,width:e.width+o}}return e}_getSavedPosition(){var e;let t;if("device"===this._options.positionStorageType){const e=h.TVLocalStorage.getItem(this._options.positionSettingsKey);t=null!==e?JSON.parse(e):null}else t=null!==(e=(0,s.getJSON)(this._options.positionSettingsKey))&&void 0!==e?e:null;return null!==t&&"top"in t&&"left"in t?t:null}_setHiddingTimeout(e){null!==this._hiddingTimeoutId&&clearTimeout(this._hiddingTimeoutId),this._hiddingTimeoutId=e}_preventWidgetTouchEndEvent(){const e=t=>{t.preventDefault(),this._widget.removeEventListener("touchend",e)};this._widget.addEventListener("touchend",e)}_updateLayoutType(){this._widget.classList.toggle("i-vertical",this._isVertical)}_onWindowResize(){if("auto"===(this._options.layout||"auto")){ -const e=this._isVertical,t=this._getCorrectedWidgetRect();this._isVertical=this._determineCurrentLayoutVertical(t),this._updateLayoutType(),e!==this._isVertical&&this._onVerticalChanged(this._isVertical,e)}this.checkPosition(),this._resizeResponsive()}_resizeResponsive(){if(null===this._responsiveResizeFunction)return;let e=this._options.layout||"auto";"auto"===e&&(e=this._isVertical?"vertical":"horizontal");const t="vertical"===e?this._widget.clientHeight:this._widget.clientWidth,o=("vertical"===e?window.innerHeight:window.innerWidth)-t;this._responsiveResizeFunction(t,o,e)}_setZIndex(e){this._widget.style.zIndex=String(e)}_zIndex(){return Number(this._widget.style.zIndex)}_loadPosition(){var e;const t=null!==(e=this._getSavedPosition())&&void 0!==e?e:this._options.defaultPosition;this._widget.style.left=Math.round(t.left)+"px",this._widget.style.top=Math.round(t.top)+"px",this._onWindowResize()}_savePosition(){const e=this._widget.getBoundingClientRect();if("device"===this._options.positionStorageType)try{h.TVLocalStorage.setItem(this._options.positionSettingsKey,JSON.stringify({left:e.left,top:e.top}))}catch(e){}else(0,s.setJSON)(this._options.positionSettingsKey,{left:e.left,top:e.top})}_init(){this._loadPosition(),this._draggable=new m({source:this._widget,containment:"window",handle:".js-drag",start:i.globalCloseMenu,stop:this._savePosition.bind(this)}),this._widget.addEventListener("pointerdown",this.raise.bind(this))}static _updateAllZIndexes(){y._toolbars.forEach(((e,t)=>{e._setZIndex(y._startZIndex+t)}))}}y._startZIndex=20,y._toolbars=[]},44296:(e,t,o)=>{"use strict";o.d(t,{LineToolPropertiesWidgetBase:()=>ye});var i=o(50959),n=o(962),r=o(11542),s=o(36298),l=o(14483),a=o(97145),c=o(1722),h=o(88348),d=o(62513),u=o(68806),p=o(50151),m=o(88640);class g extends m.default{constructor(e,t,o){super(),this._listenersMappers=[],this._isProcess=!1,this._baseProperty=e,this._propertyApplier=t,this._undoText=o}destroy(){this._baseProperty.destroy(),super.destroy()}value(){return this._baseProperty.value()}setValue(e){this._isProcess=!0,this._baseProperty.setValue(e,void 0,{applyValue:(e,t)=>this._propertyApplier.setProperty(e,t,this._undoText)}),this._isProcess=!1,this._listenersMappers.forEach((e=>{e.method.call(e.obj,this,"")}))}subscribe(e,t){const o=o=>{this._isProcess||t.call(e,this,"")},i={obj:e,method:t,callback:o};this._listenersMappers.push(i),this._baseProperty.subscribe(e,o)}unsubscribe(e,t){var o;const i=(0,p.ensureDefined)(null===(o=this._listenersMappers.find((o=>o.obj===e&&o.method===t)))||void 0===o?void 0:o.callback);this._baseProperty.unsubscribe(e,i)}unsubscribeAll(e){this._baseProperty.unsubscribeAll(e)}}var v=o(69152),_=o(97754),w=o.n(_),f=o(84877),y=o(3809),b=o(24437);const T=y.FLOATING_TOOLBAR_REACT_WIDGETS_CLASS+"__button";function C(e){const{templateButton:t,propertyButtons:o,commonButtons:n,isDrawingFinished:r,isToolbarFixed:s,buttonClassName:l,activeChartWidget:a}=e,c=a.hasModel()&&a.model().selection().dataSources();return c&&c.length?i.createElement(f.MatchMediaMap,{rules:{ -isSmallWidth:b.DialogBreakpoints.TabletSmall,isSmallHeight:"screen and (max-height: 430px)"}},(({isSmallWidth:e,isSmallHeight:t})=>i.createElement(i.Fragment,null,h(),r&&i.createElement(i.Fragment,null,Boolean(o.length)&&o.map(((o,n)=>i.createElement(o.component,{...o.props,key:`${o.props.title}_${n}`,className:w()(T,l),isSmallScreen:e||t,isToolbarFixed:s}))),Boolean(n.length)&&n.map(((o,n)=>{const r=e||t;return r?o.showForSmallScreen?i.createElement(o.component,{...o.props,isSmallScreen:r,key:`${o.props.title}_${n}`,className:w()(T,l)}):null:i.createElement(o.component,{...o.props,key:`${o.props.title}_${n}`,className:w()(T,l)})})))))):h();function h(){return null===t?null:i.createElement(t.component,{...t.props,isToolbarFixed:s,isDrawingFinished:r,className:w()(T,l)})}}var x=o(51768),L=o(50813),S=o(61964);function P(e){const{title:t,activeChartWidget:o,className:n}=e;return i.createElement(L.ToolWidgetIconButton,{className:n,icon:S,title:t,onClick:async function(){(0,x.trackEvent)("GUI","Context action on drawings","Settings");const e=o.model().selection().lineDataSources(),t=e.length;1===t?await o.showChartPropertiesForSource(e[0],void 0,{onWidget:o.onWidget()}):t>1&&await o.showChartPropertiesForSources({sources:e})},"data-name":"settings"})}var E=o(43982),A=o(66427),B=o(31188);function M(e){const{className:t,...o}=e;return i.createElement(A.ToolButton,{className:_(t,B.button),tooltipPosition:"horizontal",...o})}var z=o(65186),D=o(91244);function k(e){const{activeChartWidget:t,className:n}=e,s=t.model().selection().lineDataSources();if(0===s.length)return null;const l=s[0].properties().frozen,a=(0,E.useProperty)(l),c=a?{tooltip:r.t(null,void 0,o(15101)),icon:z}:{tooltip:r.t(null,void 0,o(42284)),icon:D};return i.createElement(M,{className:n,isActive:Boolean(a),onClick:function(){(0,x.trackEvent)("GUI","Context action on drawings","Lock"),t.toggleLockSelectedObject()},"data-name":Boolean(a)?"unlock":"lock",...c})}var N=o(35149);function W(e){const{title:t,activeChartWidget:o,className:n}=e;return i.createElement(L.ToolWidgetIconButton,{className:n,icon:N,title:t,"data-name":"remove",onClick:function(){(0,x.trackEvent)("GUI","Context action on drawings","Remove"),o.removeSelectedSources()}})}var I=o(9745),R=o(32563),F=o(8087),V=o(28127),O=o(10643),H=o(24120),K=o(68335),Z=o(4741),j=o(39347),U=o(84959);function $(e,t){const i=[(0,H.createVisualOrderAction)(e,t),(0,H.createChangeIntervalsVisibilitiesAction)(e,t)],n=function(e,t){const i=[],n=K.isMacKeyboard?" +":"",s=t.filter((e=>e.cloneable()));s.length>0&&i.push(new j.Action({actionId:"Chart.LineTool.Clone",options:{name:"clone",icon:o(36296),shortcutHint:K.humanReadableModifiers(Z.Modifiers.Mod)+n+" Drag",label:r.t(null,void 0,o(52977)),onExecute:()=>{e.model().cloneLineTools(s,!1),(0,x.trackEvent)("GUI","Context action on drawings","Clone")}}}));const l=t.filter((e=>e.copiable()));if(l.length>0){const t={name:"copy",label:r.t(null,void 0,o(35216)),shortcutHint:K.humanReadableModifiers(Z.Modifiers.Mod)+n+" C",onExecute:()=>{ -e.chartWidgetCollection().clipboard.uiRequestCopy(l)}};i.push(new j.Action({actionId:"Chart.Clipboard.CopyLineTools",options:t,id:"Copy"}))}return function(e,t){return!!(null==e?void 0:e.isMultipleLayout().value())&&t.some((e=>e.isSynchronizable()))}(e,t)?(i.push(...(0,H.createSyncDrawingActions)(e,t)),i):i}(e,t);return n.length&&i.push(new j.Separator,...n),i.push(new j.Separator,function(e){return new j.Action({actionId:"Chart.SelectedObject.Hide",options:{label:r.t(null,void 0,o(31971)),icon:U,onExecute:()=>{e.hideSelectedObject()},name:"hide"}})}(e)),i}var G=o(44996);function q(e){const{title:t,activeChartWidget:o,isSmallScreen:n,className:r}=e,s=o.model().selection().lineDataSources(),[l,a]=(0,i.useState)([]),c=(0,i.useRef)(null),h=(0,i.useMemo)((()=>new H.ActionsProvider(o)),[o]),d=(0,i.useCallback)((()=>h.contextMenuActionsForSources(s)),[h,s]),u=(0,i.useCallback)((()=>{if(n)return;const e=$(o,s);a(Y(e))}),[n,o,s]),p=(0,i.useCallback)((e=>{if(!n){const e=Y($(o,s));return a(e),void O.ContextMenuManager.createMenu(e,{mode:"drawer","data-name":"more-menu"},{menuName:"LineToolFloatingToolbarMoreMenu"})}d().then((t=>{const o=Y(t);window.matchMedia(b.DialogBreakpoints.TabletSmall).matches||a(o),O.ContextMenuManager.showMenu(o,e,{mode:"drawer","data-name":"more-menu"},{menuName:"LineToolFloatingToolbarMoreMenu"})}))}),[n,d]);return(0,i.useEffect)((()=>{var e;l.length&&(null===(e=c.current)||void 0===e||e.update())}),[l]),i.createElement(F.ToolWidgetMenu,{className:r,ref:c,arrow:!1,onOpen:u,onClick:p,title:t,content:i.createElement(I.Icon,{icon:G}),"data-name":"more",menuDataName:"more-menu",closeOnEsc:!0},i.createElement(V.ActionsTable,{parentIsOpened:!0,items:l}))}function Y(e){if(R.touch&&!window.matchMedia("(pointer:fine)").matches){const t=e.filter((e=>"Copy"!==e.id));if(t.length===e.length)return t;const o=[];return t.forEach((e=>{("separator"!==e.type||o.length>0&&"separator"!==o[o.length-1].type)&&o.push(e)})),o}return e}var X=o(95586),J=o(12811),Q=o(501),ee=o(23851),te=o(57740),oe=o(80427);function ie(e){const{property:t,propertyApplier:n,title:s,undoText:l,isToolbarFixed:a,className:c}=e,h=(0,E.useProperty)(t),d=(0,i.useMemo)((()=>[new j.Action({actionId:"Chart.LineTool.Toolbar.ChangeLineStyleToSolid",options:{icon:Q,label:r.t(null,void 0,o(1277)),active:X.LineStyle.Solid===h,onExecute:()=>n.setProperty(t,X.LineStyle.Solid,l)}}),new j.Action({actionId:"Chart.LineTool.Toolbar.ChangeLineStyleToDashed",options:{icon:ee,label:r.t(null,void 0,o(59317)),active:X.LineStyle.Dashed===h,onExecute:()=>n.setProperty(t,X.LineStyle.Dashed,l)}}),new j.Action({actionId:"Chart.LineTool.Toolbar.ChangeLineStyleToDotted",options:{icon:te,label:r.t(null,void 0,o(42973)),active:X.LineStyle.Dotted===h,onExecute:()=>n.setProperty(t,X.LineStyle.Dotted,l)}})]),[n,t,h]);return i.createElement(F.ToolWidgetMenu,{className:c,arrow:!1,content:i.createElement(I.Icon,{icon:ne(h)}),title:s,"data-name":e["data-name"],menuDataName:`${e["data-name"]}-menu`,verticalDropDirection:a?J.VerticalDropDirection.FromBottomToTop:void 0, -horizontalDropDirection:a?J.HorizontalDropDirection.FromRightToLeft:void 0,horizontalAttachEdge:a?J.HorizontalAttachEdge.Right:void 0,verticalAttachEdge:a?J.VerticalAttachEdge.Top:void 0},i.createElement(V.ActionsTable,{items:d}))}function ne(e){switch(e){case X.LineStyle.Solid:return Q;case X.LineStyle.Dashed:return ee;case X.LineStyle.Dotted:return te;case"mixed":return oe;default:return""}}const re=[10,11,12,14,16,20,24,28,32,40];function se(e){const{property:t,propertyApplier:o,title:n,undoText:r,isToolbarFixed:s,className:l}=e,a=(0,E.useProperty)(t),c=re.map((e=>new j.Action({actionId:"Chart.LineTool.Toolbar.ChangeFontSizeProperty",options:{label:e.toString(),onExecute:()=>o.setProperty(t,e,r),active:e===a}})));return i.createElement(F.ToolWidgetMenu,{arrow:!1,content:a,className:l,title:n,verticalDropDirection:s?J.VerticalDropDirection.FromBottomToTop:void 0,horizontalDropDirection:s?J.HorizontalDropDirection.FromRightToLeft:void 0,horizontalAttachEdge:s?J.HorizontalAttachEdge.Right:void 0,verticalAttachEdge:s?J.VerticalAttachEdge.Top:void 0,"data-name":e["data-name"],menuDataName:`${e["data-name"]}-menu`},i.createElement(V.ActionsTable,{items:c}))}var le=o(69774),ae=o(92249),ce=o(15367),he=o(3587),de=o(87919);const ue=new s.TranslatedString("change line tool(s) font size",r.t(null,void 0,o(36819))),pe=new s.TranslatedString("change line tool(s) line style",r.t(null,void 0,o(54769))),me=(new s.TranslatedString("apply drawing template",r.t(null,void 0,o(49037))),new s.TranslatedString("line tool(s) line style",r.t(null,{context:"line tool property name"},o(2443)))),ge=r.t(null,void 0,o(89517)),ve=r.t(null,void 0,o(34596)),_e=r.t(null,void 0,o(41610)),we=r.t(null,void 0,o(32733)),fe=r.t(null,void 0,o(17006));class ye{constructor(e){this._isDrawingFinished=new a.WatchedValue(!0),this._currentTool=null,this._updateVisibilityTimeout=null,this._lineWidthsProperty=null,this._lineColorsProperty=null,this._currentProperties=null,this._floatingContainer=null,this._floatingToolbarRendered=!1,this._toolbarVisible=!1,this._propertiesVisible=!1,this._templatesButton=null,this._propertyButtons=[],this._commonButtons=[],this._handleSourceEdit=e=>{h.isDirectionalMovementActive.value()||(e?this._floatingToolbar.hide(!0):this._floatingToolbarRendered&&this._floatingToolbar.show())},this._chartWidgetCollection=e,this._floatingToolbar=new y.FloatingToolbar({defaultPosition:{top:le.HEADER_TOOLBAR_HEIGHT_EXPANDED+15,left:window.innerWidth/2},positionSettingsKey:"properties_toolbar.position",positionStorageType:"device",layout:"horizontal","data-name":"drawing-toolbar"}),this._floatingContainer=this._floatingToolbar.getReactWidgetContainer(),this._isToolMovingNowSpawn=h.isToolMovingNow.spawn(),this._isToolEditingNowSpawn=h.isToolEditingNow.spawn(),this._toolSpawn=h.tool.spawn(),this._iconToolSpawn=h.iconTool.spawn(),this._emojiToolSpawn=h.emojiTool.spawn(),this._selectedSourcesSpawn=this._chartWidgetCollection.selectedSources.spawn(),this._isToolMovingNowSpawn.subscribe(this._handleSourceEdit), -this._isToolEditingNowSpawn.subscribe(this._handleSourceEdit),this._toolSpawn.subscribe(this._onToolChanged.bind(this),{callWithLast:!0}),this._iconToolSpawn.subscribe((()=>this._onToolChanged(h.tool.value()))),this._emojiToolSpawn.subscribe((()=>this._onToolChanged(h.tool.value()))),this._selectedSourcesSpawn.subscribe((()=>this.onSourceChanged(this.selectedSources()))),this._chartWidgetCollection.onAboutToBeDestroyed.subscribe(this,this.destroy,!0)}destroy(){this._isToolMovingNowSpawn.destroy(),this._isToolEditingNowSpawn.destroy(),this._toolSpawn.destroy(),this._iconToolSpawn.destroy(),this._emojiToolSpawn.destroy(),this._selectedSourcesSpawn.destroy()}refresh(){this.onSourceChanged(this.selectedSources())}onSourceChanged(e){if(!(null==e?void 0:e.length))return this._propertiesVisible=!1,this._toolbarVisible=!1,void this.hide();if(this._createCommonButtons(),e.every((t=>t.toolname===e[0].toolname))?this._showTemplatesOf({sources:e}):this._templatesButton&&this._clearTemplatesButton(),1===e.length){const t=e[0];t.isAvailableInFloatingWidget()&&this.activeChartWidget().model().model().dataSourceForId(t.id())?(!t.userEditEnabled()||!(0,ce.isLineDrawnWithPressedButton)(t.toolname)&&this.activeChartWidget().model().lineBeingCreated()||this._isDrawingFinished.setValue(!0),this.showPropertiesOf(t.toolname,t.properties(),!0),this._toolbarVisible=!0):this.hide()}else this._clearProperties(),this._createWidthsButton(void 0,!0),this._createLineStyleButton(),this._createColorsButton(void 0,!0),this._createBackgroundsButton(void 0,!0),this._createTextColorsButton(void 0,!0),this._propertiesVisible=!0;this._updateVisibility()}activeChartWidget(){return this._chartWidgetCollection.activeChartWidget.value()}selectedSources(){return this._chartWidgetCollection.selectedSources.value().filter(ae.isLineTool)}hide(){this._updateVisibilityTimeout&&clearTimeout(this._updateVisibilityTimeout),this._updateVisibilityTimeout=setTimeout((()=>{(0,ae.unsetNewToolProperties)(),this._floatingToolbar.hide(!0),this._isToolbarRendered()&&this._unmountFloatingToolbar(),this._clearProperties(),this._clearCommonButtons()}),0),delete this._propertyApplier}templatesList(){return this._templatesList}_onToolChanged(e,t){this._currentTool=e;const o=this.selectedSources();this._isDrawingToolExcludingCustomUrlEventTool(e)?(this._isDrawingFinished.setValue(!1),this._updateVisibility()):o&&o.length?(o.length>1&&this._isDrawingFinished.setValue(!0),this.onSourceChanged(this.selectedSources())):this.hide()}_propertyApplierImpl(){return this._propertyApplier||(this._propertyApplier=new de.PropertyApplierWithoutSavingChart((()=>this.activeChartWidget().model()),new a.WatchedValue(false))),this._propertyApplier}_clearProperties(){this._clearPropertyButtons(),this._lineWidthsProperty&&(this._lineWidthsProperty.destroy(),this._lineWidthsProperty=null),this._lineColorsProperty&&(this._lineColorsProperty.destroy(),this._lineColorsProperty=null),this._currentProperties&&(this._currentProperties=null)}_show(){ -this._updateVisibilityTimeout&&clearTimeout(this._updateVisibilityTimeout),this._updateVisibilityTimeout=setTimeout((()=>{this._renderFloatingToolbar(),this._floatingToolbar.show(),this._floatingToolbar.checkPosition()}),0)}_addPropertyButton(e){this._propertyButtons.push(e),this._renderFloatingToolbar()}_addCommonButton(e){this._commonButtons.push(e),this._renderFloatingToolbar()}_addTemplatesButton(e){this._templatesButton=e}_renderFloatingToolbar(){null!==this._floatingContainer&&this.activeChartWidget()&&this.activeChartWidget().hasModel()&&(n.render(i.createElement(C,{templateButton:this._templatesButton,propertyButtons:this._propertyButtons,commonButtons:this._commonButtons,isDrawingFinished:this._isDrawingFinished.value(),activeChartWidget:this.activeChartWidget()}),this._floatingContainer),this._floatingToolbarRendered=!0)}_unmountFloatingToolbar(){null!==this._floatingContainer&&(n.unmountComponentAtNode(this._floatingContainer),this._floatingToolbarRendered=!1)}_clearTemplatesButton(){this._templatesButton=null}_clearPropertyButtons(){this._propertyButtons=[]}_clearCommonButtons(){this._commonButtons=[]}_isToolbarRendered(){return this._floatingToolbarRendered}_createSettingsButton(){const e={component:P,props:{title:ge,activeChartWidget:this.activeChartWidget()}};this._addCommonButton(e)}_createLockButton(){const e={component:k,props:{title:"Lock",activeChartWidget:this.activeChartWidget()}};this._addCommonButton(e)}_createRemoveButton(){const e={component:W,props:{title:ve,activeChartWidget:this.activeChartWidget()},showForSmallScreen:!0};this._addCommonButton(e)}_createDotsButton(){this._addCommonButton({component:q,props:{title:_e,activeChartWidget:this.activeChartWidget()},showForSmallScreen:!0})}_createAlertButton(){}_createSourceActions(){this._createLockButton()}_createLineStyleButton(e){const t=this.selectedSources().filter(ae.isLineTool);if(!t.length)return!1;let o,i=this._propertyApplierImpl();if(1===t.length){if(o=t[0].properties().linestyle||e,!o)return!1}else{const e=t.map((e=>e.properties().linestyle||e.properties().lineStyle)).filter(c.notUndefined);if(!e.length)return!1;o=new d.CollectiblePropertyUndoWrapper(new u.LineToolCollectedProperty(e),me,this._propertyApplierImpl()),i={...i,setProperty:(e,t)=>e.setValue(t)}}return this._addPropertyButton({component:ie,props:{property:o,title:we,propertyApplier:i,"data-name":"style",undoText:pe}}),!0}_createFontSizeButton(e){const t=this.selectedSources();if(0===t.length)return!1;const o=t[0];if(!(0,he.isDataSource)(o))return!1;const i={component:se,props:{property:o.properties().fontsize||e,title:fe,propertyApplier:this._propertyApplierImpl(),"data-name":"font-size",undoText:ue}};return this._addPropertyButton(i),!0}_createCommonButtons(){this._commonButtons.length&&this._clearCommonButtons(),l.enabled("property_pages")&&this._createSettingsButton(),this._createSourceActions(),this._createRemoveButton(),this._createDotsButton()}_prepareProperties(e){const t=this.selectedSources().filter((t=>t.properties()[e])) -;if(!(t.filter((t=>t.properties()[e].visible())).length<1))return t.map((t=>t.properties()[e])).filter(c.notNull)}_createProperty(e,t,o,i){if(t){const e=this._prepareProperties(o);if(!e)return;return this._isWidthProperty(e[0])?new g(new u.MultipleLineWidthsProperty(e),this._propertyApplierImpl(),i):new v.CollectibleColorPropertyUndoWrapper(new u.MultipleLineColorsProperty(e),this._propertyApplierImpl(),i)}if(e&&e.visible())return this._isWidthProperty(e)?new u.MultipleLineWidthsProperty([e]):new v.CollectibleColorPropertyDirectWrapper(new u.MultipleLineColorsProperty([e]))}_shouldShowBackgroundProperty(e,t){return!t||!t.fillBackground||!!t.fillBackground.value()}_isDrawingToolExcludingCustomUrlEventTool(e){return Boolean(null==e?void 0:e.toLowerCase().includes("linetool"))&&"LineToolTweet"!==e&&"LineToolIdea"!==e&&"LineToolImage"!==e}_updateVisibility(){this._isDrawingFinished.value()&&(this._toolbarVisible||this._propertiesVisible)?this._show():this.hide()}_showTemplatesOf(e){}_isWidthProperty(e){return e instanceof u.LineToolWidthsProperty}}},78036:(e,t,o)=>{"use strict";o.d(t,{lineToolsInfo:()=>f});var i=o(50151),n=o(11542),r=o(61814),s=(o(42053),o(57673)),l=o(87872);const a={SyncDrawing:n.t(null,void 0,o(36551)),arrow:n.t(null,void 0,o(96237)),cursor:n.t(null,void 0,o(29908)),dot:n.t(null,void 0,o(60925)),performance:n.t(null,void 0,o(79165)),drawginmode:n.t(null,void 0,o(49421)),eraser:n.t(null,void 0,o(99289)),group:n.t(null,void 0,o(91977)),hideAllDrawings:n.t(null,void 0,o(17517)),lockAllDrawings:n.t(null,void 0,o(37057)),magnet:n.t(null,void 0,o(37140)),measure:n.t(null,void 0,o(59607)),removeAllDrawingTools:n.t(null,void 0,o(76091)),showObjectsTree:n.t(null,void 0,o(51072)),zoom:n.t(null,void 0,o(38925)),"zoom-out":n.t(null,void 0,o(49895))};var c=o(59656),h=o(68335),d=o(86972);const u=(0,h.humanReadableModifiers)(h.Modifiers.Shift,!1),p=(0,h.humanReadableModifiers)(h.Modifiers.Alt,!1),m=(0,h.humanReadableModifiers)(h.Modifiers.Mod,!1),g={keys:[u],text:n.t(null,void 0,o(40234))},v={keys:[u],text:n.t(null,void 0,o(68125))},_={keys:[u],text:n.t(null,void 0,o(81591))},w={LineTool5PointsPattern:{},LineToolABCD:{},LineToolArc:{},LineToolArrow:{},LineToolArrowMarkDown:{},LineToolArrowMarkLeft:{},LineToolArrowMarkRight:{},LineToolArrowMarkUp:{},LineToolBalloon:{},LineToolComment:{},LineToolBarsPattern:{},LineToolBezierCubic:{},LineToolBezierQuadro:{},LineToolBrush:{},LineToolCallout:{},LineToolCircleLines:{},LineToolCypherPattern:{},LineToolDateAndPriceRange:{},LineToolDateRange:{},LineToolDisjointAngle:{hotKey:(0,r.hotKeySerialize)(g)},LineToolElliottCorrection:{},LineToolElliottDoubleCombo:{},LineToolElliottImpulse:{},LineToolElliottTriangle:{},LineToolElliottTripleCombo:{},LineToolEllipse:{hotKey:(0,r.hotKeySerialize)(v)},LineToolExtended:{},LineToolFibChannel:{},LineToolFibCircles:{hotKey:(0,r.hotKeySerialize)(v)},LineToolFibRetracement:{},LineToolFibSpeedResistanceArcs:{},LineToolFibSpeedResistanceFan:{hotKey:(0,r.hotKeySerialize)(_)},LineToolFibSpiral:{},LineToolFibTimeZone:{},LineToolFibWedge:{}, -LineToolFlagMark:{},LineToolFlatBottom:{hotKey:(0,r.hotKeySerialize)(g)},LineToolAnchoredVWAP:{},LineToolGannComplex:{},LineToolGannFixed:{},LineToolGannFan:{},LineToolGannSquare:{hotKey:(0,r.hotKeySerialize)({keys:[u],text:n.t(null,void 0,o(10289))})},LineToolHeadAndShoulders:{},LineToolHorzLine:{hotKey:(0,r.hotKeySerialize)({keys:[p,"H"],text:"{0} + {1}"})},LineToolHorzRay:{},LineToolIcon:{},LineToolEmoji:{},LineToolInsidePitchfork:{},LineToolNote:{},LineToolNoteAbsolute:{},LineToolSignpost:{},LineToolParallelChannel:{hotKey:(0,r.hotKeySerialize)(g)},LineToolPitchfan:{},LineToolPitchfork:{},LineToolPolyline:{},LineToolPath:{},LineToolPrediction:{},LineToolPriceLabel:{},LineToolPriceNote:{hotKey:(0,r.hotKeySerialize)(g)},LineToolArrowMarker:{},LineToolPriceRange:{},LineToolProjection:{},LineToolRay:{},LineToolRectangle:{hotKey:(0,r.hotKeySerialize)({keys:[u],text:n.t(null,void 0,o(81591))})},LineToolCircle:{},LineToolRegressionTrend:{},LineToolRiskRewardLong:{},LineToolRiskRewardShort:{},LineToolFixedRangeVolumeProfile:{},LineToolRotatedRectangle:{hotKey:(0,r.hotKeySerialize)(g)},LineToolSchiffPitchfork:{},LineToolSchiffPitchfork2:{},LineToolSineLine:{},LineToolText:{},LineToolTextAbsolute:{},LineToolThreeDrivers:{},LineToolTimeCycles:{},LineToolTrendAngle:{hotKey:(0,r.hotKeySerialize)(g)},LineToolTrendBasedFibExtension:{},LineToolTrendBasedFibTime:{},LineToolTrendLine:{hotKey:(0,r.hotKeySerialize)(g)},LineToolInfoLine:{},LineToolTriangle:{},LineToolTrianglePattern:{},LineToolVertLine:{hotKey:(0,r.hotKeySerialize)({keys:[p,"V"],text:"{0} + {1}"})},LineToolCrossLine:{},LineToolHighlighter:{},LineToolGhostFeed:{},SyncDrawing:{iconActive:l.drawingToolsIcons.SyncDrawingActive},arrow:{},cursor:{},dot:{},drawginmode:{iconActive:l.drawingToolsIcons.drawginmodeActive},eraser:{},group:{},hideAllDrawings:{iconActive:l.drawingToolsIcons.hideAllDrawingsActive,hotKey:(0,r.hotKeySerialize)({keys:[m,p,"H"],text:"{0} + {1} + {2}"})},lockAllDrawings:{iconActive:l.drawingToolsIcons.lockAllDrawingsActive},magnet:{hotKey:(0,r.hotKeySerialize)({keys:[m],text:"{0}"})},measure:{hotKey:(0,r.hotKeySerialize)({keys:[u],text:n.t(null,void 0,o(32868))})},removeAllDrawingTools:{},showObjectsTree:{},zoom:{},"zoom-out":{}};const f={};Object.entries(w).map((([e,t])=>{var o,n;const r=null!==(o=s.lineToolsIcons[e])&&void 0!==o?o:l.drawingToolsIcons[e];(0,i.assert)(!!r,`Icon is not defined for drawing "${e}"`);const h=null!==(n=c.lineToolsLocalizedNames[e])&&void 0!==n?n:a[e];(0,i.assert)(!!h,`Localized name is not defined for drawing "${e}"`);return{...t,name:e,icon:r,localizedName:h,selectHotkey:d.lineToolsSelectHotkeys[e]}})).forEach((e=>{f[e.name]=e}))},26916:(e,t,o)=>{"use strict";var i=o(36298).TranslatedString,n=o(44296).LineToolPropertiesWidgetBase;const r=o(70114).ColorPickerButton,s=o(61259).LineWidthButton +const e=this._isVertical,t=this._getCorrectedWidgetRect();this._isVertical=this._determineCurrentLayoutVertical(t),this._updateLayoutType(),e!==this._isVertical&&this._onVerticalChanged(this._isVertical,e)}this.checkPosition(),this._resizeResponsive()}_resizeResponsive(){if(null===this._responsiveResizeFunction)return;let e=this._options.layout||"auto";"auto"===e&&(e=this._isVertical?"vertical":"horizontal");const t="vertical"===e?this._widget.clientHeight:this._widget.clientWidth,o=("vertical"===e?window.innerHeight:window.innerWidth)-t;this._responsiveResizeFunction(t,o,e)}_setZIndex(e){this._widget.style.zIndex=String(e)}_zIndex(){return Number(this._widget.style.zIndex)}_loadPosition(){var e;const t=null!==(e=this._getSavedPosition())&&void 0!==e?e:this._options.defaultPosition;this._widget.style.left=Math.round(t.left)+"px",this._widget.style.top=Math.round(t.top)+"px",this._onWindowResize()}_savePosition(){const e=this._widget.getBoundingClientRect();if("device"===this._options.positionStorageType)try{h.TVLocalStorage.setItem(this._options.positionSettingsKey,JSON.stringify({left:e.left,top:e.top}))}catch(e){}else(0,s.setJSON)(this._options.positionSettingsKey,{left:e.left,top:e.top})}_init(){this._loadPosition(),this._draggable=new m({source:this._widget,containment:"window",handle:".js-drag",start:i.globalCloseMenu,stop:this._savePosition.bind(this)}),this._widget.addEventListener("pointerdown",this.raise.bind(this))}static _updateAllZIndexes(){y._toolbars.forEach(((e,t)=>{e._setZIndex(y._startZIndex+t)}))}}y._startZIndex=20,y._toolbars=[]},44296:(e,t,o)=>{"use strict";o.d(t,{LineToolPropertiesWidgetBase:()=>be});var i=o(50959),n=o(962),r=o(11542),s=o(36298),l=o(14483),a=o(97145),c=o(1722),h=o(88348),d=o(62513),u=o(68806),p=o(50151),m=o(88640);class g extends m.default{constructor(e,t,o){super(),this._listenersMappers=[],this._isProcess=!1,this._baseProperty=e,this._propertyApplier=t,this._undoText=o}destroy(){this._baseProperty.destroy(),super.destroy()}value(){return this._baseProperty.value()}setValue(e){this._isProcess=!0,this._baseProperty.setValue(e,void 0,{applyValue:(e,t)=>this._propertyApplier.setProperty(e,t,this._undoText)}),this._isProcess=!1,this._listenersMappers.forEach((e=>{e.method.call(e.obj,this,"")}))}subscribe(e,t){const o=o=>{this._isProcess||t.call(e,this,"")},i={obj:e,method:t,callback:o};this._listenersMappers.push(i),this._baseProperty.subscribe(e,o)}unsubscribe(e,t){var o;const i=(0,p.ensureDefined)(null===(o=this._listenersMappers.find((o=>o.obj===e&&o.method===t)))||void 0===o?void 0:o.callback);this._baseProperty.unsubscribe(e,i)}unsubscribeAll(e){this._baseProperty.unsubscribeAll(e)}}var v=o(69152),_=o(97754),w=o.n(_),f=o(84877),y=o(3809),b=o(24437);const T=y.FLOATING_TOOLBAR_REACT_WIDGETS_CLASS+"__button";function C(e){const{templateButton:t,propertyButtons:o,commonButtons:n,isDrawingFinished:r,isToolbarFixed:s,buttonClassName:l,activeChartWidget:a}=e,c=a.hasModel()&&a.model().selection().dataSources();return c&&c.length?i.createElement(f.MatchMediaMap,{rules:{ +isSmallWidth:b.DialogBreakpoints.TabletSmall,isSmallHeight:"screen and (max-height: 430px)"}},(({isSmallWidth:e,isSmallHeight:t})=>i.createElement(i.Fragment,null,h(),r&&i.createElement(i.Fragment,null,Boolean(o.length)&&o.map(((o,n)=>i.createElement(o.component,{...o.props,key:`${o.props.title}_${n}`,className:w()(T,l),isSmallScreen:e||t,isToolbarFixed:s}))),Boolean(n.length)&&n.map(((o,n)=>{const r=e||t;return r?o.showForSmallScreen?i.createElement(o.component,{...o.props,isSmallScreen:r,key:`${o.props.title}_${n}`,className:w()(T,l)}):null:i.createElement(o.component,{...o.props,key:`${o.props.title}_${n}`,className:w()(T,l)})})))))):h();function h(){return null===t?null:i.createElement(t.component,{...t.props,isToolbarFixed:s,isDrawingFinished:r,className:w()(T,l)})}}var x=o(51768),L=o(50813),S=o(61964);function P(e){const{title:t,activeChartWidget:o,className:n}=e;return i.createElement(L.ToolWidgetIconButton,{className:n,icon:S,title:t,onClick:async function(){(0,x.trackEvent)("GUI","Context action on drawings","Settings");const e=o.model().selection().lineDataSources(),t=e.length;1===t?await o.showChartPropertiesForSource(e[0],void 0,{onWidget:o.onWidget()}):t>1&&await o.showChartPropertiesForSources({sources:e})},"data-name":"settings"})}var E=o(43982),A=o(66427),B=o(31188);function M(e){const{className:t,...o}=e;return i.createElement(A.ToolButton,{className:_(t,B.button),tooltipPosition:"horizontal",...o})}var z=o(65186),D=o(91244);function k(e){const{activeChartWidget:t,className:n}=e,s=t.model().selection().lineDataSources();if(0===s.length)return null;const l=s[0].properties().frozen,a=(0,E.useProperty)(l),c=a?{tooltip:r.t(null,void 0,o(15101)),icon:z}:{tooltip:r.t(null,void 0,o(42284)),icon:D};return i.createElement(M,{className:n,isActive:Boolean(a),onClick:function(){(0,x.trackEvent)("GUI","Context action on drawings","Lock"),t.toggleLockSelectedObject()},"data-name":Boolean(a)?"unlock":"lock",...c})}var N=o(35149);function W(e){const{title:t,activeChartWidget:o,className:n}=e;return i.createElement(L.ToolWidgetIconButton,{className:n,icon:N,title:t,"data-name":"remove",onClick:function(){(0,x.trackEvent)("GUI","Context action on drawings","Remove"),o.removeSelectedSources()}})}var I=o(9745),R=o(5325),F=o(32563),V=o(8087),O=o(28127),H=o(10643),K=o(24120),Z=o(68335),j=o(4741),U=o(39347),$=o(84959);function G(e,t){const i=[(0,K.createVisualOrderAction)(e,t),(0,K.createChangeIntervalsVisibilitiesAction)(e,t)],n=function(e,t){const i=[],n=Z.isMacKeyboard?" +":"",s=t.filter((e=>e.cloneable()));s.length>0&&i.push(new U.Action({actionId:"Chart.LineTool.Clone",options:{name:"clone",icon:o(36296),shortcutHint:Z.humanReadableModifiers(j.Modifiers.Mod)+n+" Drag",label:r.t(null,void 0,o(52977)),onExecute:()=>{e.model().cloneLineTools(s,!1),(0,x.trackEvent)("GUI","Context action on drawings","Clone")}}}));const l=t.filter((e=>e.copiable()));if(l.length>0){const t={name:"copy",label:r.t(null,void 0,o(35216)),shortcutHint:Z.humanReadableModifiers(j.Modifiers.Mod)+n+" C",onExecute:()=>{ +e.chartWidgetCollection().clipboard.uiRequestCopy(l)}};i.push(new U.Action({actionId:"Chart.Clipboard.CopyLineTools",options:t,id:"Copy"}))}return function(e,t){return!!(null==e?void 0:e.isMultipleLayout().value())&&t.some((e=>e.isSynchronizable()))}(e,t)?(i.push(...(0,K.createSyncDrawingActions)(e,t)),i):i}(e,t);return n.length&&i.push(new U.Separator,...n),i.push(new U.Separator,function(e){return new U.Action({actionId:"Chart.SelectedObject.Hide",options:{label:r.t(null,void 0,o(31971)),icon:$,onExecute:()=>{e.hideSelectedObject()},name:"hide"}})}(e)),i}var q=o(44996);function Y(e){const{title:t,activeChartWidget:o,isSmallScreen:n,className:r}=e,s=o.model().selection().lineDataSources(),[l,a]=(0,i.useState)([]),c=(0,i.useRef)(null),h=(0,i.useMemo)((()=>new K.ActionsProvider(o)),[o]),d=(0,i.useCallback)((()=>h.contextMenuActionsForSources(s)),[h,s]),u=(0,i.useCallback)((()=>{if(n)return;const e=G(o,s);a(X(e))}),[n,o,s]),p=(0,i.useCallback)((e=>{n&&d().then((t=>{const o=X(t);window.matchMedia(b.DialogBreakpoints.TabletSmall).matches||!R.isAnyMobile?H.ContextMenuManager.showMenu(o,e,{mode:R.isAnyMobile?"drawer":"menu","data-name":"more-menu"},{menuName:"LineToolFloatingToolbarMoreMenu"}):a(o)}))}),[n,d]);return(0,i.useEffect)((()=>{var e;l.length&&(null===(e=c.current)||void 0===e||e.update())}),[l]),i.createElement(V.ToolWidgetMenu,{className:r,ref:c,arrow:!1,onOpen:u,onClick:p,title:t,content:i.createElement(I.Icon,{icon:q}),"data-name":"more",menuDataName:"more-menu",closeOnEsc:!0},i.createElement(O.ActionsTable,{parentIsOpened:!0,items:l}))}function X(e){if(F.touch&&!window.matchMedia("(pointer:fine)").matches){const t=e.filter((e=>"Copy"!==e.id));if(t.length===e.length)return t;const o=[];return t.forEach((e=>{("separator"!==e.type||o.length>0&&"separator"!==o[o.length-1].type)&&o.push(e)})),o}return e}var J=o(95586),Q=o(12811),ee=o(501),te=o(23851),oe=o(57740),ie=o(80427);function ne(e){const{property:t,propertyApplier:n,title:s,undoText:l,isToolbarFixed:a,className:c}=e,h=(0,E.useProperty)(t),d=(0,i.useMemo)((()=>[new U.Action({actionId:"Chart.LineTool.Toolbar.ChangeLineStyleToSolid",options:{icon:ee,label:r.t(null,void 0,o(1277)),active:J.LineStyle.Solid===h,onExecute:()=>n.setProperty(t,J.LineStyle.Solid,l)}}),new U.Action({actionId:"Chart.LineTool.Toolbar.ChangeLineStyleToDashed",options:{icon:te,label:r.t(null,void 0,o(59317)),active:J.LineStyle.Dashed===h,onExecute:()=>n.setProperty(t,J.LineStyle.Dashed,l)}}),new U.Action({actionId:"Chart.LineTool.Toolbar.ChangeLineStyleToDotted",options:{icon:oe,label:r.t(null,void 0,o(42973)),active:J.LineStyle.Dotted===h,onExecute:()=>n.setProperty(t,J.LineStyle.Dotted,l)}})]),[n,t,h]);return i.createElement(V.ToolWidgetMenu,{className:c,arrow:!1,content:i.createElement(I.Icon,{icon:re(h)}),title:s,"data-name":e["data-name"],menuDataName:`${e["data-name"]}-menu`,verticalDropDirection:a?Q.VerticalDropDirection.FromBottomToTop:void 0,horizontalDropDirection:a?Q.HorizontalDropDirection.FromRightToLeft:void 0,horizontalAttachEdge:a?Q.HorizontalAttachEdge.Right:void 0, +verticalAttachEdge:a?Q.VerticalAttachEdge.Top:void 0},i.createElement(O.ActionsTable,{items:d}))}function re(e){switch(e){case J.LineStyle.Solid:return ee;case J.LineStyle.Dashed:return te;case J.LineStyle.Dotted:return oe;case"mixed":return ie;default:return""}}const se=[10,11,12,14,16,20,24,28,32,40];function le(e){const{property:t,propertyApplier:o,title:n,undoText:r,isToolbarFixed:s,className:l}=e,a=(0,E.useProperty)(t),c=se.map((e=>new U.Action({actionId:"Chart.LineTool.Toolbar.ChangeFontSizeProperty",options:{label:e.toString(),onExecute:()=>o.setProperty(t,e,r),active:e===a}})));return i.createElement(V.ToolWidgetMenu,{arrow:!1,content:a,className:l,title:n,verticalDropDirection:s?Q.VerticalDropDirection.FromBottomToTop:void 0,horizontalDropDirection:s?Q.HorizontalDropDirection.FromRightToLeft:void 0,horizontalAttachEdge:s?Q.HorizontalAttachEdge.Right:void 0,verticalAttachEdge:s?Q.VerticalAttachEdge.Top:void 0,"data-name":e["data-name"],menuDataName:`${e["data-name"]}-menu`},i.createElement(O.ActionsTable,{items:c}))}var ae=o(69774),ce=o(92249),he=o(15367),de=o(3587),ue=o(87919);const pe=new s.TranslatedString("change line tool(s) font size",r.t(null,void 0,o(36819))),me=new s.TranslatedString("change line tool(s) line style",r.t(null,void 0,o(54769))),ge=(new s.TranslatedString("apply drawing template",r.t(null,void 0,o(49037))),new s.TranslatedString("line tool(s) line style",r.t(null,{context:"line tool property name"},o(2443)))),ve=r.t(null,void 0,o(89517)),_e=r.t(null,void 0,o(34596)),we=r.t(null,void 0,o(41610)),fe=r.t(null,void 0,o(32733)),ye=r.t(null,void 0,o(17006));class be{constructor(e){this._isDrawingFinished=new a.WatchedValue(!0),this._currentTool=null,this._updateVisibilityTimeout=null,this._lineWidthsProperty=null,this._lineColorsProperty=null,this._currentProperties=null,this._floatingContainer=null,this._floatingToolbarRendered=!1,this._toolbarVisible=!1,this._propertiesVisible=!1,this._templatesButton=null,this._propertyButtons=[],this._commonButtons=[],this._handleSourceEdit=e=>{h.isDirectionalMovementActive.value()||(e?this._floatingToolbar.hide(!0):this._floatingToolbarRendered&&this._floatingToolbar.show())},this._chartWidgetCollection=e,this._floatingToolbar=new y.FloatingToolbar({defaultPosition:{top:ae.HEADER_TOOLBAR_HEIGHT_EXPANDED+15,left:window.innerWidth/2},positionSettingsKey:"properties_toolbar.position",positionStorageType:"device",layout:"horizontal","data-name":"drawing-toolbar"}),this._floatingContainer=this._floatingToolbar.getReactWidgetContainer(),this._isToolMovingNowSpawn=h.isToolMovingNow.spawn(),this._isToolEditingNowSpawn=h.isToolEditingNow.spawn(),this._toolSpawn=h.tool.spawn(),this._iconToolSpawn=h.iconTool.spawn(),this._emojiToolSpawn=h.emojiTool.spawn(),this._selectedSourcesSpawn=this._chartWidgetCollection.selectedSources.spawn(),this._isToolMovingNowSpawn.subscribe(this._handleSourceEdit),this._isToolEditingNowSpawn.subscribe(this._handleSourceEdit),this._toolSpawn.subscribe(this._onToolChanged.bind(this),{callWithLast:!0}), +this._iconToolSpawn.subscribe((()=>this._onToolChanged(h.tool.value()))),this._emojiToolSpawn.subscribe((()=>this._onToolChanged(h.tool.value()))),this._selectedSourcesSpawn.subscribe((()=>this.onSourceChanged(this.selectedSources()))),this._chartWidgetCollection.onAboutToBeDestroyed.subscribe(this,this.destroy,!0)}destroy(){this._isToolMovingNowSpawn.destroy(),this._isToolEditingNowSpawn.destroy(),this._toolSpawn.destroy(),this._iconToolSpawn.destroy(),this._emojiToolSpawn.destroy(),this._selectedSourcesSpawn.destroy()}refresh(){this.onSourceChanged(this.selectedSources())}onSourceChanged(e){if(!(null==e?void 0:e.length))return this._propertiesVisible=!1,this._toolbarVisible=!1,void this.hide();if(this._createCommonButtons(),e.every((t=>t.toolname===e[0].toolname))?this._showTemplatesOf({sources:e}):this._templatesButton&&this._clearTemplatesButton(),1===e.length){const t=e[0];t.isAvailableInFloatingWidget()&&this.activeChartWidget().model().model().dataSourceForId(t.id())?(!t.userEditEnabled()||!(0,he.isLineDrawnWithPressedButton)(t.toolname)&&this.activeChartWidget().model().lineBeingCreated()||this._isDrawingFinished.setValue(!0),this.showPropertiesOf(t.toolname,t.properties(),!0),this._toolbarVisible=!0):this.hide()}else this._clearProperties(),this._createWidthsButton(void 0,!0),this._createLineStyleButton(),this._createColorsButton(void 0,!0),this._createBackgroundsButton(void 0,!0),this._createTextColorsButton(void 0,!0),this._propertiesVisible=!0;this._updateVisibility()}activeChartWidget(){return this._chartWidgetCollection.activeChartWidget.value()}selectedSources(){return this._chartWidgetCollection.selectedSources.value().filter(ce.isLineTool)}hide(){this._updateVisibilityTimeout&&clearTimeout(this._updateVisibilityTimeout),this._updateVisibilityTimeout=setTimeout((()=>{(0,ce.unsetNewToolProperties)(),this._floatingToolbar.hide(!0),this._isToolbarRendered()&&this._unmountFloatingToolbar(),this._clearProperties(),this._clearCommonButtons()}),0),delete this._propertyApplier}templatesList(){return this._templatesList}_onToolChanged(e,t){this._currentTool=e;const o=this.selectedSources();this._isDrawingToolExcludingCustomUrlEventTool(e)?(this._isDrawingFinished.setValue(!1),this._updateVisibility()):o&&o.length?(o.length>1&&this._isDrawingFinished.setValue(!0),this.onSourceChanged(this.selectedSources())):this.hide()}_propertyApplierImpl(){return this._propertyApplier||(this._propertyApplier=new ue.PropertyApplierWithoutSavingChart((()=>this.activeChartWidget().model()),new a.WatchedValue(false))),this._propertyApplier}_clearProperties(){this._clearPropertyButtons(),this._lineWidthsProperty&&(this._lineWidthsProperty.destroy(),this._lineWidthsProperty=null),this._lineColorsProperty&&(this._lineColorsProperty.destroy(),this._lineColorsProperty=null),this._currentProperties&&(this._currentProperties=null)}_show(){this._updateVisibilityTimeout&&clearTimeout(this._updateVisibilityTimeout),this._updateVisibilityTimeout=setTimeout((()=>{this._renderFloatingToolbar(),this._floatingToolbar.show(), +this._floatingToolbar.checkPosition()}),0)}_addPropertyButton(e){this._propertyButtons.push(e),this._renderFloatingToolbar()}_addCommonButton(e){this._commonButtons.push(e),this._renderFloatingToolbar()}_addTemplatesButton(e){this._templatesButton=e}_renderFloatingToolbar(){null!==this._floatingContainer&&this.activeChartWidget()&&this.activeChartWidget().hasModel()&&(n.render(i.createElement(C,{templateButton:this._templatesButton,propertyButtons:this._propertyButtons,commonButtons:this._commonButtons,isDrawingFinished:this._isDrawingFinished.value(),activeChartWidget:this.activeChartWidget()}),this._floatingContainer),this._floatingToolbarRendered=!0)}_unmountFloatingToolbar(){null!==this._floatingContainer&&(n.unmountComponentAtNode(this._floatingContainer),this._floatingToolbarRendered=!1)}_clearTemplatesButton(){this._templatesButton=null}_clearPropertyButtons(){this._propertyButtons=[]}_clearCommonButtons(){this._commonButtons=[]}_isToolbarRendered(){return this._floatingToolbarRendered}_createSettingsButton(){const e={component:P,props:{title:ve,activeChartWidget:this.activeChartWidget()}};this._addCommonButton(e)}_createLockButton(){const e={component:k,props:{title:"Lock",activeChartWidget:this.activeChartWidget()}};this._addCommonButton(e)}_createRemoveButton(){const e={component:W,props:{title:_e,activeChartWidget:this.activeChartWidget()},showForSmallScreen:!0};this._addCommonButton(e)}_createDotsButton(){this._addCommonButton({component:Y,props:{title:we,activeChartWidget:this.activeChartWidget()},showForSmallScreen:!0})}_createAlertButton(){}_createSourceActions(){this._createLockButton()}_createLineStyleButton(e){const t=this.selectedSources().filter(ce.isLineTool);if(!t.length)return!1;let o,i=this._propertyApplierImpl();if(1===t.length){if(o=t[0].properties().linestyle||e,!o)return!1}else{const e=t.map((e=>e.properties().linestyle||e.properties().lineStyle)).filter(c.notUndefined);if(!e.length)return!1;o=new d.CollectiblePropertyUndoWrapper(new u.LineToolCollectedProperty(e),ge,this._propertyApplierImpl()),i={...i,setProperty:(e,t)=>e.setValue(t)}}return this._addPropertyButton({component:ne,props:{property:o,title:fe,propertyApplier:i,"data-name":"style",undoText:me}}),!0}_createFontSizeButton(e){const t=this.selectedSources();if(0===t.length)return!1;const o=t[0];if(!(0,de.isDataSource)(o))return!1;const i={component:le,props:{property:o.properties().fontsize||e,title:ye,propertyApplier:this._propertyApplierImpl(),"data-name":"font-size",undoText:pe}};return this._addPropertyButton(i),!0}_createCommonButtons(){this._commonButtons.length&&this._clearCommonButtons(),l.enabled("property_pages")&&this._createSettingsButton(),this._createSourceActions(),this._createRemoveButton(),this._createDotsButton()}_prepareProperties(e){const t=this.selectedSources().filter((t=>t.properties()[e]));if(!(t.filter((t=>t.properties()[e].visible())).length<1))return t.map((t=>t.properties()[e])).filter(c.notNull)}_createProperty(e,t,o,i){if(t){const e=this._prepareProperties(o);if(!e)return +;return this._isWidthProperty(e[0])?new g(new u.MultipleLineWidthsProperty(e),this._propertyApplierImpl(),i):new v.CollectibleColorPropertyUndoWrapper(new u.MultipleLineColorsProperty(e),this._propertyApplierImpl(),i)}if(e&&e.visible())return this._isWidthProperty(e)?new u.MultipleLineWidthsProperty([e]):new v.CollectibleColorPropertyDirectWrapper(new u.MultipleLineColorsProperty([e]))}_shouldShowBackgroundProperty(e,t){return!t||!t.fillBackground||!!t.fillBackground.value()}_isDrawingToolExcludingCustomUrlEventTool(e){return Boolean(null==e?void 0:e.toLowerCase().includes("linetool"))&&"LineToolTweet"!==e&&"LineToolIdea"!==e&&"LineToolImage"!==e}_updateVisibility(){this._isDrawingFinished.value()&&(this._toolbarVisible||this._propertiesVisible)?this._show():this.hide()}_showTemplatesOf(e){}_isWidthProperty(e){return e instanceof u.LineToolWidthsProperty}}},78036:(e,t,o)=>{"use strict";o.d(t,{lineToolsInfo:()=>f});var i=o(50151),n=o(11542),r=o(61814),s=(o(42053),o(57673)),l=o(87872);const a={SyncDrawing:n.t(null,void 0,o(36551)),arrow:n.t(null,void 0,o(96237)),cursor:n.t(null,void 0,o(29908)),dot:n.t(null,void 0,o(60925)),performance:n.t(null,void 0,o(79165)),drawginmode:n.t(null,void 0,o(49421)),eraser:n.t(null,void 0,o(99289)),group:n.t(null,void 0,o(91977)),hideAllDrawings:n.t(null,void 0,o(17517)),lockAllDrawings:n.t(null,void 0,o(37057)),magnet:n.t(null,void 0,o(37140)),measure:n.t(null,void 0,o(59607)),removeAllDrawingTools:n.t(null,void 0,o(76091)),showObjectsTree:n.t(null,void 0,o(51072)),zoom:n.t(null,void 0,o(38925)),"zoom-out":n.t(null,void 0,o(49895))};var c=o(59656),h=o(68335),d=o(86972);const u=(0,h.humanReadableModifiers)(h.Modifiers.Shift,!1),p=(0,h.humanReadableModifiers)(h.Modifiers.Alt,!1),m=(0,h.humanReadableModifiers)(h.Modifiers.Mod,!1),g={keys:[u],text:n.t(null,void 0,o(40234))},v={keys:[u],text:n.t(null,void 0,o(68125))},_={keys:[u],text:n.t(null,void 0,o(81591))},w={LineTool5PointsPattern:{},LineToolABCD:{},LineToolArc:{},LineToolArrow:{},LineToolArrowMarkDown:{},LineToolArrowMarkLeft:{},LineToolArrowMarkRight:{},LineToolArrowMarkUp:{},LineToolBalloon:{},LineToolComment:{},LineToolBarsPattern:{},LineToolBezierCubic:{},LineToolBezierQuadro:{},LineToolBrush:{},LineToolCallout:{},LineToolCircleLines:{},LineToolCypherPattern:{},LineToolDateAndPriceRange:{},LineToolDateRange:{},LineToolDisjointAngle:{hotKey:(0,r.hotKeySerialize)(g)},LineToolElliottCorrection:{},LineToolElliottDoubleCombo:{},LineToolElliottImpulse:{},LineToolElliottTriangle:{},LineToolElliottTripleCombo:{},LineToolEllipse:{hotKey:(0,r.hotKeySerialize)(v)},LineToolExtended:{},LineToolFibChannel:{},LineToolFibCircles:{hotKey:(0,r.hotKeySerialize)(v)},LineToolFibRetracement:{},LineToolFibSpeedResistanceArcs:{},LineToolFibSpeedResistanceFan:{hotKey:(0,r.hotKeySerialize)(_)},LineToolFibSpiral:{},LineToolFibTimeZone:{},LineToolFibWedge:{},LineToolFlagMark:{},LineToolFlatBottom:{hotKey:(0,r.hotKeySerialize)(g)},LineToolAnchoredVWAP:{},LineToolGannComplex:{},LineToolGannFixed:{},LineToolGannFan:{},LineToolGannSquare:{hotKey:(0, +r.hotKeySerialize)({keys:[u],text:n.t(null,void 0,o(10289))})},LineToolHeadAndShoulders:{},LineToolHorzLine:{hotKey:(0,r.hotKeySerialize)({keys:[p,"H"],text:"{0} + {1}"})},LineToolHorzRay:{},LineToolIcon:{},LineToolEmoji:{},LineToolInsidePitchfork:{},LineToolNote:{},LineToolNoteAbsolute:{},LineToolSignpost:{},LineToolParallelChannel:{hotKey:(0,r.hotKeySerialize)(g)},LineToolPitchfan:{},LineToolPitchfork:{},LineToolPolyline:{},LineToolPath:{},LineToolPrediction:{},LineToolPriceLabel:{},LineToolPriceNote:{hotKey:(0,r.hotKeySerialize)(g)},LineToolArrowMarker:{},LineToolPriceRange:{},LineToolProjection:{},LineToolRay:{},LineToolRectangle:{hotKey:(0,r.hotKeySerialize)({keys:[u],text:n.t(null,void 0,o(81591))})},LineToolCircle:{},LineToolRegressionTrend:{},LineToolRiskRewardLong:{},LineToolRiskRewardShort:{},LineToolFixedRangeVolumeProfile:{},LineToolRotatedRectangle:{hotKey:(0,r.hotKeySerialize)(g)},LineToolSchiffPitchfork:{},LineToolSchiffPitchfork2:{},LineToolSineLine:{},LineToolText:{},LineToolTextAbsolute:{},LineToolThreeDrivers:{},LineToolTimeCycles:{},LineToolTrendAngle:{hotKey:(0,r.hotKeySerialize)(g)},LineToolTrendBasedFibExtension:{},LineToolTrendBasedFibTime:{},LineToolTrendLine:{hotKey:(0,r.hotKeySerialize)(g)},LineToolInfoLine:{},LineToolTriangle:{},LineToolTrianglePattern:{},LineToolVertLine:{hotKey:(0,r.hotKeySerialize)({keys:[p,"V"],text:"{0} + {1}"})},LineToolCrossLine:{},LineToolHighlighter:{},LineToolGhostFeed:{},SyncDrawing:{iconActive:l.drawingToolsIcons.SyncDrawingActive},arrow:{},cursor:{},dot:{},drawginmode:{iconActive:l.drawingToolsIcons.drawginmodeActive},eraser:{},group:{},hideAllDrawings:{iconActive:l.drawingToolsIcons.hideAllDrawingsActive,hotKey:(0,r.hotKeySerialize)({keys:[m,p,"H"],text:"{0} + {1} + {2}"})},lockAllDrawings:{iconActive:l.drawingToolsIcons.lockAllDrawingsActive},magnet:{hotKey:(0,r.hotKeySerialize)({keys:[m],text:"{0}"})},measure:{hotKey:(0,r.hotKeySerialize)({keys:[u],text:n.t(null,void 0,o(32868))})},removeAllDrawingTools:{},showObjectsTree:{},zoom:{},"zoom-out":{}};const f={};Object.entries(w).map((([e,t])=>{var o,n;const r=null!==(o=s.lineToolsIcons[e])&&void 0!==o?o:l.drawingToolsIcons[e];(0,i.assert)(!!r,`Icon is not defined for drawing "${e}"`);const h=null!==(n=c.lineToolsLocalizedNames[e])&&void 0!==n?n:a[e];(0,i.assert)(!!h,`Localized name is not defined for drawing "${e}"`);return{...t,name:e,icon:r,localizedName:h,selectHotkey:d.lineToolsSelectHotkeys[e]}})).forEach((e=>{f[e.name]=e}))},26916:(e,t,o)=>{"use strict";var i=o(36298).TranslatedString,n=o(44296).LineToolPropertiesWidgetBase;const r=o(70114).ColorPickerButton,s=o(61259).LineWidthButton ;var l=o(94071),a=o(21065),c=o(89103),h=new i("change line tool(s) color",o.tf(null,void 0,o(68519))),d=new i("change line tool(s) background color",o.tf(null,void 0,o(74350))),u=new i("change line tool(s) text color",o.tf(null,void 0,o(16631))),p=new i("change line tool(s) line width",o.tf(null,void 0,o(41648))),m=o.tf(null,void 0,o(40054)),g=o.tf(null,void 0,o(12928)),v=o.tf(null,void 0,o(19221)),_=o.tf(null,void 0,o(21327)),w=o.tf(null,void 0,o(38455)),f=o.tf(null,void 0,o(71845)),y=o.tf(null,void 0,o(32733)),b=o.tf(null,void 0,o(23886)),T=o.tf(null,void 0,o(86327)),C=o.tf(null,void 0,o(47059)),x=o.tf(null,void 0,o(36785)),L=o.tf(null,void 0,o(49593)),S=o.tf(null,void 0,o(67455)),P=o.tf(null,void 0,o(79964)),E=o.tf(null,void 0,o(45320));class A extends n{constructor(e){super(e),this._templatesButton=null}_createWidthsButton(e,t){if(this._lineWidthsProperty&&(this._lineWidthsProperty.destroy(),this._lineWidthsProperty=null),this._lineWidthsProperty=this._createProperty(e,t,"linesWidths",p),!this._lineWidthsProperty)return!0;var o=T;t&&(1!==this.selectedSources().filter((e=>e.properties().linesWidths)).length&&(o=C));return this._addPropertyButton({component:s,props:{title:o,multipleProperty:this._lineWidthsProperty,propertyApplier:this._propertyApplierImpl(),"data-name":"line-tool-width",undoText:p}}),!0}_createColorsButton(e,t){return this._lineColorsProperty&&(this._lineColorsProperty.destroy(),this._lineColorsProperty=null),this._lineColorsProperty=this._createProperty(e,t,"linesColors",h),!this._lineColorsProperty||(this._addPropertyButton({component:r,props:{icon:l,title:g,property:this._lineColorsProperty,propertyApplier:this._propertyApplierImpl(),"data-name":"line-tool-color",undoText:h}}),!0)}_createBackgroundsButton(e,t){return this._backgroundsProperty&&(this._backgroundsProperty.destroy(),this._backgroundsProperty=null),this._backgroundsProperty=this._createProperty(e,t,"backgroundsColors",d),!this._backgroundsProperty||(this._addPropertyButton({component:r,props:{icon:a,title:f,property:this._backgroundsProperty,propertyApplier:this._propertyApplierImpl(),"data-name":"background-color",undoText:d}}),!0)}_createTextColorsButton(e,t){return this._textColorsProperty&&(this._textColorsProperty.destroy(),this._textColorsProperty=null),this._textColorsProperty=this._createProperty(e,t,"textsColors",u),!this._textColorsProperty||(this._addPropertyButton({component:r,props:{icon:c,title:_,property:this._textColorsProperty,propertyApplier:this._propertyApplierImpl(),"data-name":"text-color",undoText:u}}),!0)}_getPossibleProperty(e){for(var t=[],o=this._defaultToolProperties(),i=0;i{"use strict";o.d(t,{CollectibleColorPropertyDirectWrapper:()=>l,CollectibleColorPropertyUndoWrapper:()=>s});var i=o(50151),n=o(88640);class r extends n.default{constructor(e){super(),this._listenersMappers=[],this._isProcess=!1,this._baseProperty=e}destroy(){this._baseProperty.destroy(),super.destroy()}value(){ diff --git a/charting_library/bundles/library.b0e1bc71bddeb9026291.js b/charting_library/bundles/library.97ddeff81f861d17f06e.js similarity index 77% rename from charting_library/bundles/library.b0e1bc71bddeb9026291.js rename to charting_library/bundles/library.97ddeff81f861d17f06e.js index 54900b39..31b277d6 100644 --- a/charting_library/bundles/library.b0e1bc71bddeb9026291.js +++ b/charting_library/bundles/library.97ddeff81f861d17f06e.js @@ -45,105 +45,106 @@ subscribe(e,t,i,s,r){const n=d(e,t);this._threads[n]||(this._threads[n]=this._cr },3035:(e,t,i)=>{"use strict";var s,r=i(60156),n={};e.exports=function(e,t,i){var o,a,l,c,h={},d=n[i]||"out_of_session",u=!1,p=i,_=t,m=null,g=null;function f(){var e={};e.symbolname=p,e.status="ok",e.values={},e.values.current_session=d,n[p]=d,TradingView.ChartapiMessagerInstances[_].onQuotesData([_].concat([e]))}function v(){if(o)if(c)d="out_of_session";else{var e=(new Date).getTime(),t=r.isTradingNow(e,o)?"market":"out_of_session";a&&r.isTradingNow(e,a)?t="pre_market":l&&r.isTradingNow(e,l)&&(t="post_market"),t!==d&&(d=t)}}return e(i,null,(function(e){u||function(e){o=new r.SessionInfo(e.timezone,e.session,e.session_holidays,e.corrections),c=e.expired,e.subsession_id&&e.subsessions?e.subsessions.forEach((t=>{switch(t.id){case"premarket":a=new r.SessionInfo(e.timezone,t.session,e.session_holidays,e["session-premarket-correction"]||e.corrections);break;case"postmarket":l=new r.SessionInfo(e.timezone,t.session,e.session_holidays,e["session-postmarket-correction"]||e.corrections)}})):(a=void 0,l=void 0);const t=60-new Date(Date.now()).getSeconds();s&&s?.ticker===e.ticker||(s={ticker:e.ticker,timer:t},clearTimeout(s.timeout)),g=setTimeout((()=>{m=setInterval((()=>{v(),f()}),6e4),v(),f()}),1e3*s.timer),s&&void 0!==s?.timeout||(s.timeout=g),v(),f()}(e)}),(function(){})),h.stop=function(){u=!0,m&&clearInterval(m),g&&clearInterval(g)},h.marketStatus=function(){return d},h}},36454:(e,t,i)=>{"use strict";i.d(t,{getChartStyleStudy:()=>n});var s=i(81337);class r{main(e){const t=e.new_var(s.Std.open(e)),i=e.new_var(s.Std.close(e)),r=t.get(1),n=i.get(1),o=s.Std.ohlc4(e),a=s.Std.na(t.get(1))?(s.Std.open(e)+s.Std.close(e))/2:(r+n)/2;t.set(a),i.set(o);const l=s.Std.max(s.Std.high(e),s.Std.max(a,o)),c=s.Std.min(s.Std.low(e),s.Std.min(a,o)),h=s.Std.volume(e),d=e.symbol;return[d.time,a,l,c,o,h,d.updatetime,d.isBarClosed]}}function n(e){if(0===e.type.indexOf("BarSetHeikenAshi@tv-basicstudies-"))return new r;const t=`unknown builder type: ${e.type}`;throw console.error(t),new Error(t)}},61476:(e,t,i)=>{"use strict";var s=i(36274).Interval,r=i(77475).isAlignmentEnabled,n=i(36454).getChartStyleStudy,o=i(27856).decodeExtendedSymbol,a=i(47609).findSuitableResolutionToBuildFrom,l=i(66846).SubsessionId,c=function(){var e=i(74649),t=e.StudyEngine,c=e.BarBuilder,h=e.BarSet;function d(e){this.host=e,this.cache={}}function u(t){console.error(t),e.Std.error(t)}d.prototype.getCache=function(e){return this.cache[e]},d.prototype.putCache=function(e,t){this.cache[e]=t},d.prototype.subscribe=function(e,t,i,s,r,n,o,a,l,c,h){var d=l(o),u=function(e,t,i,s,r,n,o,a,l){var c=r.has_empty_bars?"_":"";return n+e+s+(t||"")+(i||"")+(l||"")+c+"_"+o.countBack+"_"+o.to+"_"+Boolean(a)}(e,t,i,s,o,a,d,c,h),p=this.getCache(u);return p||(p=this.createItem(e,t,i,s,o,d,a,c,h),this.putCache(u,p)),p.listeners.addListener(r,n),{key:u,listener:r}},d.prototype.unsubscribe=function(e){var t=this.getCache(e.key);t&&t.listeners.removeListener(e.listener)},d.prototype.removeUnused=function(){var e=[];for(var t in this.cache){ if(this.cache[t])0===this.cache[t].listeners.listenersCount()&&e.push(t)}if(0!==e.length){for(var i=0;i{"use strict";i.d(t,{findSuitableResolutionToBuildFrom:()=>o});var s=i(36274);function r(e,t){const i=t.multiplier();for(let s=e.length-1;s>=0;s--){const r=Number(e[s]);if(i%r==0)return{error:!1,resolution:`${r}${t.letter()}`}}return{error:!0,errorMessage:n(t.value())}}function n(e){return`Misconfiguration error: it is trying to request ${e} but we cannot build it from lower resolution`}function o(e,t){const i=s.Interval.parse(e);if((i.isWeeks()||i.isMonths())&&t.has_weekly_and_monthly){let e=["1"];i.isWeeks()&&void 0!==t.weekly_multipliers&&(e=t.weekly_multipliers),i.isMonths()&&void 0!==t.monthly_multipliers&&(e=t.monthly_multipliers);const s=r(e,i);if(!s.error)return s}if(i.isDWM()&&(void 0===t.has_daily||t.has_daily))return i.isDays()&&void 0!==t.daily_multipliers?r(t.daily_multipliers,i):void 0===t.daily_multipliers||t.daily_multipliers.includes("1")?{error:!1,resolution:"1D"}:{error:!0,errorMessage:"Misconfiguration error: it is trying to request a resolution but symbol does not support it"};if(i.isDWM())return{error:!0,errorMessage:n(i.value())};if(i.isMinutes()&&!t.has_intraday)return{error:!0,errorMessage:"Misconfiguration error: it is trying to request intraday resolution but symbol does not support it"};if(i.isSeconds()&&!t.has_seconds)return{error:!0,errorMessage:"Misconfiguration error: it is trying to request seconds resolution but symbol does not support it"};if(i.isTicks())return!t["is-tickbars-available"]||i.multiplier()>1?{error:!0, -errorMessage:`Misconfiguration error: it is trying to request ${i.multiplier()} ticks resolution but symbol does not support it`}:{error:!1,resolution:"1T"};const o=i.isSeconds()?t.seconds_multipliers:t.intraday_multipliers;return void 0===o?{error:!1,resolution:i.value()}:r(o,i)}},74649:(e,t,i)=>{"use strict";var s,r=i(36274).Interval,n=i(77475).createDwmAligner,o=i(77475).createTimeToBarTimeAligner,a=i(27856).decodeExtendedSymbol,l=i(27856).encodeExtendedSymbolOrGetSimpleSymbolString,c=i(66846).SubsessionId,h=i(57333).SessionSpec,d=i(81337).Std,u=i(37040).Series,p=i(97651).Script,_=i(41249),m=i(60156),g=i(94421).extrapolateBarsFrontToTime;class f{constructor(e,t,i,s,n,o,c){var h=a(e);const d="string"==typeof h.symbol?h:h.symbol;this.ticker=d.symbol,this.currencyCode=i||d["currency-id"],this.unitId=s||d["unit-id"],this.subsessionId=c||d.session;var u=d["currency-id"]!==this.currencyCode||d["unit-id"]!==this.unitId;d["currency-id"]=this.currencyCode,d["unit-id"]=this.unitId,u&&(e=l(h)),this.tickerid=e;var p=r.parse(t);this.resolution=p.letter(),this.interval=p.multiplier(),this.period=p.value(),this.index=-1,this.time=NaN,this.open=NaN,this.high=NaN,this.low=NaN,this.close=NaN,this.volume=NaN,this.updatetime=NaN,this.isNewBar=!1,this.isBarClosed=!1,this.session=new m.SessionInfo("Etc/UTC","24x7"),this.regularSubsession=null,this.preMarketSubsession=null,this.postMarketSubsession=null,this.script=n,this.isAdditionalDepthAllowed=void 0===h.type||h.type.includes("BarSetHeikenAshi"),o&&this.set_symbolinfo(o)}set_symbolinfo(e){if(e||console.error("WARN: symbolinfo isn't defined for "+this.tickerid),this.info=e,this.minTick=e.minmov/e.pricescale,this.currencyCode=e.currency_code,this.unitId=e.unit_id,this.subsessionId=e.subsession_id,this.timezone=_.get_timezone(e.timezone),this.session.init(e.timezone,e.session,e.session_holidays,e.corrections),void 0!==e.subsessions){const t=e.subsessions.find((e=>e.id===c.Regular)),i=e.subsessions.find((e=>e.id===c.PreMarket)),s=e.subsessions.find((e=>e.id===c.PostMarket));void 0!==t&&(this.regularSubsession=new h(e.timezone,t.session,e.session_holidays,t["session-correction"])),void 0!==i&&(this.preMarketSubsession=new h(e.timezone,i.session,e.session_holidays,i["session-correction"])),void 0!==s&&(this.postMarketSubsession=new h(e.timezone,s.session,e.session_holidays,s["session-correction"]))}}isdwm(){return""!==this.resolution&&"S"!==this.resolution&&"T"!==this.resolution}enable_dwm_aligning(e,t){this.dwm_aligner=m.newBarBuilder(this.period,e,t)}bartime(){var e=this.time;if(!this.isdwm()||isNaN(e))return e;var t=_.utc_to_cal(this.timezone,e);return this.session.spec.correctTradingDay(t),_.cal_to_utc(this.timezone,t)}lastbar(e){if(!isNaN(e.time)){var t=e.time;this.dwm_aligner&&(this.dwm_aligner.moveTo(t),t=this.dwm_aligner.startOfBar(0));var i=this.time!==t;i&&this.index>=0&&!this.isBarClosed&&(this.isNewBar=!1,this.isBarClosed=!0,this.script.calc(this)),this.time=t,this.open=e.open,this.high=e.high,this.low=e.low,this.close=e.close,this.volume=e.volume,this.updatetime=e.updatetime, -this.isNewBar=i,this.isBarClosed=e.isBarClosed,this.isLastBar=e.isLastBar,this.isNewBar&&(this.index++,this.isFirstBar=0===this.index),this.script.calc(this)}}}class v{constructor(e){this.symbols=[],this.barsets=[],this.subscription=[],this.host=e,this.isRecalculated=!1,this.isStarted=!1,this.start()}add_sym(e,t,i,s,r,n,o){var a=new f(e,t,i,s,r,n,o);return this.symbols.push(a),a}get_sym(e){return this.symbols[e]}out(e,t){if(this.nonseriesUpdate){var i=Object.assign({},this.nonseriesUpdate);t.splice(0,0,e.time),i.lastBar=t,this.host.nonseriesOut(e,i)}else this.host.out(e,t)}start(){this.isStarted=!0;var e=this.host;this._script=new p(e.tickerid,e.period,e.currencyCode,e.unitId,this,e.body,this.out.bind(this),e.input,e.nonseriesOut,e.symbolInfo,e.subsessionId);var t=this,i=[],s=this.symbols,a=Object.assign({},e.dataRange,{countBack:e.dataRange.countBack+t._script.maxAdditionalDepth()}),l=s[0];function c(t,s,r){i.push(v.feed.subscribe(t.tickerid,t.currencyCode,t.unitId,t.period,r,e.onErrorCallback,e.symbolInfo,e.sessionId,s,e.forceAlignBars,t.subsessionId))}function h(i,s){"series"===(s.nonseries?"nonseries":"series")?t.update(i,s):s.lastBar?(t.nonseriesUpdate=s,s.lastBar.isLastBar=!0,t.symbols[0].lastbar(s.lastBar),t.nonseriesUpdate=null):e.nonseriesOut(_,s)}function d(){return a}c(l,d,(function(e){!e.nonseries&&Number.isFinite(e.firstLoadedTimeMs)&&function(e){function i(i,s){var r=o(i,s)(e),a=n(i,s);return null!==a&&(r=a.timeToExchangeTradingDay(r)),{to:r,countBack:t._script.maxAdditionalDepth()}}for(var a=1;a=0;i--)for(var s=e[i],r=this.barsets[i],n=r.count(),o=0;o{"use strict";i.d(t,{Script:()=>o});var s=i(37040),r=i(81337);class n{constructor(e){this.minimumAdditionalDepth=null,this._vars=[],this._varsIndex=0,this._ctx=[],this._ctxIndex=0,this.symbol=e}new_sym(e,t,i,s,r){return this.symbol.script.add_sym(e,t,i,s,r)}select_sym(e){const t=this.symbol.script.get_sym(e);null==t&&r.Std.error(`Attempted to select symbol at index ${e} but there is no such symbol`),this.symbol=t}is_main_symbol(e){return void 0!==e&&e===this.symbol.script.get_sym(0)}new_var(e){const t=this._vars;t.length<=this._varsIndex&&t.push(new s.Series(this.symbol));const i=t[this._varsIndex++];return arguments.length>0&&void 0!==e&&i.set(e),i}new_unlimited_var(e){const t=this._vars -;t.length<=this._varsIndex&&t.push(new s.UnlimitedSeries(this.symbol));const i=t[this._varsIndex++];return arguments.length>0&&i.set(e),i}new_ctx(){return this._ctx.length<=this._ctxIndex&&this._ctx.push(new n(this.symbol)),this._ctx[this._ctxIndex++]}prepare(e){this._ctxIndex=0,this._varsIndex=0;for(let t=0;te&&(e=i)}return e}stop(){this.symbol=null,this._vars=null}setMinimumAdditionalDepth(e){this.minimumAdditionalDepth=e}}class o{constructor(e,t,i,s,r,o,a,l,c,h,d){this._body=o,this._symbols=[],this._runner=r,this._inputCallback=l,this._out=a,this._nonseriesOut=c,this._ctx=new n(this.add_sym(e,t,i,s,h,d)),this.init()}calc(e){const t=this._ctx,i=this._body;t.prepare(e);const s=i.main(t,this._inputCallback,e);if(s&&"composite"===s.type)for(let e=0;e1&&this._runner.host.enableDwmAligning&&o.enable_dwm_aligning(this._symbols[0].session,o.session),o}maxAdditionalDepth(){return this._symbols[0].isAdditionalDepthAllowed?this._ctx.maxAdditionalDepth():0}stop(){var e;this._symbols=null,null===(e=this._ctx)||void 0===e||e.stop(),this._ctx=null}get_sym(e){return this._symbols[e]}_processResult(e){const t=this._ctx;this._out&&e&&(!isNaN(t.symbol.time)||e.nonseries)&&(e.nonseries?("projection"===e.type&&(e.projectionTime=t.symbol.time),this._nonseriesOut(t.symbol,e)):e.bars?e.bars.forEach((e=>{this._out(t.symbol,e)})):this._out(t.symbol,e))}}},37040:(e,t,i)=>{"use strict";i.d(t,{Series:()=>n,UnlimitedSeries:()=>o});var s=i(78071),r=i(81337);class n{constructor(e){this.mindepth=0,this.original=NaN,this.modified=!1,this._hist=null,this._histPos=0,this.symbol=e}valueOf(){return this.get(0)}get(e){return isNaN(e)&&(e=0),e=e||0,this._hist?e>=this._hist.length?(console.error("not enough depth: "+this),NaN):this._get(e):(this.mindepth=r.Std.max(this.mindepth,e),NaN)}set(e){this._hist&&(this._hist[this._histPos]=e,this.modified=!0)}prepare(e){e===this.symbol&&(e.isNewBar?(this.original=this.get(0),!this.modified&&this._hist||this.add_hist()):this.set(this.original),this.modified=!1)}add_hist(){if(!this._hist){let e=r.Std.na(this.mindepth)?r.Std.max_series_default_size:r.Std.max(this.mindepth+1,1);e=Math.round(e);const t=new Array(e);for(let i=0;i{"use strict";const s=i(14483),r=i(33013).getHexColorByName;var n=i(74649);i(24172);var o=i(82808).pivotPointsStandardStudyItem,a=i(72365).volumeProfileVisibleRangeStudyItem,l=i(82597).volumeProfileFixedRangeVbPStudyItem,c=i(82597).volumeProfileFixedRangeBSStudyItem,h=i(39944).spreadStudyItem,d=i(81821).ratioStudyItem,u=i(65097).regressionTrendStudyItem,p=i(53130).anchoredVWAPStudyItem;const _=r("color-ripe-red-400"),m=r("color-minty-green-400"),g=s.enabled("secondary_series_extend_time_scale");JSServer.studyLibrary=JSServer.studyLibrary.concat([{name:"Compare",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!0,defaults:{styles:{compare:{linestyle:0,linewidth:2,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#9C27B0"}},inputs:{source:"close",symbol:""}},plots:[{id:"compare",type:"line"}],styles:{compare:{title:"Plot",histogramBase:0}},description:"Compare",shortDescription:"Compare",is_price_study:!0,inputs:[{defval:"close",id:"source",name:"Source",options:["open","high","low","close","hl2","hlc3","ohlc4"],type:"text"},{id:"symbol",name:"Symbol",type:"symbol",isHidden:!0}],id:"Compare@tv-basicstudies-1",format:{type:"inherit"}},constructor:function(){this.init=function(e,t){this._context=e,this._context.new_sym(t(1),n.Std.period(this._context))},this.main=function(e,t){this._context=e;var i=this._context.new_unlimited_var(this._context.symbol.time);this._context.select_sym(1);var s=this._context.new_unlimited_var(this._context.symbol.time),r=n.Std[t(0)](this._context),o=this._context.new_unlimited_var(r);return this._context.select_sym(0),[o.adopt(s,i,0)]}}},{name:"Overlay",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!0,defaults:{styles:{},inputs:{symbol:"",extendTimeScale:!1}},plots:[{id:"open",type:"line"},{id:"high",type:"line"},{id:"low",type:"line"},{id:"close",type:"line"}],styles:{open:{title:"Open"},high:{title:"High"},low:{title:"Low"},close:{title:"Close"}},description:"Overlay",shortDescription:"Overlay",is_price_study:!1,inputs:[{id:"symbol",name:"symbol",defval:"",type:"symbol",isHidden:!0},{id:"extendTimeScale",name:"extendTimeScale",defval:!1,type:"boolean",isHidden:!0}],id:"Overlay@tv-basicstudies-1",format:{type:"price",precision:4},canExtendTimeScale:!0 -},constructor:function(){this.init=function(e,t){this._context=e,this._context.new_sym(t(0),n.Std.period(this._context))},this.main=function(e,t){this._context=e;var i=!g||!0!==t(1),s=this._context.new_unlimited_var(this._context.symbol.time);this._context.select_sym(1);var r=this._context.new_unlimited_var(this._context.symbol.time),o=this._context.new_unlimited_var(n.Std.open(this._context)),a=this._context.new_unlimited_var(n.Std.high(this._context)),l=this._context.new_unlimited_var(n.Std.low(this._context)),c=this._context.new_unlimited_var(n.Std.close(this._context));return i?(this._context.select_sym(0),[o.adopt(r,s,1),a.adopt(r,s,1),l.adopt(r,s,1),c.adopt(r,s,1)]):[o.get(0),a.get(0),l.get(0),c.get(0)]}}},{name:"Volume",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{vol:{linestyle:0,linewidth:1,plottype:5,trackPrice:!1,transparency:50,visible:!0,color:"#000080"},vol_ma:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!1,color:"#2196F3"},smoothedMA:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!1,color:"#2196F3"}},palettes:{volumePalette:{colors:{0:{color:_,width:1,style:0},1:{color:m,width:1,style:0}}}},inputs:{showMA:!1,length:20,col_prev_close:!1,symbol:"",smoothingLine:"SMA",smoothingLength:9}},plots:[{id:"vol",type:"line"},{id:"volumePalette",palette:"volumePalette",target:"vol",type:"colorer"},{id:"vol_ma",type:"line"},{id:"smoothedMA",type:"line"}],styles:{vol:{title:"Volume",histogramBase:0},vol_ma:{title:"Volume MA",histogramBase:0},smoothedMA:{title:"Smoothed MA",histogramBase:0}},description:"Volume",shortDescription:"Volume",is_price_study:!1,palettes:{volumePalette:{colors:{0:{name:"Falling"},1:{name:"Growing"}}}},inputs:[{id:"symbol",name:"Other Symbol",defval:"",type:"symbol",optional:!0,isHidden:!1},{id:"showMA",name:"show MA",defval:!1,type:"bool",isHidden:!0},{id:"length",name:"MA Length",defval:20,type:"integer",min:1,max:2e3},{defval:!1,id:"col_prev_close",name:"Color based on previous close",type:"bool"},{id:"smoothingLine",name:"Smoothing Line",defval:"SMA",type:"text",options:["SMA","EMA","WMA"]},{id:"smoothingLength",name:"Smoothing Length",defval:9,type:"integer",min:1,max:1e4}],id:"Volume@tv-basicstudies-1",format:{type:"volume"}},constructor:function(){this.init=function(e,t){this._context=e,""!==t(0)&&this._context.new_sym(t(0),n.Std.period(this._context))},this.f_0=function(e,t){return n.Std.gt(e,t)?0:1},this.main=function(e,t){this._context=e,this._input=t;var i=n.Std.volume(this._context),s=n.Std.open(this._context),r=n.Std.close(this._context),o=this._context.new_var(this._context.symbol.time),a=this._input(4),l=this._input(5);if(this._context.setMinimumAdditionalDepth(this._input(2)+l),""!==this._input(0)){this._context.select_sym(1);var c=this._context.new_var(this._context.symbol.time),h=this._context.new_var(n.Std.volume(this._context)),d=this._context.new_var(n.Std.open(this._context)),u=this._context.new_var(n.Std.close(this._context));i=h.adopt(c,o,1),s=d.adopt(c,o,1), -r=u.adopt(c,o,1),this._context.select_sym(0)}var p,_,m=this._context.new_var(i),g=n.Std.sma(m,this._input(2),this._context),f=this._context.new_var(g),v=this._context.new_var(r);return p=v.get(1)&&this._input(3)?this.f_0(v.get(1),r):this.f_0(s,r),"EMA"===a?_=n.Std.ema(f,l,this._context):"WMA"===a?_=n.Std.wma(f,l,this._context):"SMA"===a&&(_=n.Std.sma(f,l,this._context)),[i,p,g,_]}}},{name:"ZigZag",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:2,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:5,in_1:10}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",target:"plot_0",type:"dataoffset"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Zig Zag",shortDescription:"ZigZag",is_price_study:!0,classId:"ScriptWithDataOffset",inputs:[{id:"in_0",name:"deviation",defval:5,type:"float",min:.001,max:100},{id:"in_1",name:"depth",defval:10,type:"integer",min:2,max:1e3}],id:"ZigZag@tv-basicstudies-1",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),r=i/100,o=Math.ceil(s/2);return[n.Std.zigzag(r,o,this._context),n.Std.zigzagbars(r,o,this._context)]}}},{name:"Sessions",metainfo:{_metainfoVersion:52,defaults:{graphics:{vertlines:{sessBreaks:{color:"#4985e7",style:2,visible:!1,width:1}},backgrounds:{preMarket:{color:"#FF9800",transparency:92,visible:!0},postMarket:{color:"#2196F3",transparency:92,visible:!0}}},linkedToSeries:!0},description:"Sessions",graphics:{vertlines:{sessBreaks:{name:"Session Break",halign:"left"}},backgrounds:{preMarket:{name:"Pre market"},postMarket:{name:"Post market"}}},id:"Sessions@tv-basicstudies-1",inputs:[],is_hidden_study:!0,is_price_study:!0,name:"Sessions@tv-basicstudies",palettes:{},plots:[],shortDescription:"Sessions",format:{type:"inherit"}},constructor:function(){function e(e,t){return{id:e,index:e,extendBottom:!0,extendTop:!0}}function t(e){return{id:e.start,start:e.start,stop:e.stop}}this.init=function(){this._times=[]},this._getVerticalLineData=function(t){return n.Std.selectSessionBreaks(t,this._times).map(e)},this._getPreAndPostMarketBackgroundsData=function(e){const i=n.Std.selectPreAndPostMarketTimes(e,this._times);return{preMarket:i.preMarket.map(t),postMarket:i.postMarket.map(t)}},this.main=function(e,t){if(n.Std.isdwm(e))return null;var i=n.Std.time(e);if(isNaN(i))return null;var s=this._times.length;if(0!==s&&this._times[s-1]===i||this._times.push(i),!e.symbol.isLastBar||!e.symbol.isNewBar)return null;var r=this._getVerticalLineData(e),o=this._getPreAndPostMarketBackgroundsData(e);return 0===r.length&&0===o.preMarket.length&&0===o.postMarket?null:{nonseries:!0,type:"study_graphics",data:{graphicsCmds:{create:{vertlines:[{styleId:"sessBreaks",data:r}],backgrounds:[{styleId:"preMarket",data:o.preMarket},{styleId:"postMarket",data:o.postMarket}]},erase:[{action:"all"}]}}}}}},{name:"SuperTrend",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1, -is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:3,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#000080"},plot_2:{linestyle:0,linewidth:3,plottype:"shape_arrow_up",trackPrice:!1,location:"BelowBar",transparency:35,visible:!0,color:"#00FF00"},plot_3:{linestyle:0,linewidth:3,plottype:"shape_arrow_down",trackPrice:!1,location:"AboveBar",transparency:35,visible:!0,color:"#FF0000"}},palettes:{palette_0:{colors:{0:{color:"#008000",width:3,style:0},1:{color:"#800000",width:3,style:0}}}},inputs:{in_0:10,in_1:3}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",palette:"palette_0",target:"plot_0",type:"colorer"},{id:"plot_2",type:"shapes"},{id:"plot_3",type:"shapes"}],styles:{plot_0:{title:"SuperTrend",histogramBase:0,joinPoints:!1,isHidden:!1},plot_2:{title:"Up Arrow",histogramBase:0,joinPoints:!1,isHidden:!1},plot_3:{title:"Down Arrow",histogramBase:0,joinPoints:!1,isHidden:!1}},description:"SuperTrend",shortDescription:"SuperTrend",is_price_study:!0,palettes:{palette_0:{colors:{0:{name:"Color 0"},1:{name:"Color 1"}},valToIndex:{0:0,1:1}}},inputs:[{id:"in_0",name:"Length",defval:10,type:"integer",min:1,max:100},{id:"in_1",name:"Factor",defval:3,type:"float",min:1,max:100}],id:"SuperTrend@tv-basicstudies-1",scriptIdPart:"",name:"SuperTrend",isCustomIndicator:!0,format:{type:"inherit"}},constructor:function(){this.main=function(e,t){var i=t(0),s=t(1),[r,o]=n.Std.supertrend(s,i,e),a=e.new_var(o).get(1);return[r,-1===o?0:1,-1===o&&a!==o?1:NaN,1===o&&a!==o?1:NaN]}}},o,a,l,c,h,d,u,p])},81337:(e,t,i)=>{"use strict";i.d(t,{Std:()=>h});var s=i(60156),r=i(41249);class n{constructor(e,t,i){var s,r;this._timezone=e,this._preMarketSessionEntries=null!==(s=null==t?void 0:t.entries())&&void 0!==s?s:[],this._postMarketSessionEntries=null!==(r=null==i?void 0:i.entries())&&void 0!==r?r:[]}getPreAndPostMarketTimes(e){if(0===e.length)return{preMarket:[],postMarket:[]};const t=[],i=[];let s=null,n=null,o=e[0],a=(0,r.utc_to_cal)(this._timezone,o);this._isInPreMarketSession(a)&&(n=o),this._isInPostMarketSession(a)&&(s=o);for(let l=1;le?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 S=u.get(1),y=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=S,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,S),h.n(s)>2&&(x=Math.min(x,y))):(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(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(81337);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,{pivotPointsStandardStudyItem:()=>d});var s=i(36274),r=i(47609),n=i(81337);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 S=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(S),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(81337);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=[],S=[],y=[];for(let e=m;e>=g;--e)f.push(n.get(e)),v.push(o.get(e)),S.push(a.get(e)),y.push(l.get(e));return this._updateData(f,d,c,u,h,p,_,r(y,v,S)),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:()=>r,spreadRatioDefaults:()=>n,spreadRatioInputs:()=>o,spreadRatioPlots:()=>a,spreadRatioStyles:()=>l});var s=i(81337);class r{init(e,t){e.new_sym(t(1),s.Std.period(e)),this._source=t(0),this._scaleFactor1=1,this._scaleFactor2=1}main(e,t){const i=e.symbol.time,r=s.Std[this._source](e);e.select_sym(1);const n=s.Std[this._source](e),o=e.new_unlimited_var(n),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);return[this._doCalculation(this._scaleFactor1,r,this._scaleFactor2,c)]}}const n={styles:{plot1:{linestyle:0,linewidth:2,plottype:0,trackPrice:!1,transparency:35,color:"#800080",display:15}},precision:2,inputs:{source:"close",symbol2:""}},o=[{defval:"close",id:"source",name:"Source",options:["open","high","low","close","hl2","hlc3","ohlc4"],type:"text"},{id:"symbol2",name:"Symbol",type:"symbol",confirm:!0}],a=[{id:"plot1",type:"line"}],l={plot1:{title:"Plot",histogramBase: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,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(81337);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(74649),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(14483),c=i(81337);function h(){return 6e3}function d(e){switch(e){case"Delta":case"Up/Down":return 2;case"Total":return 1;default:c.Std.error(`Invalid study argument value: ${e}`)}}class u{findBasicResolutionForFromTo(e,t,i,n){const o=(0,s.getVolumeProfileResolutionForPeriod)(e.value(),t,i,n),a=r.Interval.parse(o);return l.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&&c.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 y(e){return{constructor:S,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=y({id:"VbPFixed@tv-volumebyprice-57",description:"Volume Profile Fixed Range"}),w=y({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"}}}}},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(81337);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(74649);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.Std.or(r.Std.and(r.Std.eq(e,t),r.Std.eq(e,i)),r.Std.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.Std.close(this._context),r.Std.high(this._context),r.Std.low(this._context),r.Std.volume(this._context));return[r.Std.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.Std.open(t)),s=t.new_var(r.Std.high(t)),n=t.new_var(r.Std.low(t)),o=t.new_var(r.Std.close(t)),a=r.Std.abs(s-o.get(1)),l=r.Std.abs(n-o.get(1)),c=r.Std.abs(s-n),h=r.Std.abs(o.get(1)-i.get(1)),d=r.Std.max(a,l),u=r.Std.iff(a>=r.Std.max(l,c),a-.5*l+.25*h,r.Std.iff(l>=r.Std.max(a,c),l-.5*a+.25*h,c+.25*h));return r.Std.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.Std.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.Std.gt(e,t)},this.f_1=function(e,t){return r.Std.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.Std.close(this._context),r.Std.open(this._context)),n=this._context.new_var(s),o=r.Std.sum(n,i,this._context),a=this.f_1(r.Std.close(this._context),r.Std.open(this._context)),l=this._context.new_var(a),c=r.Std.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.Std.close(this._context),s=this._input(0),n=this._input(1),o=this._input(2),a=this._context.new_var(i);return[r.Std.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.Std.high(this._context),n=i+1,o=this._context.new_var(s),a=r.Std.highestbars(o,n,this._context),l=this.f_0(a,i),c=r.Std.low(this._context),h=this._context.new_var(c),d=r.Std.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.Std.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.Std.high(this._context)),i=r.Std.change(t),s=this._context.new_var(r.Std.low(this._context)),n=-r.Std.change(s),o=this._context.new_var(r.Std.tr(void 0,this._context)),a=r.Std.rma(o,e,this._context),l=this._context.new_var(r.Std.and(r.Std.gt(i,n),r.Std.gt(i,0))?i:0),c=r.Std.fixnan(100*r.Std.rma(l,e,this._context)/a,this._context),h=this._context.new_var(r.Std.and(r.Std.gt(n,i),r.Std.gt(n,0))?n:0);return[c,r.Std.fixnan(100*r.Std.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.Std.abs(s-n)/(r.Std.eq(o,0)?1:o));return[100*r.Std.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.Std.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.Std.le(e,0)?0:1},this.main=function(e,t){this._context=e,this._input=t;var i=r.Std.hl2(this._context),s=this._context.new_var(i),n=r.Std.sma(s,5,this._context),o=this._context.new_var(i),a=r.Std.sma(o,34,this._context),l=this.f_0(n,a),c=l,h=this._context.new_var(l),d=r.Std.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.Std.le(e,0)?0:1},this.main=function(e,t){this._context=e,this._input=t;var i=r.Std.hl2(this._context),s=this._context.new_var(i),n=r.Std.sma(s,5,this._context),o=this._context.new_var(i),a=r.Std.sma(o,34,this._context),l=this.f_0(n,a),c=this._context.new_var(l),h=r.Std.sma(c,5,this._context),d=this.f_0(l,h),u=this._context.new_var(d),p=r.Std.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.Std.close(this._context),r.Std.open(this._context),r.Std.high(this._context),r.Std.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.Std.close(this._context),s=this._input(0),n=this._input(1),o=this._context.new_var(i),a=r.Std.sma(o,s,this._context),l=this._context.new_var(i),c=r.Std.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.Std.close(this._context),s=this._input(0),n=this._input(1),o=this._context.new_var(i),a=r.Std.sma(o,s,this._context),l=this._context.new_var(i),c=r.Std.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.Std.close(this._context),s=this._input(0),n=this._input(1),o=this._context.new_var(i),a=r.Std.sma(o,s,this._context),l=this._context.new_var(i),c=r.Std.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.Std.or(r.Std.and(r.Std.eq(e,t),r.Std.eq(e,i)),r.Std.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.Std.close(this._context),r.Std.high(this._context),r.Std.low(this._context),r.Std.volume(this._context)),n=this._context.new_var(s),o=r.Std.sum(n,i,this._context),a=r.Std.volume(this._context),l=this._context.new_var(a),c=r.Std.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.Std.accdist(this._context),o=this._context.new_var(n),a=r.Std.ema(o,i,this._context),l=this._context.new_var(n),c=r.Std.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.Std.high(this._context)-r.Std.low(this._context)),s=this._context.new_var(r.Std.ema(i,this.period,this._context));return[r.Std.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.Std.high(this._context),a=this._context.new_var(o),l=r.Std.highest(a,i,this._context),c=r.Std.atr(i,this._context),h=this.f_0(l,s,c),d=this._context.new_var(o),u=r.Std.lowest(d,i,this._context),p=this.f_1(u,s,c),_=this._context.new_var(h),m=r.Std.highest(_,n,this._context),g=this._context.new_var(p);return[r.Std.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.Std.ge(e,0)?e:0},this.f_1=function(e){ -return r.Std.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.Std.close(this._context),n=this._context.new_var(s),o=r.Std.change(n),a=this.f_0(o),l=this.f_1(o),c=this._context.new_var(a),h=r.Std.sum(c,i,this._context),d=this._context.new_var(l),u=r.Std.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.Std.close(this._context),t=r.Std.hlc3(this._context),i=this._context.new_var(r.Std.high(this._context)),s=r.Std.highest(i,30,this._context),n=r.Std.lowest(i,30,this._context),o=25/(s-n)*n,a=this._context.new_var(e),l=this._context.new_var(r.Std.ema(a,34,this._context)),c=(l.get(1)-l.get(0))/t*o,h=r.Std.sqrt(1+c*c),d=r.Std.round(180*r.Std.acos(1/h)/3.141592653589793),u=r.Std.iff(r.Std.gt(c,0),-d,d),p=r.Std.and(r.Std.gt(u,-2.14),r.Std.le(u,-.71))?7:8,_=r.Std.and(r.Std.gt(u,-3.57),r.Std.le(u,-2.14))?6:p,m=r.Std.and(r.Std.gt(u,-5),r.Std.le(u,-3.57))?5:_,g=r.Std.le(u,-5)?4:m,f=r.Std.and(r.Std.lt(u,2.14),r.Std.ge(u,.71))?3:g,v=r.Std.and(r.Std.lt(u,3.57),r.Std.ge(u,2.14))?2:f,S=r.Std.and(r.Std.lt(u,5),r.Std.ge(u,3.57))?1:v;return[1,r.Std.ge(u,5)?0:S]},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.Std.log10(e/(t-i))/s},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=r.Std.atr(1,this._context),n=this._context.new_var(s),o=r.Std.sum(n,i,this._context),a=r.Std.high(this._context),l=this._context.new_var(a),c=r.Std.highest(l,i,this._context),h=r.Std.low(this._context),d=this._context.new_var(h),u=r.Std.lowest(d,i,this._context),p=r.Std.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"]},{id:"smoothingLength",name:"Smoothing Length",defval:20,type:"integer",min:1,max:1e4}],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.Std.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.Std.sma(l,s,this._context),h=this._context.new_var(i),d=r.Std.dev(h,s,this._context),u=this.f_0(i,c,d),p=this._context.new_var(u);return"EMA"===n?a=r.Std.ema(p,o,this._context):"WMA"===n?a=r.Std.wma(p,o,this._context):"SMA"===n&&(a=r.Std.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.Std.max(r.Std.change(e),0));return r.Std.rma(s,t,i)},this.f_2=function(e,t,i){var s=i.new_var(-r.Std.min(r.Std.change(e),0));return r.Std.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.Std.nz(e)<=0?1:r.Std.nz(e)+1:r.Std.nz(e)>=0?-1:r.Std.nz(e)-1,this._context.new_var(e)}),this.main=function(e,t){this._context=e,this._input=t;var i=r.Std.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.Std.rsi(this.f_1(s,n,this._context),this.f_2(s,n,this._context)),c=this.f_3(s),h=r.Std.rsi(this.f_1(c,o,this._context),this.f_2(c,o,this._context)),d=this._context.new_var(r.Std.roc(s,1)),u=r.Std.percentrank(d,a);return[r.Std.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.Std.close(this._context),a=this._context.new_var(o),l=r.Std.roc(a,s),c=this._context.new_var(o),h=r.Std.roc(c,n),d=this.f_0(l,h),u=this._context.new_var(d);return[r.Std.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.Std.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.Std.period(this._context),r.Std.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.Std.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.Std.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.Std.period(this._context)),this._context.new_sym(this._input(1),r.Std.period(this._context)),this.period=this._input(2)},this.correlationLog=function(e,t,i,s){var n=r.Std.sma(e,i,s),o=r.Std.sma(t,i,s),a=s.new_var(e.get()*t.get());return(r.Std.sma(a,i,s)-n*o)/Math.sqrt(r.Std.variance2(e,n,i)*r.Std.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.Std.close(this._context)),n=this._context.new_var(r.Std.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.Std.close(this._context)),c=this._context.new_var(r.Std.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.Std.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.Std.close(this._context)),n=this._context.new_var(r.Std.sma(s,e,this._context)),o=this._context.new_var(r.Std.close(this._context)).get(i)-n,a=r.Std.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.Std.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.Std.low(this._context),n=this._context.new_var(s),o=r.Std.lowest(n,i,this._context),a=r.Std.high(this._context),l=this._context.new_var(a),c=r.Std.highest(l,i,this._context);return[o,c,r.Std.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.Std.close(this._context),n=this._context.new_var(s),o=r.Std.ema(n,i,this._context),a=this._context.new_var(o),l=r.Std.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.Std.hl2(this._context),o=this._context.new_var(n),a=r.Std.change(o),l=this.f_0(i,a,r.Std.high(this._context),r.Std.low(this._context),r.Std.volume(this._context)),c=this._context.new_var(l);return[r.Std.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.Std.close(this._context),n=this._context.new_var(s),o=r.Std.change(n),a=this.f_0(o,r.Std.volume(this._context)),l=this._context.new_var(a);return[r.Std.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},{id:"in_1",name:"Long",defval:26,type:"integer",min:1,max:2e3}],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.Std.na()},this.main=function(e,t){this._context=e,this._input=t -;var i=this._input(0),s=this._input(1),n=r.Std.close(this._context),o=this._context.new_var(n),a=r.Std.ema(o,i,this._context),l=this._context.new_var(n),c=r.Std.ema(l,s,this._context),h=a,d=c,u=r.Std.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.Std[this._input(4)](this._context)),s=r.Std.sma(i,this._input(0),this._context);return"Exponential"===this._input(3)?s=r.Std.ema(i,this._input(0),this._context):"Weighted"===this._input(3)&&(s=r.Std.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.Std.close(this._context)),o=0,a=0,l=0;l0?1:3,i=r.Std.change(this._context.new_var(e));return t-(r.Std.le(i,0)?0:1)},this.main=function(e,t){this._context=e,this._input=t;var i=r.Std[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.Std.ema(a,s,this._context),c=this._context.new_var(i),h=r.Std.ema(c,n,this._context),d=this.f_0(l,h),u=this._context.new_var(d),p=r.Std.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"]},{id:"smoothingLength",name:"Smoothing Length",defval:9,type:"integer",min:1,max:1e4}],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.Std[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.Std.ema(c,s,this._context),d=this._context.new_var(h) -;return"EMA"===o?l=r.Std.ema(d,a,this._context):"WMA"===o?l=r.Std.wma(d,a,this._context):"SMA"===o&&(l=r.Std.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.Std[this._input(1)](this._context),s=this._input(0),n=this._input(2),o=this._context.new_var(i);return[{value:r.Std.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.Std.close(this._context));return"Exponential"===this._input(2)?(i=r.Std.ema(n,this._input(0),this._context),s=r.Std.ema(n,this._input(1),this._context)):"Weighted"===this._input(2)?(i=r.Std.wma(n,this._input(0),this._context),s=r.Std.wma(n,this._input(1),this._context)):(i=r.Std.sma(n,this._input(0),this._context),s=r.Std.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},{id:"secondPeriods",name:"2nd Period",type:"integer",defval:21,min:1,max:1e4},{id:"thirdPeriods",name:"3rd Period",type:"integer",defval:35,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,o=this._context.new_var(r.Std.close(this._context));return"Exponential"===this._input(3)?(i=r.Std.ema(o,this._input(0),this._context),s=r.Std.ema(o,this._input(1),this._context),n=r.Std.ema(o,this._input(2),this._context)):"Weighted"===this._input(3)?(i=r.Std.wma(o,this._input(0),this._context),s=r.Std.wma(o,this._input(1),this._context),n=r.Std.wma(o,this._input(2),this._context)):(i=r.Std.sma(o,this._input(0),this._context),s=r.Std.sma(o,this._input(1),this._context),n=r.Std.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.Std.stdev(t,i,this._context),a=r.Std.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.Std.close(this._context)),s=this._context.new_var(r.Std.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.Std.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.Std.gt(e,0)?t:r.Std.lt(i,0)?-t:0*t},this.main=function(e,t){this._context=e,this._input=t;var i=r.Std.close(this._context),s=this._context.new_var(i),n=r.Std.change(s);return[this.f_0(n,r.Std.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"]},{id:"smoothingLength", -name:"Smoothing Length",defval:9,type:"integer",min:1,max:1e4}],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.Std.gt(e,0)?t:r.Std.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.Std.close(this._context),o=this._context.new_var(n),a=r.Std.change(o),l=this.f_0(a,r.Std.volume(this._context),a),c=r.Std.cum(l,this._context);this._context.setMinimumAdditionalDepth(s);var h,d=this._context.new_var(c);return"EMA"===i?h=r.Std.ema(d,s,this._context):"WMA"===i?h=r.Std.wma(d,s,this._context):"SMA"===i&&(h=r.Std.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.Std.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.Std.high(this._context),s=this._context.new_var(i),n=r.Std.low(this._context),o=this._context.new_var(n),a=this._input(0),l=this._input(1),c=r.Std.highest(s,a,this._context),h=r.Std.lowest(o,a,this._context);return[{value:c,offset:l},{value:h,offset:l},{value:r.Std.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.Std.close(this._context),s=this._input(0),n=this._input(1),o=this._context.new_var(i),a=r.Std.sma(o,s,this._context),l=this._context.new_var(i),c=r.Std.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.Std.close(this._context));return[r.Std.cum(r.Std.change(e)/e.get(1)*r.Std.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.Std.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"]},{id:"smoothingLength",name:"Smoothing Length",defval:14,type:"integer",min:1,max:1e4}],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.Std.max(e,0)},this.f_1=function(e){return-r.Std.min(e,0)},this.f_2=function(e,t){return r.Std.eq(e,0)?100:r.Std.eq(t,0)?0:100-100/(1+t/e)},this.main=function(e,t){this._context=e,this._input=t;var i=r.Std.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.Std.change(l),h=this.f_0(c),d=this._context.new_var(h),u=r.Std.rma(d,s,this._context),p=this.f_1(c),_=this._context.new_var(p),m=r.Std.rma(_,s,this._context),g=this.f_2(m,u),f=this._context.new_var(g);return"EMA"===n?a=r.Std.ema(f,o,this._context):"WMA"===n?a=r.Std.wma(f,o,this._context):"SMA"===n&&(a=r.Std.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.Std.close(this._context),r.Std.open(this._context)),n=this._context.new_var(s),o=r.Std.swma(n,this._context),a=this._context.new_var(o),l=r.Std.sum(a,i,this._context),c=this.f_0(r.Std.high(this._context),r.Std.low(this._context)),h=this._context.new_var(c),d=r.Std.swma(h,this._context),u=this._context.new_var(d),p=r.Std.sum(u,i,this._context),_=this.f_1(l,p),m=this._context.new_var(_);return[_,r.Std.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.Std.le(e,0)?0:t},this.f_1=function(e,t){return r.Std.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.Std.close(this._context),n=this._context.new_var(s),o=r.Std.stdev(n,i,this._context),a=this._context.new_var(s),l=r.Std.change(a),c=this.f_0(l,o),h=this._context.new_var(c),d=r.Std.ema(h,14,this._context),u=this.f_1(l,o),p=this._context.new_var(u),_=r.Std.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}],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.Std.close(this._context),a=this._context.new_var(o),l=r.Std.tsi(a,i,s,this._context),c=this._context.new_var(l),h=r.Std.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.Std[this._input(1)](this._context);return[r.Std.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.Std.close(this._context));return[r.Std.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.Std.close(this._context),a=r.Std.high(this._context),l=r.Std.low(this._context),c=this._context.new_var(o),h=this._context.new_var(a),d=this._context.new_var(l),u=r.Std.stoch(c,h,d,i,this._context),p=this._context.new_var(u),_=r.Std.sma(p,s,this._context),m=this._context.new_var(_);return[_,r.Std.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.Std.max(r.Std.change(e),0));return r.Std.rma(s,t,i)},this.f_2=function(e,t,i){var s=i.new_var(-r.Std.min(r.Std.change(e),0));return r.Std.rma(s,t,i)},this.main=function(e,t){this._context=e,this._input=t -;var i=r.Std.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.Std.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.Std.stoch(h,d,u,n,this._context),_=this._context.new_var(p),m=r.Std.sma(_,o,this._context),g=this._context.new_var(m);return[m,r.Std.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.Std.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.Std.close(this._context)),n=this._context.new_var(s),o=r.Std.ema(n,i,this._context),a=this._context.new_var(o),l=r.Std.ema(a,i,this._context),c=this._context.new_var(l),h=r.Std.ema(c,i,this._context),d=this._context.new_var(h),u=r.Std.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.Std.close(this._context),n=this._context.new_var(s),o=r.Std.ema(n,i,this._context),a=this._context.new_var(o),l=r.Std.ema(a,i,this._context),c=this._context.new_var(l),h=r.Std.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}],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.Std.close(this._context),a=this._context.new_var(o),l=r.Std.tsi(a,s,i,this._context),c=this._context.new_var(l);return[l,r.Std.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.Std.close(this._context)),t=r.Std.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.Std.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.Std.sum(s,i,this._context)/r.Std.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.Std.close(this._context)),n=r.Std.max(r.Std.high(this._context),s.get(1)),o=this._context.new_var(r.Std.close(this._context)),a=r.Std.min(r.Std.low(this._context),o.get(1)),l=r.Std.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.Std.sqrt(s)},this.variance=function(e,t,i){var s=r.Std.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.Std.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.Std.high(this._context)-r.Std.low(this._context),t=r.Std.high(this._context)-this.bars[this.bars.length-2],i=this.bars[this.bars.length-2]-r.Std.low(this._context);return this.tr=Math.max(e,t,i),"Exponential"===this.maMethod?this.atr=r.Std.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.Std.close(this._context)===this.bars[this.bars.length-1])return this.lastSar;if(this.bars.push(r.Std.close(this._context)),1===this.count)this.atr=r.Std.high(this._context)-r.Std.low(this._context),this.sic=r.Std.close(this._context);else if(this.countthis.sic&&(this.sic=r.Std.close(this._context))}else if(this.count===this.period){e=r.Std.high(this._context)-r.Std.low(this._context),t=r.Std.high(this._context)-this.bars[this.bars.length-2],i=this.bars[this.bars.length-2]-r.Std.low(this._context);this.atr+=Math.max(e,t,i),this.atr*=1/this.period,r.Std.close(this._context)>this.sic&&(this.sic=r.Std.close(this._context)),this.position="LONG",this.nextsar=this.sic-this.atr*this.atrMult}else{var s=this.nextsar;"LONG"===this.position?r.Std.close(this._context)s?(this.position="LONG",this.sic=r.Std.close(this._context),this.nextsar=this.sic-this.computeATR()):(this.position="SHORT",this.sic=Math.min(r.Std.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.Std.weekofyear(e,t)!==r.Std.weekofyear(e,i)||r.Std.year(e,t)!==r.Std.year(e,i)};case"Month":return function(t,i){return r.Std.month(e,t)!==r.Std.month(e,i)||r.Std.year(e,t)!==r.Std.year(e,i)};case"Quarter":return function(t,i){return Math.floor(r.Std.month(e,t)/3)!==Math.floor(r.Std.month(e,i)/3)||r.Std.year(e,t)!==r.Std.year(e,i)};case"Year":return function(t,i){return r.Std.year(e,t)!==r.Std.year(e,i)};case"Decade":return function(t,i){return Math.floor(r.Std.year(e,t)/10)!==Math.floor(r.Std.year(e,i)/10)};case"Century":return function(t,i){return Math.floor(r.Std.year(e,t)/100)!==Math.floor(r.Std.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.Std.time(this._context),a=this._context.new_unlimited_var(o);return o&&(null===this._isNewSession&&(this._isNewSession=r.Std.createNewSessionCheck(e)),this._anchorChecker(a.get(),a.get(1))&&(this.f_1(s),this.f_1(n))),s.set(r.Std.nz(s.get(1))+r.Std[i](this._context)*r.Std.volume(this._context)),n.set(r.Std.nz(n.get(1))+r.Std.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.Std.close(this._context),s=this._input(0),n=this._context.new_var(i);return[r.Std.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.Std.volume(this._context),o=this._context.new_var(n),a=r.Std.ema(o,i,this._context),l=this._context.new_var(n),c=r.Std.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.Std.low(this._context)),i=this._context.new_var(r.Std.abs(r.Std.high(this._context)-t.get(1))),s=r.Std.sum(i,e,this._context),n=this._context.new_var(r.Std.high(this._context)),o=this._context.new_var(r.Std.abs(r.Std.low(this._context)-n.get(1))),a=r.Std.sum(o,e,this._context),l=this._context.new_var(r.Std.atr(1,this._context)),c=r.Std.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.Std.high(this._context),n=this._context.new_var(s),o=r.Std.highest(n,i,this._context),a=r.Std.low(this._context),l=this._context.new_var(a),c=r.Std.lowest(l,i,this._context);return[this.f_0(r.Std.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},{id:"in_1",name:"Teeth Length",defval:13,type:"integer",min:1,max:2e3},{id:"in_2",name:"Lips Length",defval:8,type:"integer",min:1,max:2e3},{id:"in_3",name:"Jaw Offset",defval:8,type:"integer",min:1,max:2e3},{id:"in_4",name:"Teeth Offset",defval:5,type:"integer",min:1,max:2e3},{id:"in_5",name:"Lips Offset",defval:3,type:"integer",min:1,max:2e3}],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.Std.hl2(this._context);return[{value:r.Std.smma(c,i,this._context),offset:o},{value:r.Std.smma(c,s,this._context),offset:a},{value:r.Std.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.Std.high(this._context)),i=!0,s=!0,n=!0,o=!0,a=!0,l=!0,c=1;c<=e;c++)i=r.Std.and(i,r.Std.lt(t.get(e-c),t.get(e))),s=r.Std.and(s,r.Std.lt(t.get(e+c),t.get(e))),n=r.Std.and(n,r.Std.and(r.Std.le(t.get(e+1),t.get(e)),r.Std.lt(t.get(e+c+1),t.get(e)))),o=r.Std.and(o,r.Std.and(r.Std.le(t.get(e+1),t.get(e)),r.Std.and(r.Std.le(t.get(e+2),t.get(e)),r.Std.lt(t.get(e+c+2),t.get(e))))),a=r.Std.and(a,r.Std.and(r.Std.le(t.get(e+1),t.get(e)),r.Std.and(r.Std.le(t.get(e+2),t.get(e)),r.Std.and(r.Std.le(t.get(e+3),t.get(e)),r.Std.lt(t.get(e+c+3),t.get(e)))))),l=r.Std.and(l,r.Std.and(r.Std.le(t.get(e+1),t.get(e)),r.Std.and(r.Std.le(t.get(e+2),t.get(e)),r.Std.and(r.Std.le(t.get(e+3),t.get(e)),r.Std.and(r.Std.le(t.get(e+4),t.get(e)),r.Std.lt(t.get(e+c+4),t.get(e)))))));var h=r.Std.or(s,r.Std.or(n,r.Std.or(o,r.Std.or(a,l)))),d=r.Std.and(i,h),u=this._context.new_var(r.Std.low(this._context)),p=1,_=1,m=1,g=1,f=1,v=1;for(c=1;c<=e;c++)p=r.Std.and(p,r.Std.gt(u.get(e-c),u.get(e))),_=r.Std.and(_,r.Std.gt(u.get(e+c),u.get(e))),m=r.Std.and(m,r.Std.and(r.Std.ge(u.get(e+1),u.get(e)),r.Std.gt(u.get(e+c+1),u.get(e)))),g=r.Std.and(g,r.Std.and(r.Std.ge(u.get(e+1),u.get(e)),r.Std.and(r.Std.ge(u.get(e+2),u.get(e)),r.Std.gt(u.get(e+c+2),u.get(e))))),f=r.Std.and(f,r.Std.and(r.Std.ge(u.get(e+1),u.get(e)),r.Std.and(r.Std.ge(u.get(e+2),u.get(e)),r.Std.and(r.Std.ge(u.get(e+3),u.get(e)),r.Std.gt(u.get(e+c+3),u.get(e)))))),v=r.Std.and(v,r.Std.and(r.Std.ge(u.get(e+1),u.get(e)),r.Std.and(r.Std.ge(u.get(e+2),u.get(e)),r.Std.and(r.Std.ge(u.get(e+3),u.get(e)),r.Std.and(r.Std.ge(u.get(e+4),u.get(e)),r.Std.gt(u.get(e+c+4),u.get(e)))))));var S=r.Std.or(_,r.Std.or(m,r.Std.or(g,r.Std.or(f,v))));return[r.Std.and(p,S),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"},{defval:5,id:"traderEMA2Length",max:1e3,min:1,name:"Trader EMA 2 length",type:"integer"},{defval:8,id:"traderEMA3Length",max:1e3,min:1,name:"Trader EMA 3 length",type:"integer"},{defval:10,id:"traderEMA4Length",max:1e3,min:1,name:"Trader EMA 4 length",type:"integer"},{defval:12,id:"traderEMA5Length",max:1e3,min:1,name:"Trader EMA 5 length",type:"integer"},{defval:15,id:"traderEMA6Length",max:1e3,min:1,name:"Trader EMA 6 length",type:"integer"},{defval:30,id:"investorEMA1Length",max:1e3,min:1,name:"Investor EMA 1 length",type:"integer"},{defval:35,id:"investorEMA2Length",max:1e3,min:1,name:"Investor EMA 2 length",type:"integer"},{defval:40,id:"investorEMA3Length",max:1e3,min:1,name:"Investor EMA 3 length",type:"integer"},{defval:45,id:"investorEMA4Length",max:1e3,min:1,name:"Investor EMA 4 length",type:"integer"},{defval:50,id:"investorEMA5Length",max:1e3,min:1,name:"Investor EMA 5 length",type:"integer"},{defval:60,id:"investorEMA6Length",max:1e3,min:1,name:"Investor EMA 6 length",type:"integer"}],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.Std.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.Std.ema(i,s,this._context),d=r.Std.ema(i,n,this._context),u=r.Std.ema(i,o,this._context),p=r.Std.ema(i,a,this._context),_=r.Std.ema(i,l,this._context),m=r.Std.ema(i,c,this._context),g=this._input(6),f=this._input(7),v=this._input(8),S=this._input(9),y=this._input(10),b=this._input(11);return[h,d,u,p,_,m,r.Std.ema(i,g,this._context),r.Std.ema(i,f,this._context),r.Std.ema(i,v,this._context),r.Std.ema(i,S,this._context),r.Std.ema(i,y,this._context),r.Std.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.Std.period(this._context)&&this._context.new_sym(this._context.symbol.ticker,"1D")},this.main=function(e,t){this._symbolSupports1DResolution||r.Std.error(`Daily bars are not available for ${this._context.symbol.info.name}`),this._context=e,this._input=t,"1D"!==r.Std.period(this._context)&&this._context.select_sym(1);const i=this._input(0),s=this._input(1),n=r.Std.time(this._context),o=this._context.new_unlimited_var(n),a=this._context.new_unlimited_var(r.Std[i](this._context)),l=this._context.new_unlimited_var(r.Std[s](this._context));if(o.get(365),!this._context.symbol.isLastBar||!this._context.symbol.isNewBar)return null;const c=r.Std.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.Std.highest(a,h,this._context),extendLeft:!0,extendRight:!0}]},{styleId:"lowest",data:[{startIndex:n,endIndex:n, -level:r.Std.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=S(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(74649),n=i(61476),o=i(76537).SymbolExtrapolator,a=i(21125).SessionTimeScale,l=i(34108).PointsetsManager,c=i(60156),h=i(77475).createDwmAligner,d=i(36274).Interval,u=i(76422),p=i(2663).visitObject,_=i(1722).isObject;i(24172),i(60325);var m=i(79850).DatafeedRequestsCachedProcessor,g=i(38618).timezoneIsAvailable,f=i(77475).isAlignmentEnabled,v=i(27856),S=v.isEncodedExtendedSymbol,y=v.decodeExtendedSymbol,b=i(42960).extractSymbolNameFromSymbolInfo,w=i(48739).replaceGraphicsTimesWithTimePointIndexIndex,C=i(14483),P=i(66846).SubsessionId,x=i(60156).getPeriodsBetweenDates;const T=C.enabled("pay_attention_to_ticker_not_symbol"),I="pre_post_market_sessions",M=C.enabled(I);var A=-5e6;function L(e){var t=e.findIndex((function(e){return e.index!==A}));return-1===t?[]:0===t?e:e.slice(t)}function k(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 D(e,t){return e+"_"+t}function E(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 V(e){const t=y(e),i="string"==typeof t.symbol?t:t.symbol;return[i.symbol,{currency:i["currency-id"],unit:i["unit-id"],session:i.session===P.Regular?void 0:i.session}]}var B=function(e){var t=this;this._studiesCache={},this._objectsDataCache={},this._studiesNonSeriesTimes={},this._metainfoCache=[],this._barsCoefficientsCache={},this._externalDatafeed=e,e.getVolumeProfileResolutionForPeriod&&r.overwriteVolumeProfileResolutionForPeriodGetter((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 m(e,this.serverTimeOffset.bind(this),this._datafeedConfiguration.reset_cache_timeout),n.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 c.SessionInfo(e.timezone,e.session,e.session_holidays,e.corrections),n=c.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 R(e,t){return e+"_"+t}function N(e,t,i,s){return e+(t?"_#_"+t:"")+(i?"_#_"+i:"")+(s?"_#_"+s:"")}B.prototype._getSymbolExtrapolator=function(e,t,i){var s=d.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 o(t,s),this._symbolExtrapolators[r]=n),n},B.prototype._barsCoefficients=function(e,t){if(void 0===y(e).type)return{};var i=e+t;return this._barsCoefficientsCache[i]||(this._barsCoefficientsCache[i]={}),this._barsCoefficientsCache[i]},B.prototype.destroy=function(){this._cachedDatafeed.destroy(),this._externalDatafeed=null,Object.keys(this._pointsetsManagers).forEach((function(e){this._pointsetsManagers[e].destroy()}),this),this._pointsetsManagers={}},B.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={}},B.prototype.purgeDataCache=function(){this._cachedDatafeed.purgeCache()},B.prototype._logMessage=function(e){C.enabled("charting_library_debug_mode")&&console.log(e)},B.prototype.on=function(e,t){return this._callbacks.hasOwnProperty(e)||(this._callbacks[e]=[]),this._callbacks[e].push(t),this}, -B.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)}))}))},B.prototype.supportedSymbolsTypes=function(){return this._datafeedConfiguration.symbols_types||[]},B.prototype.symbolsGrouping=function(){return this._datafeedConfiguration.symbols_grouping||{futures:/$a/}},B.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]},B.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=h(r,e),l=C.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(){u.emit("onMarkClick",e.id)},e.label=!!e.label&&(l?e.label.slice(0,2):e.label[0]),e}));s(c)}),r)}},B.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=h(r,e),o=t.map((function(e){return e.tickmark=null!==i?i.timeToSessionStart(1e3*e.time)/1e3:e.time,e}));s(o)}),r)}},B.prototype.getSeriesLastBarTime=function(e,t){var i=this._getSeriesData(e,t);return null===i||0===i.length?null:i[i.length-1].timeMs},B.prototype.getSeriesInterval=function(e,t){var i=this._studiesCache[e][t] -;return i?i.resolution:null},B.prototype.getSeriesSymbolInfo=function(e,t){var i=this._studiesCache[e][t];return i?i.symbolInfo:null},B.prototype._getSeriesData=function(e,t){return this._objectsDataCache[R(e,t)]||null},B.prototype._computeStudy=async function(e,t,i,s,n,o,a,l,c,u){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||u.onRealtimeCallback([_[_.length-1]],l,_.length,v,i)}(e,t,i)},nonseriesOut:function(e,t){u.onNonSeriesDataUpdate(t,i)},setNoMoreData:function(){S=!0},recalc:function(e,s){p=!1,_.endOfData=S,_.emptyBarCount=s.emptyBarCount,t.error&&null!==t.error()||(null!==l&&(y._objectsDataCache[l]=_),u.onDataReadyCallback(_,v,i,s))}});if(!y._studiesCache[e]||!y._studiesCache[e][n])throw Error("This should never happen");y._studiesCache[e][n].engine=w}catch(e){if(!e.studyError)throw e;u.onErrorCallback(e.message)}}else u.onErrorCallback("Unsupported resolution. Did you forget to set has_intraday to true?")}(w,P)},B.prototype._createStudy=function(e,t,i,s,r,n,o,a){var l=this;function c(e,t,i){if(l._studiesCache[s][r].completed=!0,e=L(e),l._setEndOfData(s,r,n,!0),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}a=function(e){if(Array.isArray(e))return e;for(var t=[],i=l._studiesCache[s][r].metainfo.inputs,n=0;n=0},B.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)},B.prototype.extendSeriesRange=function(e,t){var i=this._timeScales[e].firstSeriesBarTime();if(null!==i){var s=this._mainSeriesRecord(e);if(d.isDWM(s.resolution)&&null!=s.symbolInfo){var r=h(s.resolution,s.symbolInfo);null!==r&&(i=r.timeToExchangeTradingDay(i))}var n=this._symbolIdToSymbolRequestString.get(D(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")},B.prototype.seriesTurnaround=function(e,t){return this._studiesCache[e]&&this._studiesCache[e][t]&&this._studiesCache[e][t].turnaround},B.prototype._seriesDataRange=function(e,t){var i=this._studiesCache[e][t];return null!==i.firstLoadedTimeMs?{to:i.firstLoadedTimeMs,countBack:0}:i.dataRange},B.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))}},B.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)}},B.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))},B.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},B.prototype._seriesCount=function(e){var t=0;for(var i in this._studiesCache[e]){"series"===this._studiesCache[e][i].type&&(t+=1)}return t},B.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})))}},B.prototype.createSeries=function(e,t,i,s,n,o,a){this._setEndOfData(e,t,i,!1);var l=new r.OHLCV;this._studiesCache[e]=this._studiesCache[e]||{};var c=this._getSeriesData(e,t),h=this._studiesCache[e][t],u=this._seriesCount(e),p=this._mainSeriesRecord(e);if(!h||d.isEqual(h.resolution,n)&&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===u||null!==p&&(null!=p.firstLoadedTimeMs?(o.to=p.firstLoadedTimeMs,o.countBack=0):o=Object.assign({},p.dataRange));else if(1===u)o=Object.assign({},h.initialDatarange);else{var _=this._timeScales[e].firstSeriesBarTime();(void 0===o.to||null!==_&&_{k(e.logo_urls,e.exchange_logo,e)})),s(e)}))},B.prototype.resolveSymbol=function(e,t,i){var s=this;this._symbolIdToSymbolRequestString.set(D(e,t),i),this._resolvePromisesBySymbolId.set(D(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)}))})))},B.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]=V(e);this._resolveSymbolByName(s,r,t,i)},B.prototype._resolveSymbolByName=function(e,t,i,s){var r,n=t&&t.currency,o=t&&t.unit,a=t&&t.session,l=N(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[N(e,t.currency_id,t.unit_id,t.subsession_id)]=r,c._resolveRequests[N(b(t,null),t.currency_id,t.unit_id,t.subsession_id)]=r,c._resolveRequests[N(b(t,null),n,o,a)]=r})).catch((function(){}))}r.then(i).catch(s)},B.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){if(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.full_name){const t=e.exchange?e.exchange+":"+e.name:e.name;e.full_name=T?e.ticker:t}if(e.pro_name||(e.pro_name=T?e.ticker:e.full_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"),e.supported_resolutions)for(var t=0;tthis._resolveSymbolByName(t,i,o,(t=>{this.quoteRemoveSymbols(e,[r]),a(t)}))),e,r)}}},B.prototype._removeMarketStatusWatchers=function(e){var t=this;Object.keys(this._marketStatusWatchers[e]||{}).forEach((function(i){t._marketStatusWatchers[e][i].stop()})),this._marketStatusWatchers[e]={}},B.prototype._stopQuotesSubscription=function(e){this._quotesInfo[e].listenerGUID&&(this._externalDatafeed.unsubscribeQuotes(this._quotesInfo[e].listenerGUID),this._quotesInfo[e].listenerGUID=void 0),this._removeMarketStatusWatchers(e)},B.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,k(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){void 0!==t[e.n]?null!==t[e.n]&&s(e,t[e.n]):i._resolveSymbolByName(e.n,null,(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=>V(e)[0]));this._externalDatafeed.getQuotes&&!C.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,i._quotesInfo[e].fastSymbols,r,i._quotesInfo[e].listenerGUID))}),(function(e){})):!this._externalDatafeed.getQuotes&&C.enabled("trading_terminal")&&setTimeout((function(){r(o.map((function(e){return{n:e,s:"ok",v:{}}})))})),this._createMarketStatusWatchers(e,n)},B.prototype._restartQuotesSubscription=function(e){this._stopQuotesSubscription(e),this._startQuotesSubscription(e)},B.prototype.quoteCreateSession=function(e){this._quotesInfo[e]={symbols:[],fastSymbols:[],listenerGUID:void 0}},B.prototype.quoteDeleteSession=function(e){this._stopQuotesSubscription(e),this._quotesInfo[e]=null},B.prototype.quoteSetFields=function(e,t){},B.prototype.quoteAddSymbols=function(e,t){this._quotesInfo[e].symbols=this._filteredSymbols(this._quotesInfo[e].symbols.concat(t)),this._restartQuotesSubscription(e)},B.prototype.quoteRemoveSymbols=function(e,t){this._quotesInfo[e].symbols=this._quotesInfo[e].symbols.filter((function(e){return t.indexOf(e)<0})),this._restartQuotesSubscription(e)},B.prototype.quoteFastSymbols=function(e,t){this._quotesInfo[e].fastSymbols=this._filteredSymbols(t),this._restartQuotesSubscription(e)},B.prototype.quoteHibernateAll=function(e){},B.prototype._stopDepthSubscription=function(e){this._depthInfo[e].listenerGUID&&(this._externalDatafeed.unsubscribeDepth(this._depthInfo[e].listenerGUID),this._depthInfo[e].listenerGUID=void 0)},B.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)])))})))},B.prototype._restartDepthSubscription=function(e){this._stopDepthSubscription(e),this._startDepthSubscription(e)},B.prototype.depthCreateSession=function(e){this._depthInfo[e]={symbol:null,listenerGUID:void 0}},B.prototype.depthDeleteSession=function(e){this._depthInfo[e].symbol=null,this._stopDepthSubscription(e),delete this._depthInfo[e]},B.prototype.depthSetSymbol=function(e,t){this._depthInfo[e].symbol=t,this._restartDepthSubscription(e)},B.prototype._filteredSymbols=function(e){var t=[];return e.forEach((function(e){e instanceof Object||t.indexOf(e)<0&&t.push(e)})),t},B.prototype._isEndOfData=function(e,t,i){var s=e+"!"+t+"@"+i;return!!this._endOfData[s]},B.prototype._setEndOfData=function(e,t,i,s){var r=e+"!"+t+"@"+i;this._endOfData[r]=!1!==s},B.prototype.serverTimeOffset=function(){return this._serverTimeOffset},B.prototype.serverTime=function(){return 1e3*this.getCurrentUTCTime()},B.prototype.getCurrentUTCTime=function(){return(new Date).valueOf()/1e3+this._serverTimeOffset},B.prototype.switchTimezone=function(e,t){this._timeScales[e].setTimezone(t);var i=this._timeScales[e].tickMarks() -;null!==i&&TradingView.ChartapiMessagerInstances[e].onTickmarksUpdated(0,i)},B.prototype._studyCanExtendTimeScale=function(e,t){const i=this._studiesCache[e][t]?.metainfo;return void 0!==i&&(C.enabled("studies_extend_time_scale")&&i.canExtendTimeScale||C.enabled("secondary_series_extend_time_scale")&&"Overlay@tv-basicstudies-1"===i.id)},e.exports=B},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}} +errorMessage:`Misconfiguration error: it is trying to request ${i.multiplier()} ticks resolution but symbol does not support it`}:{error:!1,resolution:"1T"};const o=i.isSeconds()?t.seconds_multipliers:t.intraday_multipliers;return void 0===o?{error:!1,resolution:i.value()}:r(o,i)}},74649:(e,t,i)=>{"use strict";var s,r=i(36274).Interval,n=i(77475).createDwmAligner,o=i(77475).createTimeToBarTimeAligner,a=i(81337).Std,l=i(37040).Series,c=i(97651).Script,h=i(15294).SymbolInstrument,d=i(60156),u=i(94421).extrapolateBarsFrontToTime;class p{constructor(e){this.symbols=[],this.barsets=[],this.subscription=[],this.host=e,this.isRecalculated=!1,this.isStarted=!1,this.start()}add_sym(e,t,i,s,r,n,o){var a=new h(e,t,i,s,r,n,o);return this.symbols.push(a),a}get_sym(e){return this.symbols[e]}out(e,t){if(this.nonseriesUpdate){var i=Object.assign({},this.nonseriesUpdate);t.splice(0,0,e.time),i.lastBar=t,this.host.nonseriesOut(e,i)}else this.host.out(e,t)}start(){this.isStarted=!0;var e=this.host;this._script=new c(e.tickerid,e.period,e.currencyCode,e.unitId,this,e.body,this.out.bind(this),e.input,e.nonseriesOut,e.symbolInfo,e.subsessionId);var t=this,i=[],s=this.symbols,a=Object.assign({},e.dataRange,{countBack:e.dataRange.countBack+t._script.maxAdditionalDepth()}),l=s[0];function h(t,s,r){i.push(p.feed.subscribe(t.tickerid,t.currencyCode,t.unitId,t.period,r,e.onErrorCallback,e.symbolInfo,e.sessionId,s,e.forceAlignBars,t.subsessionId))}function d(i,s){"series"===(s.nonseries?"nonseries":"series")?t.update(i,s):s.lastBar?(t.nonseriesUpdate=s,s.lastBar.isLastBar=!0,t.symbols[0].lastbar(s.lastBar),t.nonseriesUpdate=null):e.nonseriesOut(m,s)}function u(){return a}h(l,u,(function(e){!e.nonseries&&Number.isFinite(e.firstLoadedTimeMs)&&function(e){function i(i,s){var r=o(i,s)(e),a=n(i,s);return null!==a&&(r=a.timeToExchangeTradingDay(r)),{to:r,countBack:t._script.maxAdditionalDepth()}}for(var a=1;a=0;i--)for(var s=e[i],r=this.barsets[i],n=r.count(),o=0;oe.endOfData));l&&this.host.setNoMoreData(), +this.host.recalc(this,{endOfData:l,firstLoadedTimeMs:this.barsets[0].firstLoadedTimeMs,emptyBarCount:this.barsets[0].emptyBarCount()})}catch(e){if(!e.studyError)throw e;this.host.onErrorCallback(e.message)}}}p.feed={subscribe:function(e,t,i,s,r){console.error("must be initialized with setupFeed")},unsubscribe:function(e){console.error("must be initialized with setupFeed")}};e.exports.Std=a,e.exports.Series=l,e.exports.Symbol=h,e.exports.StudyEngine=class{constructor(e){this.runner=new p(e)}stop(){this.runner.stop()}isStarted(){return this.runner.isStarted}},e.exports.BarSet=class{constructor(e,t){this.info=e,this.bars=t||[],this.isBarClosed=!0,this.firstLoadedTimeMs=0!==this.bars.length?this.bars[0].time:1/0,this._emptyBarCount=0,this._lastBarIsEmpty=!1}symbolinfo(){return this.info}isLastBarClosed(){return this.isBarClosed}setLastBarClosed(e){this.isBarClosed=e}bar(e){return this.bars[e]}count(){return this.bars.length}emptyBarCount(){return this._emptyBarCount}add(e,t,i){void 0===i&&(i=!1);var s=e,r=this.bars,n=r.length,o=s.time,a=0===n?NaN:r[n-1].time;0===n||a{"use strict";i.d(t,{Script:()=>o});var s=i(37040),r=i(81337);class n{constructor(e){this.minimumAdditionalDepth=null,this._vars=[],this._varsIndex=0,this._ctx=[],this._ctxIndex=0,this.symbol=e}new_sym(e,t,i,s,r){return this.symbol.script.add_sym(e,t,i,s,r)}select_sym(e){const t=this.symbol.script.get_sym(e) +;null==t&&r.Std.error(`Attempted to select symbol at index ${e} but there is no such symbol`),this.symbol=t}is_main_symbol(e){return void 0!==e&&e===this.symbol.script.get_sym(0)}new_var(e){const t=this._vars;t.length<=this._varsIndex&&t.push(new s.Series(this.symbol));const i=t[this._varsIndex++];return arguments.length>0&&void 0!==e&&i.set(e),i}new_unlimited_var(e){const t=this._vars;t.length<=this._varsIndex&&t.push(new s.UnlimitedSeries(this.symbol));const i=t[this._varsIndex++];return arguments.length>0&&i.set(e),i}new_ctx(){return this._ctx.length<=this._ctxIndex&&this._ctx.push(new n(this.symbol)),this._ctx[this._ctxIndex++]}prepare(e){this._ctxIndex=0,this._varsIndex=0;for(let t=0;te&&(e=i)}return e}stop(){this.symbol=null,this._vars=null}setMinimumAdditionalDepth(e){this.minimumAdditionalDepth=e}}class o{constructor(e,t,i,s,r,o,a,l,c,h,d){this._body=o,this._symbols=[],this._runner=r,this._inputCallback=l,this._out=a,this._nonseriesOut=c,this._ctx=new n(this.add_sym(e,t,i,s,h,d)),this.init()}calc(e){const t=this._ctx,i=this._body;t.prepare(e);const s=i.main(t,this._inputCallback,e);if(s&&"composite"===s.type)for(let e=0;e1&&this._runner.host.enableDwmAligning&&o.enable_dwm_aligning(this._symbols[0].session,o.session),o}maxAdditionalDepth(){return this._symbols[0].isAdditionalDepthAllowed?this._ctx.maxAdditionalDepth():0}stop(){var e;this._symbols=null,null===(e=this._ctx)||void 0===e||e.stop(),this._ctx=null}get_sym(e){return this._symbols[e]}_processResult(e){const t=this._ctx;this._out&&e&&(!isNaN(t.symbol.time)||e.nonseries)&&(e.nonseries?("projection"===e.type&&(e.projectionTime=t.symbol.time),this._nonseriesOut(t.symbol,e)):e.bars?e.bars.forEach((e=>{this._out(t.symbol,e)})):this._out(t.symbol,e))}}},37040:(e,t,i)=>{"use strict";i.d(t,{Series:()=>n,UnlimitedSeries:()=>o});var s=i(78071),r=i(81337);class n{constructor(e){this.mindepth=0,this.original=NaN,this.modified=!1,this._hist=null,this._histPos=0,this.symbol=e}valueOf(){return this.get(0)}get(e){return isNaN(e)&&(e=0),e=e||0,this._hist?e>=this._hist.length?(console.error("not enough depth: "+this),NaN):this._get(e):(this.mindepth=r.Std.max(this.mindepth,e),NaN)}set(e){this._hist&&(this._hist[this._histPos]=e,this.modified=!0)}prepare(e){e===this.symbol&&(e.isNewBar?(this.original=this.get(0),!this.modified&&this._hist||this.add_hist()):this.set(this.original),this.modified=!1)}add_hist(){if(!this._hist){ +let e=r.Std.na(this.mindepth)?r.Std.max_series_default_size:r.Std.max(this.mindepth+1,1);e=Math.round(e);const t=new Array(e);for(let i=0;i{"use strict";const s=i(14483),r=i(33013).getHexColorByName;var n=i(74649);i(24172);var o=i(82808).pivotPointsStandardStudyItem,a=i(72365).volumeProfileVisibleRangeStudyItem,l=i(82597).volumeProfileFixedRangeVbPStudyItem,c=i(82597).volumeProfileFixedRangeBSStudyItem,h=i(39944).spreadStudyItem,d=i(81821).ratioStudyItem,u=i(65097).regressionTrendStudyItem,p=i(53130).anchoredVWAPStudyItem;const _=r("color-ripe-red-400"),m=r("color-minty-green-400"),g=s.enabled("secondary_series_extend_time_scale");JSServer.studyLibrary=JSServer.studyLibrary.concat([{name:"Compare",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!0,defaults:{styles:{compare:{linestyle:0,linewidth:2,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#9C27B0"}},inputs:{source:"close",symbol:""}},plots:[{id:"compare",type:"line"}],styles:{compare:{title:"Plot",histogramBase:0}},description:"Compare",shortDescription:"Compare",is_price_study:!0,inputs:[{defval:"close",id:"source",name:"Source",options:["open","high","low","close","hl2","hlc3","ohlc4"],type:"text"},{id:"symbol",name:"Symbol",type:"symbol",isHidden:!0}],id:"Compare@tv-basicstudies-1",format:{type:"inherit"}},constructor:function(){this.init=function(e,t){this._context=e,this._context.new_sym(t(1),n.Std.period(this._context))},this.main=function(e,t){this._context=e;var i=this._context.new_unlimited_var(this._context.symbol.time);this._context.select_sym(1);var s=this._context.new_unlimited_var(this._context.symbol.time),r=n.Std[t(0)](this._context),o=this._context.new_unlimited_var(r);return this._context.select_sym(0),[o.adopt(s,i,0)]}}},{name:"Overlay",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!0,defaults:{styles:{},inputs:{symbol:"",extendTimeScale:!1}},plots:[{id:"open",type:"line"},{id:"high",type:"line"},{ +id:"low",type:"line"},{id:"close",type:"line"}],styles:{open:{title:"Open"},high:{title:"High"},low:{title:"Low"},close:{title:"Close"}},description:"Overlay",shortDescription:"Overlay",is_price_study:!1,inputs:[{id:"symbol",name:"symbol",defval:"",type:"symbol",isHidden:!0},{id:"extendTimeScale",name:"extendTimeScale",defval:!1,type:"boolean",isHidden:!0}],id:"Overlay@tv-basicstudies-1",format:{type:"price",precision:4},canExtendTimeScale:!0},constructor:function(){this.init=function(e,t){this._context=e,this._context.new_sym(t(0),n.Std.period(this._context))},this.main=function(e,t){this._context=e;var i=!g||!0!==t(1),s=this._context.new_unlimited_var(this._context.symbol.time);this._context.select_sym(1);var r=this._context.new_unlimited_var(this._context.symbol.time),o=this._context.new_unlimited_var(n.Std.open(this._context)),a=this._context.new_unlimited_var(n.Std.high(this._context)),l=this._context.new_unlimited_var(n.Std.low(this._context)),c=this._context.new_unlimited_var(n.Std.close(this._context));return i?(this._context.select_sym(0),[o.adopt(r,s,1),a.adopt(r,s,1),l.adopt(r,s,1),c.adopt(r,s,1)]):[o.get(0),a.get(0),l.get(0),c.get(0)]}}},{name:"Volume",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{vol:{linestyle:0,linewidth:1,plottype:5,trackPrice:!1,transparency:50,visible:!0,color:"#000080"},vol_ma:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!1,color:"#2196F3"},smoothedMA:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!1,color:"#2196F3"}},palettes:{volumePalette:{colors:{0:{color:_,width:1,style:0},1:{color:m,width:1,style:0}}}},inputs:{showMA:!1,length:20,col_prev_close:!1,symbol:"",smoothingLine:"SMA",smoothingLength:9}},plots:[{id:"vol",type:"line"},{id:"volumePalette",palette:"volumePalette",target:"vol",type:"colorer"},{id:"vol_ma",type:"line"},{id:"smoothedMA",type:"line"}],styles:{vol:{title:"Volume",histogramBase:0},vol_ma:{title:"Volume MA",histogramBase:0},smoothedMA:{title:"Smoothed MA",histogramBase:0}},description:"Volume",shortDescription:"Volume",is_price_study:!1,palettes:{volumePalette:{colors:{0:{name:"Falling"},1:{name:"Growing"}}}},inputs:[{id:"symbol",name:"Other Symbol",defval:"",type:"symbol",optional:!0,isHidden:!1},{id:"showMA",name:"show MA",defval:!1,type:"bool",isHidden:!0},{id:"length",name:"MA Length",defval:20,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["vol_ma"]},{defval:!1,id:"col_prev_close",name:"Color based on previous close",type:"bool"},{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:"Volume@tv-basicstudies-1",format:{type:"volume"}},constructor:function(){this.init=function(e,t){this._context=e,""!==t(0)&&this._context.new_sym(t(0),n.Std.period(this._context))},this.f_0=function(e,t){return n.Std.gt(e,t)?0:1},this.main=function(e,t){this._context=e, +this._input=t;var i=n.Std.volume(this._context),s=n.Std.open(this._context),r=n.Std.close(this._context),o=this._context.new_var(this._context.symbol.time),a=this._input(4),l=this._input(5);if(this._context.setMinimumAdditionalDepth(this._input(2)+l),""!==this._input(0)){this._context.select_sym(1);var c=this._context.new_var(this._context.symbol.time),h=this._context.new_var(n.Std.volume(this._context)),d=this._context.new_var(n.Std.open(this._context)),u=this._context.new_var(n.Std.close(this._context));i=h.adopt(c,o,1),s=d.adopt(c,o,1),r=u.adopt(c,o,1),this._context.select_sym(0)}var p,_,m=this._context.new_var(i),g=n.Std.sma(m,this._input(2),this._context),f=this._context.new_var(g),v=this._context.new_var(r);return p=v.get(1)&&this._input(3)?this.f_0(v.get(1),r):this.f_0(s,r),"EMA"===a?_=n.Std.ema(f,l,this._context):"WMA"===a?_=n.Std.wma(f,l,this._context):"SMA"===a&&(_=n.Std.sma(f,l,this._context)),[i,p,g,_]}}},{name:"ZigZag",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:2,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:5,in_1:10}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",target:"plot_0",type:"dataoffset"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Zig Zag",shortDescription:"ZigZag",is_price_study:!0,classId:"ScriptWithDataOffset",inputs:[{id:"in_0",name:"deviation",defval:5,type:"float",min:.001,max:100},{id:"in_1",name:"depth",defval:10,type:"integer",min:2,max:1e3}],id:"ZigZag@tv-basicstudies-1",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),r=i/100,o=Math.ceil(s/2);return[n.Std.zigzag(r,o,this._context),n.Std.zigzagbars(r,o,this._context)]}}},{name:"Sessions",metainfo:{_metainfoVersion:52,defaults:{graphics:{vertlines:{sessBreaks:{color:"#4985e7",style:2,visible:!1,width:1}},backgrounds:{preMarket:{color:"#FF9800",transparency:92,visible:!0},postMarket:{color:"#2196F3",transparency:92,visible:!0}}},linkedToSeries:!0},description:"Sessions",graphics:{vertlines:{sessBreaks:{name:"Session Break",halign:"left"}},backgrounds:{preMarket:{name:"Pre market"},postMarket:{name:"Post market"}}},id:"Sessions@tv-basicstudies-1",inputs:[],is_hidden_study:!0,is_price_study:!0,name:"Sessions@tv-basicstudies",palettes:{},plots:[],shortDescription:"Sessions",format:{type:"inherit"}},constructor:function(){function e(e,t){return{id:e,index:e,extendBottom:!0,extendTop:!0}}function t(e){return{id:e.start,start:e.start,stop:e.stop}}this.init=function(){this._times=[]},this._getVerticalLineData=function(t){return n.Std.selectSessionBreaks(t,this._times).map(e)},this._getPreAndPostMarketBackgroundsData=function(e){const i=n.Std.selectPreAndPostMarketTimes(e,this._times);return{preMarket:i.preMarket.map(t),postMarket:i.postMarket.map(t)}},this.main=function(e,t){if(n.Std.isdwm(e))return null;var i=n.Std.time(e);if(isNaN(i))return null;var s=this._times.length +;if(0!==s&&this._times[s-1]===i||this._times.push(i),!e.symbol.isLastBar||!e.symbol.isNewBar)return null;var r=this._getVerticalLineData(e),o=this._getPreAndPostMarketBackgroundsData(e);return 0===r.length&&0===o.preMarket.length&&0===o.postMarket?null:{nonseries:!0,type:"study_graphics",data:{graphicsCmds:{create:{vertlines:[{styleId:"sessBreaks",data:r}],backgrounds:[{styleId:"preMarket",data:o.preMarket},{styleId:"postMarket",data:o.postMarket}]},erase:[{action:"all"}]}}}}}},{name:"SuperTrend",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:3,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#000080"},plot_2:{linestyle:0,linewidth:3,plottype:"shape_arrow_up",trackPrice:!1,location:"BelowBar",transparency:35,visible:!0,color:"#00FF00"},plot_3:{linestyle:0,linewidth:3,plottype:"shape_arrow_down",trackPrice:!1,location:"AboveBar",transparency:35,visible:!0,color:"#FF0000"}},palettes:{palette_0:{colors:{0:{color:"#008000",width:3,style:0},1:{color:"#800000",width:3,style:0}}}},inputs:{in_0:10,in_1:3}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",palette:"palette_0",target:"plot_0",type:"colorer"},{id:"plot_2",type:"shapes"},{id:"plot_3",type:"shapes"}],styles:{plot_0:{title:"SuperTrend",histogramBase:0,joinPoints:!1,isHidden:!1},plot_2:{title:"Up Arrow",histogramBase:0,joinPoints:!1,isHidden:!1},plot_3:{title:"Down Arrow",histogramBase:0,joinPoints:!1,isHidden:!1}},description:"SuperTrend",shortDescription:"SuperTrend",is_price_study:!0,palettes:{palette_0:{colors:{0:{name:"Color 0"},1:{name:"Color 1"}},valToIndex:{0:0,1:1}}},inputs:[{id:"in_0",name:"Length",defval:10,type:"integer",min:1,max:100},{id:"in_1",name:"Factor",defval:3,type:"float",min:1,max:100}],id:"SuperTrend@tv-basicstudies-1",scriptIdPart:"",name:"SuperTrend",isCustomIndicator:!0,format:{type:"inherit"}},constructor:function(){this.main=function(e,t){var i=t(0),s=t(1),[r,o]=n.Std.supertrend(s,i,e),a=e.new_var(o).get(1);return[r,-1===o?0:1,-1===o&&a!==o?1:NaN,1===o&&a!==o?1:NaN]}}},o,a,l,c,h,d,u,p])},81337:(e,t,i)=>{"use strict";i.d(t,{Std:()=>h});var s=i(60156),r=i(41249);class n{constructor(e,t,i){var s,r;this._timezone=e,this._preMarketSessionEntries=null!==(s=null==t?void 0:t.entries())&&void 0!==s?s:[],this._postMarketSessionEntries=null!==(r=null==i?void 0:i.entries())&&void 0!==r?r:[]}getPreAndPostMarketTimes(e){if(0===e.length)return{preMarket:[],postMarket:[]};const t=[],i=[];let s=null,n=null,o=e[0],a=(0,r.utc_to_cal)(this._timezone,o);this._isInPreMarketSession(a)&&(n=o),this._isInPostMarketSession(a)&&(s=o);for(let l=1;le?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 S=u.get(1),y=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=S,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,S),h.n(s)>2&&(x=Math.min(x,y))):(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(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(81337);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,{pivotPointsStandardStudyItem:()=>d});var s=i(36274),r=i(47609),n=i(81337);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 S=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(S),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(81337);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=[],S=[],y=[];for(let e=m;e>=g;--e)f.push(n.get(e)),v.push(o.get(e)),S.push(a.get(e)),y.push(l.get(e));return this._updateData(f,d,c,u,h,p,_,r(y,v,S)),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:()=>r,spreadRatioDefaults:()=>n,spreadRatioInputs:()=>o,spreadRatioPlots:()=>a,spreadRatioStyles:()=>l});var s=i(81337);class r{init(e,t){e.new_sym(t(1),s.Std.period(e)),this._source=t(0),this._scaleFactor1=1,this._scaleFactor2=1}main(e,t){const i=e.symbol.time,r=s.Std[this._source](e);e.select_sym(1);const n=s.Std[this._source](e),o=e.new_unlimited_var(n),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);return[this._doCalculation(this._scaleFactor1,r,this._scaleFactor2,c)]}}const n={styles:{plot1:{linestyle:0,linewidth:2,plottype:0,trackPrice:!1,transparency:35,color:"#800080",display:15}},precision:2,inputs:{source:"close",symbol2:""}},o=[{defval:"close",id:"source",name:"Source",options:["open","high","low","close","hl2","hlc3","ohlc4"],type:"text"},{id:"symbol2",name:"Symbol",type:"symbol",confirm:!0}],a=[{id:"plot1",type:"line"}],l={plot1:{title:"Plot",histogramBase: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,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(81337);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(74649),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(14483),c=i(81337);function h(){return 6e3}function d(e){switch(e){case"Delta":case"Up/Down":return 2;case"Total":return 1;default:c.Std.error(`Invalid study argument value: ${e}`)}}class u{findBasicResolutionForFromTo(e,t,i,n){const o=(0,s.getVolumeProfileResolutionForPeriod)(e.value(),t,i,n),a=r.Interval.parse(o);return l.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&&c.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 y(e){return{constructor:S,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=y({id:"VbPFixed@tv-volumebyprice-57",description:"Volume Profile Fixed Range"}),w=y({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"}}}}},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(81337);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(74649) +;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.Std.or(r.Std.and(r.Std.eq(e,t),r.Std.eq(e,i)),r.Std.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.Std.close(this._context),r.Std.high(this._context),r.Std.low(this._context),r.Std.volume(this._context));return[r.Std.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.Std.open(t)),s=t.new_var(r.Std.high(t)),n=t.new_var(r.Std.low(t)),o=t.new_var(r.Std.close(t)),a=r.Std.abs(s-o.get(1)),l=r.Std.abs(n-o.get(1)),c=r.Std.abs(s-n),h=r.Std.abs(o.get(1)-i.get(1)),d=r.Std.max(a,l),u=r.Std.iff(a>=r.Std.max(l,c),a-.5*l+.25*h,r.Std.iff(l>=r.Std.max(a,c),l-.5*a+.25*h,c+.25*h));return r.Std.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.Std.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.Std.gt(e,t)},this.f_1=function(e,t){return r.Std.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.Std.close(this._context),r.Std.open(this._context)),n=this._context.new_var(s),o=r.Std.sum(n,i,this._context),a=this.f_1(r.Std.close(this._context),r.Std.open(this._context)),l=this._context.new_var(a),c=r.Std.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.Std.close(this._context),s=this._input(0),n=this._input(1),o=this._input(2),a=this._context.new_var(i);return[r.Std.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.Std.high(this._context),n=i+1,o=this._context.new_var(s),a=r.Std.highestbars(o,n,this._context),l=this.f_0(a,i),c=r.Std.low(this._context),h=this._context.new_var(c),d=r.Std.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.Std.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.Std.high(this._context)),i=r.Std.change(t),s=this._context.new_var(r.Std.low(this._context)),n=-r.Std.change(s),o=this._context.new_var(r.Std.tr(void 0,this._context)),a=r.Std.rma(o,e,this._context),l=this._context.new_var(r.Std.and(r.Std.gt(i,n),r.Std.gt(i,0))?i:0),c=r.Std.fixnan(100*r.Std.rma(l,e,this._context)/a,this._context),h=this._context.new_var(r.Std.and(r.Std.gt(n,i),r.Std.gt(n,0))?n:0);return[c,r.Std.fixnan(100*r.Std.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.Std.abs(s-n)/(r.Std.eq(o,0)?1:o));return[100*r.Std.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.Std.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.Std.le(e,0)?0:1},this.main=function(e,t){this._context=e,this._input=t;var i=r.Std.hl2(this._context),s=this._context.new_var(i),n=r.Std.sma(s,5,this._context),o=this._context.new_var(i),a=r.Std.sma(o,34,this._context),l=this.f_0(n,a),c=l,h=this._context.new_var(l),d=r.Std.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.Std.le(e,0)?0:1},this.main=function(e,t){this._context=e,this._input=t;var i=r.Std.hl2(this._context),s=this._context.new_var(i),n=r.Std.sma(s,5,this._context),o=this._context.new_var(i),a=r.Std.sma(o,34,this._context),l=this.f_0(n,a),c=this._context.new_var(l),h=r.Std.sma(c,5,this._context),d=this.f_0(l,h),u=this._context.new_var(d),p=r.Std.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.Std.close(this._context),r.Std.open(this._context),r.Std.high(this._context),r.Std.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.Std.close(this._context),s=this._input(0),n=this._input(1),o=this._context.new_var(i),a=r.Std.sma(o,s,this._context),l=this._context.new_var(i),c=r.Std.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.Std.close(this._context),s=this._input(0),n=this._input(1),o=this._context.new_var(i),a=r.Std.sma(o,s,this._context),l=this._context.new_var(i),c=r.Std.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.Std.close(this._context),s=this._input(0),n=this._input(1),o=this._context.new_var(i),a=r.Std.sma(o,s,this._context),l=this._context.new_var(i),c=r.Std.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.Std.or(r.Std.and(r.Std.eq(e,t),r.Std.eq(e,i)),r.Std.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.Std.close(this._context),r.Std.high(this._context),r.Std.low(this._context),r.Std.volume(this._context)),n=this._context.new_var(s),o=r.Std.sum(n,i,this._context),a=r.Std.volume(this._context),l=this._context.new_var(a),c=r.Std.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.Std.accdist(this._context),o=this._context.new_var(n),a=r.Std.ema(o,i,this._context),l=this._context.new_var(n),c=r.Std.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.Std.high(this._context)-r.Std.low(this._context)),s=this._context.new_var(r.Std.ema(i,this.period,this._context));return[r.Std.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.Std.high(this._context),a=this._context.new_var(o),l=r.Std.highest(a,i,this._context),c=r.Std.atr(i,this._context),h=this.f_0(l,s,c),d=this._context.new_var(o),u=r.Std.lowest(d,i,this._context),p=this.f_1(u,s,c),_=this._context.new_var(h),m=r.Std.highest(_,n,this._context),g=this._context.new_var(p);return[r.Std.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.Std.ge(e,0)?e:0},this.f_1=function(e){return r.Std.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.Std.close(this._context),n=this._context.new_var(s),o=r.Std.change(n),a=this.f_0(o),l=this.f_1(o),c=this._context.new_var(a),h=r.Std.sum(c,i,this._context),d=this._context.new_var(l),u=r.Std.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.Std.close(this._context),t=r.Std.hlc3(this._context),i=this._context.new_var(r.Std.high(this._context)),s=r.Std.highest(i,30,this._context),n=r.Std.lowest(i,30,this._context),o=25/(s-n)*n,a=this._context.new_var(e),l=this._context.new_var(r.Std.ema(a,34,this._context)),c=(l.get(1)-l.get(0))/t*o,h=r.Std.sqrt(1+c*c),d=r.Std.round(180*r.Std.acos(1/h)/3.141592653589793),u=r.Std.iff(r.Std.gt(c,0),-d,d),p=r.Std.and(r.Std.gt(u,-2.14),r.Std.le(u,-.71))?7:8,_=r.Std.and(r.Std.gt(u,-3.57),r.Std.le(u,-2.14))?6:p,m=r.Std.and(r.Std.gt(u,-5),r.Std.le(u,-3.57))?5:_,g=r.Std.le(u,-5)?4:m,f=r.Std.and(r.Std.lt(u,2.14),r.Std.ge(u,.71))?3:g,v=r.Std.and(r.Std.lt(u,3.57),r.Std.ge(u,2.14))?2:f,S=r.Std.and(r.Std.lt(u,5),r.Std.ge(u,3.57))?1:v;return[1,r.Std.ge(u,5)?0:S]},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.Std.log10(e/(t-i))/s},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=r.Std.atr(1,this._context),n=this._context.new_var(s),o=r.Std.sum(n,i,this._context),a=r.Std.high(this._context),l=this._context.new_var(a),c=r.Std.highest(l,i,this._context),h=r.Std.low(this._context),d=this._context.new_var(h),u=r.Std.lowest(d,i,this._context),p=r.Std.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.Std.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.Std.sma(l,s,this._context),h=this._context.new_var(i),d=r.Std.dev(h,s,this._context),u=this.f_0(i,c,d),p=this._context.new_var(u);return"EMA"===n?a=r.Std.ema(p,o,this._context):"WMA"===n?a=r.Std.wma(p,o,this._context):"SMA"===n&&(a=r.Std.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.Std.max(r.Std.change(e),0));return r.Std.rma(s,t,i)},this.f_2=function(e,t,i){var s=i.new_var(-r.Std.min(r.Std.change(e),0));return r.Std.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.Std.nz(e)<=0?1:r.Std.nz(e)+1:r.Std.nz(e)>=0?-1:r.Std.nz(e)-1,this._context.new_var(e)}),this.main=function(e,t){this._context=e,this._input=t;var i=r.Std.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.Std.rsi(this.f_1(s,n,this._context),this.f_2(s,n,this._context)),c=this.f_3(s),h=r.Std.rsi(this.f_1(c,o,this._context),this.f_2(c,o,this._context)),d=this._context.new_var(r.Std.roc(s,1)),u=r.Std.percentrank(d,a);return[r.Std.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.Std.close(this._context),a=this._context.new_var(o),l=r.Std.roc(a,s),c=this._context.new_var(o),h=r.Std.roc(c,n),d=this.f_0(l,h),u=this._context.new_var(d);return[r.Std.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.Std.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.Std.period(this._context),r.Std.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.Std.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.Std.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.Std.period(this._context)),this._context.new_sym(this._input(1),r.Std.period(this._context)),this.period=this._input(2)}, +this.correlationLog=function(e,t,i,s){var n=r.Std.sma(e,i,s),o=r.Std.sma(t,i,s),a=s.new_var(e.get()*t.get());return(r.Std.sma(a,i,s)-n*o)/Math.sqrt(r.Std.variance2(e,n,i)*r.Std.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.Std.close(this._context)),n=this._context.new_var(r.Std.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.Std.close(this._context)),c=this._context.new_var(r.Std.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.Std.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.Std.close(this._context)),n=this._context.new_var(r.Std.sma(s,e,this._context)),o=this._context.new_var(r.Std.close(this._context)).get(i)-n,a=r.Std.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.Std.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.Std.low(this._context),n=this._context.new_var(s),o=r.Std.lowest(n,i,this._context),a=r.Std.high(this._context),l=this._context.new_var(a),c=r.Std.highest(l,i,this._context);return[o,c,r.Std.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.Std.close(this._context),n=this._context.new_var(s),o=r.Std.ema(n,i,this._context),a=this._context.new_var(o),l=r.Std.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.Std.hl2(this._context),o=this._context.new_var(n),a=r.Std.change(o),l=this.f_0(i,a,r.Std.high(this._context),r.Std.low(this._context),r.Std.volume(this._context)),c=this._context.new_var(l);return[r.Std.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.Std.close(this._context),n=this._context.new_var(s),o=r.Std.change(n),a=this.f_0(o,r.Std.volume(this._context)),l=this._context.new_var(a);return[r.Std.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.Std.na()},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=r.Std.close(this._context),o=this._context.new_var(n),a=r.Std.ema(o,i,this._context),l=this._context.new_var(n),c=r.Std.ema(l,s,this._context),h=a,d=c,u=r.Std.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.Std[this._input(4)](this._context)),s=r.Std.sma(i,this._input(0),this._context);return"Exponential"===this._input(3)?s=r.Std.ema(i,this._input(0),this._context):"Weighted"===this._input(3)&&(s=r.Std.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.Std.close(this._context)),o=0,a=0,l=0;l0?1:3,i=r.Std.change(this._context.new_var(e));return t-(r.Std.le(i,0)?0:1)},this.main=function(e,t){this._context=e,this._input=t;var i=r.Std[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.Std.ema(a,s,this._context),c=this._context.new_var(i),h=r.Std.ema(c,n,this._context),d=this.f_0(l,h),u=this._context.new_var(d),p=r.Std.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.Std[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.Std.ema(c,s,this._context),d=this._context.new_var(h);return"EMA"===o?l=r.Std.ema(d,a,this._context):"WMA"===o?l=r.Std.wma(d,a,this._context):"SMA"===o&&(l=r.Std.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.Std[this._input(1)](this._context),s=this._input(0),n=this._input(2),o=this._context.new_var(i);return[{value:r.Std.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.Std.close(this._context));return"Exponential"===this._input(2)?(i=r.Std.ema(n,this._input(0),this._context),s=r.Std.ema(n,this._input(1),this._context)):"Weighted"===this._input(2)?(i=r.Std.wma(n,this._input(0),this._context),s=r.Std.wma(n,this._input(1),this._context)):(i=r.Std.sma(n,this._input(0),this._context),s=r.Std.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.Std.close(this._context));return"Exponential"===this._input(3)?(i=r.Std.ema(o,this._input(0),this._context),s=r.Std.ema(o,this._input(1),this._context),n=r.Std.ema(o,this._input(2),this._context)):"Weighted"===this._input(3)?(i=r.Std.wma(o,this._input(0),this._context),s=r.Std.wma(o,this._input(1),this._context),n=r.Std.wma(o,this._input(2),this._context)):(i=r.Std.sma(o,this._input(0),this._context),s=r.Std.sma(o,this._input(1),this._context),n=r.Std.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.Std.stdev(t,i,this._context),a=r.Std.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.Std.close(this._context)),s=this._context.new_var(r.Std.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.Std.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.Std.gt(e,0)?t:r.Std.lt(i,0)?-t:0*t},this.main=function(e,t){this._context=e,this._input=t;var i=r.Std.close(this._context),s=this._context.new_var(i),n=r.Std.change(s);return[this.f_0(n,r.Std.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.Std.gt(e,0)?t:r.Std.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.Std.close(this._context),o=this._context.new_var(n),a=r.Std.change(o),l=this.f_0(a,r.Std.volume(this._context),a),c=r.Std.cum(l,this._context);this._context.setMinimumAdditionalDepth(s);var h,d=this._context.new_var(c);return"EMA"===i?h=r.Std.ema(d,s,this._context):"WMA"===i?h=r.Std.wma(d,s,this._context):"SMA"===i&&(h=r.Std.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.Std.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.Std.high(this._context),s=this._context.new_var(i),n=r.Std.low(this._context),o=this._context.new_var(n),a=this._input(0),l=this._input(1),c=r.Std.highest(s,a,this._context),h=r.Std.lowest(o,a,this._context);return[{value:c,offset:l},{value:h,offset:l},{value:r.Std.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.Std.close(this._context),s=this._input(0),n=this._input(1),o=this._context.new_var(i),a=r.Std.sma(o,s,this._context),l=this._context.new_var(i),c=r.Std.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.Std.close(this._context));return[r.Std.cum(r.Std.change(e)/e.get(1)*r.Std.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.Std.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.Std.max(e,0)},this.f_1=function(e){return-r.Std.min(e,0)},this.f_2=function(e,t){return r.Std.eq(e,0)?100:r.Std.eq(t,0)?0:100-100/(1+t/e)},this.main=function(e,t){this._context=e,this._input=t;var i=r.Std.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.Std.change(l),h=this.f_0(c),d=this._context.new_var(h),u=r.Std.rma(d,s,this._context),p=this.f_1(c),_=this._context.new_var(p),m=r.Std.rma(_,s,this._context),g=this.f_2(m,u),f=this._context.new_var(g);return"EMA"===n?a=r.Std.ema(f,o,this._context):"WMA"===n?a=r.Std.wma(f,o,this._context):"SMA"===n&&(a=r.Std.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.Std.close(this._context),r.Std.open(this._context)),n=this._context.new_var(s),o=r.Std.swma(n,this._context),a=this._context.new_var(o),l=r.Std.sum(a,i,this._context),c=this.f_0(r.Std.high(this._context),r.Std.low(this._context)),h=this._context.new_var(c),d=r.Std.swma(h,this._context),u=this._context.new_var(d),p=r.Std.sum(u,i,this._context),_=this.f_1(l,p),m=this._context.new_var(_);return[_,r.Std.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.Std.le(e,0)?0:t},this.f_1=function(e,t){return r.Std.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.Std.close(this._context),n=this._context.new_var(s),o=r.Std.stdev(n,i,this._context),a=this._context.new_var(s),l=r.Std.change(a),c=this.f_0(l,o),h=this._context.new_var(c),d=r.Std.ema(h,14,this._context),u=this.f_1(l,o),p=this._context.new_var(u),_=r.Std.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.Std.close(this._context),a=this._context.new_var(o),l=r.Std.tsi(a,i,s,this._context),c=this._context.new_var(l),h=r.Std.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.Std[this._input(1)](this._context);return[r.Std.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.Std.close(this._context));return[r.Std.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.Std.close(this._context),a=r.Std.high(this._context),l=r.Std.low(this._context),c=this._context.new_var(o),h=this._context.new_var(a),d=this._context.new_var(l),u=r.Std.stoch(c,h,d,i,this._context),p=this._context.new_var(u),_=r.Std.sma(p,s,this._context),m=this._context.new_var(_);return[_,r.Std.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.Std.max(r.Std.change(e),0));return r.Std.rma(s,t,i)},this.f_2=function(e,t,i){var s=i.new_var(-r.Std.min(r.Std.change(e),0));return r.Std.rma(s,t,i)},this.main=function(e,t){this._context=e,this._input=t;var i=r.Std.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.Std.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.Std.stoch(h,d,u,n,this._context),_=this._context.new_var(p),m=r.Std.sma(_,o,this._context),g=this._context.new_var(m);return[m,r.Std.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.Std.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.Std.close(this._context)),n=this._context.new_var(s),o=r.Std.ema(n,i,this._context),a=this._context.new_var(o),l=r.Std.ema(a,i,this._context),c=this._context.new_var(l),h=r.Std.ema(c,i,this._context),d=this._context.new_var(h),u=r.Std.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.Std.close(this._context),n=this._context.new_var(s),o=r.Std.ema(n,i,this._context),a=this._context.new_var(o),l=r.Std.ema(a,i,this._context),c=this._context.new_var(l),h=r.Std.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.Std.close(this._context),a=this._context.new_var(o),l=r.Std.tsi(a,s,i,this._context),c=this._context.new_var(l);return[l,r.Std.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.Std.close(this._context)),t=r.Std.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.Std.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.Std.sum(s,i,this._context)/r.Std.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.Std.close(this._context)),n=r.Std.max(r.Std.high(this._context),s.get(1)),o=this._context.new_var(r.Std.close(this._context)),a=r.Std.min(r.Std.low(this._context),o.get(1)),l=r.Std.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.Std.sqrt(s)},this.variance=function(e,t,i){var s=r.Std.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.Std.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.Std.high(this._context)-r.Std.low(this._context),t=r.Std.high(this._context)-this.bars[this.bars.length-2],i=this.bars[this.bars.length-2]-r.Std.low(this._context);return this.tr=Math.max(e,t,i),"Exponential"===this.maMethod?this.atr=r.Std.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.Std.close(this._context)===this.bars[this.bars.length-1])return this.lastSar;if(this.bars.push(r.Std.close(this._context)),1===this.count)this.atr=r.Std.high(this._context)-r.Std.low(this._context),this.sic=r.Std.close(this._context);else if(this.countthis.sic&&(this.sic=r.Std.close(this._context))}else if(this.count===this.period){e=r.Std.high(this._context)-r.Std.low(this._context),t=r.Std.high(this._context)-this.bars[this.bars.length-2],i=this.bars[this.bars.length-2]-r.Std.low(this._context);this.atr+=Math.max(e,t,i),this.atr*=1/this.period,r.Std.close(this._context)>this.sic&&(this.sic=r.Std.close(this._context)),this.position="LONG",this.nextsar=this.sic-this.atr*this.atrMult}else{var s=this.nextsar;"LONG"===this.position?r.Std.close(this._context)s?(this.position="LONG",this.sic=r.Std.close(this._context),this.nextsar=this.sic-this.computeATR()):(this.position="SHORT",this.sic=Math.min(r.Std.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.Std.weekofyear(e,t)!==r.Std.weekofyear(e,i)||r.Std.year(e,t)!==r.Std.year(e,i)};case"Month":return function(t,i){return r.Std.month(e,t)!==r.Std.month(e,i)||r.Std.year(e,t)!==r.Std.year(e,i)};case"Quarter":return function(t,i){return Math.floor(r.Std.month(e,t)/3)!==Math.floor(r.Std.month(e,i)/3)||r.Std.year(e,t)!==r.Std.year(e,i)};case"Year":return function(t,i){return r.Std.year(e,t)!==r.Std.year(e,i)};case"Decade":return function(t,i){return Math.floor(r.Std.year(e,t)/10)!==Math.floor(r.Std.year(e,i)/10)};case"Century":return function(t,i){return Math.floor(r.Std.year(e,t)/100)!==Math.floor(r.Std.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.Std.time(this._context),a=this._context.new_unlimited_var(o);return o&&(null===this._isNewSession&&(this._isNewSession=r.Std.createNewSessionCheck(e)),this._anchorChecker(a.get(),a.get(1))&&(this.f_1(s),this.f_1(n))),s.set(r.Std.nz(s.get(1))+r.Std[i](this._context)*r.Std.volume(this._context)),n.set(r.Std.nz(n.get(1))+r.Std.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.Std.close(this._context),s=this._input(0),n=this._context.new_var(i);return[r.Std.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.Std.volume(this._context),o=this._context.new_var(n),a=r.Std.ema(o,i,this._context),l=this._context.new_var(n),c=r.Std.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.Std.low(this._context)),i=this._context.new_var(r.Std.abs(r.Std.high(this._context)-t.get(1))),s=r.Std.sum(i,e,this._context),n=this._context.new_var(r.Std.high(this._context)),o=this._context.new_var(r.Std.abs(r.Std.low(this._context)-n.get(1))),a=r.Std.sum(o,e,this._context),l=this._context.new_var(r.Std.atr(1,this._context)),c=r.Std.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.Std.high(this._context),n=this._context.new_var(s),o=r.Std.highest(n,i,this._context),a=r.Std.low(this._context),l=this._context.new_var(a),c=r.Std.lowest(l,i,this._context);return[this.f_0(r.Std.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.Std.hl2(this._context);return[{value:r.Std.smma(c,i,this._context),offset:o},{value:r.Std.smma(c,s,this._context),offset:a},{value:r.Std.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.Std.high(this._context)),i=!0,s=!0,n=!0,o=!0,a=!0,l=!0,c=1;c<=e;c++)i=r.Std.and(i,r.Std.lt(t.get(e-c),t.get(e))),s=r.Std.and(s,r.Std.lt(t.get(e+c),t.get(e))),n=r.Std.and(n,r.Std.and(r.Std.le(t.get(e+1),t.get(e)),r.Std.lt(t.get(e+c+1),t.get(e)))),o=r.Std.and(o,r.Std.and(r.Std.le(t.get(e+1),t.get(e)),r.Std.and(r.Std.le(t.get(e+2),t.get(e)),r.Std.lt(t.get(e+c+2),t.get(e))))),a=r.Std.and(a,r.Std.and(r.Std.le(t.get(e+1),t.get(e)),r.Std.and(r.Std.le(t.get(e+2),t.get(e)),r.Std.and(r.Std.le(t.get(e+3),t.get(e)),r.Std.lt(t.get(e+c+3),t.get(e)))))),l=r.Std.and(l,r.Std.and(r.Std.le(t.get(e+1),t.get(e)),r.Std.and(r.Std.le(t.get(e+2),t.get(e)),r.Std.and(r.Std.le(t.get(e+3),t.get(e)),r.Std.and(r.Std.le(t.get(e+4),t.get(e)),r.Std.lt(t.get(e+c+4),t.get(e)))))));var h=r.Std.or(s,r.Std.or(n,r.Std.or(o,r.Std.or(a,l)))),d=r.Std.and(i,h),u=this._context.new_var(r.Std.low(this._context)),p=1,_=1,m=1,g=1,f=1,v=1;for(c=1;c<=e;c++)p=r.Std.and(p,r.Std.gt(u.get(e-c),u.get(e))),_=r.Std.and(_,r.Std.gt(u.get(e+c),u.get(e))),m=r.Std.and(m,r.Std.and(r.Std.ge(u.get(e+1),u.get(e)),r.Std.gt(u.get(e+c+1),u.get(e)))),g=r.Std.and(g,r.Std.and(r.Std.ge(u.get(e+1),u.get(e)),r.Std.and(r.Std.ge(u.get(e+2),u.get(e)),r.Std.gt(u.get(e+c+2),u.get(e))))), +f=r.Std.and(f,r.Std.and(r.Std.ge(u.get(e+1),u.get(e)),r.Std.and(r.Std.ge(u.get(e+2),u.get(e)),r.Std.and(r.Std.ge(u.get(e+3),u.get(e)),r.Std.gt(u.get(e+c+3),u.get(e)))))),v=r.Std.and(v,r.Std.and(r.Std.ge(u.get(e+1),u.get(e)),r.Std.and(r.Std.ge(u.get(e+2),u.get(e)),r.Std.and(r.Std.ge(u.get(e+3),u.get(e)),r.Std.and(r.Std.ge(u.get(e+4),u.get(e)),r.Std.gt(u.get(e+c+4),u.get(e)))))));var S=r.Std.or(_,r.Std.or(m,r.Std.or(g,r.Std.or(f,v))));return[r.Std.and(p,S),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.Std.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.Std.ema(i,s,this._context),d=r.Std.ema(i,n,this._context),u=r.Std.ema(i,o,this._context),p=r.Std.ema(i,a,this._context),_=r.Std.ema(i,l,this._context),m=r.Std.ema(i,c,this._context),g=this._input(6),f=this._input(7),v=this._input(8),S=this._input(9),y=this._input(10),b=this._input(11);return[h,d,u,p,_,m,r.Std.ema(i,g,this._context),r.Std.ema(i,f,this._context),r.Std.ema(i,v,this._context),r.Std.ema(i,S,this._context),r.Std.ema(i,y,this._context),r.Std.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.Std.period(this._context)&&this._context.new_sym(this._context.symbol.ticker,"1D")},this.main=function(e,t){this._symbolSupports1DResolution||r.Std.error(`Daily bars are not available for ${this._context.symbol.info.name}`),this._context=e,this._input=t,"1D"!==r.Std.period(this._context)&&this._context.select_sym(1);const i=this._input(0),s=this._input(1),n=r.Std.time(this._context),o=this._context.new_unlimited_var(n),a=this._context.new_unlimited_var(r.Std[i](this._context)),l=this._context.new_unlimited_var(r.Std[s](this._context));if(o.get(365),!this._context.symbol.isLastBar||!this._context.symbol.isNewBar)return null;const c=r.Std.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.Std.highest(a,h,this._context),extendLeft:!0,extendRight:!0}]},{styleId:"lowest",data:[{startIndex:n,endIndex:n,level:r.Std.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={}))},15294:(e,t,i)=>{"use strict";i.d(t,{SymbolInstrument:()=>d});var s=i(27856),r=i(41249),n=i(98829),o=i(57333),a=i(36274),l=i(60156),c=i(66846),h=i(50151);class d{constructor(e,t,i,r,o,l,c){this.periodBase="";const h=(0,s.decodeExtendedSymbol)(e),d="string"==typeof h.symbol?h:h.symbol;if((0,s.isStudySymbol)(d))throw new Error(`Unexpected nested study symbol: ${e}`);const u="string"==typeof h.symbol?h.symbol:h.symbol.symbol;this.ticker=u,this.currencyCode=i||d["currency-id"],this.unitId=r||d["unit-id"],this.subsessionId=c||d.session;const p=d["currency-id"]!==this.currencyCode||d["unit-id"]!==this.unitId;d["currency-id"]=this.currencyCode,d["unit-id"]=this.unitId,p&&(e=(0,s.encodeExtendedSymbolOrGetSimpleSymbolString)(h)),this.tickerid=e;const _=a.Interval.parse(t);this.resolution=_.letter(),this.interval=_.multiplier(),this.period=_.value(),this.index=-1,this.time=NaN,this.open=NaN,this.high=NaN, +this.low=NaN,this.close=NaN,this.volume=NaN,this.updatetime=NaN,this.minTick=NaN,this.isNewBar=!1,this.isBarClosed=!1,this.isFirstBar=!1,this.isLastBar=!1,this.session=new n.SessionInfo("Etc/UTC","24x7"),this.regularSubsession=null,this.preMarketSubsession=null,this.postMarketSubsession=null,this.script=o,this.isAdditionalDepthAllowed=!(0,s.isStudySymbol)(h)||h.type.includes("BarSetHeikenAshi"),l&&this.set_symbolinfo(l)}set_symbolinfo(e){if(e||console.error("WARN: symbolinfo isn't defined for "+this.tickerid),this.info=e,this.minTick=e.minmov/e.pricescale,this.currencyCode=e.currency_code,this.unitId=e.unit_id,this.subsessionId=e.subsession_id,this.timezone=r.get_timezone(e.timezone),this.session.init(e.timezone,e.session,e.session_holidays,e.corrections),void 0!==e.subsessions){const t=e.subsessions.find((e=>e.id===c.SubsessionId.Regular)),i=e.subsessions.find((e=>e.id===c.SubsessionId.PreMarket)),s=e.subsessions.find((e=>e.id===c.SubsessionId.PostMarket));void 0!==t&&(this.regularSubsession=new o.SessionSpec(e.timezone,t.session,e.session_holidays,t["session-correction"])),void 0!==i&&(this.preMarketSubsession=new o.SessionSpec(e.timezone,i.session,e.session_holidays,i["session-correction"])),void 0!==s&&(this.postMarketSubsession=new o.SessionSpec(e.timezone,s.session,e.session_holidays,s["session-correction"]))}}isdwm(){return""!==this.resolution&&"S"!==this.resolution&&"T"!==this.resolution}enable_dwm_aligning(e,t){this.dwm_aligner=(0,l.newBarBuilder)(this.period,e,t)}bartime(){const e=this.time;if(!this.isdwm()||isNaN(e))return e;const t=(0,h.ensureDefined)(this.timezone,"symbol instrument timezone"),i=r.utc_to_cal(t,e);return this.session.spec.correctTradingDay(i),r.cal_to_utc(t,i)}lastbar(e){if(isNaN(e.time))return;let t=e.time;this.dwm_aligner&&(this.dwm_aligner.moveTo(t),t=this.dwm_aligner.startOfBar(0));const i=this.time!==t;i&&this.index>=0&&!this.isBarClosed&&(this.isNewBar=!1,this.isBarClosed=!0,this.script.calc(this)),this.time=t,this.open=e.open,this.high=e.high,this.low=e.low,this.close=e.close,this.volume=e.volume||NaN,this.updatetime=e.updatetime||NaN,this.isNewBar=i,this.isBarClosed=!!e.isBarClosed,this.isLastBar=!!e.isLastBar,this.isNewBar&&(this.index++,this.isFirstBar=0===this.index),this.script.calc(this)}}},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=S(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(74649),n=i(61476),o=i(76537).SymbolExtrapolator,a=i(21125).SessionTimeScale,l=i(34108).PointsetsManager,c=i(60156),h=i(77475).createDwmAligner,d=i(36274).Interval,u=i(76422),p=i(2663).visitObject,_=i(1722).isObject;i(24172),i(60325);var m=i(79850).DatafeedRequestsCachedProcessor,g=i(38618).timezoneIsAvailable,f=i(77475).isAlignmentEnabled,v=i(27856),S=v.isEncodedExtendedSymbol,y=v.decodeExtendedSymbol,b=i(42960).extractSymbolNameFromSymbolInfo,w=i(48739).replaceGraphicsTimesWithTimePointIndexIndex,C=i(14483),P=i(66846).SubsessionId,x=i(60156).getPeriodsBetweenDates;const T="pre_post_market_sessions",I=C.enabled(T);var M=-5e6;function A(e){var t=e.findIndex((function(e){return e.index!==M}));return-1===t?[]:0===t?e:e.slice(t)}function L(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 k(e,t){return e+"_"+t}function D(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 E(e){const t=y(e),i="string"==typeof t.symbol?t:t.symbol;return[i.symbol,{currency:i["currency-id"],unit:i["unit-id"],session:i.session===P.Regular?void 0:i.session}]}var V=function(e){var t=this;this._studiesCache={},this._objectsDataCache={},this._studiesNonSeriesTimes={},this._metainfoCache=[],this._barsCoefficientsCache={},this._externalDatafeed=e,e.getVolumeProfileResolutionForPeriod&&r.overwriteVolumeProfileResolutionForPeriodGetter((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 m(e,this.serverTimeOffset.bind(this),this._datafeedConfiguration.reset_cache_timeout),n.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 c.SessionInfo(e.timezone,e.session,e.session_holidays,e.corrections),n=c.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 B(e,t){return e+"_"+t}function R(e,t,i,s){return e+(t?"_#_"+t:"")+(i?"_#_"+i:"")+(s?"_#_"+s:"")}V.prototype._getSymbolExtrapolator=function(e,t,i){var s=d.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 o(t,s),this._symbolExtrapolators[r]=n),n},V.prototype._barsCoefficients=function(e,t){if(void 0===y(e).type)return{};var i=e+t;return this._barsCoefficientsCache[i]||(this._barsCoefficientsCache[i]={}),this._barsCoefficientsCache[i]},V.prototype.destroy=function(){this._cachedDatafeed.destroy(),this._externalDatafeed=null,Object.keys(this._pointsetsManagers).forEach((function(e){this._pointsetsManagers[e].destroy()}),this),this._pointsetsManagers={}},V.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={}},V.prototype.purgeDataCache=function(){this._cachedDatafeed.purgeCache()},V.prototype._logMessage=function(e){C.enabled("charting_library_debug_mode")&&console.log(e)},V.prototype.on=function(e,t){return this._callbacks.hasOwnProperty(e)||(this._callbacks[e]=[]),this._callbacks[e].push(t),this},V.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)}))}))},V.prototype.supportedSymbolsTypes=function(){return this._datafeedConfiguration.symbols_types||[]},V.prototype.symbolsGrouping=function(){return this._datafeedConfiguration.symbols_grouping||{futures:/$a/}},V.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]},V.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=h(r,e),l=C.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(){u.emit("onMarkClick",e.id)},e.label=!!e.label&&(l?e.label.slice(0,2):e.label[0]),e}));s(c)}),r)}},V.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=h(r,e),o=t.map((function(e){return e.tickmark=null!==i?i.timeToSessionStart(1e3*e.time)/1e3:e.time,e}));s(o)}),r)}},V.prototype.getSeriesLastBarTime=function(e,t){var i=this._getSeriesData(e,t);return null===i||0===i.length?null:i[i.length-1].timeMs},V.prototype.getSeriesInterval=function(e,t){var i=this._studiesCache[e][t];return i?i.resolution:null},V.prototype.getSeriesSymbolInfo=function(e,t){var i=this._studiesCache[e][t];return i?i.symbolInfo:null},V.prototype._getSeriesData=function(e,t){return this._objectsDataCache[B(e,t)]||null},V.prototype._computeStudy=async function(e,t,i,s,n,o,a,l,c,u){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||u.onRealtimeCallback([_[_.length-1]],l,_.length,v,i)}(e,t,i)},nonseriesOut:function(e,t){u.onNonSeriesDataUpdate(t,i)},setNoMoreData:function(){S=!0},recalc:function(e,s){p=!1,_.endOfData=S,_.emptyBarCount=s.emptyBarCount,t.error&&null!==t.error()||(null!==l&&(y._objectsDataCache[l]=_),u.onDataReadyCallback(_,v,i,s))}});if(!y._studiesCache[e]||!y._studiesCache[e][n])throw Error("This should never happen");y._studiesCache[e][n].engine=w}catch(e){if(!e.studyError)throw e;u.onErrorCallback(e.message)}}else u.onErrorCallback("Unsupported resolution. Did you forget to set has_intraday to true?")}(w,P)},V.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},V.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=A(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},V.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)},V.prototype.extendSeriesRange=function(e,t){var i=this._timeScales[e].firstSeriesBarTime();if(null!==i){var s=this._mainSeriesRecord(e);if(d.isDWM(s.resolution)&&null!=s.symbolInfo){var r=h(s.resolution,s.symbolInfo);null!==r&&(i=r.timeToExchangeTradingDay(i))}var n=this._symbolIdToSymbolRequestString.get(k(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")},V.prototype.seriesTurnaround=function(e,t){return this._studiesCache[e]&&this._studiesCache[e][t]&&this._studiesCache[e][t].turnaround},V.prototype._seriesDataRange=function(e,t){var i=this._studiesCache[e][t];return null!==i.firstLoadedTimeMs?{to:i.firstLoadedTimeMs,countBack:0}:i.dataRange},V.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))}},V.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)}},V.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))},V.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},V.prototype._seriesCount=function(e){var t=0;for(var i in this._studiesCache[e]){"series"===this._studiesCache[e][i].type&&(t+=1)}return t},V.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})))}},V.prototype.createSeries=function(e,t,i,s,n,o,a){this._setEndOfData(e,t,i,!1);var l=new r.OHLCV;this._studiesCache[e]=this._studiesCache[e]||{};var c=this._getSeriesData(e,t),h=this._studiesCache[e][t],u=this._seriesCount(e),p=this._mainSeriesRecord(e);if(!h||d.isEqual(h.resolution,n)&&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===u||null!==p&&(null!=p.firstLoadedTimeMs?(o.to=p.firstLoadedTimeMs,o.countBack=0):o=Object.assign({},p.dataRange));else if(1===u)o=Object.assign({},h.initialDatarange);else{var _=this._timeScales[e].firstSeriesBarTime();(void 0===o.to||null!==_&&_{L(e.logo_urls,e.exchange_logo,e)})),s(e)}))},V.prototype.resolveSymbol=function(e,t,i){var s=this;this._symbolIdToSymbolRequestString.set(k(e,t),i),this._resolvePromisesBySymbolId.set(k(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)}))})))},V.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]=E(e);this._resolveSymbolByName(s,r,t,i)},V.prototype._resolveSymbolByName=function(e,t,i,s){var r,n=t&&t.currency,o=t&&t.unit,a=t&&t.session,l=R(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[R(e,t.currency_id,t.unit_id,t.subsession_id)]=r,c._resolveRequests[R(b(t,null),t.currency_id,t.unit_id,t.subsession_id)]=r,c._resolveRequests[R(b(t,null),n,o,a)]=r})).catch((function(){}))}r.then(i).catch(s)},V.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"),e.supported_resolutions)for(var i=0;ithis._resolveSymbolByName(t,i,o,(t=>{this.quoteRemoveSymbols(e,[r]),a(t)}))),e,r)}}},V.prototype._removeMarketStatusWatchers=function(e){var t=this;Object.keys(this._marketStatusWatchers[e]||{}).forEach((function(i){t._marketStatusWatchers[e][i].stop()})),this._marketStatusWatchers[e]={}},V.prototype._stopQuotesSubscription=function(e){this._quotesInfo[e].listenerGUID&&(this._externalDatafeed.unsubscribeQuotes(this._quotesInfo[e].listenerGUID),this._quotesInfo[e].listenerGUID=void 0),this._removeMarketStatusWatchers(e)},V.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,L(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){void 0!==t[e.n]?null!==t[e.n]&&s(e,t[e.n]):i._resolveSymbolByName(e.n,null,(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=>E(e)[0]));this._externalDatafeed.getQuotes&&!C.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,i._quotesInfo[e].fastSymbols,r,i._quotesInfo[e].listenerGUID))}),(function(e){})):!this._externalDatafeed.getQuotes&&C.enabled("trading_terminal")&&setTimeout((function(){r(o.map((function(e){return{n:e,s:"ok",v:{}}})))})), +this._createMarketStatusWatchers(e,n)},V.prototype._restartQuotesSubscription=function(e){this._stopQuotesSubscription(e),this._startQuotesSubscription(e)},V.prototype.quoteCreateSession=function(e){this._quotesInfo[e]={symbols:[],fastSymbols:[],listenerGUID:void 0}},V.prototype.quoteDeleteSession=function(e){this._stopQuotesSubscription(e),this._quotesInfo[e]=null},V.prototype.quoteSetFields=function(e,t){},V.prototype.quoteAddSymbols=function(e,t){this._quotesInfo[e].symbols=this._filteredSymbols(this._quotesInfo[e].symbols.concat(t)),this._restartQuotesSubscription(e)},V.prototype.quoteRemoveSymbols=function(e,t){this._quotesInfo[e].symbols=this._quotesInfo[e].symbols.filter((function(e){return t.indexOf(e)<0})),this._restartQuotesSubscription(e)},V.prototype.quoteFastSymbols=function(e,t){this._quotesInfo[e].fastSymbols=this._filteredSymbols(t),this._restartQuotesSubscription(e)},V.prototype.quoteHibernateAll=function(e){},V.prototype._stopDepthSubscription=function(e){this._depthInfo[e].listenerGUID&&(this._externalDatafeed.unsubscribeDepth(this._depthInfo[e].listenerGUID),this._depthInfo[e].listenerGUID=void 0)},V.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)])))})))},V.prototype._restartDepthSubscription=function(e){this._stopDepthSubscription(e),this._startDepthSubscription(e)},V.prototype.depthCreateSession=function(e){this._depthInfo[e]={symbol:null,listenerGUID:void 0}},V.prototype.depthDeleteSession=function(e){this._depthInfo[e].symbol=null,this._stopDepthSubscription(e),delete this._depthInfo[e]},V.prototype.depthSetSymbol=function(e,t){this._depthInfo[e].symbol=t,this._restartDepthSubscription(e)},V.prototype._filteredSymbols=function(e){var t=[];return e.forEach((function(e){e instanceof Object||t.indexOf(e)<0&&t.push(e)})),t},V.prototype._isEndOfData=function(e,t,i){var s=e+"!"+t+"@"+i;return!!this._endOfData[s]},V.prototype._setEndOfData=function(e,t,i,s){var r=e+"!"+t+"@"+i;this._endOfData[r]=!1!==s},V.prototype.serverTimeOffset=function(){return this._serverTimeOffset},V.prototype.serverTime=function(){return 1e3*this.getCurrentUTCTime()},V.prototype.getCurrentUTCTime=function(){return(new Date).valueOf()/1e3+this._serverTimeOffset},V.prototype.switchTimezone=function(e,t){this._timeScales[e].setTimezone(t);var i=this._timeScales[e].tickMarks();null!==i&&TradingView.ChartapiMessagerInstances[e].onTickmarksUpdated(0,i)},V.prototype._studyCanExtendTimeScale=function(e,t){const i=this._studiesCache[e][t]?.metainfo +;return void 0!==i&&(C.enabled("studies_extend_time_scale")&&i.canExtendTimeScale||C.enabled("secondary_series_extend_time_scale")&&"Overlay@tv-basicstudies-1"===i.id)},e.exports=V},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] @@ -750,135 +751,135 @@ P.distanceToSegment)(new f.Point(n,o),new f.Point(n,this._data.histogramBase),ne ;return this._items.push(t(e,s)),!1})),this._items.length?(0,s.ensureDefined)(this._items[0].timePointIndex)-l:void 0;{const i=(0,s.ensureDefined)(o),n=l>=0?0:l,c=l>=0?l:0;let h=(0,a.lowerbound)(this._items,i+n,((e,t)=>e.timePointIndex=0?0:l,i=l>=0?l:0;let r=(0,a.lowerbound)(this._items,o+t,((e,t)=>e.timePointIndexr+1)return{startBar:null,endBar:null};let a=this._study.plots();a=a.range(n,(0,s.ensureNotNull)(a.lastIndex())),i=Math.max(i,n),r=Math.max(r,n);const l=a.search(i,o.PlotRowSearchMode.NearestLeft,this._plotIndex+1),c=a.search(r,o.PlotRowSearchMode.NearestRight,this._plotIndex+1);return null!==l&&(i=l.index),null!==c&&(r=c.index),i=Math.max(n,i),{startBar:i,endBar:r}}_updateImplLight(){const e=this._study.firstValue();if(null===e)return this._selectionData=null,void this._updateRenderer(0,-1);const t=this._study.priceScale();if(null===t)return this._selectionData=null,void this._updateRenderer(0,-1);const i=this._model.timeScale().visibleBarsStrictRange();if(null===i)return this._selectionData=null,void this._updateRenderer(0,-1);const{startBar:s,endBar:r}=this._calculateStartEnd(i);if(null===s||null===r||0===this._items.length)return this._selectionData=null,void this._updateRenderer(0,-1);const n=Math.max(0,(0,a.lowerbound)(this._items,s,((e,t)=>e.timePointIndexe=o)return this._selectionData=null,void this._updateRenderer(0,-1);this._convertItemsToCoordinates(t,e,n,o),this._createSelection(e);const l=this._model.mainSeries().data().bars().lastIndex();null!==l&&(this._lastConfirmedSeriesBarCoordinate=this._model.timeScale().indexToCoordinate(l)),this._updateRenderer(n,o)}_convertItemsToCoordinates(e,t,i,s){this._convertItemsToCoordinatesImpl(e,t,i,s)}_convertItemsToCoordinatesImpl(e,t,i,s){for(let e=i;e{"use strict";i.d(t,{createStudyPlotColorProvider:()=>p});var s=i(72877),r=i(50151),n=i(96759);const o=new Map([[0,"color"],[2,"textColor"],[3,"borderColor"],[4,"wickColor"],[5,"colorup"],[6,"colordown"]]);class a{constructor(e){this._plotStyle=e}getPlotPointStyle(e,t){const i=t?(0,n.clearStyle)(t):(0,n.createEmptyStyle)();return o.forEach(((e,t)=>{this._plotStyle[e]&&(i.colors[t]=this._plotStyle[e].value())})),i.lineWidth=this._plotStyle.linewidth?this._plotStyle.linewidth.value():void 0,i.lineStyle=this._plotStyle.linestyle?this._plotStyle.linestyle.value():void 0,i}isColorDefined(){return!0}singleColor(){return!0}getDefaultPlotPointStyle(){return null}}const l=[0,1,2,3,4,5,6];class c{constructor(e,t,i,s){this._palettesColors=new Map,this._defaultPlotColors=new Map,this._indexes=s;const n=t.styles[i];if(n)for(const[e,t]of o)this._defaultPlotColors.set(e,n[t]);const a=(0,r.ensureDefined)(e.palettes),l=e.plots;s.forEach(((e,i)=>{const s=l[e];if(s&&"palette"in s){const e=a[s.palette],r=t.palettes[s.palette];if(e&&r){const{valToIndex:t}=e,{colors:s}=r,n={...s};t&&Object.keys(t).forEach((e=>{const i=t[e];void 0!==i&&(n[e]=s[i])})),this._palettesColors.set(i,n)}}}))}getPlotPointStyle(e,t){const i=t?(0,n.clearStyle)(t):(0,n.createEmptyStyle)();return l.forEach((t=>{var s,n;if(this._palettesColors.has(t)){const n=e[(0,r.ensureDefined)(this._indexes.get(t))+1];if("number"==typeof n){const e=null===(s=this._palettesColors.get(t))||void 0===s?void 0:s[n];0===t&&e&&(i.lineWidth=e.width.value(),i.lineStyle=e.style.value()),i.colors[t]=null==e?void 0:e.color.value()}else i.colors[t]="transparent"}else i.colors[t]=null===(n=this._defaultPlotColors.get(t))||void 0===n?void 0:n.value()})),i}getDefaultPlotPointStyle(){var e;const t=null===(e=this._palettesColors.get(0))||void 0===e?void 0:e[0];if(void 0!==t){return{colors:[t.color.value(),void 0,void 0,void 0,void 0,void 0,void 0],lineStyle:void 0,lineWidth:t.width.value()}}return null}isColorDefined(){return!!this._palettesColors.size}singleColor(){return!1}}var h=i(54282);class d{constructor(e){this._rgbaFromInteger=(0,h.rgbaFromIntegerCached)(),this._indexes=e}getPlotPointStyle(e,t){const i=t?(0,n.clearStyle)(t):(0,n.createEmptyStyle)();return this._indexes.forEach(((t,s)=>{const r=e[t+1];if(null!=r){const e=this._rgbaFromInteger(r);i.colors[s]=e }else i.colors[s]="transparent"})),i}isColorDefined(){return!0}singleColor(){return!1}getDefaultPlotPointStyle(){return null}}const u=new Map([[0,function(e,t){const i=(0,s.isColorerPlot)(t)||(0,s.isOhlcColorerPlot)(t);return"target"in t&&t.target===e&&i}],[2,function(e,t){const i=(0,s.isTextColorerPlot)(t);return"target"in t&&t.target===e&&i}],[1,function(e,t){return(0,s.isBgColorerPlot)(t)&&t.id===e}],[3,function(e,t){const i=(0,s.isCandleBorderColorerPlot)(t);return"target"in t&&t.target===e&&i}],[4,function(e,t){const i=(0,s.isCandleWickColorerPlot)(t);return"target"in t&&t.target===e&&i}],[5,function(e,t){const i=(0,s.isUpColorerPlot)(t);return"target"in t&&t.target===e&&i}],[6,function(e,t){const i=(0,s.isDownColorerPlot)(t);return"target"in t&&t.target===e&&i}]]);function p(e,t,i){const{colorers:s}=function(e,t){const i=e.plots,s=i.findIndex((e=>e.id===t)),r=new Map;return i.forEach(((e,i)=>{u.forEach(((s,n)=>{s(t,e)&&r.set(n,i)}))})),{plotIndex:-1===s?null:s,colorers:r}}(e,i);if(s.size)return e.isRGB?new d(s):new c(e,t,i,s);{const e=t.ohlcPlots;if(e&&e[i])return new a(e[i]);const s=t.styles[i];return new a(s)}}},72877:(e,t,i)=>{"use strict";var s,r,n;function o(e){return"line"===e.type}function a(e){return"shapes"===e.type}function l(e){return"chars"===e.type}function c(e){return"arrows"===e.type}function h(e){return"data"===e.type}function d(e){return"dataoffset"===e.type}function u(e){return"ohlc_open"===e.type}function p(e){return"ohlc_high"===e.type}function _(e){return"ohlc_low"===e.type}function m(e){return"ohlc_close"===e.type}function g(e){return u(e)||p(e)||_(e)||m(e)}function f(e){return"colorer"===e.type&&"palette"in e}function v(e){return"colorer"===e.type&&!("palette"in e)}function S(e){return"colorer"===e.type}function y(e){return"bar_colorer"===e.type}function b(e){return"bg_colorer"===e.type}function w(e){return"text_colorer"===e.type}function C(e){return"ohlc_colorer"===e.type}function P(e){return"wick_colorer"===e.type}function x(e){return"border_colorer"===e.type}function T(e){return"up_colorer"===e.type}function I(e){return"down_colorer"===e.type}function M(e){return"alertcondition"===e.type}function A(e){return o(e)||a(e)||l(e)||c(e)}function L(e){return"Plot"!==e}function k(e){return"ohlc_bars"===e.plottype}function D(e){return"ohlc_candles"===e.plottype}function E(e){return S(e)||y(e)||b(e)||h(e)||d(e)||C(e)||M(e)||T(e)||I(e)||x(e)||P(e)||w(e)}function V(e){return S(e)||w(e)||y(e)||h(e)||d(e)||C(e)||P(e)||x(e)||T(e)||I(e)||M(e)}i.r(t),i.d(t,{LineStudyPlotStyle:()=>s,PlotSymbolSize:()=>n,STUDYPLOTDISPLAYTARGET:()=>r,isAlertConditionPlot:()=>M,isArrowsPlot:()=>c,isBarColorerPlot:()=>y,isBgColorerPlot:()=>b,isCandleBorderColorerPlot:()=>x,isCandleWickColorerPlot:()=>P,isCharsPlot:()=>l,isColorerPlot:()=>S,isDataOffsetPlot:()=>d,isDataPlot:()=>h,isDownColorerPlot:()=>I,isLinePlot:()=>o,isNonVisualPlot:()=>V,isOhlcClosePlot:()=>m,isOhlcColorerPlot:()=>C,isOhlcHighPlot:()=>p,isOhlcLowPlot:()=>_,isOhlcOpenPlot:()=>u,isOhlcPlot:()=>g,isOhlcPlotStyleBars:()=>k,isOhlcPlotStyleCandles:()=>D, -isPaletteColorerPlot:()=>f,isPlotSupportDisplay:()=>A,isPlotTitleDefined:()=>L,isPlotWithTechnicalValues:()=>E,isRgbaColorerPlot:()=>v,isShapesPlot:()=>a,isTextColorerPlot:()=>w,isUpColorerPlot:()=>T}),function(e){e[e.Line=0]="Line",e[e.Histogram=1]="Histogram",e[e.Cross=3]="Cross",e[e.Area=4]="Area",e[e.Columns=5]="Columns",e[e.Circles=6]="Circles",e[e.LineWithBreaks=7]="LineWithBreaks",e[e.AreaWithBreaks=8]="AreaWithBreaks",e[e.StepLine=9]="StepLine",e[e.StepLineWithDiamonds=10]="StepLineWithDiamonds",e[e.StepLineWithBreaks=11]="StepLineWithBreaks"}(s||(s={})),function(e){e[e.None=0]="None",e[e.Pane=1]="Pane",e[e.DataWindow=2]="DataWindow",e[e.PriceScale=4]="PriceScale",e[e.StatusLine=8]="StatusLine",e[e.All=15]="All"}(r||(r={})),function(e){e.Auto="auto",e.Tiny="tiny",e.Small="small",e.Normal="normal",e.Large="large",e.Huge="huge"}(n||(n={}))},28853:(e,t,i)=>{"use strict";i.r(t),i.d(t,{createStudy:()=>le,isESDStudy:()=>oe,isFundamentalStudy:()=>ne,isRollDatesStudy:()=>ae,isStudy:()=>ie,isStudyStrategy:()=>se,isStudyStub:()=>re,studyColorRotationMode:()=>ce,useSameColorRotationComparator:()=>de});var s=i(14483),r=i(42856),n=i(56827),o=i(50151),a=i(26426),l=i(27714),c=i(74359);class h{constructor(e,t,i,s){this._priceAxisFontSize=11,this._prices=[],this._labelWidth=0,this._pixelRatioParams=e,this._recreateCanvasAndContext((0,l.size)({width:0,height:0})),this.reset({font:t,fontSize:i,backColors:s})}destroy(){delete this._canvas,delete this._cache}canvas(){return this._canvas}reset(e){this._renderParams=e,this._prices=[],this._cache.font=e.fontSize+"px "+e.font,this._labelWidth=["P","S1","R1","S2","R2","S3","R3","S4","R4","S5","R5","/"].reduce(((e,t)=>{const i=this._cache.measureText(t).width;return Math.max(i,e)}),0)}rowHeight(){return this._priceAxisFontSize+4}labelRectByIndex(e){return{left:0,top:Math.round(this._topByIndex(e)),width:Math.round(this._labelWidth+4),height:Math.round(this._renderParams.fontSize+8)}}setPrices(e){let t=!1;const i=(e,t)=>{const i=void 0===e,s=void 0===t;return(!i&&!s||i===s)&&(0,o.ensureDefined)(e).formatted===(0,o.ensureDefined)(t).formatted};if(e.length!==this._prices.length)t=!0;else for(let s=0;s{this._cache.translate(.5,.5),this._cache.font=this._renderParams.fontSize+"px "+this._renderParams.font,this._cache.textBaseline="middle";for(let e=0;ef,isPlotSupportDisplay:()=>A,isPlotTitleDefined:()=>L,isPlotWithTechnicalValues:()=>E,isRgbaColorerPlot:()=>v,isShapesPlot:()=>a,isTextColorerPlot:()=>w,isUpColorerPlot:()=>T}),function(e){e[e.Line=0]="Line",e[e.Histogram=1]="Histogram",e[e.Cross=3]="Cross",e[e.Area=4]="Area",e[e.Columns=5]="Columns",e[e.Circles=6]="Circles",e[e.LineWithBreaks=7]="LineWithBreaks",e[e.AreaWithBreaks=8]="AreaWithBreaks",e[e.StepLine=9]="StepLine",e[e.StepLineWithDiamonds=10]="StepLineWithDiamonds",e[e.StepLineWithBreaks=11]="StepLineWithBreaks"}(s||(s={})),function(e){e[e.None=0]="None",e[e.Pane=1]="Pane",e[e.DataWindow=2]="DataWindow",e[e.PriceScale=4]="PriceScale",e[e.StatusLine=8]="StatusLine",e[e.All=15]="All"}(r||(r={})),function(e){e.Auto="auto",e.Tiny="tiny",e.Small="small",e.Normal="normal",e.Large="large",e.Huge="huge"}(n||(n={}))},28853:(e,t,i)=>{"use strict";i.r(t),i.d(t,{createStudy:()=>ae,isESDStudy:()=>ne,isFundamentalStudy:()=>re,isRollDatesStudy:()=>oe,isStudy:()=>te,isStudyStrategy:()=>ie,isStudyStub:()=>se,studyColorRotationMode:()=>le,useSameColorRotationComparator:()=>he});var s=i(14483),r=i(42856),n=i(56827),o=i(50151),a=i(26426),l=i(27714),c=i(74359);class h{constructor(e,t,i,s){this._priceAxisFontSize=11,this._prices=[],this._labelWidth=0,this._pixelRatioParams=e,this._recreateCanvasAndContext((0,l.size)({width:0,height:0})),this.reset({font:t,fontSize:i,backColors:s})}destroy(){delete this._canvas,delete this._cache}canvas(){return this._canvas}reset(e){this._renderParams=e,this._prices=[],this._cache.font=e.fontSize+"px "+e.font,this._labelWidth=["P","S1","R1","S2","R2","S3","R3","S4","R4","S5","R5","/"].reduce(((e,t)=>{const i=this._cache.measureText(t).width;return Math.max(i,e)}),0)}rowHeight(){return this._priceAxisFontSize+4}labelRectByIndex(e){return{left:0,top:Math.round(this._topByIndex(e)),width:Math.round(this._labelWidth+4),height:Math.round(this._renderParams.fontSize+8)}}setPrices(e){let t=!1;const i=(e,t)=>{const i=void 0===e,s=void 0===t;return(!i&&!s||i===s)&&(0,o.ensureDefined)(e).formatted===(0,o.ensureDefined)(t).formatted};if(e.length!==this._prices.length)t=!0;else for(let s=0;s{this._cache.translate(.5,.5),this._cache.font=this._renderParams.fontSize+"px "+this._renderParams.font,this._cache.textBaseline="middle";for(let e=0;e=n||c)){this._visiblePivots.add(o[e]),this._prices=[];for(let i=0;i=t.left&&e.x<=t.left+t.width&&e.y>=t.top&&e.y<=t.top+t.height)return new I.HitTestResult(I.HitTarget.Regular);return null}_drawImpl(e){const t=this._cacheProvider(e),{horizontalPixelRatio:i,verticalPixelRatio:s,context:r}=e;this._drawRects=[];const n=e=>{const n=t.labelRectByIndex(e),o={left:Math.round(this._point.x-n.width+a),top:Math.round(this._point.y-n.height/2),width:n.width,height:n.height};return r.drawImage(t.canvas(),Math.round(n.left*i),Math.round(n.top*s),n.width*i,n.height*s,Math.round(o.left*i),Math.round(o.top*s),o.width*i,o.height*s),this._drawRects.push(o),n.width},o=this._label.split("/");let a=0;for(let e=0;e0&&(a+=n(t+11)/2),a+=n(t)/2}}}function L(e){return"P"===e?e:"S"+e[1]+"/R"+e[1]}function k(e,t,i){const s=t;void 0===e[s]?e[s]={text:i,ids:[L(i)]}:(e[s].text+="/"+i,e[s].ids.push(L(i)))}class D{constructor(e,t){this._pivots=[],this._invalidated=!0,this._renderer=new x.CompositeRenderer,this._model=e,this._source=t,this._cacheProvider=this._source.getCache.bind(this._source)}update(e){this._invalidated=!0}renderer(e,t){return this._invalidated&&(this._updateImpl(t,e),this._invalidated=!1),this._renderer}_updateImpl(e,t){this._renderer.clear();const i=this._source.ownerSource();if(null===i)return;this._source.pricesView().prices(),this._pivots=[];const s=this._source.customData();if(!s||!s.pivots)return;const r=this._source.properties().childs();if(!r.visible.value())return;const n=s.pivots,a=this._source.indexes(),l=this._model.timeScale(),c=this._source.priceScale(),h=i.firstValue();if(!c||c.isEmpty()||l.isEmpty()||!n||!a||null===h)return;const d=(0,o.ensureNotNull)(l.visibleBarsStrictRange()),u=d.firstBar(),p=d.lastBar();for(let e=0;ep)continue;const s={},o=r.levelsStyle.childs().visibility.childs();o.P.value()&&k(s,n[e].p,"P"),o["S1/R1"].value()&&(k(s,n[e].s1,"S1"),k(s,n[e].r1,"R1")),o["S2/R2"].value()&&(k(s,n[e].s2,"S2"),k(s,n[e].r2,"R2")),o["S3/R3"].value()&&(k(s,n[e].s3,"S3"),k(s,n[e].r3,"R3")),o["S4/R4"].value()&&(k(s,n[e].s4,"S4"),k(s,n[e].r4,"R4")),o["S5/R5"].value()&&(k(s,n[e].s5,"S5"),k(s,n[e].r5,"R5"));const d=l.indexToCoordinate(t),_=l.indexToCoordinate(i);for(const t of Object.keys(s)){const i=parseFloat(t),r=c.priceToCoordinate(i,h);this._pivots.push({x1:d,x2:_,y:r,label:s[t].text,labelIds:s[t].ids,src:n[e]})}}const _=r.levelsStyle.childs().colors,m=r.levelsStyle.childs().widths,g=this._source.visiblePivots();for(let e=0;ethis.processHibernate()))}pricesView(){return this._pricesView}indexes(){return this._indexes}properties(){return this._properties}getCache(e){if(null===this._cache||null==this._cachedPixelRatioParams||(t=e,i=this._cachedPixelRatioParams,t.horizontalPixelRatio!==i.horizontalPixelRatio||t.verticalPixelRatio!==i.verticalPixelRatio)){this._cache&&this._cache.destroy();const t=this._getActualCacheParams(),i={horizontalPixelRatio:e.horizontalPixelRatio,verticalPixelRatio:e.verticalPixelRatio};this._cache=new h(i,t.font,t.fontSize,t.backColors),this._cache.setPrices((0,o.ensureNotNull)(this._pricesView).prices()),this._cachedPixelRatioParams=i,this._cache.reset(t)}var t,i;return this._cache}priceLabelText(e){return this._metaInfo.shortDescription+":"+e.toUpperCase()}updateAllViews(e){super.updateAllViews(e),this._pricesView.update()}visiblePivots(){return this._pricesView.visiblePivots()}isVisible(){if(!this.properties().childs().visible.value()||!this.isActualInterval())return!1;const e=["P","S1/R1","S2/R2","S3/R3","S4/R4","S5/R5"],t=this.properties().childs().levelsStyle.childs().visibility;for(let i=0;it)continue;const a=[],l=this.properties().childs().levelsStyle.childs().visibility.childs();l.P.value()&&a.push(r[i].p),l["S1/R1"].value()&&a.push(r[i].s1,r[i].r1),l["S2/R2"].value()&&a.push(r[i].s2,r[i].r2),l["S3/R3"].value()&&a.push(r[i].s3,r[i].r3),l["S4/R4"].value()&&a.push(r[i].s4,r[i].r4),l["S5/R5"].value()&&a.push(r[i].s5,r[i].r5);for(let e=0;ethis.invalidateTitleCache()))}base(){return 1}destroy(){(0,o.ensureDefined)(this.properties().childs().styles.childs().vol_ma).childs().display.listeners().unsubscribeAll(this),super.destroy()}showOnTopOnHovering(){return!1}_titleInputs(e){const t={symbolsForDisplay:!0,skipHiddenInputs:!0,fakeInputsForDisplay:!0,asObject:!0,displayMask:e,skipOptionalEmptySymbolInputs:W};return 0!==(0,o.ensureDefined)(this.properties().childs().styles.childs().vol_ma).childs().display.value()?this.inputs(t):this.inputs({...t,skippedInputs:["length"]})}_titleInParts(e,t,i,s,r){const n=super._titleInParts(e,t,i,s,r),o=this._getVolumeUnit();return o&&(n[0]+=` · ${o}`),n}_getVolumeUnit(){const e=this.symbolSource().symbolInfo();return e?function(e){switch(e.volume_type){case"base":return e.base_currency;case"quote":return e.currency;case"tick":return F.t(null,void 0,i(30973))}}({...e,currency:e.original_currency_code||e.currency_code}):void 0}}var z=i(97145),U=i(88640),j=i(42960),G=i(97121),q=i(24954);class $ extends n.Study{constructor(e,t,i,s){super(e,function(e){return e.hasChild("currencyId")||e.addChild("currencyId",new U.default(null)),e.hasChild("unitId")||e.addChild("unitId",new U.default(null)),e.addExclusion("currencyId"),e.addExclusion("unitId"),e}(t),i,s),this._isActingAsSymbolSource=new z.WatchedValue(!1),this._symbolHibernated=new z.WatchedValue(!1),this._symbolResolvingActive=new z.WatchedValue(!1),this._realignToolsLastParams=null,this._lastResolvedSymbolSource="",this._onIsActingAsSymbolSourceChanged=()=>{this._recreatePriceFormattingDependencies(),this._realignLineToolsIfParamsChanged()},this._recalculateIsActingAsSymbolSource(),this._isActingAsSymbolSource.subscribe(this._onIsActingAsSymbolSourceChanged);const r=this.properties().childs().inputs.childs().symbol;this._previousSymbolInputValue=r.value()}isActingAsSymbolSource(){return this._isActingAsSymbolSource.readonly()}properties(){return this._properties}symbol(){ -return this._isActingAsSymbolSource.value()?this.properties().childs().inputs.childs().symbol.value():this.symbolSource().symbol()}symbolChanged(){return this._isActingAsSymbolSource.value()?this.properties().childs().inputs.childs().symbol.listeners():this.symbolSource().symbolChanged()}interval(){return this.model().mainSeries().interval()}style(){return this._firstSourceOrSeries().symbolSource().style()}currency(){return this._isActingAsSymbolSource.value()?this.properties().childs().currencyId.value()||null:this.symbolSource().currency()}unit(){return this._isActingAsSymbolSource.value()?this.properties().childs().unitId.value()||null:this.symbolSource().unit()}symbolParams(){return(0,G.symbolParams)(this)}compareSymbolParams(e){return(0,G.compareSymbolParams)(this,e,this._model.unitConversionEnabled())}setSymbolParams(e){this._setSymbolParamsInternal(e)}setSymbol(e){this.setSymbolParams({symbol:e})}symbolInfo(){var e;if(!this._isActingAsSymbolSource.value())return super.symbolSource().symbolInfo();const t=this._getSymbolForResolve(this.symbol());return null!==(e=this._resolvedSymbols[t])&&void 0!==e?e:null}symbolSource(){return this._isActingAsSymbolSource.value()?this:super.symbolSource()}symbolResolved(){return this.symbolsResolved()}symbolResolvingActive(){return this._symbolResolvingActive}symbolHibernated(){return this._symbolHibernated}isVisible(){const e=super.isVisible();return this._symbolHibernated.setValue(!e),e}symbolSameAsCurrent(e){return(0,G.symbolSameAsCurrent)(e,this.symbolInfo())}symbolSameAsResolved(e){return(0,q.symbolSameAsResolved)(e,this._lastResolvedSymbolSource,this.symbol())}setCurrency(e){this.setSymbolParams({currency:e})}isConvertedToOtherCurrency(){return(0,j.isConvertedToOtherCurrency)(this.symbolInfo())}setUnit(e){this.setSymbolParams({unit:e})}isConvertedToOtherUnit(){return(0,j.isConvertedToOtherUnit)(this.symbolInfo(),this._model.unitConversionEnabled())}setInterval(e){}setStyle(e){}symbolTitle(e,t,i){return this.title(e,!0,{},!1,t)}measureUnitId(){return(0,j.measureUnitId)(this.symbolInfo())}bars(){return super.data()}dataUpdated(){return this._dataUpdated}_onPropertiesChanged(){this._recalculateIsActingAsSymbolSource(),super._onPropertiesChanged(),this._realignLineToolsIfParamsChanged()}async _tryChangeInputs(){var e;const t=this._resolvedSymbolsByInput[this.symbol()]||null;(0,G.symbolSameAsCurrent)(this._previousSymbolInputValue,t)||this._setSymbolParamsInternal({currency:null,unit:null}),await super._tryChangeInputs(),this._formatter=null,null===(e=this.priceScale())||void 0===e||e.updateFormatter(),this._previousSymbolInputValue=this.properties().childs().inputs.childs().symbol.value()}_getSymbolObject(e){const t={symbol:e},i=this.currency();null!==i&&(t["currency-id"]=i);const s=this.unit();return this._model.unitConversionEnabled()&&null!==s&&(t["unit-id"]=s),t}_onSymbolResolved(e,t,i){super._onSymbolResolved(e,t,i),this._recreatePriceFormattingDependencies();const s=t===this.symbol()?(0,j.extractSymbolNameFromSymbolInfo)(i,this.symbol()):null -;null!==s&&(this._previousSymbolInputValue=s);const r=(0,j.symbolCurrency)(i),n=(0,j.symbolUnit)(i,this._model.unitConversionEnabled());this._setSymbolParamsInternal({symbol:null!=s?s:void 0,currency:r,unit:n},i),this._symbolResolvingActive.setValue(!1)}_onSymbolResolvingStart(e,t){this._lastResolvedSymbolSource=t,super._onSymbolResolvingStart(e,t),this._symbolResolvingActive.setValue(!0)}_onSymbolError(){super._onSymbolError(),this._symbolResolvingActive.setValue(!1)}_onCurrencyMayChange(){this.isActingAsSymbolSource()?super._onCurrencyMayChange():this._onCurrencyChanged()}_recalculateIsActingAsSymbolSource(){var e,t;const i=null!==(t=""!==(null===(e=this._currencySourceSymbolInputProperty)||void 0===e?void 0:e.value()))&&void 0!==t&&t;this._isActingAsSymbolSource.setValue(i)}_setSymbolParamsInternal(e,t){const{symbol:i,currency:s,unit:r}=e,n=this.properties().childs(),o=n.inputs.childs().symbol.value(),a=n.currencyId.value(),l=n.unitId.value();if(void 0!==i&&n.inputs.childs().symbol.setValueSilently(i),void 0!==s&&n.currencyId.setValueSilently(s),void 0!==r&&n.unitId.setValueSilently(r),t)this._resolvedSymbolsByInput[this.symbol()]=t,this._resolvedSymbols[this._getSymbolForResolve(this.symbol())]=t,this._realignToolsLastParams=null;else{const e=this.symbolInfo();null!==e&&(n.currencyId.setValueSilently((0,j.symbolCurrency)(e)),n.unitId.setValueSilently((0,j.symbolUnit)(e,this._model.unitConversionEnabled())))}n.inputs.childs().symbol.value()!==o&&n.inputs.childs().symbol.listeners().fire(n.inputs.childs().symbol,""),n.currencyId.value()!==a&&n.currencyId.listeners().fire(n.currencyId,""),n.unitId.value()!==l&&n.unitId.listeners().fire(n.unitId,""),this._realignLineToolsIfParamsChanged()}_realignLineToolsIfParamsChanged(){let e=null===this._realignToolsLastParams;if(null!==this._realignToolsLastParams){const t=this.compareSymbolParams(this._realignToolsLastParams);e=t.symbolChanged||t.intervalChanged||t.currencyChanged||t.unitChanged}e&&(this._model.realignLineTools(this),this._realignToolsLastParams=this.symbolParams())}}class Y extends u.PriceAxisView{constructor(e,t){super(),this._source=e,this._styleId=t}_updateRendererData(e,t,i){var s;e.visible=!1;const r=this._source.priceScale(),n=this._source.properties().childs();if(!r||r.isEmpty()||!n.visible.value())return;const o=null===(s=this._source.properties().childs().graphics.childs().horizlines)||void 0===s?void 0:s.childs()[this._styleId].childs();if(!(o&&o.visible&&o.visible.value()&&this._isLabelVisibleAccordinglyToProperties()))return;const a=this._source.model().timeScale().logicalRange(),l=this._source.firstValue();if(null===l||null===a)return;const c={price:NaN,time:-1/0},h=this._source.graphics().horizlines().get(this._styleId);if(void 0===h)return;for(const e of h){if(void 0===e.level)continue;const t=a.contains(e.startIndex,!0);t===a.contains(e.endIndex,!0)&&0!==t||c.timenew Y(this,e)))}_createStudyPlotPaneView(e){return new K.StudyPlotPaneView(this,this._series,this._model,e,this._needExtendToBarsEnding())}_apiInputs(){return{...super._apiInputs(),mapRightBoundaryToBarStartTime:!!this._needExtendToBarsEnding()||void 0}}_needExtendToBarsEnding(){var e;return void 0!==(null===(e=this.metaInfo().defaults.inputs)||void 0===e?void 0:e.mapRightBoundaryToBarStartTime)}}class X extends Z{priceRange(e,t){let i=!1;this.graphics().hhists().forEach(((e,t)=>{var s;i=i||(0,o.ensureDefined)(null===(s=this.properties().childs().graphics.childs().hhists)||void 0===s?void 0:s.childs()[t]).value()}));const s=function(e,t,i,s){let r=null;return e.forEach(((e,s)=>{e.forEach((e=>{e.firstBarTime<=i&&e.lastBarTime>=t&&(null===r?r={low:{l:e.priceLow,h:e.priceHigh},high:{h:e.priceHigh}}:(e.priceLow{"use strict";i.d(t,{StudyBaseWindowView:()=>n});var s=i(93835),r=i(37591);class n extends s.DataWindowView{constructor(e,t){super(),this._invalidated=!0,this._study=e,this._model=t,this._valueProvider=this._createValuesProvider(e,t),this._items=this._valueProvider.getItems().map((e=>new s.DataWindowItem(e.id,e.title,""))),this.update()}update(){this._invalidated=!0}items(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),this._items}study(){return this._study}_updateImpl(){this._header=this._study.title(r.TitleDisplayTarget.DataWindow,!0),this._title=this._study.title(r.TitleDisplayTarget.DataWindow);const e=this._valueProvider.getValues(this._currentIndex());for(let t=0;t{"use strict";i.d(t,{StudyColorRotatorFactory:()=>h});var s=i(33013),r=i(24377),n=i(87095),o=i(28853);const a=["color-sky-blue-400","color-banana-yellow-700","color-deep-blue-500","color-grapes-purple-a700","color-iguana-green-500","color-minty-green-a600","color-ripe-red-a200","color-berry-pink-200","color-tv-blue-a100","color-tan-orange-a200","color-sky-blue-a400","color-deep-blue-a100","color-grapes-purple-400","color-iguana-green-a700","color-minty-green-200","color-ripe-red-200","color-berry-pink-a200","color-ripe-red-500","color-grapes-purple-500","color-deep-blue-400","color-tv-blue-a200","color-sky-blue-500","color-iguana-green-400","color-minty-green-400","color-banana-yellow-600","color-tan-orange-500","color-berry-pink-400","color-ripe-red-300","color-grapes-purple-300","color-deep-blue-300","color-tv-blue-300","color-sky-blue-300","color-iguana-green-300","color-minty-green-300","color-banana-yellow-400","color-tan-orange-300","color-berry-pink-300","color-tan-orange-a700"];class l{constructor(e){this._offset=0,this._offset=e}getColor(e){if(0===this._offset)return e;const t=a[(this._offset-1)%a.length],i=s.colorsPalette[t],o=(0,n.isHexColor)(e)?1:(0,r.parseRgba)(e)[3];return(0,n.generateColor)(i,(0,n.alphaToTransparency)(o))}}class c{constructor(e,t){this._offset=e,this._modelStartOffset=t}getColor(e){if((0,n.isHexColor)(e)){const t=(0,r.parseRgb)(e);return(0,r.rgbToHexString)((0,r.shiftRgb)(t,this._offset,this._modelStartOffset))}{const t=(0,r.parseRgba)(e);return(0, -r.rgbaToString)((0,r.shiftRgba)(t,this._offset,this._modelStartOffset))}}}class h{constructor(e){this._chartModel=e}getColorRotator(e){const t=(0,o.studyColorRotationMode)(e);if(null===t)return null;const i=this._calcDefaultColorsOffset(e);switch(t){case"loop":return new l(i);case"shift":{const e=this._chartModel.getStudyShiftColorStartOffset();return new c(i,e)}}}_calcDefaultColorsOffset(e){let t=0;const i=(0,o.useSameColorRotationComparator)(e);return this._chartModel.dataSources().filter(o.isStudy).forEach((s=>{i(e,s.metaInfo())&&t++})),t}}},94739:(e,t,i)=>{"use strict";i.d(t,{StudyDataSource:()=>p});var s=i(50151),r=i(57898),n=i(97034),o=i(1115),a=i(19171),l=i(72007),c=i(83435),h=i(75319);const d=(0,i(59224).getLogger)("Chart.StudyDataSource");var u;!function(e){e[e.Idle=0]="Idle",e[e.AwaitingConnection=1]="AwaitingConnection",e[e.AwaitingParent=2]="AwaitingParent",e[e.AwaitingFirstDataUpdate=3]="AwaitingFirstDataUpdate",e[e.Active=4]="Active"}(u||(u={}));class p{constructor(e,t,i,s){this._inputs=null,this._status=u.Idle,this._studyId=null,this._turnaroundCounter=1,this._studyStatus={type:h.StudyStatusType.Undefined},this._studyStatusChanged=new r.Delegate,this._dataCleared=new r.Delegate,this._dataUpdated=new r.Delegate,this._boundOnGatewayIsConnectedChanged=this._onGatewayIsConnectedChanged.bind(this),this._ongoingDataUpdate=Promise.resolve(),this._gateway=e,this._metaInfo=s,this._seriesSource=t,this._turnaroundPrefix=i,this._plots=new n.PlotList((0,l.studyPlotFunctionMap)(s),l.studyEmptyPlotValuePredicate),this._gateway.isConnected().subscribe(this._boundOnGatewayIsConnectedChanged),this._graphics=new c.LiveStudyGraphics(s.graphics)}destroy(){this.stop(),this._gateway.isConnected().unsubscribe(this._boundOnGatewayIsConnectedChanged),this._seriesSource.dataEvents().created().unsubscribeAll(this)}metaInfo(){return this._metaInfo}inputs(){return this._inputs}setInputs(e){this._inputs=e,null!==this._studyId&&(this._turnaroundCounter++,this._onStudyStatusChangedTo({type:h.StudyStatusType.Undefined}),this._gateway.modifyStudy(this._studyId,this._turnaround(),e,this._onMessage.bind(this)),this._status===u.Active&&this._changeStatusTo(u.AwaitingFirstDataUpdate))}isStarted(){return this._status!==u.Idle}isActive(){return this._status===u.Active}start(){this.isStarted()?d.logNormal("start: data source is already started, nothing to do"):((0,s.assert)(null!==this._inputs,"Inputs should be defined when starting a study data source"),this._gateway.isConnected().value()?this._createStudy():this._changeStatusTo(u.AwaitingConnection))}stop(){this.isStarted()?(null!==this._studyId&&(this._gateway.removeStudy(this._studyId),this._studyId=null,this._onStudyStatusChangedTo({type:h.StudyStatusType.Undefined})),this._changeStatusTo(u.Idle)):d.logNormal("stop: data source is already stopped, nothing to do")}studyId(){return this._studyId}studyStatus(){return this._studyStatus}studyStatusChanged(){return this._studyStatusChanged}plots(){return this._plots}graphics(){return this._graphics}clearData(){this._plots.clear(), -this._graphics.clear(),this._dataCleared.fire()}stopAndStealData(){(0,s.assert)(this._status===u.Active,"Couldn't steal data from non-active data source"),this.stop();const e=this._plots,t=this._graphics.extract();return this._plots=new n.PlotList((0,l.studyPlotFunctionMap)(this._metaInfo),l.studyEmptyPlotValuePredicate),{plots:e,graphics:t}}dataCleared(){return this._dataCleared}dataUpdated(){return this._dataUpdated}moveData(e){this._ongoingDataUpdate=this._ongoingDataUpdate.then((()=>{this._plots.move(e)}))}pendingUpdatesReady(){return this._ongoingDataUpdate}_createStudyError(e){return{type:h.StudyStatusType.Error,errorDescription:this._getStudyErrorDescription(e)}}_getStudyErrorDescription(e){return"string"==typeof e?{error:e.split(":",2)[0]}:e}_changeStatusTo(e){(0,s.assert)(this._status!==e,"Source and destination status should be distinct"),d.logNormal(`Status changed from ${u[this._status]} to ${u[e]}`),this._status=e}_createStudy(){const e=this._seriesSource.instanceId();null!==e?this._createStudyUsingParentId(e):(this._changeStatusTo(u.AwaitingParent),this._seriesSource.dataEvents().created().subscribe(this,this._onSeriesCreated,!0))}_createStudyUsingParentId(e){(0,s.assert)(this._status!==u.Active,'Status should not be "Active" when creating a study'),(0,s.assert)(this._studyStatus.type===h.StudyStatusType.Undefined,'Study status should be "Undefined" when creating a study'),(0,s.assert)(null===this._studyId,"Study id should be empty when creating a study"),this._studyId=(0,a.makeNextStudyId)(),this._gateway.createStudy(this._studyId,this._turnaround(),e,this._metaInfo.fullId+("tv-basicstudies"===this._metaInfo.packageId?"":"!"),(0,s.ensureNotNull)(this._inputs),this._onMessage.bind(this)),this._changeStatusTo(u.AwaitingFirstDataUpdate)}_onGatewayIsConnectedChanged(e){e?this._onGatewayConnected():this._onGatewayDisconnected()}_onGatewayConnected(){this._status===u.AwaitingConnection&&this._createStudy()}_onGatewayDisconnected(){this._status!==u.Idle&&this._status!==u.AwaitingConnection&&(this._studyId=null,this._changeStatusTo(u.AwaitingConnection),this._studyStatus.type!==h.StudyStatusType.Undefined&&this._onStudyStatusChangedTo({type:h.StudyStatusType.Undefined})),this._turnaroundCounter=1}_onSeriesCreated(){this._status===u.AwaitingParent&&this._createStudyUsingParentId((0,s.ensure)(this._seriesSource.instanceId()))}_onStudyStatusChangedTo(e){const t=this._studyStatus;this._studyStatus=e,d.logNormal(`Study status type changed from ${h.StudyStatusType[t.type]} to ${h.StudyStatusType[e.type]}`),this._studyStatusChanged.fire(t,e)}_onMessage(e){if("data_update"===e.method){const{customId:t,turnaround:i,plots:r,nonseries:n}=e.params;t===this._studyId&&this._checkTurnaround(i)&&this._onDataUpdate(r,(0,s.ensureDefined)(n))}else if("study_loading"===e.method){const[t,i,s]=e.params;t===this._studyId&&this._checkTurnaround(i)&&this._onStudyLoading(s)}else if("study_completed"===e.method){const[t,i,s]=e.params;t===this._studyId&&this._checkTurnaround(i)&&this._onStudyCompleted(s) -}else if("study_error"===e.method){const[t,i,s,r,n]=e.params;t===this._studyId&&this._checkTurnaround(i)&&this._onStudyError(s,r,n)}else"clear_data"===e.method&&this._checkTurnaround(e.params.turnaround)&&this.clearData()}_onDataUpdate(e,t){const i=(0,o.unpackNonSeriesData)(t.d);return this._ongoingDataUpdate=this._ongoingDataUpdate.then((()=>i),(()=>i)).then(this._onDataUnpacked.bind(this,e,t.indexes)),this._ongoingDataUpdate}_onDataUnpacked(e,t,i){this._status!==u.Idle&&(this._status===u.AwaitingFirstDataUpdate&&(this._changeStatusTo(u.Active),this.clearData()),this._mergePlots(e),null!==i&&(i.indexes_replace?((0,s.assert)("nochange"!==t),this._graphics.replaceIndexesTo(t)):("nochange"!==t&&this._graphics.replaceIndexesTo(t),void 0!==i.graphicsCmds&&this._graphics.processCommands(i.graphicsCmds))),this._dataUpdated.fire(e,i,t))}_onStudyLoading(e){this._onStudyStatusChangedTo({type:h.StudyStatusType.Loading,startTime:Date.now()})}_onStudyError(e,t,i){this.clearData(),this._onStudyStatusChangedTo(this._createStudyError(e))}_onStudyCompleted(e){this._onStudyStatusChangedTo({type:h.StudyStatusType.Completed})}_mergePlots(e){this._plots.merge(e)}_turnaround(){return`${this._turnaroundPrefix}${this._turnaroundCounter}`}_checkTurnaround(e){const t=this._turnaround();return e===t||e===this._seriesSource.turnaround()||e===`${this._seriesSource.turnaround()}_${t}`}}},88318:(e,t,i)=>{"use strict";i.d(t,{StudyDataWindowView:()=>a});var s=i(70512),r=i(54303),n=i(40484);class o{constructor(e,t){this._study=e,this._model=t,this._hhistBasedStudy=void 0!==e.metaInfo().graphics.hhists,this._valuesProvider=this._createValuesProvider(e,t)}getItems(){return this._valuesProvider.getItems()}getValues(e){const t=this._valuesProvider.getValues(e),i=e=>!!this._hhistBasedStudy||this._study.isPlotVisibleAt(e,2);for(const e of t)e.visible=e.visible&&i(e.id);return t}_createValuesProvider(e,t){return this._hhistBasedStudy?new n.HHistBasedValuesProvider(e,t):new r.StudyValuesProvider(e,t)}}class a extends s.StudyBaseWindowView{_createValuesProvider(e,t){return new o(e,t)}}},72007:(e,t,i)=>{"use strict";function s(e){const t=new Map;return e.plots.forEach(((e,i)=>{t.set(e.id,(e=>e[i+1]))})),t}function r(e,t){return null==e[t]}i.d(t,{studyEmptyPlotValuePredicate:()=>r,studyPlotFunctionMap:()=>s})},70826:(e,t,i)=>{"use strict";function s(e,t){return`${e}@${t}`}function r(e){return e.replace(/(@[^-]+-[^-]+).*$/,"$1")}i.d(t,{extractStudyId:()=>r,studyIdString:()=>s})},33703:(e,t,i)=>{"use strict";i.d(t,{ChartColorDependentStudyInputNames:()=>n,InputDisplayFlags:()=>s,RangeDependentStudyInputNames:()=>r,areStudyInputsEqual:()=>d,editableStudyInputs:()=>p,getInputValue:()=>c,isExtendedInput:()=>a,isExtendedInputSource:()=>l,isStudyInputDependsOnChartColors:()=>_,isStudyInputOptionsInfo:()=>h,isTimeOrPriceNotHiddenInput:()=>u});var s,r,n,o=i(98279);function a(e){return(0,o.default)(e)}function l(e){return"source"===e.t}function c(e){return a(e)?e.v:e}function h(e){ -return["text","integer","float","price","session","resolution"].includes(e.type)&&e.hasOwnProperty("options")}function d(e,t,i){for(const s of e)if(t[s.id]!==i[s.id])return!1;return!0}function u(e){return("time"===e.type||"price"===e.type)&&!0!==e.isHidden}function p(e){return[]}function _(e){return Object.values(n).map((e=>e)).includes(e.id)}!function(e){e[e.None=0]="None",e[e.DataWindow=2]="DataWindow",e[e.StatusLine=8]="StatusLine",e[e.All=15]="All"}(s||(s={})),function(e){e.FirstBar="first_visible_bar_time",e.LastBar="last_visible_bar_time",e.Realtime="subscribeRealtime"}(r||(r={})),function(e){e.FgColor="__chart_fgcolor",e.BgColor="__chart_bgcolor"}(n||(n={}))},97340:(e,t,i)=>{"use strict";i.d(t,{StudyInserter:()=>h});var s=i(42856),r=i(1722),n=i(74970),o=i(85804),a=i(59744);const l=(0,i(59224).getLogger)("Chart.Studies.StudyInserter"),c=/^PUB;.*/;class h{constructor(e,t){this._parentSources=[],this._propsState=void 0,this._preferredPriceScale=void 0,this._allowChangeCurrency=!1,this._allowChangeUnit=!1,this._paneSize=void 0,this._forceOverlay=!1,this._inserterImpl=t,this._studyDescriptor=e}setParentSources(e){this._parentSources=e}setPaneSize(e){this._paneSize=e}setPreferredPriceScale(e){this._preferredPriceScale=e}setAllowChangeCurrency(e){this._allowChangeCurrency=e}setAllowChangeUnit(e){this._allowChangeUnit=e}setForceOverlay(e){this._forceOverlay=e}setPropertiesState(e){this._propsState=e}setTargetPriceScaleMode(e){this._targetPriceScaleMode=e}async insert(e,t){var i,h;const d=void 0!==(u=this._inserterImpl).createStub&&void 0!==u.removeStub?this._inserterImpl.createStub():null;var u;let p,_=!0;try{p=await(0,n.studyMetaInfoRepository)().findById(this._studyDescriptor)}catch(e){l.logWarn(`Cannot get study ${JSON.stringify(this._studyDescriptor)}`);const t=this._studyDescriptor.pineId,s=c.test(t),r=!!(null===(i=null==e?void 0:e.errors)||void 0===i?void 0:i.length);return s&&r?Promise.reject(a.InsertionErrorCode.CannotCompilePub):Promise.reject(a.InsertionErrorCode.CannotGetMetainfo)}finally{null!==d&&(_=this._inserterImpl.removeStub(d))}if(!_)return Promise.reject(a.InsertionErrorCode.StubWasRemoved);if(void 0!==t&&t.cancelled)return Promise.reject(a.InsertionErrorCode.Cancelled);if(!this._canApplyStudyToParent(p))return Promise.reject(a.InsertionErrorCode.StudyCannotBeChild);const m={...p.defaults.inputs};let g={};if(void 0!==e){const t=s.StudyMetaInfo.getStudyPropertyRootName(p),i=(0,r.clone)((0,o.defaults)(t));(0,r.merge)(m,i.inputs);const n=await e(m,p.inputs,p);g=n.inputs,this._parentSources=null!==(h=n.parentSources)&&void 0!==h?h:[]}if(void 0!==t&&t.cancelled)return Promise.reject(a.InsertionErrorCode.Cancelled);const f=this._insertStudy(p,g);return null===f?Promise.reject(a.InsertionErrorCode.Unknown):(await f.startPromise,f.study)}_insertStudy(e,t){return this._inserterImpl.createStudy(e,t,null,this._propsState,this._forceOverlay,this._parentSources,this._preferredPriceScale,this._allowChangeCurrency,this._allowChangeUnit,this._paneSize,this._targetPriceScaleMode)}_canApplyStudyToParent(e){ -return 0===this._parentSources.length||s.StudyMetaInfo.canBeChild(e)}}},74970:(e,t,i)=>{"use strict";i.d(t,{studyMetaInfoRepository:()=>_});var s=i(95171),r=i(11542),n=i(50151),o=i(42856),a=i(97087),l=i(18923),c=i(59224),h=i(51608);(0,c.getLogger)("Chart.Studies.StudyMetaInfoRepository",{color:"#606"});class d{constructor(e){this._isReady=!1,this._rawStudiesMetaInfo=[],this._rawStudiesMetaInfoDeferredPromise=null,this._javaStudiesMetaInfo=[],this._pineMetaInfoCache=[],this._studiesMigrations=[],this._chartApi=e}async requestMetaInfo(){if(null===this._rawStudiesMetaInfoDeferredPromise){this._rawStudiesMetaInfoDeferredPromise=(0,h.createDeferredPromise)(),this._rawStudiesMetaInfoDeferredPromise.promise.finally((()=>{this._rawStudiesMetaInfoDeferredPromise=null})),this._requestStarted();const e=(await this._chartApi.requestMetadata()).params[1].metainfo.slice();this._processLibraryMetaInfo(e),this._requestFinished(),this._rawStudiesMetaInfoDeferredPromise.resolve(this._rawStudiesMetaInfo)}return this._rawStudiesMetaInfoDeferredPromise.promise}async findById(e){this._isReady||await this.requestMetaInfo();const t=this._findStudyMetaInfo(e);return null!==t?Promise.resolve(t):"pine"===e.type?this._compilePine(e):Promise.reject(`unexpected study id=${e.studyId} with type=${e.type}`)}findByIdSync(e){return this._findStudyMetaInfo(e)}isReady(){return this._isReady}async findAllJavaStudies(){return this._isReady||await this.requestMetaInfo(),this._javaStudiesMetaInfo}getInternalMetaInfoArray(){return this._javaStudiesMetaInfo}getMigrations(){return this._studiesMigrations}addPineMetaInfo(e){return p(this._pineMetaInfoCache,e)}async getLatestMetaInfoForPineStudy(e,t){return null}_processMigrations(e){throw new Error("not implemented")}_processSiteMetaInfo(e,t){throw new Error("not implemented")}_processLibraryMetaInfo(e){for(const t of e)u(t),p(this._javaStudiesMetaInfo,t);this._javaStudiesMetaInfo=this._javaStudiesMetaInfo.sort(((e,t)=>{const i=e.description_localized||e.description,s=t.description_localized||t.description;return i>s?1:it.id===e.studyId))||null:this._pineMetaInfoCache.find((t=>t.scriptIdPart===e.pineId&&(void 0===e.pineVersion||(0,n.ensureDefined)(t.pine).version===e.pineVersion)))||null}_compilePine(e){throw new Error("unsupported")}}function u(e){e.description_localized=r.t(e.description,{context:"study"},i(68716))}function p(e,t){const i=new o.StudyMetaInfo(t);(0,a.migrateMetaInfoAndPropState)(i);let s=!0;const r=e.findIndex((e=>e.id===i.id));if(-1===r)e.push(i);else{const t=e[r],n=void 0!==t.pine?l.Version.parse(t.pine.version):null,o=void 0!==i.pine?l.Version.parse(i.pine.version):null;null===o||null===n||o.isGreaterOrEqual(n)?(t.removeDefaults(),e[r]=i):s=!1} -return s&&i.createDefaults(),i}const _=(0,s.default)((()=>new d(window.ChartApiInstance)))},99672:(e,t,i)=>{"use strict";i.d(t,{StudyStatusProviderBase:()=>l});var s=i(11877),r=i(13333),n=i(37591);const o={NONE:"Default"},a=!1;class l extends s.StatusProviderBase{constructor(e,t){super(t),this._source=e}getSplitTitle(){return this._source.titleInParts(n.TitleDisplayTarget.StatusLine,!0,o,void 0,a)}text(){return this._source.isActualInterval()?this._source.isFailed()?`${this._source.title(n.TitleDisplayTarget.StatusLine,!0,o,void 0,a)}: ${this.sourceStatusText()}`:`${this._source.title(n.TitleDisplayTarget.StatusLine,!0,o,void 0,a)} ${this.sourceStatusText()}`:this._source.title(n.TitleDisplayTarget.StatusLine,!0,o,void 0,a)}sourceStatusText(){return(0,r.convertStudyStatusToString)(this._source.status(),!0)}errorStatus(){if(!this._source.isActualInterval()||this._source.isSymbolInvalid())return null;const e=this._source.status();return e.type===r.StudyStatusType.Error?{error:this.sourceStatusText(),solutionId:(0,r.studyStatusSolutionId)(e),title:(0,r.studyStatusTitle)(e),studyFeature:(0,r.studyStatusFeature)(e)}:null}}},6892:(e,t,i)=>{"use strict";i.d(t,{StudyStatusProvider:()=>n});var s=i(11542),r=(i(13333),i(99672));s.t(null,void 0,i(47542));class n extends r.StudyStatusProviderBase{constructor(e,t){super(e,t),this._study=e}color(){return this._study.isFailed()||this._study.metaInfo&&this._study.metaInfo().isTVScriptStub?"#ff0000":super.color()}sourceStatusText(){this._study.status();return super.sourceStatusText()}}},90830:(e,t,i)=>{"use strict";i.d(t,{StudyStatusView:()=>r});var s=i(79055);class r extends s.StatusView{constructor(e){super(e.statusProvider())}color(){return this._statusProvider.color()}getSplitTitle(){return this._statusProvider.getSplitTitle()}update(){this._text=this._statusProvider.text()}}},13333:(e,t,i)=>{"use strict";i.d(t,{StudyStatusType:()=>c,convertStudyStatusToString:()=>h,studyStatusFeature:()=>p,studyStatusSolutionId:()=>d,studyStatusTitle:()=>u});var s=i(11542);const r=new Map([["You cannot see this pivot timeframe on this resolution",s.t(null,void 0,i(17126))],["The data vendor doesn't provide volume data for this symbol.",s.t(null,void 0,i(29198))],['Histogram is too large, please increase "Row Size" input.',s.t(null,void 0,i(69085))],["Histogram is too large, please reduce 'Row Size' input.",s.t(null,void 0,i(8122))],["This script is invite-only. To request access, please contact its author.",s.t(null,void 0,i(74986))],["Volume Profile indicator available only on our upgraded plans.",s.t(null,void 0,i(61022))],["VOLUME_BIST_MIXED",s.t(null,void 0,i(82772))]]),n=s.t(null,void 0,i(16971));const o=new Map,a=new Map,l=s.t(null,void 0,i(30295));var c;function h(e,t){if(e.type===c.Loading)return t?l:"loading...";if(e.type===c.Error){const s=e.errorDescription,n=t?(i=s.error,r.get(i)||i):s.error;if(s.ctx){const e={};return Object.entries(s.ctx).forEach((([t,i])=>{e[t]=i.toString()})),n.format(e)}return n}var i;return""}function d(e){ -if(e.type===c.Error)return e.errorDescription.solution_id?e.errorDescription.solution_id:function(e){for(const t of Array.from(o.keys()))if(e.includes(t))return o.get(t)}(e.errorDescription.error)}function u(e){if(e.type===c.Error)return function(e){const t=e.toLowerCase();return t.includes("the data vendor doesn't provide volume data for this symbol.")||t.includes("no volume is provided by the data vendor")}(e.errorDescription.error)?n:e.errorDescription.title}function p(e){const{errorDescription:{error:t}}=e;for(const[e,i]of a)if(t.startsWith(e))return i}!function(e){e[e.Undefined=0]="Undefined",e[e.Loading=1]="Loading",e[e.Completed=2]="Completed",e[e.Error=3]="Error"}(c||(c={}))},52329:(e,t,i)=>{"use strict";i.d(t,{StudyStub:()=>g});var s=i(91280),r=i(90830),n=i(80842),o=i(71766),a=i(57898),l=i(88640),c=i(99672),h=i(37591);class d extends c.StudyStatusProviderBase{text(){return this._source.isActualInterval()?`${this._source.title(h.TitleDisplayTarget.StatusLine)} ${this.sourceStatusText()}`:this._source.title(h.TitleDisplayTarget.StatusLine)}}var u=i(13333),p=i(53588);class _{getItems(){return[]}getValues(e){return[]}}const m=new a.Delegate;class g extends n.PriceDataSource{constructor(e,t,i,s){super(e),this._priceStep=.01,this._status={type:u.StudyStatusType.Undefined},this._statusChanged=new a.Delegate,this._formatter=new o.PriceFormatter(100),this._origState=t,this._title=i,this._alwaysShowInLegend=s;this._properties=new l.default({visible:!0}),this._statusView=new r.StudyStatusView(this)}barColorer(){return null}properties(){return this._properties}statusView(){return this._statusView}legendView(){return null}state(e){return this._origState}setStatus(e){const t=this.isDisplayedInLegend();if(this._status=e,this._statusChanged.fire(),this.isDisplayedInLegend()!==t){const e=this._model.paneForSource(this);if(e){const t=this._model.panes().indexOf(e),i=s.InvalidationMask.invalidateLegendWidgetLayout(t);this.model().invalidate(i)}}}formatter(){return this._formatter}name(){return this._title}title(){return this._title}titleInParts(){return[this._title]}isFailed(){return this._status.type===u.StudyStatusType.Error}isLoading(){return this._status.type===u.StudyStatusType.Loading}isDisplayedInLegend(){return this._alwaysShowInLegend||this.isFailed()}setFailed(e){this.setStatus({type:u.StudyStatusType.Error,errorDescription:{error:e}}),this._model.updateSource(this)}isSymbolInvalid(){return!1}isActualInterval(){return!0}onIsActualIntervalChange(){return m}start(){}status(){return this._status}onStatusChanged(){return this._statusChanged}firstValue(){return null}currency(){return null}sessionId(){return this._model.mainSeries().sessionId()}sessionIdChanged(){return this._model.mainSeries().sessionIdChanged()}unit(){return null}symbolSource(){return this._model.mainSeries()}barsProvider(){return this._model.mainSeries()}valuesProvider(){return new _}statusProvider(e){return new d(this,this._model.properties().childs().scalesProperties.childs().textColor)}isRemovedByStudyTemplates(){return null!==this._origState&&(0, -p.isStudyState)(this._origState)}}},54303:(e,t,i)=>{"use strict";i.d(t,{StudyValuesProvider:()=>S});var s=i(50335),r=i(49483),n=i(87095),o=i(14483),a=i(86094),l=i(15367),c=i(88348),h=i(72877),d=i(41726),u=i(92052),p=i(50151),_=i(88546),m=i(37591);const g=r.CheckMobile.any(),f=o.enabled("hide_last_na_study_output"),v=o.enabled("always_show_legend_values_on_mobile");class S{constructor(e,t){this._emptyValues=[],this._colorProviders=new Map,this._study=e,this._model=t,this._studyMetaInfo=this._study.metaInfo(),this._studyProperties=this._study.properties().childs(),this._isFundamental=!1;const i=this._studyMetaInfo.plots;i&&i.forEach(((e,t)=>{if((0,h.isPlotWithTechnicalValues)(e))return;const i=e.id;this._emptyValues.push(function(e,t="",i=""){return{id:t,index:e,title:i,value:"",visible:!1}}(t,i,this._study.guiPlotName(m.TitleDisplayTarget.StatusLine,i)));const s=(0,h.isOhlcPlot)(e)?e.target:i;this._colorProviders.set(s,(0,d.createStudyPlotColorProvider)(this._studyMetaInfo,this._study.properties(),s))}))}getItems(){return this._emptyValues}getPlotColor(e,t){var i;const r=t[e+1];if(!(0,s.isNumber)(r))return"";const n=r>0;let o;const a=this._studyMetaInfo.plots[e];let l=a.id;const c=this._studyProperties;if((0,h.isOhlcPlot)(a))l=a.target||l,o=(0,p.ensureDefined)(c.ohlcPlots.childs()[l].childs().color).value();else if((0,h.isArrowsPlot)(a)){const e=(0,p.ensureDefined)(c.styles.childs()[l]);o=n?e.childs().colorup.value():e.childs().colordown.value()}else o=(0,p.ensureDefined)(null===(i=c.styles.childs()[l])||void 0===i?void 0:i.child("color")).value();let d=o;const u=this._colorProviders.get(l),_=u&&u.getPlotPointStyle(t);return _&&((0,h.isArrowsPlot)(a)?(n&&void 0!==_.colors[5]&&(d=_.colors[5]),n||void 0===_.colors[6]||(d=_.colors[6])):void 0!==_.colors[0]&&(d=_.colors[0])),"transparent"===d&&(d=o),d}getValues(e){var t,i;const r=this._emptyValues.map((e=>({...e})));let o=null;const l=this._study.data().lastIndex(),c=this._studyProperties;if(null!==l)for(const e of r){if(0===(null===(t=c.styles.childs()[e.id])||void 0===t?void 0:t.childs().display.value()))continue;const i=this._study.nearestIndex(l,a.PlotRowSearchMode.NearestLeft,e.index+1);if(void 0===i)continue;const s=i+this._study.offset(e.id);o=null!==o?Math.max(s,o):s}(null===e||null!==o&&e>o)&&(e=o);const d=this._hideValues(),m=this._study.isVisible()&&!d?_.notAvailable:"";for(const e of r)e.value=m;if(d)return r;f&&r.length&&(r[r.length-1].value="");const g=this._study.priceScale();if(!this._study.isVisible()||null===e||null===g||g.isEmpty()||this._model.timeScale().isEmpty())return r;const v={};for(const t of r){const r=t.id,o=(0,u.getPriceValueFormatterForStudy)(this._study,r),d=(0,p.ensureDefined)(c.styles.childs()[r]),_=d.childs().display.value();if(t.visible=0!==_,!t.visible)continue -;const m=d.hasChild("plottype")?null===(i=d.child("plottype"))||void 0===i?void 0:i.value():null,g=this._isFundamental&&(m===h.LineStudyPlotStyle.StepLine||m===h.LineStudyPlotStyle.StepLineWithDiamonds),f=t.index,S=e-this._study.offset(r),y=g||null!==l&&S>l?a.PlotRowSearchMode.NearestLeft:a.PlotRowSearchMode.Exact,b=this._study.nearestIndex(S,y);if(void 0===b)continue;let w=v[r];if(void 0===w&&(w=this._study.getMinFirstBarIndexForPlot(r),Number.isFinite(w)&&(v[r]=w)),w>b)continue;const C=this._study.data().last(),P=this._study.data().valueAt(b)||(null!==C?C.value:null);if(null===P)continue;const x=P[f+1];(0,s.isNumber)(x)&&(t.value=o(x),t.color=(0,n.resetTransparency)(this.getPlotColor(f,P)))}return r}_hideValues(){return v?(0,l.isLineToolName)(c.tool.value())||null!==this._model.lineBeingEdited():g&&(null===this._model.crossHairSource().pane||(0,l.isLineToolName)(c.tool.value())||null!==this._model.lineBeingEdited())}}},8561:(e,t,i)=>{"use strict";i.d(t,{StudyCompare:()=>F});var s=i(50151),r=i(42226),n=i(56827),o=i(42960),a=i(88640),l=i(27856),c=i(14483),h=i(74304),d=i(42275),u=i(78211),p=i(87095);const _=c.enabled("force_exchange_as_title");class m extends d.PriceAxisView{constructor(e,t){super(),this._studyCompare=e,this._data=t}_updateRendererData(e,t,i){e.visible=!1,t.visible=!1;const r=this._studyCompare.priceScale(),n=this._studyCompare.lastValueData(this._data.plotIndex,!1);if(n.noData||null===r||r.isEmpty())return;const o=this._studyCompare.model(),a=o.timeScale().visibleBarsStrictRange(),l=o.mainSeries().bars().lastIndex();if(null===a||null===l)return;if(l<=a.lastBar())i.background=(0,p.resetTransparency)(n.color),i.textColor=this.generateTextColor(i.background),i.borderColor=void 0,e.borderVisible=!1,t.borderVisible=!1;else{const r=o.backgroundColorAtYPercentFromTop(n.coordinate/(0,s.ensureNotNull)(o.paneForSource(this._studyCompare)).height());i.background=r,i.textColor=(0,p.resetTransparency)(n.color),i.borderColor=i.textColor,e.borderVisible=!0,t.borderVisible=!0}i.coordinate=n.coordinate,i.floatCoordinate=n.floatCoordinate;const c=o.properties().childs().scalesProperties.childs();c.showSeriesLastValue.value()&&(e.text=(0,u.getCurrentModePriceText)(r,n),c.seriesLastValueMode.value()!==h.PriceAxisLastValueMode.LastPriceAndPercentageValue?e.secondLine="":e.secondLine=(0,u.getOppositeModePriceText)(r,n),e.visible=!0),t.text="",c.showSymbolLabels.value()&&(t.text=this._paneText(),t.visible=t.text.length>0)}_paneText(){let e="";const t=this._studyCompare.symbolInfo();return _?e=(0,o.displayedSymbolExchange)(t):this._studyCompare.model().properties().childs().scalesProperties.childs().showSymbolLabels.value()&&(e=(0,o.displayedSymbolName)(t)),e}}i(11542);var g=i(88318),f=i(54303),v=i(88348),S=i(49483),y=i(15367),b=i(1722),w=i(37591);const C=S.CheckMobile.any();class P extends f.StudyValuesProvider{constructor(e,t){super(e,t),this._emptyValues[0].title=e.guiPlotName(w.TitleDisplayTarget.StatusLine,"")}getValues(e){return(0, -b.isNumber)(e)||(this._showLastPriceAndChangeOnly()?e=this._study.data().lastIndex():(e=this._model.crossHairSource().appliedIndex(),(0,b.isNumber)(e)||(e=this._study.data().lastIndex()))),super.getValues(e)}_hideValues(){return!1}_showLastPriceAndChangeOnly(){return C&&(null===this._model.crossHairSource().pane||(0,y.isLineToolName)(v.tool.value())||null!==this._model.lineBeingEdited())}}class x extends g.StudyDataWindowView{constructor(e,t){super(e,t),this._studyCompare=e}_hideValues(){return!1}_createValuesProvider(e,t){return new P(e,t)}}class T extends x{constructor(e,t){super(e,t),this._additional=null,this._showSeriesOHLC=t.properties().childs().paneProperties.childs().legendProperties.childs().showSeriesOHLC,this._showSeriesOHLC.subscribe(this,this.update)}areValuesVisible(){return this._showSeriesOHLC.value()}destroy(){this._showSeriesOHLC.unsubscribeAll(this)}additional(){return this._additional}_updateImpl(){super._updateImpl()}}var I=i(90830),M=i(1763),A=i(6892);class L extends A.StudyStatusProvider{getSplitTitle(){return this._source.titleInParts(w.TitleDisplayTarget.StatusLine,!0,void 0,!1,!1)}text(){return this._source.isActualInterval()?this._source.isFailed()?`${this._source.title(w.TitleDisplayTarget.StatusLine,!0,void 0,!1,!1)}: ${this.sourceStatusText()}`:`${this._source.title(w.TitleDisplayTarget.StatusLine,!0,void 0,!1,!1)} ${this.sourceStatusText()}`:this._source.title(w.TitleDisplayTarget.StatusLine,!0,void 0,!1,!1)}}var k=i(97121),D=i(24954),E=i(97145);const V=c.enabled("study_overlay_compare_legend_option"),B=c.enabled("force_exchange_as_title"),R=!c.enabled("hide_study_compare_legend_item"),N=c.enabled("hide_unresolved_symbols_in_legend"),O=c.enabled("symbol_info_price_source");class F extends n.Study{constructor(e,t,i,s){super(e,function(e){return e.hasChild("currencyId")||e.addChild("currencyId",new a.default(null)),e.hasChild("unitId")||e.addChild("unitId",new a.default(null)),e.addExclusion("currencyId"),e.addExclusion("unitId"),e}(t),i,s),this._isActingAsSymbolSource=new E.WatchedValue(!0),this._realignToolsLastParams=null,this._lastResolvedSymbolSource="",this.properties().childs().minTick.subscribe(null,(()=>this._recreatePriceFormattingDependencies())),this.properties().childs().minTick.subscribe(null,(()=>this._model.fullUpdate())),this.properties().childs().currencyId.subscribe(this,this._onCurrencyChanged),this.properties().childs().unitId.subscribe(this,this._onUnitChanged),this._symbolResolvingActive=new E.WatchedValue(!1),this._symbolHibernated=new E.WatchedValue(!1),e.mainSeries().onIntervalChanged().subscribe(this,(()=>e.realignLineTools(this)))}destroy(){this._model.mainSeries().onIntervalChanged().unsubscribeAll(this),super.destroy()}properties(){return this._properties}isActingAsSymbolSource(){return this._isActingAsSymbolSource.readonly()}symbolParams(){return(0,k.symbolParams)(this)}compareSymbolParams(e){return(0,k.compareSymbolParams)(this,e,this._model.unitConversionEnabled())}setSymbolParams(e){this._setSymbolCurrencyUnitInternal(e)}symbol(){ -return this.properties().childs().inputs.childs().symbol.value()}symbolChanged(){return this.properties().childs().inputs.childs().symbol.listeners()}setSymbol(e){this.setSymbolParams({symbol:e})}symbolInfo(){if(!this._resolvedSymbols)return null;const e=this.symbol();if(!e)return null;let t;return t=this._resolvedSymbols[this._getSymbolForResolve(e)]||null,t}symbolResolved(){return this.symbolsResolved()}symbolResolvingActive(){return this._symbolResolvingActive}symbolHibernated(){return this._symbolHibernated}isVisible(){const e=super.isVisible();return this._symbolHibernated.setValue(!e),e}symbolSameAsCurrent(e){return(0,k.symbolSameAsCurrent)(e,this.symbolInfo())}symbolSameAsResolved(e){return(0,D.symbolSameAsResolved)(e,this._lastResolvedSymbolSource,this.symbol())}currency(){return this.properties().childs().currencyId.value()||null}setCurrency(e){this.setSymbolParams({currency:e})}isConvertedToOtherCurrency(){return(0,o.isConvertedToOtherCurrency)(this.symbolInfo())}unit(){return this.properties().childs().unitId.value()||null}setUnit(e){this.setSymbolParams({unit:e})}isConvertedToOtherUnit(){return(0,o.isConvertedToOtherUnit)(this.symbolInfo(),this._model.unitConversionEnabled())}style(){return 2}setStyle(e){}interval(){return this._model.mainSeries().interval()}setInterval(e){}symbolSource(){return this}valueAt(e,t){var i,s;return null!==(s=null===(i=this.data().search(e))||void 0===i?void 0:i.value[1])&&void 0!==s?s:null}state(e,t){var i;const r=super.state(e,t);this._model.unitConversionEnabled()||delete r.state.unitId;const n=this.symbol();return r.state.inputs.symbol=(0,o.symbolToSaveInState)(null!==(i=this.symbolInfo())&&void 0!==i?i:this._model.chartApi().lastSymbolResolveInfo(n),n),e&&((0,s.ensureDefined)(r.data).symbols={___snapshot:this.symbolInfo()||void 0}),r}symbolTitle(e,t,i){return this.title(e,!0,{},!1,t)}titleInParts(e,t,i,s,r){var n;const o=this._titleInParts(e,t,i,s,r);return[[o[0],...null!==(n=o[1])&&void 0!==n?n:[]].join(", ")]}tags(){const e=this.symbol();return e?[e]:[]}statusView(){return R?super.statusView():null}guiPlotName(e,t){return this.properties().childs().inputs.childs().symbol.value()}canOverrideMinTick(){return!0}canBeHiddenByGlobalFlag(){return!1}valuesProvider(){return new P(this,this.model())}statusProvider(e){return new L(this,this._model.properties().childs().scalesProperties.childs().textColor)}measureUnitId(){return(0,o.measureUnitId)(this.symbolInfo())}getSymbolString(e){return void 0===e&&(e=this._getSymbolForApi(this.symbol())),(0,l.encodeExtendedSymbolOrGetSimpleSymbolString)(this._getSymbolObject(e))}_createPriceAxisView(e){return new m(this,{plotIndex:"compare"})}_createViews(){this._legendView||(this._legendView=new T(this,this._model)),this._dataWindowView||(this._dataWindowView=new x(this,this._model)),this._statusView||(this._statusView=new I.StudyStatusView(this)),super._createViews()}_onUnitChanged(){"alwaysOff"!==(0,r.currencyUnitVisibilityProperty)().value()&&this._model.fullUpdate(), -this._model.unitConversionEnabled()&&this.isStarted()&&this._tryChangeInputs(),this._unitChanged.fire()}_getSymbolObject(e){const t=super._getSymbolObject(e),i=this.currency();null!==i&&(t["currency-id"]=i);const s=this.unit();return this._model.unitConversionEnabled()&&null!==s&&(t["unit-id"]=s),t}_onSymbolResolvingStart(e,t){this._lastResolvedSymbolSource=t,super._onSymbolResolvingStart(e,t),this._symbolResolvingActive.setValue(!0)}_onSymbolError(){super._onSymbolError(),this._symbolResolvingActive.setValue(!1)}_onSymbolResolved(e,t,i){super._onSymbolResolved(e,t,i),this._recreatePriceFormattingDependencies();const s=t===this.symbol()?(0,o.extractSymbolNameFromSymbolInfo)(i,this.symbol()):null,r=(0,o.symbolCurrency)(i),n=(0,o.symbolUnit)(i,this._model.unitConversionEnabled());this._setSymbolCurrencyUnitInternal({symbol:null!=s?s:void 0,currency:r,unit:n},i),this._symbolResolvingActive.setValue(!1)}async _changeInputsImpl(e,t){await super._changeInputsImpl(e,t),this._realignLineToolsIfParamsChanged()}_createStudyOnServer(){super._createStudyOnServer(),this._realignLineToolsIfParamsChanged()}_tryCreateFormatter(){var e,t;const i=null!==(t=null===(e=null===M.customFormatters||void 0===M.customFormatters?void 0:M.customFormatters.priceFormatterFactory)||void 0===e?void 0:e.call(M.customFormatters,this.symbolInfo(),this.properties().childs().minTick.value()))&&void 0!==t?t:null;return null!==i?i:(0,o.createSeriesFormatter)(this.symbolInfo(),this.properties().childs().minTick.value())}_titleInParts(e,t,i,s,r){const n=this.symbolInfo();return[this._getSymbolTitlePart(n),[this._getExchangeTitlePart(n,r),this._getPriceSourceTitlePart(n)].filter((e=>null!==e))]}_skipHistogramBaseOnAutoScale(){return!0}_getSymbolTitlePart(e){var t;if(null===e)return N?"":this.properties().childs().inputs.childs().symbol.value();const i=(0,o.getSymbolExchange)(e);if(B&&void 0!==i)return i;if(V)switch(this._model.mainSeries().symbolTextSourceProxyProperty().value()){case"description":return e.description;case"ticker-and-description":return`${e.name}, ${e.description}`;case"long-description":return null!==(t=e.long_description)&&void 0!==t?t:e.description}return e.name}_getExchangeTitlePart(e,t){return null===e||t?null:(0,o.getSymbolExchange)(e)}_getPriceSourceTitlePart(e){var t;return O&&!1!==this._model.properties().childs().paneProperties.childs().legendProperties.childs().showPriceSource.value()&&void 0!==(null==e?void 0:e.price_source_id)&&null!==(t=this._model.availablePriceSources(this.getSymbolString(this._getSymbolForApi(this.symbol()))).name(e.price_source_id))&&void 0!==t?t:null}_setSymbolCurrencyUnitInternal(e,t){const{symbol:i,currency:s,unit:r}=e,n=this.properties().childs(),a=n.inputs.childs().symbol.value(),l=n.currencyId.value(),c=n.unitId.value();if(void 0!==i&&n.inputs.childs().symbol.setValueSilently(i),void 0!==s&&n.currencyId.setValueSilently(s),void 0!==r&&n.unitId.setValueSilently(r),t)this._resolvedSymbolsByInput[this.symbol()]=t,this._resolvedSymbols[this._getSymbolForResolve(this.symbol())]=t, -this._realignToolsLastParams=null;else{const e=this.symbolInfo();null!==e&&(n.currencyId.setValueSilently((0,o.symbolCurrency)(e)),n.unitId.setValueSilently((0,o.symbolUnit)(e,this._model.unitConversionEnabled())))}n.inputs.childs().symbol.value()!==a&&n.inputs.childs().symbol.listeners().fire(n.inputs.childs().symbol,""),n.currencyId.value()!==l&&n.currencyId.listeners().fire(n.currencyId,""),n.unitId.value()!==c&&n.unitId.listeners().fire(n.unitId,""),this._realignLineToolsIfParamsChanged()}_realignLineToolsIfParamsChanged(){let e=null===this._realignToolsLastParams;if(null!==this._realignToolsLastParams){const t=this.compareSymbolParams(this._realignToolsLastParams);e=t.symbolChanged||t.intervalChanged||t.currencyChanged||t.unitChanged}e&&(this._model.realignLineTools(this),this._realignToolsLastParams=this.symbolParams())}}},47468:(e,t,i)=>{"use strict";i.d(t,{StudyOverlayBase:()=>_e});var s=i(50151),r=i(49483),n=i(59224),o=i(56827),a=i(81049),l=i(42226),c=i(13497),h=i(42960),d=i(88640),u=i(27856),p=i(14483),_=i(71625),m=i(97121),g=i(24954),f=i(94025),v=i(97034),S=i(86094),y=i(1722),b=i(34256),w=i(97145),C=i(1763),P=i(90830),x=i(11775),T=i(42275),I=i(74304),M=i(78211),A=i(87095);const L=p.enabled("force_exchange_as_title");class k extends T.PriceAxisView{constructor(e){super(),this._source=e}_updateRendererData(e,t,i){e.visible=!1,t.visible=!1;const r=this._source.lastValueData("close",!1);if(r.noData)return;const n=this._source.model(),o=this._source.priceScale();if(null===o)return;if(!n.isPriceScaleVisible(o))return;const a=n.timeScale().visibleBarsStrictRange(),l=n.mainSeries().bars().lastIndex();if(null===a||null===l)return;if(l<=a.lastBar())i.background=(0,A.resetTransparency)(r.color),i.textColor=this.generateTextColor(r.color),e.borderVisible=!1,t.borderVisible=!1;else{const o=n.backgroundColorAtYPercentFromTop(r.coordinate/(0,s.ensureNotNull)(n.paneForSource(this._source)).height());i.background=o,i.textColor=(0,A.resetTransparency)(r.color),i.borderColor=i.textColor,e.borderVisible=!0,t.borderVisible=!0}i.coordinate=r.coordinate,i.floatCoordinate=r.floatCoordinate;const c=this._source.model().properties().childs().scalesProperties.childs();c.showSeriesLastValue.value()&&(e.text=(0,M.getCurrentModePriceText)(o,r),c.seriesLastValueMode.value()!==I.PriceAxisLastValueMode.LastPriceAndPercentageValue?e.secondLine="":e.secondLine=(0,M.getOppositeModePriceText)(o,r),e.visible=!0),t.text="",c.showSymbolLabels.value()&&(t.text=this._paneText(),t.visible=t.text.length>0)}_paneText(){let e="";const t=this._source.symbolInfo();return L?e=(0,h.displayedSymbolExchange)(t):this._source.model().properties().childs().scalesProperties.childs().showSymbolLabels.value()&&(e=(0,h.displayedSymbolName)(t)),e}}var D=i(11527);class E extends D.PriceLineAxisView{constructor(e){super(),this._study=e}_value(){return this._study.lastValueData("",!0)}_priceLineColor(e){return e}_lineWidth(){return 1}_isVisible(){const e=this._study.model().properties().childs().scalesProperties.childs().showSeriesLastValue.value() -;return this._study.properties().childs().showPriceLine.value()&&e}}var V=i(79849),B=i(74997);class R{constructor(e){this._lineRenderer=new B.HorizontalLineRenderer,this._visible=!1,this._source=e}update(){if(this._visible=!1,!this._source.properties().childs().showPriceLine.value())return;const e=this._source.lastValueData("",!0);e.noData||(this._visible=!0,this._lineRenderer.setData({y:e.coordinate,color:e.color,linewidth:1,linestyle:V.LINESTYLE_DOTTED,visible:this._visible}))}renderer(){return this._visible?this._lineRenderer:null}}var N=i(93835),O=i(15367),F=i(88348),W=i(37591),H=i(27361);const z=r.CheckMobile.any();class U extends N.DataWindowView{constructor(e,t){super(),this._invalidated=!0,this._study=e,this._model=t,this._valueProvider=this._createValuesProvider(e,t),this._items=this._valueProvider.getItems().map((e=>new N.DataWindowItem(e.id,e.title,""))),this.update()}items(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),this._items}update(){this._invalidated=!0}study(){return this._study}_updateImpl(){var e,t;this._header=this._study.title(W.TitleDisplayTarget.DataWindow);let i;this._showLastPriceAndChangeOnly()?i=this._study.data().lastIndex():(i=this._model.crossHairSource().appliedIndex(),isNaN(i)&&(i=this._study.data().lastIndex(),p.enabled("use_last_visible_bar_value_in_legend")&&(i=null!==(t=null===(e=this._model.timeScale().visibleBarsStrictRange())||void 0===e?void 0:e.lastBar())&&void 0!==t?t:NaN)));const s=this._valueProvider.getValues(i);for(let e=0;ee||t),i.showBarChange.weakReference(),i.showSeriesOHLC.weakReference()),this._visibilityProperty.subscribe(this,this.update)}areValuesVisible(){return this._visibilityProperty.value()}additional(){return this._additional}destroy(){this._backgroundColorSpawn.destroy(),this._visibilityProperty.destroy()}_updateImpl(){super._updateImpl()}_createValuesProvider(e,t){return new j.OverlayLegendValuesProvider(e,t)}}var $=i(43493),Y=i(7138),K=i(57917),Z=i(41800),X=i(8943),J=i(53275),Q=i(28400),ee=i(11740),te=i(18671),ie=i(79586),se=i(48984),re=i(16410) -;const ne=p.enabled("show_symbol_logos")&&p.enabled("show_symbol_logo_in_legend")&&p.enabled("show_symbol_logo_for_compare_studies"),oe=(r.CheckMobile.any()||ne)&&!1,ae=p.enabled("study_overlay_compare_legend_option"),le=p.enabled("secondary_series_extend_time_scale"),ce=p.enabled("hide_unresolved_symbols_in_legend"),he=!p.enabled("hide_study_overlay_legend_item"),de=p.enabled("symbol_info_price_source"),ue=(0,n.getLogger)("Chart.StudyOverlay");function pe(e,t){return null==e[t]}class _e extends o.Study{constructor(e,t,i,s){super(e,function(e){e.hasChild("currencyId")||e.addChild("currencyId",new d.default(null)),e.hasChild("unitId")||e.addChild("unitId",new d.default(null)),(0,re.allChartStyles)().includes(e.childs().style.value())||e.childs().style.setValueSilently(2);const t=e.childs();if(t.lineStyle.hasChild("styleType")){const e=t.lineStyle.childs(),i=e.styleType.value();let s,r;0===i&&(r=14,s=t.lineWithMarkersStyle.childs()),1===i&&(r=15,s=t.steplineStyle.childs()),s&&(s.color.setValueSilently(e.color.value()),s.linestyle.setValueSilently(e.linestyle.value()),s.linewidth.setValueSilently(e.linewidth.value()),s.priceSource.setValueSilently(e.priceSource.value())),void 0!==r&&2===t.style.value()&&t.style.setValueSilently(r),t.lineStyle.removeProperty("styleType")}return e.addExclusion("currencyId"),e.addExclusion("unitId"),e}(t),i,s),this._seriesSource=null,this._symbolResolvingActive=new w.WatchedValue(!1),this._symbolHibernated=new w.WatchedValue(!1),this._styleToRecover=null,this._isActingAsSymbolSource=new w.WatchedValue(!0),this._realignToolsLastParams=null,this._precomputedBarStyles=new WeakMap,this._lastResolvedSymbolSource="",this._data=new v.PlotList((0,c.seriesPlotFunctionMap)(),pe),this._quotesProvider=new _.QuotesProvider(void 0,e.collapsed().spawnOwnership()),oe&&this._quotesProvider.quotesUpdate().subscribe(this,this._onQuotesUpdate);const r=this.properties().childs();r.currencyId.subscribe(this,this._onCurrencyChanged),r.unitId.subscribe(this,this._onUnitChanged),r.allowExtendTimeScale.subscribe(this,this._onAllowExtendTimeScaleChanged),this._onAllowExtendTimeScaleChanged(),r.style.subscribe(this,this._onChartStyleChanged),r.lineStyle.childs().priceSource.subscribe(this,this._updateBarFunction),r.lineWithMarkersStyle.childs().priceSource.subscribe(this,this._updateBarFunction),r.steplineStyle.childs().priceSource.subscribe(this,this._updateBarFunction),r.areaStyle.childs().priceSource.subscribe(this,this._updateBarFunction),r.baselineStyle.childs().priceSource.subscribe(this,this._updateBarFunction),r.columnStyle.childs().priceSource.subscribe(this,this._updateBarFunction),this._updateBarFunction(),this._formatter=null,e.mainSeries().onIntervalChanged().subscribe(this,(()=>e.realignLineTools(this)))}destroy(){var e;this._model.mainSeries().onIntervalChanged().unsubscribeAll(this),null===(e=this._quotesProvider)||void 0===e||e.destroy(),super.destroy()}isActingAsSymbolSource(){return this._isActingAsSymbolSource.readonly()}precomputedBarStyle(e){return this._precomputedBarStyles.get(e)} -setPrecomputedBarStyle(e,t){this._precomputedBarStyles.set(e,t)}properties(){return this._properties}barColorer(){return new se.SeriesBarColorer({data:()=>this.data(),bars:()=>this.data(),nsBars:()=>new v.PlotList,priceScale:()=>(0,s.ensureNotNull)(this.priceScale()),properties:()=>this.properties(),firstValue:()=>this.firstValue()})}symbolParams(){return(0,m.symbolParams)(this)}compareSymbolParams(e){return(0,m.compareSymbolParams)(this,e,this._model.unitConversionEnabled())}setSymbolParams(e){this._setSymbolParamsInternal(e)}symbol(){return this.properties().childs().inputs.childs().symbol.value()}symbolChanged(){return this.properties().childs().inputs.childs().symbol.listeners()}setSymbol(e){this.setSymbolParams({symbol:e})}symbolInfo(){if(!this._resolvedSymbols)return null;const e=this._properties.childs().inputs.childs().symbol.value();if(!e)return null;let t;return t=this._resolvedSymbols[this._getSymbolForResolve(e)]||null,t}supportsPressedChunks(){return!1}pressedChunks(e,t){throw new Error("Pressed chunks are not supported")}data(){return null===this._seriesSource?super.data():this._seriesSource.data().bars()}symbolResolved(){return this.symbolsResolved()}symbolResolvingActive(){return this._symbolResolvingActive}symbolHibernated(){return this._symbolHibernated}isVisible(){const e=super.isVisible();return this._symbolHibernated.setValue(!e),e}symbolSameAsCurrent(e){return(0,m.symbolSameAsCurrent)(e,this.symbolInfo())}symbolSameAsResolved(e){return(0,g.symbolSameAsResolved)(e,this._lastResolvedSymbolSource,this.symbol())}priceSource(){const e=this.properties().childs();switch(e.style.value()){case 2:return e.lineStyle.childs().priceSource.value();case 14:return e.lineWithMarkersStyle.childs().priceSource.value();case 15:return e.steplineStyle.childs().priceSource.value();case 3:return e.areaStyle.childs().priceSource.value();case 10:return e.baselineStyle.childs().priceSource.value();case 13:return e.columnStyle.childs().priceSource.value()}return null}barFunction(){return this._barFunction}quotesProvider(){return this._quotesProvider}quotes(){return this._quotesProvider.quotes()}currency(){return this.properties().childs().currencyId.value()||null}setCurrency(e){this.setSymbolParams({currency:e})}isConvertedToOtherCurrency(){return(0,h.isConvertedToOtherCurrency)(this.symbolInfo())}unit(){return this.properties().childs().unitId.value()||null}setUnit(e){this.setSymbolParams({unit:e})}isConvertedToOtherUnit(){return(0,h.isConvertedToOtherUnit)(this.symbolInfo(),this._model.unitConversionEnabled())}style(){return this.properties().childs().style.value()}setStyle(e){this.setSymbolParams({style:e})}interval(){return this._model.mainSeries().interval()}setInterval(e){}valueAt(e,t){var i,s;return null!==(s=null===(i=this.data().search(e))||void 0===i?void 0:i.value[t])&&void 0!==s?s:null}symbolSource(){return this}barsProvider(){return this}state(e,t){var i;const r=super.state(e,t);this._model.unitConversionEnabled()||delete r.state.unitId;const n=this.symbol();return r.state.inputs.symbol=(0, -h.symbolToSaveInState)(null!==(i=this.symbolInfo())&&void 0!==i?i:this._model.chartApi().lastSymbolResolveInfo(n),n),e&&((0,s.ensureDefined)(r.data).symbols={___snapshot:this.symbolInfo()||void 0}),r}symbolTitle(e,t,i){return this.title(e,!0,{},!1,t)}title(e,t,i,s,r){var n;const o=this._titleInParts(e,t,i,s,r);return[o[0],...null!==(n=o[1])&&void 0!==n?n:[]].join(` ${h.symbolTitleSeparator} `)}titleInParts(e,t,i,s,r){return[this.title(e,t,i,s,r)]}isStarted(){return null===this._seriesSource?super.isStarted():this._seriesSource.isStarted()}sourceId(){return null===this._seriesSource?super.sourceId():(0,s.ensureNotNull)(this._seriesSource.instanceId())}moveData(e){null===this._seriesSource?super.moveData(e):this._seriesSource.moveData(e)}firstValue(){const e=this._model.timeScale().visibleBarsStrictRange();if(null===e)return null;const t=e.firstBar();if(0===this.data().size())return this._ownFirstValue;const i=this.data().search(t,S.PlotRowSearchMode.NearestRight,1);return this._ownFirstValue=null!==i?this._barFunction(i.value,0):null,this._ownFirstValue}lastValueData(e,t,i){const s={noData:!0},r=this.priceScale();if(this._model.timeScale().isEmpty()||null===r||r.isEmpty()||this.data().isEmpty())return s;const n=this._model.timeScale().visibleBarsStrictRange();if(null===n)return s;const o=this.properties().childs();if(!o.visible.value())return s;const a=this.nearestIndex(n.lastBar(),S.PlotRowSearchMode.NearestLeft,1);if(void 0===a)return s;const l=this.firstValue();if(null===l)return s;const c=this._lastNonEmptyPlotRow(4),h=null!==c&&n.contains(c.index),d=null!==c?c.value:null,u=t||h?d:this.data().valueAt(a);if(null===u)return s;const p=this._barFunction(u,2);if(!(0,y.isNumber)(p))return s;const _=r.priceToCoordinate(p,l);let m;switch(o.style.value()){case 0:m=u[1]<=u[4]?o.barStyle.childs().upColor.value():o.barStyle.childs().downColor.value();break;case 1:case 9:m=u[1]<=u[4]?o.candleStyle.childs().upColor.value():o.candleStyle.childs().downColor.value();break;case 13:m=u[1]<=u[4]?o.columnStyle.childs().upColor.value():o.columnStyle.childs().downColor.value();break;case 2:m=o.lineStyle.childs().color.value();break;case 14:m=o.lineWithMarkersStyle.childs().color.value();break;case 15:m=o.steplineStyle.childs().color.value();break;case 3:m=o.areaStyle.childs().linecolor.value();break;case 16:m=o.hlcAreaStyle.childs().closeLineColor.value();break;case 10:{const e=o.baselineStyle.childs();m=_(0,s.ensureNotNull)(this.priceScale()).height(),color:()=>e.baselineColor.value(),baseLevelPercentage:()=>e.baseLevelPercentage.value()});break}case 12:r=new ie.SeriesHiLoPaneView(this,this._model)}r&&this._paneViews.push(r),null!==i&&this._paneViews.push(i),this._paneViews.push(new R(this)),this._dataWindowView||(this._dataWindowView=new U(this,this._model)),this._legendView||(this._legendView=new q(this,this._model)),this._statusView||(this._statusView=new P.StudyStatusView(this)),this._priceAxisViews=[...this._priceAxisViewsBase],this._labelPaneViews.push(new $.PanePriceAxisView(e,this,this._model))}_createStudyOnServer(){null===this._seriesSource?super._createStudyOnServer():this._modifyStudyOnServer((0,s.ensureDefined)(this._inputs)),this._realignLineToolsIfParamsChanged()}_modifyStudyOnServer(e){null===this._seriesSource?super._modifyStudyOnServer(e,0):(this._seriesSource.modifySeries((0,u.decodeExtendedSymbol)(e.symbol),(0,f.getServerInterval)(this._series.properties().childs().interval.value())),this._seriesSource.isStarted()||this._seriesSource.start())}_stopStudyOnServer(){null===this._seriesSource?super._stopStudyOnServer():this._seriesSource.stop()}_titleInParts(e,t,i,s,r){const n=this.symbolInfo();return[this._getSymbolTitlePart(n),[this._getExchangeTitlePart(n,r),this._getPriceSourceTitlePart(n)].filter((e=>null!==e))]}_getSymbolTitlePart(e){var t;if(null===e)return ce?"":this.properties().childs().inputs.childs().symbol.value() -;if(ae)switch(this._model.mainSeries().symbolTextSourceProxyProperty().value()){case"description":return e.description;case"ticker-and-description":return`${e.name}, ${e.description}`;case"long-description":return null!==(t=e.long_description)&&void 0!==t?t:e.description}return e.name}_getExchangeTitlePart(e,t){return null===e||t?null:(0,h.getSymbolExchange)(e)}_getPriceSourceTitlePart(e){var t;return de&&!1!==this._model.properties().childs().paneProperties.childs().legendProperties.childs().showPriceSource.value()&&void 0!==(null==e?void 0:e.price_source_id)&&null!==(t=this._model.availablePriceSources(this.getSymbolString(this._getSymbolForApi(this.symbol()))).name(e.price_source_id))&&void 0!==t?t:null}_onAllowExtendTimeScaleChanged(){if(!le)return;const e=this.isStarted();e&&this.stop(!0);const t=this.properties().childs().allowExtendTimeScale.value();this.properties().childs().inputs.childs().extendTimeScale.setValue(t),e&&this.start(!0)}_setSymbolParamsInternal(e,t){const{symbol:i,currency:s,unit:r,style:n}=e,o=this.properties().childs(),a=o.inputs.childs().symbol.value(),l=o.currencyId.value(),c=o.unitId.value(),d=o.style.value();if(void 0!==i&&o.inputs.childs().symbol.setValueSilently(i),void 0!==s&&o.currencyId.setValueSilently(s),void 0!==r&&o.unitId.setValueSilently(r),void 0!==n&&o.style.setValueSilently(n),t)this._resolvedSymbolsByInput[this.symbol()]=t,this._resolvedSymbols[this._getSymbolForResolve(this.symbol())]=t,this._realignToolsLastParams=null;else{const e=this.symbolInfo();null!==e&&(o.currencyId.setValueSilently((0,h.symbolCurrency)(e)),o.unitId.setValueSilently((0,h.symbolUnit)(e,this._model.unitConversionEnabled())))}o.inputs.childs().symbol.value()!==a&&o.inputs.childs().symbol.listeners().fire(o.inputs.childs().symbol,""),o.currencyId.value()!==l&&o.currencyId.listeners().fire(o.currencyId,""),o.unitId.value()!==c&&o.unitId.listeners().fire(o.unitId,""),o.style.value()!==d&&o.style.listeners().fire(o.style,""),this._checkStyle(),this._realignLineToolsIfParamsChanged()}_updateBarFunction(){this._barFunction=(0,a.barFunctionByStyle)(this.style(),this.priceSource())}_onChartStyleChanged(){var e;this._updateBarFunction(),(null===(e=this._styleToRecover)||void 0===e?void 0:e.originalStyle)!==this.style()&&(this._styleToRecover=null)}_checkStyle(){const e=this.style();(0,h.isCloseBasedSymbol)(this.symbolInfo())?(0,h.isSingleValueBasedStyle)(e)||(this.setStyle(2),this._styleToRecover={correctedStyle:this.style(),originalStyle:e}):null!==this._styleToRecover&&(this.setStyle(this._styleToRecover.originalStyle),this._styleToRecover=null)}_realignLineToolsIfParamsChanged(){let e=null===this._realignToolsLastParams;if(null!==this._realignToolsLastParams){const t=this.compareSymbolParams(this._realignToolsLastParams);e=t.symbolChanged||t.intervalChanged||t.currencyChanged||t.unitChanged}e&&(this._model.realignLineTools(this),this._realignToolsLastParams=this.symbolParams())}}},45802:(e,t,i)=>{"use strict";i.d(t,{StudyPriceAxisView:()=>o});var s=i(50151),r=i(42275),n=i(87095) -;class o extends r.PriceAxisView{constructor(e,t){super(),this._model=e.model(),this._source=e,this._data=t}_updateRendererData(e,t,i){e.visible=!1,t.visible=!1;const r=this._source.model(),o=this._source.priceScale();if(null===o)return;if(!r.isPriceScaleVisible(o))return;const a=this._source.lastValueData(this._data.plotIndex,!1);if(a.noData)return;const l=r.timeScale().visibleBarsStrictRange(),c=r.mainSeries().bars().lastIndex();if(null!==l&&null!==c){if(c<=l.lastBar()){i.background=(0,n.resetTransparency)(a.color);let s=a.color;"transparent"===s&&(s=this._model.properties().childs().scalesProperties.childs().backgroundColor.value()),i.textColor=this.generateTextColor(s),i.borderColor=void 0,e.borderVisible=!1,t.borderVisible=!1}else{const o=r.backgroundColorAtYPercentFromTop(a.coordinate/(0,s.ensureNotNull)(r.paneForSource(this._source)).height());i.background=o,i.textColor=(0,n.resetTransparency)(a.color),i.borderColor=(0,n.resetTransparency)(i.textColor),e.borderVisible=!0,t.borderVisible=!0}i.coordinate=a.coordinate,i.floatCoordinate=a.floatCoordinate,this._showAxisLabel()&&(e.text=a.text,e.visible=!0),this._updatePaneRendererData(t)}}_showPaneLabel(){return!!this._model.properties().childs().scalesProperties.childs().showStudyPlotLabels.value()&&this._source.properties().childs().showLabelsOnPriceScale.value()&&this._source.isPlotVisibleAt(this._data.plotIndex,4)}_showAxisLabel(){return!!this._model.properties().childs().scalesProperties.childs().showStudyLastValue.value()&&this._source.properties().childs().showLabelsOnPriceScale.value()&&this._source.isPlotVisibleAt(this._data.plotIndex,4)}_updatePaneRendererData(e){e.text="",this._showPaneLabel()&&(e.text=this._source.priceLabelText(this._data.plotIndex),e.visible=!0)}}},45574:(e,t,i)=>{"use strict";i.d(t,{applyOverridesToStudy:()=>d,applyOverridesToStudyDefaults:()=>u});var s=i(50151),r=i(72877),n=i(59224);const o={line:r.LineStudyPlotStyle.Line,histogram:r.LineStudyPlotStyle.Histogram,cross:r.LineStudyPlotStyle.Cross,area:r.LineStudyPlotStyle.Area,columns:r.LineStudyPlotStyle.Columns,circles:r.LineStudyPlotStyle.Circles,line_with_breaks:r.LineStudyPlotStyle.LineWithBreaks,area_with_breaks:r.LineStudyPlotStyle.AreaWithBreaks,step_line:r.LineStudyPlotStyle.StepLine,step_line_with_breaks:r.LineStudyPlotStyle.StepLineWithBreaks,step_line_with_diamonds:r.LineStudyPlotStyle.StepLineWithDiamonds},a=(0,n.getLogger)("Chart.Model.StudyPropertiesOverrider");var l,c;function h(e,t,i,s){const r=i.split(".");if(0===r.length||0===r[0].length)return;const n=function(e){const t=e.split(":");return{name:t[0],type:2===t.length?t[1]:null}}(r[0]),o=n.name,h=n.type,d=null!==h,u=!d||"band"===h,p=!d||"area"===h,_=!d||"input"===h,m=!d||"plot"===h?c.getPlotIdByTitle(e,o):null,g=u?c.getBandIndexByName(e,o):null,f=p?c.getFilledAreaIdByTitle(e,o):null,v=_?c.getInputByName(e,o):null,S=t.hasOwnProperty(o);if((null!==m?1:0)+(null!==g?1:0)+(null!==f?1:0)+(null!==v?1:0)+(S?1:0)>1)return void a.logWarn(`Study '${e.description}' has ambiguous identifier '${o}'`);const y=r[1];if(null!==m){ -if(1===r.length)return void a.logWarn(`Path of sub-property of '${o}' plot for study '${e.description}' must be not empty`);const i=r.slice(1);l.applyPlotProperty(e,t,m,i,s)}else if(null!==v)l.applyInputValue(t,v,s);else if(null!==g){if(void 0===y)return void a.logWarn(`Property name of '${o}' band for study '${e.description}' must be set`);l.applyBandProperty(t,g,y,s)}else if(null!==f){if(void 0===y)return void a.logWarn(`Property name of '${o}' area for study '${e.description}' must be set`);l.applyFilledAreaProperty(t,f,y,s)}else S?l.setRootProperty(t,r,s):a.logWarn(`Study '${e.description}' has no plot or input '${o}'`)}function d(e,t){const i=e.properties(),s=i.state();for(const i in t)t.hasOwnProperty(i)&&h(e.metaInfo(),s,i,t[i]);i.mergeAndFire(s)}function u(e,t,i){for(const s in e){if(!e.hasOwnProperty(s))continue;const r=s.indexOf(".");if(-1===r)continue;const n=s.substring(0,r),o=c.getMetaInfoByDescription(t,n);if(null===o){a.logWarn(`There is no such study ${n}`);continue}const l=i(o);null!==l?h(o,l,s.substring(r+1),e[s]):a.logWarn(`Cannot apply overrides for study ${n}`)}}!function(e){e.applyPlotProperty=function(e,t,i,n,l){if(void 0===t.styles)return void a.logWarn("Study does not have styles");const c=n[0];if("color"===c){const o=function(e,t,i){if(void 0===e.plots)return null;for(const s of e.plots){if(!(0,r.isPaletteColorerPlot)(s)||void 0===t.palettes)continue;const e=t.palettes[s.palette];if(s.target===i&&void 0!==e)return e}return null}(e,t,i);return void function(e,t,i,r,n){var o;void 0!==e.styles?null===t&&!isNaN(r)&&r>0?a.logWarn(`Study plot does not have color #${r}`):((0===r||isNaN(r))&&((0,s.ensureDefined)(e.styles[i]).color=String(n),r=0),null!==t&&((0,s.ensureDefined)(null===(o=t.colors)||void 0===o?void 0:o[r]).color=String(n))):a.logWarn("Study does not have styles")}(t,o,i,n.length>1?parseInt(n[1]):NaN,l)}const h=t.styles[i];if(void 0!==h&&h.hasOwnProperty(c)){if("plottype"===c){const e=o[String(l)];if(void 0===e)return void a.logWarn(`Unsupported plot type for plot: ${l}`);l=e}h[c]=l}else a.logWarn(`Study plot does not have property '${c}'`)},e.applyBandProperty=function(e,t,i,s){if(void 0===e.bands)return void a.logWarn("Study does not have bands");const r=e.bands[t];if(void 0!==r&&r.hasOwnProperty(i)){if("plottype"===i){const e=o[String(s)];if(void 0===e)return void a.logWarn(`Unsupported plot type for band: ${s}`);s=e}r[i]=s}else a.logWarn(`Study band does not have property '${i}'`)},e.applyFilledAreaProperty=function(e,t,i,s){if(void 0===e.filledAreasStyle)return void a.logWarn("Study does not have areas");const r=e.filledAreasStyle[t];void 0!==r&&r.hasOwnProperty(i)?r[i]=s:a.logWarn(`Study area does not have property '${i}'`)},e.applyInputValue=function(e,t,i){void 0!==e.inputs&&e.inputs.hasOwnProperty(t)?e.inputs[t]=i:a.logWarn(`Study does not have input '${t}'`)},e.setRootProperty=function(e,t,i){if(0===t.length)return;let s=e;for(const e of t.slice(0,-1)){if(null==s||!s.hasOwnProperty(e))break;s=s[e]}const r=t[t.length-1] -;null!=s&&s.hasOwnProperty(r)?s[r]=i:a.logWarn(`Study does not have property ${t.join(".")}`)}}(l||(l={})),function(e){e.getInputByName=function(e,t){if(void 0===e.inputs)return null;t=t.toLowerCase();for(const i of e.inputs)if(i.name.toLowerCase()===t)return i.id;return null},e.getPlotIdByTitle=function(e,t){if(void 0===e.styles)return null;t=t.toLowerCase();for(const i in e.styles){const s=e.styles[i];if((void 0!==s&&void 0!==s.title?s.title:i).toLowerCase()===t)return i}return null},e.getFilledAreaIdByTitle=function(e,t){if(void 0===e.filledAreas)return null;t=t.toLowerCase();for(const i of e.filledAreas)if(i.title.toLowerCase()===t)return i.id;return null},e.getBandIndexByName=function(e,t){if(void 0===e.bands)return null;t=t.toLowerCase();for(let i=0;i{"use strict";i.d(t,{Study:()=>ti,createStudyError:()=>Xt,prepareStudyProperties:()=>Gt,prepareStudyPropertiesForLoadChart:()=>Kt});var s=i(16230),r=i(27788),n=i(14314),o=i(50151),a=i(30551),l=i(11542),c=i(59224),h=i(49483),d=i(21866),u=i(57898),p=i(87095),_=i(1115),m=i(80842),g=i(34256),f=i(97034),v=i(42856),S=i(12442),y=i(86094),b=i(95586),w=i(70512),C=i(54303),P=i(40484);class x{constructor(e,t){this._study=e,this._model=t,this._showStudyValues=t.properties().childs().paneProperties.childs().legendProperties.childs().showStudyValues,this._hhistBasedStudy=void 0!==e.metaInfo().graphics.hhists,this._valuesProvider=this._createValuesProvider(e,t)}getItems(){return this._valuesProvider.getItems()}getValues(e){const t=this._valuesProvider.getValues(e),i=this._study.properties(),s=this._showStudyValues.value()&&i.childs().showLegendValues.value(),r=e=>!!this._hhistBasedStudy||this._study.isPlotVisibleAt(e,8);for(const e of t)e.visible=e.visible&&s&&r(e.id);return t}_createValuesProvider(e,t){return this._hhistBasedStudy?new P.HHistBasedValuesProvider(e,t):new C.StudyValuesProvider(e,t)}}var T=i(72877);class I extends w.StudyBaseWindowView{constructor(e,t){super(e,t),this._showStudyValues=t.properties().childs().paneProperties.childs().legendProperties.childs().showStudyValues,this._showStudyValues.subscribe(this,this.update);const i=this._study.properties();i.childs().showLegendValues.subscribe(this,this.update);const s=this._study.metaInfo().plots,r=new Set;s.forEach((e=>{var t;if((0,T.isOhlcPlot)(e)){const t=e.target;if(r.has(t))return;r.add(t),i.childs().ohlcPlots.childs()[t].childs().display.subscribe(this,this.update)}else(0,T.isPlotSupportDisplay)(e)&&(null===(t=i.childs().styles.childs()[e.id])||void 0===t||t.childs().display.subscribe(this,this.update))}))}areValuesVisible(){return this._showStudyValues.value()}additional(){return null}destroy(){this._showStudyValues.unsubscribeAll(this);const e=this._study.properties();e.childs().showLegendValues.unsubscribeAll(this) -;const t=this._study.metaInfo().plots,i=new Set;t.forEach((t=>{var s;if((0,T.isOhlcPlot)(t)){const s=t.target;if(i.has(s))return;i.add(s),e.childs().ohlcPlots.childs()[s].childs().display.unsubscribe(this,this.update)}else(0,T.isPlotSupportDisplay)(t)&&(null===(s=e.childs().styles.childs()[t.id])||void 0===s||s.childs().display.unsubscribe(this,this.update))}))}_createValuesProvider(e,t){return new x(e,t)}}var M=i(88348),A=i(90830),L=i(27856),k=i(19171),D=i(1803),E=i(6892),V=i(1722),B=i(87663);i(37591),i(49475);function R(e,t){return e.studyId.localeCompare(t.studyId)}function N(e){const t=new Set,i=[];return e.forEach((e=>{t.has(e.studyId)||(t.add(e.studyId),i.push(e))})),i}function O(e){const t=e.model().mainSeries();return{studyId:(0,o.ensureNotNull)(e.sourceId()),turnaround:e.turnaround(),sourceStudies:e.parentSources().filter((e=>e!==t)).map((e=>O(e)))}}var F=i(33703),W=i(14483),H=i(19266),z=i(59590);class U extends z.BitmapCoordinatesPaneRenderer{constructor(e){super(),this._data=e}hitTest(e){return null}_drawImpl(e){}_drawBackgroundImpl(e){const{context:t,horizontalPixelRatio:i,bitmapSize:s}=e,r=this._data;for(let e=0;e0?(i-=r,s+=r):(i+=r,s-=r);const n=this._study.getMinFirstBarIndexForPlot(this._plotName);if(n>s)return -;i=Math.max(n,i);const a=this._study.data();for(const e of a.rangeIterator(i,s)){let i=e.index;const s=e.value;i+=r;const n={timePointIndex:Math.floor(i),left:NaN,center:NaN,right:NaN};let a=(0,V.isNumber)(t)?t:50;a=Math.min(a,100),a=Math.max(a,0);const l=this._colorProvider.getPlotPointStyle(s);void 0!==l.colors[1]&&(n.color=(0,p.generateColor)((0,o.ensureDefined)(l.colors[1]),a)),this._items.push(n)}this._model.timeScale().fillBarBorders(this._items)}}var q,$,Y=i(54358),K=i(80101),Z=i(76058),X=i(37160),J=i(57490),Q=i(13497),ee=i(96759),te=i(86441),ie=i(34026),se=i(50335),re=i(18807),ne=i(50146),oe=i(29764),ae=i(27714),le=i(74359);!function(e){e.Left="left",e.Right="right",e.Center="center"}(q||(q={})),function(e){e.Top="top",e.Bottom="bottom",e.Middle="middle"}($||($={}));const ce=(0,le.createDisconnectedCanvas)(document,(0,ae.size)({width:0,height:0}),1);class he{constructor(e,t,i,s,r,n="center",a=0){this._lines=e.split(/[^\S\r\n]*(?:\r\n|\r|\n)/),this._font=function(e,t,i,s){return(0,oe.makeFont)(s,i,`${e?"bold ":""}${t?"italic ":""}`)}(t,i,s,r),this._fontSize=r,this._verticalPadding=~~(r/6),this._textAlign=n,this._lineSpacing=a;const l=(0,o.ensureNotNull)(ce.getContext("2d"));l.font=this._font,l.textBaseline="top";let c=0;for(let e=0;e{for(const t of this._lines)n.strokeStyle&&e.strokeText(t,o,a),e.fillText(t,o,a),a+=this._fontSize,a+=this._lineSpacing})),e.restore()}}class de extends ne.AbstractMapContainer{constructor(e){super(),this._maxSize=e,this._keysQueue=[]}get(e){const{fontSize:t,text:i,align:s,font:r,lineSpacing:n=0}=e;if(!i||!t||!s)return null;const o=(0,oe.makeFont)(t,r),a=(0,ne.getDefault3)(this._map,n,s,o,new Map);let l=a.get(i);return void 0!==l||(this._size>=this._maxSize?this._deleteFirstKey():++this._size,this._keysQueue.push([o,s,n,i]),l=new he(i,e.bold,e.italic,r,t,s,n),a.set(i,l)),l}_deleteFirstKey(){const e=this._keysQueue.shift(),[t,i,s,r]=e,n=(0,o.ensureDefined)(this._map.get(s)),a=(0,o.ensureDefined)(n.get(i)),l=(0,o.ensureDefined)(a.get(t));l.delete(r), -0===l.size&&a.delete(t),0===a.size&&n.delete(i),0===n.size&&this._map.delete(s)}}var ue=i(46501);class pe{constructor(e,t={skipRenderingOptimizations:!1}){this._items=[],this._barSpacing=0,this._vertOffset=0,this._textCache=t.textCache||new de(5e3),this._drawOperation=t.skipRenderingOptimizations?this._drawWithoutOptimizations.bind(this):this._drawWithOptimizations.bind(this),null!==e&&this.setData(e)}draw(e,t){this._preDrawInit(),this._drawOperation(e,t)}hitTest(e){const t=re.HitTarget.Regular;let i=null;for(const s of this._items){if(!s)continue;const r=this._calcBoundingBox(s);if(r&&(0,ie.pointInBox)(e,r)){const e={tooltip:this._getTooltip(s,r)};i=new re.HitTestResult(t,e)}}return i}setData(e){var t,i,s,r;if(this._height=void 0!==e.height?e.height:e.width,this._width=void 0!==e.width?e.width:e.height,this._color=e.color,this._borderColor=e.borderColor,this._vertOffset=e.vertOffset||0,e.text&&(this._text=e.text,this._fontSize=e.fontSize,this._lineSpacing=e.lineSpacing,this._textColor=e.textColor,this._textAlign=e.textAlign||"center"),void 0!==e.items&&void 0!==e.barSpacing){const n=null!==(i=null===(t=e.visibleItemsRange)||void 0===t?void 0:t.startItemIndex)&&void 0!==i?i:0,o=null!==(r=null===(s=e.visibleItemsRange)||void 0===s?void 0:s.endItemIndex)&&void 0!==r?r:e.items.length;this.setItems(e.items.slice(n,o),e.barSpacing)}}setItems(e,t){this._setBaseData(e,t)}_calcBoundingBox(e){const t=e.vertOffset,i=this._getTextCache(e);if(!i)return;const s=i.textImageWidth,r=i.textImageHeight,n=s/2,o=e.y+t+e.textVertOffset,a=t>0?0:-r,l=t>0?r:0,c=new te.Point(e.center-n,o+a),h=new te.Point(e.center+n,o+l);return(0,te.box)(c,h)}_unionBox(e,t){const i=Math.min(e.min.x,t.min.x),s=Math.max(e.max.x,t.max.x),r=Math.min(e.min.y,t.min.y),n=Math.max(e.max.y,t.max.y),o=new te.Point(i,r),a=new te.Point(s,n);return(0,te.box)(o,a)}_getTooltip(e,t){if(e.tooltip)return{content:{type:"text",data:e.tooltip},tooltipDelay:200,extendMargin:!0,rect:{x:t.min.x,y:t.min.y,w:Math.abs(t.max.x-t.min.x),h:Math.abs(t.max.y-t.min.y)}}}_setBaseData(e,t){this._items.length=0,this._barSpacing=t;for(const t of e){if((0,se.isNaN)(t.y))continue;const e=void 0===t.width?(0,o.ensureDefined)(this._width):t.width,i=void 0===t.height?(0,o.ensureDefined)(this._height):t.height,s=void 0===t.vertOffset?this._vertOffset:t.vertOffset,r=s>0?i:-i;this._items.push({width:e,height:i,vertOffset:s,textVertOffset:r,shapeWidth:0,shapeHeight:0,stepX:0,stepY:0,...t})}}_drawItemText(e,t,i){const s=this._getTextCache(i);if(null===s)return;const r=i.center,n=i.vertOffset,o=i.y+n+i.textVertOffset;let a;a=i.style&&void 0!==i.style.textColor?i.style.textColor:this._textColor;const l={style:{fillStyle:a},location:{x:r,y:o,horzAlign:q.Center,vertAlign:n>0?$.Top:$.Bottom}};s.paintTo(e,t,l)}_drawWithOptimizations(e,t){let i,s,r=null,n=!1;for(const o of this._items)(0,se.isNaN)(o.y)||(o.style&&void 0!==o.style.color?(i=o.style.color||"rgba(0, 0, 0, 0)",s=o.style.borderColor||"rgba(0, 0, 0, 0)"):(i=this._color,s=this._borderColor),(r!==i||h.isSafari)&&(r=i,n&&this._endPath(e), -this._startPath(e,t,i,s)),this._drawItemShape(e,t,o),n=!0);n&&this._endPath(e),e.save();for(const i of this._items)(0,se.isNaN)(i.y)||this._drawItemText(e,t,i);e.restore()}_drawWithoutOptimizations(e,t){let i,s;e.save();for(const r of this._items){if((0,se.isNaN)(r.y))continue;const n=(0,o.ensureDefined)(r.style);i=n.color||"rgba(0, 0, 0, 0)",s=n.borderColor||"rgba(0, 0, 0, 0)",this._startPath(e,t,i,s),this._drawItemShape(e,t,r),this._endPath(e),this._drawItemText(e,t,r)}e.restore()}_drawItemShape(e,t,i){(0,le.drawScaled)(e,t.pixelRatio,t.pixelRatio,(()=>this._drawItemShapeUsingCSSPixels(e,i)))}_drawItemShapeUsingCSSPixels(e,t){}_preDrawInit(){}_startPath(e,t,i,s){}_endPath(e){}_getTextCache(e){var t,i;const s=e.text||this._text,r=e.fontSize||this._fontSize,n=null!==(t=e.lineSpacing)&&void 0!==t?t:this._lineSpacing,o=e.textAlign||this._textAlign,a=null!==(i=e.font)&&void 0!==i?i:ue.CHART_FONT_FAMILY;return this._textCache.get({text:s,bold:!1,italic:!1,font:a,fontSize:r,lineSpacing:n,align:o})}}class _e extends pe{_startPath(e,t,i,s){e.beginPath(),e.lineWidth=this._lineWidth(t),e.lineCap="butt",e.strokeStyle=i}_endPath(e){e.stroke()}_lineWidth(e){return Math.max(1,Math.floor(2*e.pixelRatio))}}class me extends pe{_startPath(e,t,i,s){e.beginPath(),e.lineWidth=this._lineWidth(t),e.lineCap="butt",e.fillStyle=i,e.strokeStyle=s}_endPath(e){e.fill(),e.stroke()}_lineWidth(e){return Math.max(1,Math.floor(e.pixelRatio))}}class ge extends me{constructor(){super(...arguments),this._sign=0,this._thinArrow=!1,this._thinArrowLineWidth=0,this._headHeight=0,this._arrowWidth=0}setItems(e,t){this._setBaseData(e,t)}_drawItemShape(e,t,i){const s=t.pixelRatio,r=this._lineWidth(t)%2?.5:0,n=this._sign,o=this._arrowWidth,a=this._headHeight,l=Math.abs(i.height),c=Math.round(i.center*s)+r,h=i.vertOffset,d=Math.round((i.y+h+n*l/2)*s)+r,u=(0,X.ceiledEven)(o*s),p=u/2,_=Math.round(l*s),m=Math.round(a*s);e.translate(c,d),this._thinArrow?(e.moveTo(0,0),e.lineTo(-p,-p*n),e.moveTo(0,0),e.lineTo(p,-p*n),e.moveTo(0,0),e.lineTo(0,-_*n),e.moveTo(-p,-_*n),e.lineTo(p,-_*n)):(e.moveTo(0,0),_=0?e.vertOffset:e.vertOffset-e.shapeHeight}}),Pe.set("PaneRendererLabelDown",class extends ve{_calcBoundingBox(e){const t=e.center-e.shapeWidth/2,i=e.center+e.shapeWidth/2,s=e.y-e.shapeHeight+e.vertOffset,r=e.y+e.vertOffset,n=new te.Point(t,s),o=new te.Point(i,r);return(0,te.box)(n,o)}_drawItemShape(e,t,i){const s=t.pixelRatio,r=this._lineWidth(t)%2?.5:0,n=Math.max(1,Math.floor(s))%2?.5:0,o=this._getArrowSize(i);let a=Math.round(o*s);(n+a)%1!=r%1&&(a+=.5);let l=Math.round(i.shapeWidth/2*s);(n+l)%1!=r%1&&(l+=.5);const c=Math.round(i.center*s)+n,h=Math.round((i.y+i.vertOffset)*s)+r,d=c+a,u=Math.round((i.y+i.vertOffset-o)*s)+r,p=c-a,_=c+l,m=Math.round((i.y+i.vertOffset-i.shapeHeight-o)*s)+r,g=c-l;e.moveTo(d,u),e.lineTo(c,h),e.lineTo(p,u),i.shapeWidth<=2*o?(e.lineTo(g,u),this._drawCorner(e,g,m,ye.leftUp,s), -this._drawCorner(e,_,m,ye.rightUp,s),e.lineTo(_,u)):(this._drawCorner(e,g,u,ye.leftDown,s),this._drawCorner(e,g,m,ye.leftUp,s),this._drawCorner(e,_,m,ye.rightUp,s),this._drawCorner(e,_,u,ye.rightDown,s)),e.lineTo(d,u)}_getVerticalTextOffset(e){return-e.shapeHeight/2-this._getArrowSize(e)}_calcVertOffset(e){return Math.sign(e.vertOffset)<=0?e.vertOffset:e.vertOffset+e.shapeHeight}}),Pe.set("PaneRendererSquare",class extends me{_drawItemShape(e,t,i){const s=t.pixelRatio,r=Math.max(1,Math.floor(s))%2?.5:0,n=this._lineWidth(t)%2?.5:0;let o=Math.round(i.height/2*s);(r+o)%1!=n%1&&(o+=.5);const a=Math.round(i.center*s)+r,l=Math.round((i.y+i.vertOffset)*s)+r,c=a-o,h=l-o,d=a+o,u=l+o;e.rect(c,h,d-c,u-h)}_calcBoundingBox(e){const t=e.height,i=Math.round(t/2),s=e.center-i,r=e.vertOffset,n=e.y+r-i,o=s,a=s+t,l=n,c=n+t,h=new te.Point(o,l),d=new te.Point(a,c);let u=(0,te.box)(h,d);const p=super._calcBoundingBox(e);return p&&(u=this._unionBox(u,p)),u}}),Pe.set("PaneRendererTriangleApexUp",class extends be{_drawItemShape(e,t,i){const s=i.width,r=i.height,n=Math.round(r/3),o=i.vertOffset-2*n,a=t.pixelRatio,l=this._lineWidth(t)%2?.5:0,c=Math.max(1,Math.floor(a)),h=c%2?.5:0;let d=Math.round(s*a);d%2!=c%2&&(d+=1);const u=Math.round(i.center*a)+h,p=Math.round((i.y+o)*a),_=u+d/2,m=Math.round((i.y+o+r)*a)+l,g=u-d/2;e.moveTo(u,p),e.lineTo(_,m),e.lineTo(g,m),e.lineTo(u,p)}}),Pe.set("PaneRendererTriangleApexDown",class extends be{_drawItemShape(e,t,i){const s=i.width,r=i.height,n=Math.round(r/3),o=i.vertOffset-n,a=t.pixelRatio,l=this._lineWidth(t)%2?.5:0,c=Math.max(1,Math.floor(a)),h=c%2?.5:0;let d=Math.round(s*a);d%2!=c%2&&(d+=1);const u=Math.round(i.center*a)+h,p=Math.round((i.y+o)*a)+l,_=u+d/2,m=Math.round((i.y+o+r)*a),g=u-d/2;e.moveTo(g,p),e.lineTo(_,p),e.lineTo(u,m),e.lineTo(g,p)}}),Pe.set("PaneRendererXCross",class extends _e{_drawItemShapeUsingCSSPixels(e,t){const i=t.width,s=t.height,r=t.center-i/2,n=t.vertOffset,o=t.y-s/2+n;e.moveTo(r,o),e.lineTo(r+i,o+s),e.moveTo(r,o+s),e.lineTo(r+i,o)}_calcBoundingBox(e){const t=e.width,i=e.height,s=e.center-t/2,r=e.vertOffset,n=e.y-i/2+r,o=s,a=s+t,l=n,c=n+i,h=new te.Point(o,l),d=new te.Point(a,c);let u=(0,te.box)(h,d);const p=super._calcBoundingBox(e);return p&&(u=this._unionBox(u,p)),u}});class xe extends Ce.StudyPaneViewInplaceUpdatable{constructor(e,t,i,s){var r;super(i),this._renderer=null,this._shapesRenderer=null,this._selectionRenderer=null,this._isMarkersEnabled=W.enabled("source_selection_markers"),this._study=e,this._series=t,this._model=i,this._plotName=s;const n=e.metaInfo().plots;for(let e=0;ethis._createItem(e,null!=t?t:null,c,h,a)));let u=this._series.nearestIndex(r.firstBar(),y.PlotRowSearchMode.NearestRight),p=this._series.nearestIndex(r.lastBar(),y.PlotRowSearchMode.NearestLeft);if(void 0===u||void 0===p)return!1;a>0?(u-=a,p+=a):(u+=a,p-=a);const _=this._study.getMinFirstBarIndexForPlot(this._plotName);if(_>p)return!0;u=Math.max(_,u);const m=this._getTranspValue(),g=this._study.properties().childs().styles.childs()[this._plotName].childs(),f=g.color.value(),v=g.textColor?g.textColor.value():void 0,S=f,b=f,w=void 0===v?void 0:v,C=(0,o.ensureNotNull)(this._plotIndex),P=(0,ee.createEmptyStyle)(),x=null!=d?d:(0,o.ensureNotNull)(n.firstIndex()),T=n.rangeIterator(x,(0,o.ensureNotNull)(n.lastIndex())+1);let I=(0,we.lowerbound)(this._items,x+a,((e,t)=>e.timePointIndex9?i-10:0;s.borderColor=(0,p.generateColor)(s.color,e)}void 0!==t.colors[2]&&(s.textColor=(0,p.generateColor)((0,o.ensureDefined)(t.colors[2]),i))}_updateRenderer(e,t){this._makeSureRendererIsValid();const i=this._model.timeScale(),s={},r=this._getTranspValue(),n=i.barSpacing(),o=this._calculateShapeHeight(n),a=this._study.properties().childs().styles.childs()[this._plotName].childs(),l=a.location.value(),c=this._calculateVerticalOffset(l,o+o/2);s.barSpacing=n,s.items=this._items,s.color=(0,p.generateColor)(a.color.value(),r),s.height=o,s.vertOffset=c,s.visibleItemsRange={startItemIndex:e,endItemIndex:t};const h=a.plottype.value(),d=Z.plotShapesData[h],u=new H.CompositeRenderer;d&&(this._shapesRenderer?this._shapesRenderer.setData(s):(this._shapesRenderer=this._createRenderer(d.paneRendererClass,s),u.append(this._shapesRenderer))),this._model.selection().isSelected(this._study)&&this._isMarkersEnabled&&null!==this._selectionData&&(this._selectionData.vertOffset=c,u.append(new K.SelectionRenderer(this._selectionData))),this._renderer=u} -_createRenderer(e,t){const i=Pe.get(e);return new((0,o.ensureDefined)(i))(t)}_getSeriesVal(e,t){const i=(0,Q.barFunction)(e),s=this._series.data().valueAt(t);return null===s?null:i(s)}_getTranspValue(){let e=0;const t=this._study.properties().childs();t.transparency&&(e=t.transparency.value(),e=(0,V.isNumber)(e)?e:50);const i=t.styles.childs()[this._plotName].childs();return i.transparency&&(e=i.transparency.value(),e=(0,V.isNumber)(e)?e:50),(0,X.clamp)(e,0,100)}_createItem(e,t,i,s,r){const n=this._study.properties().childs().styles.childs()[this._plotName].childs().location.value(),a={origPrices:{price:NaN},timePointIndex:e+r};if((null===t||0===t)&&n!==b.MarkLocation.Absolute)return a;if(null==t)return a;let l=NaN;switch(n){case b.MarkLocation.AboveBar:{const t=this._getLocationPrice(e,i,r);if(null===t)return a;l=t;break}case b.MarkLocation.BelowBar:{const t=this._getLocationPrice(e,s,r);if(null===t)return a;l=t;break}case b.MarkLocation.Absolute:l=(0,o.ensureNotNull)(t);break;case b.MarkLocation.Top:case b.MarkLocation.Bottom:l=0;break;default:throw new Error("Bad value: "+n)}return{y:NaN,origPrices:{price:l},timePointIndex:e+r}}_dependsOnSeriesData(){const e=this._study.properties().childs().styles.childs()[this._plotName].childs().location.value();return e===b.MarkLocation.AboveBar||e===b.MarkLocation.BelowBar}_getValueForUpdating(e){const t=e.value[this._plotIndex+1];if(null==t)return null;const i=this._study.properties().childs().styles.childs()[this._plotName].childs().location.value();if(0===t&&i!==b.MarkLocation.Absolute)return null;const s=this._study.offset(this._plotName),{hiPlot:r,loPlot:n}=this._hiLoPlots();switch(i){case b.MarkLocation.AboveBar:return this._getLocationPrice(e.index,r,s);case b.MarkLocation.BelowBar:return this._getLocationPrice(e.index,n,s)}return super._getValueForUpdating(e)}_convertItemsToCoordinates(e,t,i,s){for(let e=i;e{for(let t=i;t19?o-10:0,u=this._calculateVerticalOffset(c,Math.round(1.5*l));n.barSpacing=a,n.items=this.items(),n.color=h,n.borderColor=(0,p.generateColor)(s.color.value(),d),n.height=l,n.vertOffset=u,n.visibleItemsRange={startItemIndex:e,endItemIndex:t};const _=s.plottype.value(),m=Z.plotShapesData[_],g=this._plotStyleInfo.text;if(void 0!==g&&""!==g.trim()){let e=g.trim().replace(/\\n/gm,"\n");e=(0,Y.cleanButAmpersand)(e,!0),n.text=e,n.fontSize=12;const t=s.textColor?s.textColor.value():void 0;n.textColor=t?(0,p.generateColor)(t,o):h}if(this._renderer&&this._shapesRenderer&&this._selectionRenderer)this._shapesRenderer.setData(n),this._model.selection().isSelected(this._study)&&this._isMarkersEnabled&&null!==this._selectionData?(this._selectionData.vertOffset=u,this._selectionRenderer.setData(this._selectionData)):this._selectionRenderer.setData(null);else{const e=new H.CompositeRenderer;this._shapesRenderer=super._createRenderer(m.paneRendererClass,n),e.append(this._shapesRenderer),this._selectionRenderer=new K.SelectionRenderer(null!==(i=this._selectionData)&&void 0!==i?i:void 0),this._model.selection().isSelected(this._study)&&this._isMarkersEnabled&&null!==this._selectionData?this._selectionData.vertOffset=u:this._selectionRenderer.setData(null),e.append(this._selectionRenderer),this._renderer=e}}}var Ie=i(87795),Me=i.n(Ie),Ae=i(45197);class Le extends pe{constructor(e,t){super(null,t),this._fontSizeEnsured=0,this._ch="",this._fontFamily=ue.CHART_FONT_FAMILY,this._charCache=null,null!==e&&this.setData(e)}setData(e){super.setData(e),this._fontSizeEnsured=(0,o.ensureDefined)(this._height);const t=e.char.slice(0,40);this._ch=Me()(t)[0]||" ",this._fontFamily=e.fontFamily||ue.CHART_FONT_FAMILY}hitTest(e){const t=(0,Ae.interactionTolerance)().series+this._fontSizeEnsured/2;for(const i of this._items){if(new te.Point(i.center,i.y+i.vertOffset).subtract(e).length()<=t)return new re.HitTestResult(re.HitTarget.Regular)}return null}_drawItemShape(e,t,i){const s=i.center,r=i.vertOffset>0?1:-1,n=i.y+i.vertOffset-r*Math.round(this._fontSizeEnsured/2);let o;o=i.style&&void 0!==i.style.color?i.style.color:this._color;const a=this._textImageCache(),l=t.pixelRatio;if(this._fontSizeEnsured<=4/l){e.save();const t=Math.max(1,Math.floor(l));let r=Math.max(1,Math.floor(a.textImageWidth*l));r%2!=t%2&&(r+=r>1?-1:1) -;const c=Math.round(n*l)+(i.vertOffset>=0?0:-r);return e.fillStyle=o,e.fillRect(Math.round(s*l)+(l%2?.5:0)-r/2,c,r,r),void e.restore()}const c={style:{fillStyle:o},location:{x:s,y:n,horzAlign:q.Center,vertAlign:i.vertOffset>0?$.Top:$.Bottom}};a.paintTo(e,t,c)}_startPath(e,t,i,s){}_endPath(e){}_textImageCache(){return null!==this._charCache&&this._charCache.fontFamily===this._fontFamily&&this._charCache.fontSize===this._fontSizeEnsured||(this._charCache={fontSize:this._fontSizeEnsured,fontFamily:this._fontFamily,cache:new he(this._ch,!1,!1,this._fontFamily,this._fontSizeEnsured,"center",0)}),this._charCache.cache}}class ke extends xe{constructor(){super(...arguments),this._charRenderer=new Le(null)}_updateRenderer(e,t){var i,s;const r=this._getTranspValue(),n=this._model.timeScale().barSpacing();let a;const l=this._study.properties().childs().styles.childs()[this._plotName].childs();a=this._plotStyleInfo.size?this._calculateShapeHeight(50,this._plotStyleInfo.size):Math.round(n);const c=l.location.value(),h=(0,p.generateColor)(l.color.value(),r),d=this._calculateVerticalOffset(c,a),u={items:this.items(),barSpacing:n,char:(0,o.ensureDefined)(null!==(s=null===(i=l.char)||void 0===i?void 0:i.value())&&void 0!==s?s:this._plotStyleInfo.char),height:a,vertOffset:d,color:h,visibleItemsRange:{startItemIndex:e,endItemIndex:t}},_=this._plotStyleInfo.text;if(void 0!==_&&""!==_.trim()){let e=_.trim().replace(/\\n/gm,"\n");e=(0,Y.cleanButAmpersand)(e,!0),u.text=e,u.fontSize=12;const t=l.textColor?l.textColor.value():void 0;u.textColor=t?(0,p.generateColor)(t,r):h}this._charRenderer.setData(u);const m=new H.CompositeRenderer;m.append(this._charRenderer),this._model.selection().isSelected(this._study)&&this._isMarkersEnabled&&null!==this._selectionData&&(this._selectionData.vertOffset=d,m.append(new K.SelectionRenderer(this._selectionData))),this._renderer=m}}var De=i(24377);class Ee{constructor(e,t,i,s,r){this.left=NaN,this.right=NaN,this.height=NaN,this.center=e,this.y=t,this.origHeight=i,this.isUp=s,this.origPrices=r,this.timePointIndex=e,this.style={}}}function Ve(e){return Math.round(e/4)}function Be(e){return Math.round(e/2)}class Re extends z.BitmapCoordinatesPaneRenderer{constructor(e){super(),this._data=e}hitTest(e){var t,i,s,r;const n=this._data,o=Be(n.barSpacing),a=Math.round(o/2),l=Math.round(o),c=Ve(n.barSpacing),h=null!==(i=null===(t=n.visibleItemsRange)||void 0===t?void 0:t.startItemIndex)&&void 0!==i?i:0,d=null!==(r=null===(s=n.visibleItemsRange)||void 0===s?void 0:s.endItemIndex)&&void 0!==r?r:n.items.length;for(const t of n.items.slice(h,d)){if(!t)continue;if(!Number.isFinite(t.center)||!Number.isFinite(t.y))continue;const i=Math.abs(t.height),s=t.isUp?-1:1,r=i+l,n=t.y-s*c,o=n-s*r,h=t.center-a,d=t.center+a;if(h0,{hiPlot:r,loPlot:n}=this._hiLoPlots(),a=this._study.offset(this._plotName),l=Math.min(i+a,(0, -o.ensureNotNull)(this._series.data().last()).index);if(s){const e=this._getSeriesVal(n,l);if(null!==e)return e}else{const e=this._getSeriesVal(r,l);if(null!==e)return e}return null}_updateItem(e,t){const i=this._getValueForUpdating(e),s=e.value[this._plotIndex+1]>0;return this._items[t].origPrices.price=null!=i?i:NaN,this._items[t].isUp=s,t+1}_createItem(e,t,i,s,r){const n={center:NaN,y:NaN,origPrices:{price:NaN,timePointIndex:NaN},origHeight:NaN};if(n.timePointIndex=e+r,!t)return n;const a=Math.min(e+r,(0,o.ensureNotNull)(this._series.data().last()).index),l=t>0;let c;if(l){const e=this._getSeriesVal(s,a);if(null===e)return n;c=e}else{const e=this._getSeriesVal(i,a);if(null===e)return n;c=e}return new Ee(e+r,c,t,l,{price:c,timePointIndex:e+r})}_dependsOnSeriesData(){return!0}_convertItemsToCoordinates(e,t,i,s){this._convertItemsToCoordinatesImpl(e,t,i,s)}_updateItemsHeights(e){var t,i,s,r,n,a,l,c;const h=this._study.properties().childs().styles.childs();let d=Math.abs((0,o.ensureDefined)(null!==(i=null===(t=h[this._plotName].childs().minHeight)||void 0===t?void 0:t.value())&&void 0!==i?i:this._plotStyleInfo.minHeight)),u=Math.abs((0,o.ensureDefined)(null!==(r=null===(s=h[this._plotName].childs().maxHeight)||void 0===s?void 0:s.value())&&void 0!==r?r:this._plotStyleInfo.maxHeight));if(d>u){const e=d;d=u,u=e}const p=this._items,_=null!==(a=null===(n=e.visibleItemsRange)||void 0===n?void 0:n.startItemIndex)&&void 0!==a?a:0,m=(null!==(c=null===(l=e.visibleItemsRange)||void 0===l?void 0:l.endItemIndex)&&void 0!==c?c:p.length)-1;let g=0;for(let e=_;e<=m;e++){const t=p[e],i=Math.abs(t.origHeight);i>g&&(g=i)}const f=(u-d)/g;for(let e=_;e<=m;e++){const t=p[e],i=Math.abs(t.origHeight);t.height=i*f+d}}}var Fe=i(77786);class We{constructor(e,t,i,s){this._bars=[],this._invalidated=!1,this._isMarkersEnabled=W.enabled("source_selection_markers"),this._selectionData=null,this._ohlcPlotIndexes=new Map,this._study=e,this._series=t,this._model=i,this._plotName=s,this._isMarkersEnabled=W.enabled("source_selection_markers"),this._colorProvider=(0,j.createStudyPlotColorProvider)(e.metaInfo(),e.properties(),s),this._selectionIndexer=new J.SelectionIndexes(i.timeScale());const r=this._study.metaInfo().plots;for(let e=0;es)return -;i=Math.max(r,i);const n=this._study.data(),a=this._study.firstValue();if(null===a)return;const l=n.rangeIterator(i,s),c=(0,o.ensureDefined)(this._study.properties().childs().ohlcPlots).childs()[this._plotName].childs(),h=new Map,d=(e,t)=>{const i=e+"@"+t;if(!h.has(i)){const s=(0,p.generateColor)(e,t);return h.set(i,s),s}return h.get(i)},u=(0,ee.createEmptyStyle)();for(const e of l){let t=e.index;const i=e.value;t=Math.floor(t);let s=!0;const r=new Map;for(let e=1;e<=4;++e){const t=this._ohlcPlotIndexes.get(e);if(void 0===t){s=!1;break}const n=i[t+1];if(null==n){s=!1;break}r.set(e,n)}if(!s)continue;const n=(0,o.ensureDefined)(r.get(1)),a=(0,o.ensureDefined)(r.get(4)),l=(0,o.ensureDefined)(r.get(2)),h=(0,o.ensureDefined)(r.get(3)),p=Math.max(n,l,h,a),_=Math.min(n,l,h,a);let m=(0,o.ensureDefined)(d(c.color.value(),0));const g=this._colorProvider.getPlotPointStyle(i,u);void 0!==g.colors[0]&&(m=(0,o.ensureDefined)(g.colors[0]));const f={time:Math.round(t),open:n,high:p,low:_,close:a,color:m,wickColor:g.colors[4],borderColor:g.colors[3],hollow:null};this._bars.push(f)}if(e.barPricesToCoordinates(this._bars,a),this._model.timeScale().barIndexesToCoordinates(this._bars),this._model.selection().isSelected(this._study)){const t=this._selectionIndexer.indexes();this._selectionData={points:[],hittestResult:re.HitTarget.Regular,bgColors:[],visible:!0,barSpacing:this._model.timeScale().barSpacing()};const i=(0,o.ensureNotNull)(this._model.paneForSource(this._study)).height(),s=(0,o.ensureDefined)(this._ohlcPlotIndexes.get(4));for(let r=0;r{var e;return this._colorPlotIndex=null!==(e=this._colorPlotIndex)&&void 0!==e?e:{type:1}};for(let t=0;t{null===this._bandAKey&&i.id===e&&(this._bandAKey=s),null===this._bandBKey&&i.id===t&&(this._bandBKey=s)}))}}var at=i(13333),lt=i(4949),ct=i(91280),ht=i(28558),dt=i(97145),ut=i(42960),pt=i(42226),_t=i(45802),mt=i(11527),gt=i(85402);class ft extends gt.AbstractBarColorer{constructor(e,t){super(),this._rgbaFromInteger=(0,Ze.rgbaFromIntegerCached)(),this._study=e,this._plotIndex=t}applyBarStyle(e,t,i,s){var r;if(t)return i;const n=this._study.properties().childs();if(!n.visible.value())return i;const a=this._study.metaInfo(),l=this._study.data();if(!l||0===l.size())return i;const c=a.plots[this._plotIndex],h=this._getOffset();if(this._study.getMinFirstBarIndexForPlot(c.id)>e+h)return i;if(0===n.styles.childs()[c.id].childs().display.value())return i;const d=l.valueAt(e-h);if(null===d)return i;let u=d[this._plotIndex+1];if(null==u)return i;if(u=Math.round(u),a.isRGB)i.barColor=this._rgbaFromInteger(u),i.upColor=i.barColor,i.downColor=i.barColor;else{const e=a.plots[this._plotIndex];if("palette"in e){const t=e.palette,s=n.palettes.childs()[t],l=(0,o.ensureDefined)(null===(r=a.palettes)||void 0===r?void 0:r[t]),c=l.valToIndex?(0,o.ensureDefined)(l.valToIndex[u]):u,h=s.childs().colors.childs()[c].childs().color.value();i.barColor=h,i.upColor=h,i.downColor=h}}return i}firstColoredBar(e){var t;let i=e;for(const s of this._backColorers)i=Math.min(i,null!==(t=s.firstColoredBar(e))&&void 0!==t?t:1/0);const s=this._getOffset();i=Math.min(i,e+s);const r=this._getBars().firstIndex();return Math.max(i,null!=r?r:-1/0)}_getBars(){return this._study.series().bars()}_getOffset(){const e=this._study.metaInfo().plots[this._plotIndex];return this._study.offset(e.id)}}var vt=i(76422),St=i(85804),yt=i(17236),bt=i(46100),wt=i(38349),Ct=i(6674),Pt=i(71766),xt=i(98596),Tt=i(93572),It=(i(74970),i(72007)),Mt=i(1763);const At=(0,c.getLogger)("Chart.Study"),Lt=l.t(null,void 0,i(14177));const kt={symbolsForDisplay:!1,symbolsForChartApi:!0, -skipHiddenInputs:!1,skipFakeInputs:!1,skipBooleanInputs:W.enabled("dont_show_boolean_study_arguments"),asObject:!0,skippedGroups:[],skippedInputs:[],noExchanges:!1,noResolution:!1,keepOptionalSymbolsEmpty:!1,skipColorInputs:!1,skipTimeInputs:!1,skipOptionalEmptySymbolInputs:!1,skipTextareaInputs:!1,priceInputsForDisplay:!1},Dt=W.enabled("study_symbol_ticker_description"),Et=W.enabled("hide_main_series_symbol_from_indicator_legend"),Vt=W.enabled("datasource_copypaste"),Bt=W.enabled("hide_unresolved_symbols_in_legend");function Rt(e,t){const i=e.plots[t];if(!i||!(0,T.isOhlcPlot)(i))return!1;const s=i.target,r=e.defaults.styles&&e.defaults.styles[s],n=e.defaults.ohlcPlots&&e.defaults.ohlcPlots[s],o=e.ohlcPlots&&e.ohlcPlots[s];return r&&(0,T.isOhlcPlotStyleBars)(r)||n&&(0,T.isOhlcPlotStyleBars)(n)||!!o&&(0,T.isOhlcPlotStyleBars)(o)}function Nt(e,t){const i=e.plots[t];if(!i||!(0,T.isOhlcPlot)(i))return!1;const s=i.target,r=e.defaults.styles&&e.defaults.styles[s],n=e.defaults.ohlcPlots&&e.defaults.ohlcPlots[s],o=e.ohlcPlots&&e.ohlcPlots[s];return r&&(0,T.isOhlcPlotStyleCandles)(r)||n&&(0,T.isOhlcPlotStyleCandles)(n)||!!o&&(0,T.isOhlcPlotStyleCandles)(o)}function Ot(e,t){(0,o.assert)(void 0!==e,"zOrder must be defined"),(0,o.assert)(!t.has(e),"zOrder must be unique")}function Ft(e,t){return e.plots.some((e=>((0,T.isColorerPlot)(e)||(0,T.isDataPlot)(e))&&e.target===t))}function Wt(e){const t={};if(e.plots)for(let i=0;i= 1");const r=v.StudyMetaInfo.getStudyPropertyRootName(e),o=(0,V.clone)(e.defaults),l=Ht();if((0,n.default)(l,Wt(e)),(0,n.default)(l,o),(0,n.default)(l,(0,St.factoryDefaults)(r)),(0,n.default)(l,zt(e,s,r)),(0,n.default)(l,t),(0,n.default)(l,Ut(o,l)),null!==i){const t=i.model().studiesColorRotatorFactory().getColorRotator(e);null!==t&&("Overlay@tv-basicstudies"===e.id?l.lineStyle.color=t.getColor(l.lineStyle.color):(0,n.default)(l,function(e,t){for(const i of Object.keys(e.styles)){const s=e.styles[i];if((0,a.isObject)(s)&&"color"in s){const e=s.color;s.color=t.getColor(e)}} -return e}(l,t)))}return l}function Gt(e,t,i,s,r){return function(e,t,i,s,r,n){const o=jt(e,t,i,s);return v.StudyMetaInfo.getSourceInputIds(e).forEach(((e,t)=>{const i=o.inputs[e];t=1&&(0,n.default)(d,Ut(l,d)),d}(e,t,i,s,o);return $t(t||e,r,a)}function Kt(e,t,i,s,r){return Yt(e,t,i,s,v.StudyMetaInfo.getStudyPropertyRootName(e),r)}function Zt(e,t,i){let s=0,r=0;return e.inputs.filter((e=>"source"===e.type)).forEach((e=>{(0,F.getInputValue)(i[e.id]).includes("$")&&s++,(0,F.getInputValue)(t[e.id]).includes("$")&&r++})),Math.sign(r)-Math.sign(s)}function Xt(e,t){return{type:at.StudyStatusType.Error,errorDescription:e}}function Jt(e){return"inherit"===e.type&&(e.type="price"),e}function Qt(e,t,i,s){var r,n;{const t=(0, -V.isNumber)(s)?s:void 0,o=null!==(n=null===(r=null===Mt.customFormatters||void 0===Mt.customFormatters?void 0:Mt.customFormatters.studyFormatterFactory)||void 0===r?void 0:r.call(Mt.customFormatters,e,i,t))&&void 0!==n?n:null;if(null!==o)return o}if(null!==t)switch(e.type){case"inherit":case"price":return new Pt.PriceFormatter(t);case"volume":return new xt.VolumeFormatter(Math.log10(t));case"percent":return new Tt.PercentageFormatter(t)}if("inherit"===e.type)return null;const o=(0,V.isNumber)(e.precision)?Math.pow(10,e.precision):void 0;switch(e.type){case"price":return new Pt.PriceFormatter(o);case"volume":{let t=e.precision;return void 0===t&&(t=i&&(0,V.isNumber)(i.volume_precision)?i.volume_precision:0),new xt.VolumeFormatter(t)}case"percent":return new Tt.PercentageFormatter(o);default:return At.logWarn(`Unsupported format type: ${e.type}`),null}}const ei=new Set(["first_visible_bar_time","last_visible_bar_time","subscribeRealtime"]);class ti extends m.PriceDataSource{constructor(e,t,i,s){var r,n,a;super(e),this._onStart=new u.Delegate,this._restarting=!1,this._paneViews=[],this._legendView=null,this._priceAxisViews=[],this._resolvedSymbols={},this._resolvedSymbolsByInput={},this._priceAxisViewsBase=[],this._priceLinesAxisViews=[],this._labelPaneViews=[],this._ownFirstValue=null,this._formatter=null,this._dataUpdated=new u.Delegate,this._currencySourceSymbolInputProperty=null,this._onHibernationStateChange=new u.Delegate,this._symbolsResolved=new u.Delegate,this._statusChanged=new u.Delegate,this._inputsAnchorsPaneView=null,this._inputsLinesPaneView=null,this._inputsTimeAxisPaneViews=[],this._inputsPriceAxisPaneViews=[],this._sources=[],this._status={type:at.StudyStatusType.Undefined},this._wasCompletedBefore=!1,this._studyId=null,this._isSubscribedToSessionId=!1,this._titleStrCache={},this._titleInPartsCache={},this._children=[],this._numericFormatter=new B.NumericFormatter,this._graphicsPriceAxisViews=[],this._plotOffsets={},this._ongoingDataUpdate=Promise.resolve(),this._studyModified=!1,this._tagsChanged=new u.Delegate,this._studyName="",this._turnaround="st0",this._pendingResolveSymbols=new Map,this._onIsActualIntervalChange=new u.Delegate,this._childStudyByRebind=new u.Delegate,this._lastNonEmptyPlotRowCache={},this._startMovingPoint=null,this._processHibernateBound=this.processHibernate.bind(this,1),this._maxOffset=new dt.WatchedValue(0),this._currencySourceSymbolInfo=null,this._graphicsPriceRangeGroups=null,this._graphicsViewsReady=!1,this._visibleTimeRangeInputs=null,this._turnaroundCounter=0,this._deferredPinePatchProps=!1,this._propertiesPatched=Promise.resolve(),this._aboutToBeDestroyed=new u.Delegate,this._definitionsViewModel=null,this._plotFormatters=new Map,this._onParentSourcesChanges=new u.Delegate,this._chartApi=e.chartApi(),this._properties=t,this._metaInfo=s,this._series=this._model.mainSeries(),this._series.onIntervalChanged().subscribe(this,this._calcIsActualInterval), -this._showStudyArgumentsProperty=e.properties().childs().paneProperties.childs().legendProperties.childs().showStudyArguments,e.collapsed().subscribe(this._processHibernateBound),this._sources=i,v.StudyMetaInfo.setChildStudyMetaInfoPropertiesSourceId(s,null===(r=this._sources[0])||void 0===r?void 0:r.id(),t),i.forEach((e=>{e.setChild(this)})),[this._series,...i].forEach((e=>{e.currencyChanged().subscribe(this,this._onSourceCurrencyChanged),e.unitChanged().subscribe(this,this._onSourceUnitChanged),e.priceRangeReadyChanged().subscribe(this,this._onSourcePriceRangeReadyChanged),e.formatterChanged().subscribe(this,this._onSourceFormatterChanged),e.priceStepChanged().subscribe(this,this._onSourcePriceStepChanged)})),Dt&&this._model.mainSeries().properties().childs().statusViewStyle.childs().symbolTextSource.listeners().subscribe(this,(()=>{this.invalidateTitleCache(!0)}));const l=this._properties.childs();for(const e of v.StudyMetaInfo.getSourceInputIds(s))null===(n=l.inputs.childs()[e])||void 0===n||n.subscribe(this,this._onSourceInputChanged);this._properties.subscribe(this,this._onPropertiesChanged),l.visible.subscribe(this,this._visibleChanged),l.visible.subscribe(this,(()=>this.processHibernate())),l.intervalsVisibilities.subscribe(this,this._calcIsActualInterval),l.inputs.listeners().subscribe(this,this._updateMaxOffsetValue),void 0!==l.offsets&&l.offsets.listeners().subscribe(this,this._updateMaxOffsetValue),void 0!==l.offset&&l.offset.listeners().subscribe(this,this._updateMaxOffsetValue),this._initializeCurrencySource(),M.hideAllIndicators().subscribe(this,this._visibleChanged);for(let e=0;ethis.processHibernate()))}for(const e of Object.keys(this._metaInfo.graphics))for(const t of Object.keys(this._metaInfo.graphics[e])){const i=null===(a=l.graphics.childs()[e])||void 0===a?void 0:a.childs()[t];i&&i.childs().visible&&(0,o.ensureDefined)(i.childs().visible).subscribe(this,(()=>this.processHibernate()))}this._isActualInterval=(0,lt.isActualInterval)(this._series.intervalObj(),l.intervalsVisibilities),this._initializeStudyInputsPaneViews(),this._handler=e=>this._onData(e),this._handler.isTVScriptStrategy=this._metaInfo.isTVScriptStrategy,this._valuesProvider=new C.StudyValuesProvider(this,e),this._graphics=new S.LiveStudyGraphics(s.graphics),this._chartApi=e.chartApi(),this._invalidateLastNonEmptyPlotRowCache(),this._data=new f.PlotList((0,It.studyPlotFunctionMap)(this._metaInfo),It.studyEmptyPlotValuePredicate),this._createViews(),this._recreatePriceFormattingDependencies(this._series.symbolInfo()),l.precision.subscribe(this,this._precisionChanged),this._showStudyArgumentsProperty.subscribe(this,(()=>this.invalidateTitleCache(!0))),l.inputs.listeners().subscribe(this,(()=>this.invalidateTitleCache(!0))),W.enabled("update_study_formatter_on_symbol_resolve")&&e.mainSeries().dataEvents().symbolResolved().subscribe(this,this._recreatePriceFormattingDependencies), -e.mainSeries().dataEvents().symbolResolved().subscribe(this,(()=>this.invalidateTitleCache(!0)));const c=new Set;if(this._simplePlotsCount=s.plots.filter(((e,t)=>{if((0,T.isLinePlot)(e))return!0;if((0,T.isOhlcPlot)(e)){const t=e.target;return!c.has(t)&&(c.add(t),!0)}return!1})).length,this.hasBarColorer()&&l.visible.listeners().subscribe(this,(()=>e.mainSeries().invalidateBarStylesCache)),this._definitionsViewModel=null,this._updateMaxOffsetValue(),s.inputs.some((e=>ei.has(e.id)))){this._visibleTimeRangeInputs=e.visibleRangeStudiesInputs().spawn();const t=this._visibleTimeRangeInputs.value();let i=null!==t;this._visibleTimeRangeInputs.subscribe((e=>{this._onVisibleTimeRangeInputsChanged(e),i!==(null!==e)&&(i=null!==e,!i||this._restarting||this.isStarted()||this.start(!0))})),t&&this._updateVisibleTimeRangeInputs(t,!1)}}destroy(){var e,t,i;null===(e=this._signlePerformanceValue)||void 0===e||e.destroy(),this._aboutToBeDestroyed.fire(),null!==this._definitionsViewModel&&(this._definitionsViewModel.destroy(),this._definitionsViewModel=null),this._showStudyArgumentsProperty.unsubscribeAll(this),this._model.mainSeries().dataEvents().symbolResolved().unsubscribeAll(this);this.parentSources().forEach((e=>{e.currencyChanged().unsubscribeAll(this),e.unitChanged().unsubscribeAll(this),e.priceRangeReadyChanged().unsubscribeAll(this),e.formatterChanged().unsubscribeAll(this),e.priceStepChanged().unsubscribeAll(this)})),this._series.properties().childs().statusViewStyle.childs().symbolTextSource.unsubscribeAll(this),this._series.onIntervalChanged().unsubscribeAll(this),this.formatterChanged().unsubscribe(this,this.invalidateTitleCache),M.hideAllIndicators().unsubscribe(this,this._visibleChanged),this._model.collapsed().unsubscribe(this._processHibernateBound),null!==this._currencySourceSymbolInputProperty&&this._currencySourceSymbolInputProperty.unsubscribeAll(this),null===(t=this._legendView)||void 0===t||t.destroy(),null===(i=this._visibleTimeRangeInputs)||void 0===i||i.destroy(),super.destroy()}properties(){return this._properties}propertiesPatched(){return this._propertiesPatched}isDraggable(){return!this._metaInfo.linkedToSeries}logs(){return null}logLevelMask(){const e=this._properties.childs().inputs.childs().__log_level.value();if(!(0,V.isNumber)(e)||e<0||e>7)throw new Error(`Value of log level is unexpected, current value is ${e}, but expected values from 0 to 7`);return{error:Boolean(1&e),warning:Boolean(2&e),info:Boolean(4&e)}}setLogLevelMask(e){const t=(Number(e.error)&&1)|(Number(e.warning)&&2)|(Number(e.info)&&4);this._properties.childs().inputs.childs().__log_level.setValue(t)}performance(){return new dt.WatchedValue(null)}profilingEnabled(){return this._properties.childs().inputs.childs().__profile.value()}enableProfiling(e){this._properties.childs().inputs.childs().__profile.setValue(e)}onAboutToBeDestroyed(){return this._aboutToBeDestroyed}lastValueData(e,t,i){const s={noData:!0},r=this.priceScale();if(this._model.timeScale().isEmpty()||null===r||r.isEmpty()||this.data().isEmpty())return s -;const n=this._model.timeScale().visibleBarsStrictRange(),o=this.firstValue(!0);if(null===n||null===o)return s;if(!this._properties.childs().visible.value())return s;const a=this._properties.childs().styles,l=this._properties.childs().ohlcPlots;let c,h;if(a&&a.childs()[e]&&(c=a.childs()[e]),l&&l.childs()[e]&&(c=l.childs()[e]),!c||0===c.childs().display.value())return s;const d=this.metaInfo().plots;for(h=0;he.id()));if(c.length&&(l.parentSources=c),e){let e=this.data();const t=this._model.timeScale(),i=this._seriesDataRangeToSave(e);null!==i&&(e=e.range(i.firstBar(),i.lastBar())),l.data=e.state(),l.data.symbols=this._resolvedSymbols,l.data.graphics=(0,S.saveStudyGraphics)(this.graphics(),t.visibleBarsStrictRange()),l.data.plotOffsets=this._plotOffsets}this.ownerSource()&&(l.ownerSource=null===(i=this.ownerSource())||void 0===i?void 0:i.id());for(let e=0;e=0?e:0}}if(null===(s=l.state)||void 0===s?void 0:s.inputs){const e=l.metaInfo.inputs.find((e=>"ILScript"===e.name));e&&delete l.state.inputs[e.id],delete l.state.inputs.__log_level,delete l.state.inputs.__profile}const d=this.stateCustomFields();return d&&(l.customFields=d),l}stateCustomFields(){}restoreStateCustomFields(e){}restoreData(e){var t,i;this._invalidateLastNonEmptyPlotRowCache(),this.data().restoreState(e),this._resolvedSymbols=null!==(t=e.symbols)&&void 0!==t?t:{},this._graphics=e.graphics?(0,S.loadStudyGraphics)(e.graphics):(0,S.emptyStudyGraphics)(),this._postProcessGraphics(),this._plotOffsets=null!==(i=e.plotOffsets)&&void 0!==i?i:{},this._setStatus({ -type:at.StudyStatusType.Completed},!0)}hasStateForAlert(){return!1}stateForAlert(){throw new Error("Not implemented")}idForAlert(){return super.idForAlert()}hasBarColorer(){return(0,o.ensureNotNull)(this._metaInfo).plots.some(T.isBarColorerPlot)}barColorer(){const e=this._metaInfo.plots;let t=null;for(let i=0;i"bar_time"!==e.type))}restart(e){this._restarting=!0,this.clearData(),(e||W.enabled("stop_study_on_restart"))&&this.stop(),setTimeout(this.start.bind(this),0)}stop(e,t){if(!0===e&&this._children)for(const e of this._children)e.stop(!0);this._stopStudyOnServer(),this.clearData(),this._unsubscribeToSessionId(),this.recalculate()}disconnect(){this._studyId=null,this._model.isSnapshot()||(this._resolvedSymbols={},this._resolvedSymbolsByInput={})}sourceId(){return this._studyId}parentSources(){return this._sources}symbolSource(){return this._firstSourceOrSeries().symbolSource()}valueAt(e,t){return this.symbolSource().valueAt(e,t)}barsProvider(){return this._firstSourceOrSeries().barsProvider()}ownerSource(){return this.isChildStudy()?this._sources[0]:super.ownerSource()}isChildStudy(){return this._sources.length>0}hasChildren(){return this._children.length>0}isStarted(){return Boolean(this._studyId)}isRestarting(){return this._restarting}isActualInterval(){return this._isActualInterval}onIsActualIntervalChange(){return this._onIsActualIntervalChange}isVisible(){var e,t,i;const s=this._properties.childs();if(this._model.collapsed().value()||!s.visible.value()||!this.isActualInterval())return!1;const r=this.metaInfo();if(r.plots.length>0)for(let e=0;ee.isHibernated())).map((e=>e.start())));const r=!(this.isHibernationAllowed()&&!this.isVisible())||!0===t;if(this._chartApi&&this._chartApi.isConnected().value()&&r)try{await this._allSymbolsAreResolved(),await this._startAfterSymbolsResolved(e,t)}catch(e){const t=`ERROR: ${this._debugId()} start failed, ${e}`;At.logError(t),this._restarting=!1,"TooManyStudies"===(null==e?void 0:e.cause)&&(0,d.showTooManyStudiesNotice)(this._chartApi.getStudyCounter())}}replaceData(e,t,i){this._invalidateLastNonEmptyPlotRowCache(),this.data().remove(e+1), -this.data().addTail(i,t)}inputs(e){const t=(0,n.default)((0,V.clone)(kt),e||{});t.skipOptionalEmptySymbolInputs&&(t.keepOptionalSymbolsEmpty=!0);const i=(0,r.default)(this._buildInputs(t));return t.patchSosInputs&&v.StudyMetaInfo.patchSoSInputs(i,(e=>{var t,i;return null!==(i=null===(t=this._sources.find((t=>t.id()===e)))||void 0===t?void 0:t.sourceId())&&void 0!==i?i:null})),i}data(){return this._data}moveData(e){this._ongoingDataUpdate=this._ongoingDataUpdate.then((()=>{this._invalidateLastNonEmptyPlotRowCache(),this.data().move(e)}))}plots(){return this.data()}metaInfo(){return this._metaInfo}status(){return this._status}name(e){return e?this.metaInfo().shortDescription||"Study":this.metaInfo().description||"Study"}title(e,t,i,s,r){s=void 0===s?!this._showStudyArgumentsProperty.value():s;const n=JSON.stringify([e,t,i,s,r]);if(this._titleStrCache[n])return this._titleStrCache[n];if(this._titleInPartsCache[n])return this._joinTitlesParts(this._titleInPartsCache[n]);const o=this._title(e,t,i,s,r);return this._titleStrCache[n]=o,o}titleInParts(e,t,i,s,r){s=void 0===s?!this._showStudyArgumentsProperty.value():s;const n=JSON.stringify([e,t,i,s,r]);if(this._titleInPartsCache[n])return this._titleInPartsCache[n];const o=this._titleInParts(e,t,i,s,r);return this._titleInPartsCache[n]=o,o}invalidateTitleCache(e){if(this._titleStrCache={},this._titleInPartsCache={},!0===e&&this._children)for(let t=0;tt.update(e))),this._labelPaneViews.forEach((t=>t.update(e))),null===(t=this._dataWindowView)||void 0===t||t.update(),null===(i=this._legendView)||void 0===i||i.update(),null===(s=this._statusView)||void 0===s||s.update(),this._priceAxisViews.forEach((t=>t.update(e))),this._priceLinesAxisViews.forEach((t=>t.update(e))),null===(r=this._inputsLinesPaneView)||void 0===r||r.update(e),null===(n=this._inputsAnchorsPaneView)||void 0===n||n.update(e),this._inputsTimeAxisPaneViews.forEach((t=>t.update(e))),this._inputsPriceAxisPaneViews.forEach((t=>t.update(e))),"data-source-change"===e.type&&e.sourceId===this.id()&&e.clearData&&this._children.forEach((e=>e.updateAllViews({type:"data-source-change",sourceId:e.id(),clearData:!0})))}removeByRemoveAllStudies(){return!0}getStudyName(){return this._studyName}nearestIndex(e,t,i){var s;return null===(s=this.data().search(e,t,i))||void 0===s?void 0:s.index} -getMinFirstBarIndexForPlot(e){var t,i,s,r,n,o,a,l,c,h,d,u,p,_,m;const g=this._properties.childs(),f=this._metaInfo,v=null!==(m=null!==(u=null!==(c=null!==(o=null!==(s=null===(i=null===(t=g.styles.childs()[e])||void 0===t?void 0:t.child("showLast"))||void 0===i?void 0:i.value())&&void 0!==s?s:null===(n=null===(r=g.filledAreasStyle.childs()[e])||void 0===r?void 0:r.child("showLast"))||void 0===n?void 0:n.value())&&void 0!==o?o:null===(l=null===(a=f.styles)||void 0===a?void 0:a[e])||void 0===l?void 0:l.showLast)&&void 0!==c?c:null===(d=null===(h=g.ohlcPlots.childs()[e])||void 0===h?void 0:h.child("showLast"))||void 0===d?void 0:d.value())&&void 0!==u?u:null===(_=null===(p=f.ohlcPlots)||void 0===p?void 0:p[e])||void 0===_?void 0:_.showLast)&&void 0!==m?m:null;if(null===v)return-1/0;const S=this.data().lastIndex();return null===S?-1/0:S-v+1}guiPlotName(e,t){var i,s,r;return null!==(r=null===(s=null===(i=this._metaInfo.styles)||void 0===i?void 0:i[t])||void 0===s?void 0:s.title)&&void 0!==r?r:this.title(e)}childStudyByRebind(){return this._childStudyByRebind}isPine(){return void 0!==this._metaInfo.pine}isStandardPine(){return this.isPine()&&v.StudyMetaInfo.isStandardPine(this._metaInfo.id)}isLinkedToSeries(){return!0===this._metaInfo.linkedToSeries}defaultPlotIdForAlert(){return this._metaInfo.plots.length?this._metaInfo.plots[0].id:null}resolvedSymbolInfoBySymbol(e){return this._resolvedSymbols&&e&&this._resolvedSymbols[this._getSymbolForResolve(e)]||null}hasPendingUnresolvedSymbols(){return this._pendingResolveSymbols.size>0}hasSymbolInputs(){return this._metaInfo.inputs.some((e=>"symbol"===e.type))}currency(){if(null!==this._currencySourceSymbolInfo)return(0,ut.symbolCurrency)(this._currencySourceSymbolInfo);const e=this.metaInfo();return Boolean(e)&&e.is_price_study?this._firstSourceOrSeries().currency():null}currencySourceSymbolInfo(){var e,t,i;return null!==(e=this._currencySourceSymbolInfo)&&void 0!==e?e:null!==(i=null===(t=this.symbolSource())||void 0===t?void 0:t.symbolInfo())&&void 0!==i?i:null}unit(){const e=this.metaInfo();return Boolean(e)&&e.is_price_study?this._firstSourceOrSeries().unit():null}canOverrideMinTick(){return!1}dataWindowView(){return this._dataWindowView}statusView(){return this._statusView}legendView(){return this._legendView}inputsForAlertState(){return this.inputs()}sessionId(){return this._firstSourceOrSeries().sessionId()}sessionIdChanged(){return this._firstSourceOrSeries().sessionIdChanged()}getSymbolString(e){return""===e?"":(0,L.encodeExtendedSymbolOrGetSimpleSymbolString)(this._getSymbolObject(e))}onStatusChanged(){return this._statusChanged}symbolsResolved(){return this._symbolsResolved}onHibernationStateChange(){return this._onHibernationStateChange}valuesProvider(){return new x(this,this.model())}statusProvider(e){return new E.StudyStatusProvider(this,this._model.properties().childs().scalesProperties.childs().textColor)}correctScaleMargins(e){if("Volume"===this.metaInfo().shortId){const t=this.model().paneForSource(this);return null!==t&&t.isOverlay(this)&&t.containsMainSeries()?{ -top:.75,bottom:0}:{top:e.top,bottom:0}}return e}canBeHiddenByGlobalFlag(){return!0}isSourceHidden(){return!this.isVisible()||this.canBeHiddenByGlobalFlag()&&M.hideAllIndicators().value()}paneViews(e){if(this.isSourceHidden()||!e.hasPriceDataSource(this))return null;const t=[];return!this._startMovingPoint&&this._wasCompletedBefore&&t.push(...this._paneViews),this._inputsLinesPaneView&&(this._startMovingPoint||this._model.selection().isSelected(this))&&t.push(this._inputsLinesPaneView),this._inputsAnchorsPaneView&&t.push(this._inputsAnchorsPaneView),t}labelPaneViews(){return this.isSourceHidden()?null:this._labelPaneViews}timeAxisViews(){return this._model.selection().isSelected(this)?this._inputsTimeAxisPaneViews:null}priceAxisViews(e,t){const i=this._properties.childs().oldShowLastValue;if(i&&!i.value())return null;let s=this._priceAxisViews.slice();return this._model.selection().isSelected(this)&&(s=s.concat(this._inputsPriceAxisPaneViews)),e.findTargetPriceAxisViews(this,t,s,this._priceLinesAxisViews)}movable(){return null!==this._inputsAnchorsPaneView}startMoving(e,t,i,s){this._startMovingPoint=e,this.stop()}move(e,t,i,s){if(void 0!==e.logical&&null!==this._startMovingPoint){if(Array.isArray(t)){const i=t;this._updateInputValue(e.logical,i[0]),this._updateInputValue(e.logical,i[1])}else this._updateInputValue(e.logical,t);this.updateAllViews((0,ht.sourceChangeEvent)(this.id()))}}endMoving(e,t){return this._startMovingPoint=null,this.start(),{indexesChanged:!1,pricesChanged:!1}}clearData(){var e;this._invalidateLastNonEmptyPlotRowCache(),this.data().clear(),this._graphics instanceof S.LiveStudyGraphics&&(null===(e=this._graphics)||void 0===e||e.clear()),this._plotOffsets={},this.hasBarColorer()&&this._model.mainSeries().invalidateBarStylesCache(),this.updateAllViews((0,ht.sourceChangeEvent)({sourceId:this.id(),clearData:!0}))}convertYCoordinateToPriceForMoving(e,t){const i=this.priceScale();if(!t||!i||i.isEmpty())return null;const s=t.firstValue();return null===s?null:i.coordinateToPrice(e,s)}processHibernate(e){const t=this.isVisible();if(!this.isStarted()&&t&&(this._sources.forEach((e=>{e.processHibernate()})),this.start(void 0,void 0,e),this._onHibernationStateChange.fire(!1)),this.isHibernationAllowed()&&this.isStarted()&&!t){for(const e of this._children)e.processHibernate();this.stop(void 0,e),this._onHibernationStateChange.fire(!0)}}isHibernationAllowed(){return!this.metaInfo().historyCalculationMayChange&&(!this.hasChildren()||!!this._model.collapsed().value()&&this._children.every((e=>e.isHibernationAllowed())))}isPlotVisibleAt(e,t){let i;const s=this.metaInfo().plots.find((t=>t.id===e));if(i=void 0!==s?(0,T.isOhlcPlot)(s)?this._properties.childs().ohlcPlots.childs()[s.target]:this._properties.childs().styles.childs()[e]:this._properties.childs().ohlcPlots.childs()[e],void 0===i)throw new Error(`Study does not contain ${e} plot`);const r=i.childs().display.value();return null!==r&&(r&t)===t}recalculate(){const e=this._model.paneForSource(this);this._model.recalculatePane(e,(0, -ht.sourceChangeEvent)(this.id())),this._model.updateSource(this)}maxOffset(){return this._maxOffset}onStart(){return this._onStart}onParentSourcesChanges(){return this._onParentSourcesChanges}isHibernated(){return!this.isVisible()&&!this.isStarted()}graphicsViewsReady(){return this._graphicsViewsReady}turnaround(e){if(!e)return this._turnaround;return function(e,t){let i=t.turnaround,s=[t];for(;s.length>0;){let e=[];const t=[];s.forEach((i=>{const s=N(i.sourceStudies).sort(R);if(s.length>0){e=e.concat(s);const i=s.map((e=>e.turnaround)).join("_");t.push(i)}})),t.length&&(i=t.join("_")+"_"+i),s=e}return e+"_"+i}(this._series.seriesSource().turnaround(),O(this))}canHaveChildren(){var e;return this._canHaveChildren=null!==(e=this._canHaveChildren)&&void 0!==e?e:v.StudyMetaInfo.canHaveChildren(this._metaInfo),this._canHaveChildren}setChild(e){-1===this._children.indexOf(e)&&this._children.push(e)}unsetChild(e){const t=this._children.indexOf(e);~t&&this._children.splice(t,1)}getAllChildren(){const e=this._children.slice();for(let t=0;te.id()===i)))&&void 0!==t?t:null}return this._series}priceStep(){return this._priceStep||this._firstSourceOrSeries().priceStep(!1)}recreatePriceFormatter(){this._recreatePriceFormattingDependencies()}setOwnerSource(e){super.setOwnerSource(e),this._recreatePriceFormattingDependencies()}onTagsChanged(){return this._tagsChanged}getPropertyDefinitionsViewModel(){return null===this._definitionsViewModel?this._getPropertyDefinitionsViewModelClass().then((e=>null===e||this._isDestroyed?null:(null===this._definitionsViewModel&&(this._definitionsViewModel=new e(this._model.undoModel(),this)),this._definitionsViewModel))):Promise.resolve(this._definitionsViewModel)}_getPropertyDefinitionsViewModelClass(){return Promise.resolve(null)}_alertMetaInfo(){return this.metaInfo()}_createStudyOnServer(){if(this._isDestroyed)return;const e=this._getStudyIdWithLatestVersion();this._studyId=(0,k.makeNextStudyId)(),this._incrementTurnaround(),this._studyName=e;const t=(0,V.clone)((0,o.ensureDefined)(this._inputs));v.StudyMetaInfo.patchSoSInputs(t,(e=>{var t,i;return null!==(i=null===(t=this._sources.find((t=>t.id()===e)))||void 0===t?void 0:t.sourceId())&&void 0!==i?i:null})),this._chartApi.createStudy(this._studyId,this._turnaround,this.isChildStudy()?(0,o.ensureNotNull)(this._sources[0].sourceId()):(0,o.ensureNotNull)(this._series.seriesSource().instanceId()),this._studyName,t,this._handler,this.isChildStudy())}_stopStudyOnServer(){this._chartApi&&this._chartApi.isConnected().value()&&this.isStarted()&&(this._chartApi.removeStudy((0,o.ensureNotNull)(this._studyId),this.isChildStudy()),this._setStatus({type:at.StudyStatusType.Undefined})),this._studyId=null}_modifyStudyOnServer(e,t){const i=(0,V.clone)((0,o.ensureDefined)(e));v.StudyMetaInfo.patchSoSInputs(i,(e=>{var t,i +const i=new m(this,{name:e[t]});this._priceAxisViews.push(i),this._labelPaneViews.push(new g.PanePriceAxisView(i,this,this._model))}this._dataWindowView||(this._dataWindowView=new f.StudyDataWindowView(this,this._model)),this._statusView||(this._statusView=new v.StudyStatusView(this)),this._legendView=null,this._pricesView=new w(this)}_postProcessGraphics(){}_getActualCacheParams(){const e=this.properties().childs(),t=e.levelsStyle.childs().colors.childs();return{font:d.CHART_FONT_FAMILY,fontSize:e.fontsize.value(),backColors:[t.P.value(),t["S1/R1"].value(),t["S1/R1"].value(),t["S2/R2"].value(),t["S2/R2"].value(),t["S3/R3"].value(),t["S3/R3"].value(),t["S4/R4"].value(),t["S4/R4"].value(),t["S5/R5"].value(),t["S5/R5"].value()]}}}var B=i(64063),R=i(8561),N=i(43583),O=i(52329),F=i(11542);class W extends n.Study{constructor(e,t,i,s){super(e,t,i,s)}base(){return 1}destroy(){super.destroy()}showOnTopOnHovering(){return!1}_titleInParts(e,t,i,s,r){const n=super._titleInParts(e,t,i,s,r),o=this._getVolumeUnit();return o&&(n[0]+=` · ${o}`),n}_skippedTitleInputs(){return super._skippedTitleInputs()}_getVolumeUnit(){const e=this.symbolSource().symbolInfo();return e?function(e){switch(e.volume_type){case"base":return e.base_currency;case"quote":return e.currency;case"tick":return F.t(null,void 0,i(30973))}}({...e,currency:e.original_currency_code||e.currency_code}):void 0}}var H=i(97145),z=i(88640),U=i(42960),j=i(97121),G=i(24954);class q extends n.Study{constructor(e,t,i,s){super(e,function(e){return e.hasChild("currencyId")||e.addChild("currencyId",new z.default(null)),e.hasChild("unitId")||e.addChild("unitId",new z.default(null)),e.addExclusion("currencyId"),e.addExclusion("unitId"),e}(t),i,s),this._isActingAsSymbolSource=new H.WatchedValue(!1),this._symbolHibernated=new H.WatchedValue(!1),this._symbolResolvingActive=new H.WatchedValue(!1),this._realignToolsLastParams=null,this._lastResolvedSymbolSource="",this._onIsActingAsSymbolSourceChanged=()=>{this._recreatePriceFormattingDependencies(),this._realignLineToolsIfParamsChanged()},this._recalculateIsActingAsSymbolSource(),this._isActingAsSymbolSource.subscribe(this._onIsActingAsSymbolSourceChanged);const r=this.properties().childs().inputs.childs().symbol;this._previousSymbolInputValue=r.value()}isActingAsSymbolSource(){return this._isActingAsSymbolSource.readonly()}properties(){return this._properties}symbol(){return this._isActingAsSymbolSource.value()?this.properties().childs().inputs.childs().symbol.value():this.symbolSource().symbol()}symbolChanged(){return this._isActingAsSymbolSource.value()?this.properties().childs().inputs.childs().symbol.listeners():this.symbolSource().symbolChanged()}interval(){return this.model().mainSeries().interval()}style(){return this._firstSourceOrSeries().symbolSource().style()}currency(){return this._isActingAsSymbolSource.value()?this.properties().childs().currencyId.value()||null:this.symbolSource().currency()}unit(){return this._isActingAsSymbolSource.value()?this.properties().childs().unitId.value()||null:this.symbolSource().unit()} +symbolParams(){return(0,j.symbolParams)(this)}compareSymbolParams(e){return(0,j.compareSymbolParams)(this,e,this._model.unitConversionEnabled())}setSymbolParams(e){this._setSymbolParamsInternal(e)}setSymbol(e){this.setSymbolParams({symbol:e})}symbolInfo(){var e;if(!this._isActingAsSymbolSource.value())return super.symbolSource().symbolInfo();const t=this._getSymbolForResolve(this.symbol());return null!==(e=this._resolvedSymbols[t])&&void 0!==e?e:null}symbolSource(){return this._isActingAsSymbolSource.value()?this:super.symbolSource()}symbolResolved(){return this.symbolsResolved()}symbolResolvingActive(){return this._symbolResolvingActive}symbolHibernated(){return this._symbolHibernated}isVisible(){const e=super.isVisible();return this._symbolHibernated.setValue(!e),e}symbolSameAsCurrent(e){return(0,j.symbolSameAsCurrent)(e,this.symbolInfo())}symbolSameAsResolved(e){return(0,G.symbolSameAsResolved)(e,this._lastResolvedSymbolSource,this.symbol())}setCurrency(e){this.setSymbolParams({currency:e})}isConvertedToOtherCurrency(){return(0,U.isConvertedToOtherCurrency)(this.symbolInfo())}setUnit(e){this.setSymbolParams({unit:e})}isConvertedToOtherUnit(){return(0,U.isConvertedToOtherUnit)(this.symbolInfo(),this._model.unitConversionEnabled())}setInterval(e){}setStyle(e){}symbolTitle(e,t,i){return this.title(e,!0,{},!1,t)}measureUnitId(){return(0,U.measureUnitId)(this.symbolInfo())}bars(){return super.data()}dataUpdated(){return this._dataUpdated}_onPropertiesChanged(){this._recalculateIsActingAsSymbolSource(),super._onPropertiesChanged(),this._realignLineToolsIfParamsChanged()}async _tryChangeInputs(){var e;const t=this._resolvedSymbolsByInput[this.symbol()]||null;(0,j.symbolSameAsCurrent)(this._previousSymbolInputValue,t)||this._setSymbolParamsInternal({currency:null,unit:null}),await super._tryChangeInputs(),this._formatter=null,null===(e=this.priceScale())||void 0===e||e.updateFormatter(),this._previousSymbolInputValue=this.properties().childs().inputs.childs().symbol.value()}_getSymbolObject(e){const t={symbol:e},i=this.currency();null!==i&&(t["currency-id"]=i);const s=this.unit();return this._model.unitConversionEnabled()&&null!==s&&(t["unit-id"]=s),t}_onSymbolResolved(e,t,i){super._onSymbolResolved(e,t,i),this._recreatePriceFormattingDependencies();const s=t===this.symbol()?(0,U.extractSymbolNameFromSymbolInfo)(i,this.symbol()):null;null!==s&&(this._previousSymbolInputValue=s);const r=(0,U.symbolCurrency)(i),n=(0,U.symbolUnit)(i,this._model.unitConversionEnabled());this._setSymbolParamsInternal({symbol:null!=s?s:void 0,currency:r,unit:n},i),this._symbolResolvingActive.setValue(!1)}_onSymbolResolvingStart(e,t){this._lastResolvedSymbolSource=t,super._onSymbolResolvingStart(e,t),this._symbolResolvingActive.setValue(!0)}_onSymbolError(){super._onSymbolError(),this._symbolResolvingActive.setValue(!1)}_onCurrencyMayChange(){this.isActingAsSymbolSource()?super._onCurrencyMayChange():this._onCurrencyChanged()}_recalculateIsActingAsSymbolSource(){var e,t +;const i=null!==(t=""!==(null===(e=this._currencySourceSymbolInputProperty)||void 0===e?void 0:e.value()))&&void 0!==t&&t;this._isActingAsSymbolSource.setValue(i)}_setSymbolParamsInternal(e,t){const{symbol:i,currency:s,unit:r}=e,n=this.properties().childs(),o=n.inputs.childs().symbol.value(),a=n.currencyId.value(),l=n.unitId.value();if(void 0!==i&&n.inputs.childs().symbol.setValueSilently(i),void 0!==s&&n.currencyId.setValueSilently(s),void 0!==r&&n.unitId.setValueSilently(r),t)this._resolvedSymbolsByInput[this.symbol()]=t,this._resolvedSymbols[this._getSymbolForResolve(this.symbol())]=t,this._realignToolsLastParams=null;else{const e=this.symbolInfo();null!==e&&(n.currencyId.setValueSilently((0,U.symbolCurrency)(e)),n.unitId.setValueSilently((0,U.symbolUnit)(e,this._model.unitConversionEnabled())))}n.inputs.childs().symbol.value()!==o&&n.inputs.childs().symbol.listeners().fire(n.inputs.childs().symbol,""),n.currencyId.value()!==a&&n.currencyId.listeners().fire(n.currencyId,""),n.unitId.value()!==l&&n.unitId.listeners().fire(n.unitId,""),this._realignLineToolsIfParamsChanged()}_realignLineToolsIfParamsChanged(){let e=null===this._realignToolsLastParams;if(null!==this._realignToolsLastParams){const t=this.compareSymbolParams(this._realignToolsLastParams);e=t.symbolChanged||t.intervalChanged||t.currencyChanged||t.unitChanged}e&&(this._model.realignLineTools(this),this._realignToolsLastParams=this.symbolParams())}}class $ extends u.PriceAxisView{constructor(e,t){super(),this._source=e,this._styleId=t}_updateRendererData(e,t,i){var s;e.visible=!1;const r=this._source.priceScale(),n=this._source.properties().childs();if(!r||r.isEmpty()||!n.visible.value())return;const o=null===(s=this._source.properties().childs().graphics.childs().horizlines)||void 0===s?void 0:s.childs()[this._styleId].childs();if(!(o&&o.visible&&o.visible.value()&&this._isLabelVisibleAccordinglyToProperties()))return;const a=this._source.model().timeScale().logicalRange(),l=this._source.firstValue();if(null===l||null===a)return;const c={price:NaN,time:-1/0},h=this._source.graphics().horizlines().get(this._styleId);if(void 0===h)return;for(const e of h){if(void 0===e.level)continue;const t=a.contains(e.startIndex,!0);t===a.contains(e.endIndex,!0)&&0!==t||c.timenew $(this,e)))}_createStudyPlotPaneView(e){return new Y.StudyPlotPaneView(this,this._series,this._model,e,this._needExtendToBarsEnding())}_apiInputs(){return{...super._apiInputs(),mapRightBoundaryToBarStartTime:!!this._needExtendToBarsEnding()||void 0}}_needExtendToBarsEnding(){var e;return void 0!==(null===(e=this.metaInfo().defaults.inputs)||void 0===e?void 0:e.mapRightBoundaryToBarStartTime)}}class Z extends K{priceRange(e,t){let i=!1;this.graphics().hhists().forEach(((e,t)=>{var s;i=i||(0,o.ensureDefined)(null===(s=this.properties().childs().graphics.childs().hhists)||void 0===s?void 0:s.childs()[t]).value()}));const s=function(e,t,i,s){let r=null;return e.forEach(((e,s)=>{e.forEach((e=>{e.firstBarTime<=i&&e.lastBarTime>=t&&(null===r?r={low:{l:e.priceLow,h:e.priceHigh},high:{h:e.priceHigh}}:(e.priceLow{"use strict";i.d(t,{StudyBaseWindowView:()=>n});var s=i(93835),r=i(37591);class n extends s.DataWindowView{constructor(e,t){super(),this._invalidated=!0,this._study=e,this._model=t,this._valueProvider=this._createValuesProvider(e,t),this._items=this._valueProvider.getItems().map((e=>new s.DataWindowItem(e.id,e.title,""))),this.update()}update(){this._invalidated=!0}items(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),this._items}study(){return this._study}_updateImpl(){this._header=this._study.title(r.TitleDisplayTarget.DataWindow,!0),this._title=this._study.title(r.TitleDisplayTarget.DataWindow);const e=this._valueProvider.getValues(this._currentIndex());for(let t=0;t{"use strict";i.d(t,{StudyColorRotatorFactory:()=>h});var s=i(33013),r=i(24377),n=i(87095),o=i(28853);const a=["color-sky-blue-400","color-banana-yellow-700","color-deep-blue-500","color-grapes-purple-a700","color-iguana-green-500","color-minty-green-a600","color-ripe-red-a200","color-berry-pink-200","color-tv-blue-a100","color-tan-orange-a200","color-sky-blue-a400","color-deep-blue-a100","color-grapes-purple-400","color-iguana-green-a700","color-minty-green-200","color-ripe-red-200","color-berry-pink-a200","color-ripe-red-500","color-grapes-purple-500","color-deep-blue-400","color-tv-blue-a200","color-sky-blue-500","color-iguana-green-400","color-minty-green-400","color-banana-yellow-600","color-tan-orange-500","color-berry-pink-400","color-ripe-red-300","color-grapes-purple-300","color-deep-blue-300","color-tv-blue-300","color-sky-blue-300","color-iguana-green-300","color-minty-green-300","color-banana-yellow-400","color-tan-orange-300","color-berry-pink-300","color-tan-orange-a700"];class l{constructor(e){this._offset=0,this._offset=e}getColor(e){if(0===this._offset)return e;const t=a[(this._offset-1)%a.length],i=s.colorsPalette[t],o=(0,n.isHexColor)(e)?1:(0,r.parseRgba)(e)[3];return(0,n.generateColor)(i,(0,n.alphaToTransparency)(o))}}class c{constructor(e,t){this._offset=e,this._modelStartOffset=t}getColor(e){if((0,n.isHexColor)(e)){const t=(0,r.parseRgb)(e);return(0,r.rgbToHexString)((0,r.shiftRgb)(t,this._offset,this._modelStartOffset))}{const t=(0,r.parseRgba)(e);return(0,r.rgbaToString)((0,r.shiftRgba)(t,this._offset,this._modelStartOffset))}}}class h{constructor(e){this._chartModel=e}getColorRotator(e){const t=(0,o.studyColorRotationMode)(e);if(null===t)return null;const i=this._calcDefaultColorsOffset(e);switch(t){case"loop":return new l(i);case"shift":{const e=this._chartModel.getStudyShiftColorStartOffset();return new c(i,e)}}}_calcDefaultColorsOffset(e){let t=0;const i=(0,o.useSameColorRotationComparator)(e);return this._chartModel.dataSources().filter(o.isStudy).forEach((s=>{ +i(e,s.metaInfo())&&t++})),t}}},94739:(e,t,i)=>{"use strict";i.d(t,{StudyDataSource:()=>p});var s=i(50151),r=i(57898),n=i(97034),o=i(1115),a=i(19171),l=i(72007),c=i(83435),h=i(75319);const d=(0,i(59224).getLogger)("Chart.StudyDataSource");var u;!function(e){e[e.Idle=0]="Idle",e[e.AwaitingConnection=1]="AwaitingConnection",e[e.AwaitingParent=2]="AwaitingParent",e[e.AwaitingFirstDataUpdate=3]="AwaitingFirstDataUpdate",e[e.Active=4]="Active"}(u||(u={}));class p{constructor(e,t,i,s){this._inputs=null,this._status=u.Idle,this._studyId=null,this._turnaroundCounter=1,this._studyStatus={type:h.StudyStatusType.Undefined},this._studyStatusChanged=new r.Delegate,this._dataCleared=new r.Delegate,this._dataUpdated=new r.Delegate,this._boundOnGatewayIsConnectedChanged=this._onGatewayIsConnectedChanged.bind(this),this._ongoingDataUpdate=Promise.resolve(),this._gateway=e,this._metaInfo=s,this._seriesSource=t,this._turnaroundPrefix=i,this._plots=new n.PlotList((0,l.studyPlotFunctionMap)(s),l.studyEmptyPlotValuePredicate),this._gateway.isConnected().subscribe(this._boundOnGatewayIsConnectedChanged),this._graphics=new c.LiveStudyGraphics(s.graphics)}destroy(){this.stop(),this._gateway.isConnected().unsubscribe(this._boundOnGatewayIsConnectedChanged),this._seriesSource.dataEvents().created().unsubscribeAll(this)}metaInfo(){return this._metaInfo}inputs(){return this._inputs}setInputs(e){this._inputs=e,null!==this._studyId&&(this._turnaroundCounter++,this._onStudyStatusChangedTo({type:h.StudyStatusType.Undefined}),this._gateway.modifyStudy(this._studyId,this._turnaround(),e,this._onMessage.bind(this)),this._status===u.Active&&this._changeStatusTo(u.AwaitingFirstDataUpdate))}isStarted(){return this._status!==u.Idle}isActive(){return this._status===u.Active}start(){this.isStarted()?d.logNormal("start: data source is already started, nothing to do"):((0,s.assert)(null!==this._inputs,"Inputs should be defined when starting a study data source"),this._gateway.isConnected().value()?this._createStudy():this._changeStatusTo(u.AwaitingConnection))}stop(){this.isStarted()?(null!==this._studyId&&(this._gateway.removeStudy(this._studyId),this._studyId=null,this._onStudyStatusChangedTo({type:h.StudyStatusType.Undefined})),this._changeStatusTo(u.Idle)):d.logNormal("stop: data source is already stopped, nothing to do")}studyId(){return this._studyId}studyStatus(){return this._studyStatus}studyStatusChanged(){return this._studyStatusChanged}plots(){return this._plots}graphics(){return this._graphics}clearData(){this._plots.clear(),this._graphics.clear(),this._dataCleared.fire()}stopAndStealData(){(0,s.assert)(this._status===u.Active,"Couldn't steal data from non-active data source"),this.stop();const e=this._plots,t=this._graphics.extract();return this._plots=new n.PlotList((0,l.studyPlotFunctionMap)(this._metaInfo),l.studyEmptyPlotValuePredicate),{plots:e,graphics:t}}dataCleared(){return this._dataCleared}dataUpdated(){return this._dataUpdated}moveData(e){this._ongoingDataUpdate=this._ongoingDataUpdate.then((()=>{this._plots.move(e)}))} +pendingUpdatesReady(){return this._ongoingDataUpdate}_createStudyError(e){return{type:h.StudyStatusType.Error,errorDescription:this._getStudyErrorDescription(e)}}_getStudyErrorDescription(e){return"string"==typeof e?{error:e.split(":",2)[0]}:e}_changeStatusTo(e){(0,s.assert)(this._status!==e,"Source and destination status should be distinct"),d.logNormal(`Status changed from ${u[this._status]} to ${u[e]}`),this._status=e}_createStudy(){const e=this._seriesSource.instanceId();null!==e?this._createStudyUsingParentId(e):(this._changeStatusTo(u.AwaitingParent),this._seriesSource.dataEvents().created().subscribe(this,this._onSeriesCreated,!0))}_createStudyUsingParentId(e){(0,s.assert)(this._status!==u.Active,'Status should not be "Active" when creating a study'),(0,s.assert)(this._studyStatus.type===h.StudyStatusType.Undefined,'Study status should be "Undefined" when creating a study'),(0,s.assert)(null===this._studyId,"Study id should be empty when creating a study"),this._studyId=(0,a.makeNextStudyId)(),this._gateway.createStudy(this._studyId,this._turnaround(),e,this._metaInfo.fullId+("tv-basicstudies"===this._metaInfo.packageId?"":"!"),(0,s.ensureNotNull)(this._inputs),this._onMessage.bind(this)),this._changeStatusTo(u.AwaitingFirstDataUpdate)}_onGatewayIsConnectedChanged(e){e?this._onGatewayConnected():this._onGatewayDisconnected()}_onGatewayConnected(){this._status===u.AwaitingConnection&&this._createStudy()}_onGatewayDisconnected(){this._status!==u.Idle&&this._status!==u.AwaitingConnection&&(this._studyId=null,this._changeStatusTo(u.AwaitingConnection),this._studyStatus.type!==h.StudyStatusType.Undefined&&this._onStudyStatusChangedTo({type:h.StudyStatusType.Undefined})),this._turnaroundCounter=1}_onSeriesCreated(){this._status===u.AwaitingParent&&this._createStudyUsingParentId((0,s.ensure)(this._seriesSource.instanceId()))}_onStudyStatusChangedTo(e){const t=this._studyStatus;this._studyStatus=e,d.logNormal(`Study status type changed from ${h.StudyStatusType[t.type]} to ${h.StudyStatusType[e.type]}`),this._studyStatusChanged.fire(t,e)}_onMessage(e){if("data_update"===e.method){const{customId:t,turnaround:i,plots:r,nonseries:n}=e.params;t===this._studyId&&this._checkTurnaround(i)&&this._onDataUpdate(r,(0,s.ensureDefined)(n))}else if("study_loading"===e.method){const[t,i,s]=e.params;t===this._studyId&&this._checkTurnaround(i)&&this._onStudyLoading(s)}else if("study_completed"===e.method){const[t,i,s]=e.params;t===this._studyId&&this._checkTurnaround(i)&&this._onStudyCompleted(s)}else if("study_error"===e.method){const[t,i,s,r,n]=e.params;t===this._studyId&&this._checkTurnaround(i)&&this._onStudyError(s,r,n)}else"clear_data"===e.method&&this._checkTurnaround(e.params.turnaround)&&this.clearData()}_onDataUpdate(e,t){const i=(0,o.unpackNonSeriesData)(t.d);return this._ongoingDataUpdate=this._ongoingDataUpdate.then((()=>i),(()=>i)).then(this._onDataUnpacked.bind(this,e,t.indexes)),this._ongoingDataUpdate}_onDataUnpacked(e,t,i){ +this._status!==u.Idle&&(this._status===u.AwaitingFirstDataUpdate&&(this._changeStatusTo(u.Active),this.clearData()),this._mergePlots(e),null!==i&&(i.indexes_replace?((0,s.assert)("nochange"!==t),this._graphics.replaceIndexesTo(t)):("nochange"!==t&&this._graphics.replaceIndexesTo(t),void 0!==i.graphicsCmds&&this._graphics.processCommands(i.graphicsCmds))),this._dataUpdated.fire(e,i,t))}_onStudyLoading(e){this._onStudyStatusChangedTo({type:h.StudyStatusType.Loading,startTime:Date.now()})}_onStudyError(e,t,i){this.clearData(),this._onStudyStatusChangedTo(this._createStudyError(e))}_onStudyCompleted(e){this._onStudyStatusChangedTo({type:h.StudyStatusType.Completed})}_mergePlots(e){this._plots.merge(e)}_turnaround(){return`${this._turnaroundPrefix}${this._turnaroundCounter}`}_checkTurnaround(e){const t=this._turnaround();return e===t||e===this._seriesSource.turnaround()||e===`${this._seriesSource.turnaround()}_${t}`}}},88318:(e,t,i)=>{"use strict";i.d(t,{StudyDataWindowView:()=>a});var s=i(70512),r=i(54303),n=i(40484);class o{constructor(e,t){this._study=e,this._model=t,this._hhistBasedStudy=void 0!==e.metaInfo().graphics.hhists,this._valuesProvider=this._createValuesProvider(e,t)}getItems(){return this._valuesProvider.getItems()}getValues(e){const t=this._valuesProvider.getValues(e),i=e=>!!this._hhistBasedStudy||this._study.isPlotVisibleAt(e,2);for(const e of t)e.visible=e.visible&&i(e.id);return t}_createValuesProvider(e,t){return this._hhistBasedStudy?new n.HHistBasedValuesProvider(e,t):new r.StudyValuesProvider(e,t)}}class a extends s.StudyBaseWindowView{_createValuesProvider(e,t){return new o(e,t)}}},72007:(e,t,i)=>{"use strict";function s(e){const t=new Map;return e.plots.forEach(((e,i)=>{t.set(e.id,(e=>e[i+1]))})),t}function r(e,t){return null==e[t]}i.d(t,{studyEmptyPlotValuePredicate:()=>r,studyPlotFunctionMap:()=>s})},70826:(e,t,i)=>{"use strict";function s(e,t){return`${e}@${t}`}function r(e){return e.replace(/(@[^-]+-[^-]+).*$/,"$1")}i.d(t,{extractStudyId:()=>r,studyIdString:()=>s})},33703:(e,t,i)=>{"use strict";i.d(t,{ChartColorDependentStudyInputNames:()=>n,InputDisplayFlags:()=>s,RangeDependentStudyInputNames:()=>r,areStudyInputsEqual:()=>d,editableStudyInputs:()=>p,getInputValue:()=>c,isExtendedInput:()=>a,isExtendedInputSource:()=>l,isStudyInputDependsOnChartColors:()=>_,isStudyInputOptionsInfo:()=>h,isTimeOrPriceNotHiddenInput:()=>u});var s,r,n,o=i(98279);function a(e){return(0,o.default)(e)}function l(e){return"source"===e.t}function c(e){return a(e)?e.v:e}function h(e){return["text","integer","float","price","session","resolution"].includes(e.type)&&e.hasOwnProperty("options")}function d(e,t,i){for(const s of e)if(t[s.id]!==i[s.id])return!1;return!0}function u(e){return("time"===e.type||"price"===e.type)&&!0!==e.isHidden}function p(e){return[]}function _(e){return Object.values(n).map((e=>e)).includes(e.id)}!function(e){e[e.None=0]="None",e[e.DataWindow=2]="DataWindow",e[e.StatusLine=8]="StatusLine",e[e.All=15]="All"}(s||(s={})),function(e){e.FirstBar="first_visible_bar_time", +e.LastBar="last_visible_bar_time",e.Realtime="subscribeRealtime"}(r||(r={})),function(e){e.FgColor="__chart_fgcolor",e.BgColor="__chart_bgcolor"}(n||(n={}))},97340:(e,t,i)=>{"use strict";i.d(t,{StudyInserter:()=>h});var s=i(42856),r=i(1722),n=i(74970),o=i(85804),a=i(59744);const l=(0,i(59224).getLogger)("Chart.Studies.StudyInserter"),c=/^PUB;.*/;class h{constructor(e,t){this._parentSources=[],this._propsState=void 0,this._preferredPriceScale=void 0,this._allowChangeCurrency=!1,this._allowChangeUnit=!1,this._paneSize=void 0,this._forceOverlay=!1,this._inserterImpl=t,this._studyDescriptor=e}setParentSources(e){this._parentSources=e}setPaneSize(e){this._paneSize=e}setPreferredPriceScale(e){this._preferredPriceScale=e}setAllowChangeCurrency(e){this._allowChangeCurrency=e}setAllowChangeUnit(e){this._allowChangeUnit=e}setForceOverlay(e){this._forceOverlay=e}setPropertiesState(e){this._propsState=e}setTargetPriceScaleMode(e){this._targetPriceScaleMode=e}async insert(e,t){var i,h;const d=void 0!==(u=this._inserterImpl).createStub&&void 0!==u.removeStub?this._inserterImpl.createStub():null;var u;let p,_=!0;try{p=await(0,n.studyMetaInfoRepository)().findById(this._studyDescriptor)}catch(e){l.logWarn(`Cannot get study ${JSON.stringify(this._studyDescriptor)}`);const t=this._studyDescriptor.pineId,s=c.test(t),r=!!(null===(i=null==e?void 0:e.errors)||void 0===i?void 0:i.length);return s&&r?Promise.reject(a.InsertionErrorCode.CannotCompilePub):Promise.reject(a.InsertionErrorCode.CannotGetMetainfo)}finally{null!==d&&(_=this._inserterImpl.removeStub(d))}if(!_)return Promise.reject(a.InsertionErrorCode.StubWasRemoved);if(void 0!==t&&t.cancelled)return Promise.reject(a.InsertionErrorCode.Cancelled);if(!this._canApplyStudyToParent(p))return Promise.reject(a.InsertionErrorCode.StudyCannotBeChild);const m={...p.defaults.inputs};let g={};if(void 0!==e){const t=s.StudyMetaInfo.getStudyPropertyRootName(p),i=(0,r.clone)((0,o.defaults)(t));(0,r.merge)(m,i.inputs);const n=await e(m,p.inputs,p);g=n.inputs,this._parentSources=null!==(h=n.parentSources)&&void 0!==h?h:[]}if(void 0!==t&&t.cancelled)return Promise.reject(a.InsertionErrorCode.Cancelled);const f=this._insertStudy(p,g);return null===f?Promise.reject(a.InsertionErrorCode.Unknown):(await f.startPromise,f.study)}_insertStudy(e,t){return this._inserterImpl.createStudy(e,t,null,this._propsState,this._forceOverlay,this._parentSources,this._preferredPriceScale,this._allowChangeCurrency,this._allowChangeUnit,this._paneSize,this._targetPriceScaleMode)}_canApplyStudyToParent(e){return 0===this._parentSources.length||s.StudyMetaInfo.canBeChild(e)}}},74970:(e,t,i)=>{"use strict";i.d(t,{studyMetaInfoRepository:()=>_});var s=i(95171),r=i(11542),n=i(50151),o=i(42856),a=i(97087),l=i(18923),c=i(59224),h=i(51608);(0,c.getLogger)("Chart.Studies.StudyMetaInfoRepository",{color:"#606"});class d{constructor(e){this._isReady=!1,this._rawStudiesMetaInfo=[],this._rawStudiesMetaInfoDeferredPromise=null,this._javaStudiesMetaInfo=[],this._pineMetaInfoCache=[],this._studiesMigrations=[],this._chartApi=e} +async requestMetaInfo(){if(null===this._rawStudiesMetaInfoDeferredPromise){this._rawStudiesMetaInfoDeferredPromise=(0,h.createDeferredPromise)(),this._rawStudiesMetaInfoDeferredPromise.promise.finally((()=>{this._rawStudiesMetaInfoDeferredPromise=null})),this._requestStarted();const e=(await this._chartApi.requestMetadata()).params[1].metainfo.slice();this._processLibraryMetaInfo(e),this._requestFinished(),this._rawStudiesMetaInfoDeferredPromise.resolve(this._rawStudiesMetaInfo)}return this._rawStudiesMetaInfoDeferredPromise.promise}async findById(e){this._isReady||await this.requestMetaInfo();const t=this._findStudyMetaInfo(e);return null!==t?Promise.resolve(t):"pine"===e.type?this._compilePine(e):Promise.reject(`unexpected study id=${e.studyId} with type=${e.type}`)}findByIdSync(e){return this._findStudyMetaInfo(e)}isReady(){return this._isReady}async findAllJavaStudies(){return this._isReady||await this.requestMetaInfo(),this._javaStudiesMetaInfo}getInternalMetaInfoArray(){return this._javaStudiesMetaInfo}getMigrations(){return this._studiesMigrations}addPineMetaInfo(e){return p(this._pineMetaInfoCache,e)}async getLatestMetaInfoForPineStudy(e,t){return null}_processMigrations(e){throw new Error("not implemented")}_processSiteMetaInfo(e,t){throw new Error("not implemented")}_processLibraryMetaInfo(e){for(const t of e)u(t),p(this._javaStudiesMetaInfo,t);this._javaStudiesMetaInfo=this._javaStudiesMetaInfo.sort(((e,t)=>{const i=e.description_localized||e.description,s=t.description_localized||t.description;return i>s?1:it.id===e.studyId))||null:this._pineMetaInfoCache.find((t=>t.scriptIdPart===e.pineId&&(void 0===e.pineVersion||(0,n.ensureDefined)(t.pine).version===e.pineVersion)))||null}_compilePine(e){throw new Error("unsupported")}}function u(e){e.description_localized=r.t(e.description,{context:"study"},i(68716))}function p(e,t){const i=new o.StudyMetaInfo(t);(0,a.migrateMetaInfoAndPropState)(i);let s=!0;const r=e.findIndex((e=>e.id===i.id));if(-1===r)e.push(i);else{const t=e[r],n=void 0!==t.pine?l.Version.parse(t.pine.version):null,o=void 0!==i.pine?l.Version.parse(i.pine.version):null;null===o||null===n||o.isGreaterOrEqual(n)?(t.removeDefaults(),e[r]=i):s=!1}return s&&i.createDefaults(),i}const _=(0,s.default)((()=>new d(window.ChartApiInstance)))},99672:(e,t,i)=>{"use strict";i.d(t,{StudyStatusProviderBase:()=>l});var s=i(11877),r=i(13333),n=i(37591);const o={NONE:"Default"},a=!1;class l extends s.StatusProviderBase{constructor(e,t){super(t),this._source=e}getSplitTitle(){return this._source.titleInParts(n.TitleDisplayTarget.StatusLine,!0,o,void 0,a)}text(){ +return this._source.isActualInterval()?this._source.isFailed()?`${this._source.title(n.TitleDisplayTarget.StatusLine,!0,o,void 0,a)}: ${this.sourceStatusText()}`:`${this._source.title(n.TitleDisplayTarget.StatusLine,!0,o,void 0,a)} ${this.sourceStatusText()}`:this._source.title(n.TitleDisplayTarget.StatusLine,!0,o,void 0,a)}sourceStatusText(){return(0,r.convertStudyStatusToString)(this._source.status(),!0)}errorStatus(){if(!this._source.isActualInterval()||this._source.isSymbolInvalid())return null;const e=this._source.status();return e.type===r.StudyStatusType.Error?{error:this.sourceStatusText(),solutionId:(0,r.studyStatusSolutionId)(e),title:(0,r.studyStatusTitle)(e),studyFeature:(0,r.studyStatusFeature)(e)}:null}}},6892:(e,t,i)=>{"use strict";i.d(t,{StudyStatusProvider:()=>n});var s=i(11542),r=(i(13333),i(99672));s.t(null,void 0,i(47542));class n extends r.StudyStatusProviderBase{constructor(e,t){super(e,t),this._study=e}color(){return this._study.isFailed()||this._study.metaInfo&&this._study.metaInfo().isTVScriptStub?"#ff0000":super.color()}sourceStatusText(){this._study.status();return super.sourceStatusText()}}},90830:(e,t,i)=>{"use strict";i.d(t,{StudyStatusView:()=>r});var s=i(79055);class r extends s.StatusView{constructor(e){super(e.statusProvider())}color(){return this._statusProvider.color()}getSplitTitle(){return this._statusProvider.getSplitTitle()}update(){this._text=this._statusProvider.text()}}},13333:(e,t,i)=>{"use strict";i.d(t,{StudyStatusType:()=>c,convertStudyStatusToString:()=>h,studyStatusFeature:()=>p,studyStatusSolutionId:()=>d,studyStatusTitle:()=>u});var s=i(11542);const r=new Map([["You cannot see this pivot timeframe on this resolution",s.t(null,void 0,i(17126))],["The data vendor doesn't provide volume data for this symbol.",s.t(null,void 0,i(29198))],['Histogram is too large, please increase "Row Size" input.',s.t(null,void 0,i(69085))],["Histogram is too large, please reduce 'Row Size' input.",s.t(null,void 0,i(8122))],["This script is invite-only. To request access, please contact its author.",s.t(null,void 0,i(74986))],["Volume Profile indicator available only on our upgraded plans.",s.t(null,void 0,i(61022))],["VOLUME_BIST_MIXED",s.t(null,void 0,i(82772))]]),n=s.t(null,void 0,i(16971));const o=new Map,a=new Map,l=s.t(null,void 0,i(30295));var c;function h(e,t){if(e.type===c.Loading)return t?l:"loading...";if(e.type===c.Error){const s=e.errorDescription,n=t?(i=s.error,r.get(i)||i):s.error;if(s.ctx){const e={};return Object.entries(s.ctx).forEach((([t,i])=>{e[t]=i.toString()})),n.format(e)}return n}var i;return""}function d(e){if(e.type===c.Error)return e.errorDescription.solution_id?e.errorDescription.solution_id:function(e){for(const t of Array.from(o.keys()))if(e.includes(t))return o.get(t)}(e.errorDescription.error)}function u(e){if(e.type===c.Error)return function(e){const t=e.toLowerCase();return t.includes("the data vendor doesn't provide volume data for this symbol.")||t.includes("no volume is provided by the data vendor") +}(e.errorDescription.error)?n:e.errorDescription.title}function p(e){const{errorDescription:{error:t}}=e;for(const[e,i]of a)if(t.startsWith(e))return i}!function(e){e[e.Undefined=0]="Undefined",e[e.Loading=1]="Loading",e[e.Completed=2]="Completed",e[e.Error=3]="Error"}(c||(c={}))},52329:(e,t,i)=>{"use strict";i.d(t,{StudyStub:()=>g});var s=i(91280),r=i(90830),n=i(80842),o=i(71766),a=i(57898),l=i(88640),c=i(99672),h=i(37591);class d extends c.StudyStatusProviderBase{text(){return this._source.isActualInterval()?`${this._source.title(h.TitleDisplayTarget.StatusLine)} ${this.sourceStatusText()}`:this._source.title(h.TitleDisplayTarget.StatusLine)}}var u=i(13333),p=i(53588);class _{getItems(){return[]}getValues(e){return[]}}const m=new a.Delegate;class g extends n.PriceDataSource{constructor(e,t,i,s){super(e),this._priceStep=.01,this._status={type:u.StudyStatusType.Undefined},this._statusChanged=new a.Delegate,this._formatter=new o.PriceFormatter(100),this._origState=t,this._title=i,this._alwaysShowInLegend=s;this._properties=new l.default({visible:!0}),this._statusView=new r.StudyStatusView(this)}barColorer(){return null}properties(){return this._properties}statusView(){return this._statusView}legendView(){return null}state(e){return this._origState}setStatus(e){const t=this.isDisplayedInLegend();if(this._status=e,this._statusChanged.fire(),this.isDisplayedInLegend()!==t){const e=this._model.paneForSource(this);if(e){const t=this._model.panes().indexOf(e),i=s.InvalidationMask.invalidateLegendWidgetLayout(t);this.model().invalidate(i)}}}formatter(){return this._formatter}name(){return this._title}title(){return this._title}titleInParts(){return[this._title]}isFailed(){return this._status.type===u.StudyStatusType.Error}isLoading(){return this._status.type===u.StudyStatusType.Loading}isDisplayedInLegend(){return this._alwaysShowInLegend||this.isFailed()}setFailed(e){this.setStatus({type:u.StudyStatusType.Error,errorDescription:{error:e}}),this._model.updateSource(this)}isSymbolInvalid(){return!1}isActualInterval(){return!0}onIsActualIntervalChange(){return m}start(){}status(){return this._status}onStatusChanged(){return this._statusChanged}firstValue(){return null}currency(){return null}sessionId(){return this._model.mainSeries().sessionId()}sessionIdChanged(){return this._model.mainSeries().sessionIdChanged()}unit(){return null}symbolSource(){return this._model.mainSeries()}barsProvider(){return this._model.mainSeries()}valuesProvider(){return new _}statusProvider(e){return new d(this,this._model.properties().childs().scalesProperties.childs().textColor)}isRemovedByStudyTemplates(){return null!==this._origState&&(0,p.isStudyState)(this._origState)}}},54303:(e,t,i)=>{"use strict";i.d(t,{StudyValuesProvider:()=>S});var s=i(50335),r=i(49483),n=i(87095),o=i(14483),a=i(86094),l=i(15367),c=i(88348),h=i(72877),d=i(41726),u=i(92052),p=i(50151),_=i(88546),m=i(37591);const g=r.CheckMobile.any(),f=o.enabled("hide_last_na_study_output"),v=o.enabled("always_show_legend_values_on_mobile");class S{constructor(e,t){this._emptyValues=[], +this._colorProviders=new Map,this._study=e,this._model=t,this._studyMetaInfo=this._study.metaInfo(),this._studyProperties=this._study.properties().childs(),this._isFundamental=!1;const i=this._studyMetaInfo.plots;i&&i.forEach(((e,t)=>{if((0,h.isPlotWithTechnicalValues)(e))return;const i=e.id;this._emptyValues.push(function(e,t="",i=""){return{id:t,index:e,title:i,value:"",visible:!1}}(t,i,this._study.guiPlotName(m.TitleDisplayTarget.StatusLine,i)));const s=(0,h.isOhlcPlot)(e)?e.target:i;this._colorProviders.set(s,(0,d.createStudyPlotColorProvider)(this._studyMetaInfo,this._study.properties(),s))}))}getItems(){return this._emptyValues}getPlotColor(e,t){var i;const r=t[e+1];if(!(0,s.isNumber)(r))return"";const n=r>0;let o;const a=this._studyMetaInfo.plots[e];let l=a.id;const c=this._studyProperties;if((0,h.isOhlcPlot)(a))l=a.target||l,o=(0,p.ensureDefined)(c.ohlcPlots.childs()[l].childs().color).value();else if((0,h.isArrowsPlot)(a)){const e=(0,p.ensureDefined)(c.styles.childs()[l]);o=n?e.childs().colorup.value():e.childs().colordown.value()}else o=(0,p.ensureDefined)(null===(i=c.styles.childs()[l])||void 0===i?void 0:i.child("color")).value();let d=o;const u=this._colorProviders.get(l),_=u&&u.getPlotPointStyle(t);return _&&((0,h.isArrowsPlot)(a)?(n&&void 0!==_.colors[5]&&(d=_.colors[5]),n||void 0===_.colors[6]||(d=_.colors[6])):void 0!==_.colors[0]&&(d=_.colors[0])),"transparent"===d&&(d=o),d}getValues(e){var t,i;const r=this._emptyValues.map((e=>({...e})));let o=null;const l=this._study.data().lastIndex(),c=this._studyProperties;if(null!==l)for(const e of r){if(0===(null===(t=c.styles.childs()[e.id])||void 0===t?void 0:t.childs().display.value()))continue;const i=this._study.nearestIndex(l,a.PlotRowSearchMode.NearestLeft,e.index+1);if(void 0===i)continue;const s=i+this._study.offset(e.id);o=null!==o?Math.max(s,o):s}(null===e||null!==o&&e>o)&&(e=o);const d=this._hideValues(),m=this._study.isVisible()&&!d?_.notAvailable:"";for(const e of r)e.value=m;if(d)return r;f&&r.length&&(r[r.length-1].value="");const g=this._study.priceScale();if(!this._study.isVisible()||null===e||null===g||g.isEmpty()||this._model.timeScale().isEmpty())return r;const v={};for(const t of r){const r=t.id,o=(0,u.getPriceValueFormatterForStudy)(this._study,r),d=(0,p.ensureDefined)(c.styles.childs()[r]),_=d.childs().display.value();if(t.visible=0!==_,!t.visible)continue;const m=d.hasChild("plottype")?null===(i=d.child("plottype"))||void 0===i?void 0:i.value():null,g=this._isFundamental&&(m===h.LineStudyPlotStyle.StepLine||m===h.LineStudyPlotStyle.StepLineWithDiamonds),f=t.index,S=e-this._study.offset(r),y=g||null!==l&&S>l?a.PlotRowSearchMode.NearestLeft:a.PlotRowSearchMode.Exact,b=this._study.nearestIndex(S,y);if(void 0===b)continue;let w=v[r];if(void 0===w&&(w=this._study.getMinFirstBarIndexForPlot(r),Number.isFinite(w)&&(v[r]=w)),w>b)continue;const C=this._study.data().last(),P=this._study.data().valueAt(b)||(null!==C?C.value:null);if(null===P)continue;const x=P[f+1];(0,s.isNumber)(x)&&(t.value=o(x),t.color=(0, +n.resetTransparency)(this.getPlotColor(f,P)))}return r}_hideValues(){return v?(0,l.isLineToolName)(c.tool.value())||null!==this._model.lineBeingEdited():g&&(null===this._model.crossHairSource().pane||(0,l.isLineToolName)(c.tool.value())||null!==this._model.lineBeingEdited())}}},8561:(e,t,i)=>{"use strict";i.d(t,{StudyCompare:()=>F});var s=i(50151),r=i(42226),n=i(56827),o=i(42960),a=i(88640),l=i(27856),c=i(14483),h=i(74304),d=i(42275),u=i(78211),p=i(87095);const _=c.enabled("force_exchange_as_title");class m extends d.PriceAxisView{constructor(e,t){super(),this._studyCompare=e,this._data=t}_updateRendererData(e,t,i){e.visible=!1,t.visible=!1;const r=this._studyCompare.priceScale(),n=this._studyCompare.lastValueData(this._data.plotIndex,!1);if(n.noData||null===r||r.isEmpty())return;const o=this._studyCompare.model(),a=o.timeScale().visibleBarsStrictRange(),l=o.mainSeries().bars().lastIndex();if(null===a||null===l)return;if(l<=a.lastBar())i.background=(0,p.resetTransparency)(n.color),i.textColor=this.generateTextColor(i.background),i.borderColor=void 0,e.borderVisible=!1,t.borderVisible=!1;else{const r=o.backgroundColorAtYPercentFromTop(n.coordinate/(0,s.ensureNotNull)(o.paneForSource(this._studyCompare)).height());i.background=r,i.textColor=(0,p.resetTransparency)(n.color),i.borderColor=i.textColor,e.borderVisible=!0,t.borderVisible=!0}i.coordinate=n.coordinate,i.floatCoordinate=n.floatCoordinate;const c=o.properties().childs().scalesProperties.childs();c.showSeriesLastValue.value()&&(e.text=(0,u.getCurrentModePriceText)(r,n),c.seriesLastValueMode.value()!==h.PriceAxisLastValueMode.LastPriceAndPercentageValue?e.secondLine="":e.secondLine=(0,u.getOppositeModePriceText)(r,n),e.visible=!0),t.text="",c.showSymbolLabels.value()&&(t.text=this._paneText(),t.visible=t.text.length>0)}_paneText(){let e="";const t=this._studyCompare.symbolInfo();return _?e=(0,o.displayedSymbolExchange)(t):this._studyCompare.model().properties().childs().scalesProperties.childs().showSymbolLabels.value()&&(e=(0,o.displayedSymbolName)(t)),e}}i(11542);var g=i(88318),f=i(54303),v=i(88348),S=i(49483),y=i(15367),b=i(1722),w=i(37591);const C=S.CheckMobile.any();class P extends f.StudyValuesProvider{constructor(e,t){super(e,t),this._emptyValues[0].title=e.guiPlotName(w.TitleDisplayTarget.StatusLine,"")}getValues(e){return(0,b.isNumber)(e)||(this._showLastPriceAndChangeOnly()?e=this._study.data().lastIndex():(e=this._model.crossHairSource().appliedIndex(),(0,b.isNumber)(e)||(e=this._study.data().lastIndex()))),super.getValues(e)}_hideValues(){return!1}_showLastPriceAndChangeOnly(){return C&&(null===this._model.crossHairSource().pane||(0,y.isLineToolName)(v.tool.value())||null!==this._model.lineBeingEdited())}}class x extends g.StudyDataWindowView{constructor(e,t){super(e,t),this._studyCompare=e}_hideValues(){return!1}_createValuesProvider(e,t){return new P(e,t)}}class T extends x{constructor(e,t){super(e,t),this._additional=null,this._showSeriesOHLC=t.properties().childs().paneProperties.childs().legendProperties.childs().showSeriesOHLC, +this._showSeriesOHLC.subscribe(this,this.update)}areValuesVisible(){return this._showSeriesOHLC.value()}destroy(){this._showSeriesOHLC.unsubscribeAll(this)}additional(){return this._additional}_updateImpl(){super._updateImpl()}}var I=i(90830),M=i(1763),A=i(6892);class L extends A.StudyStatusProvider{getSplitTitle(){return this._source.titleInParts(w.TitleDisplayTarget.StatusLine,!0,void 0,!1,!1)}text(){return this._source.isActualInterval()?this._source.isFailed()?`${this._source.title(w.TitleDisplayTarget.StatusLine,!0,void 0,!1,!1)}: ${this.sourceStatusText()}`:`${this._source.title(w.TitleDisplayTarget.StatusLine,!0,void 0,!1,!1)} ${this.sourceStatusText()}`:this._source.title(w.TitleDisplayTarget.StatusLine,!0,void 0,!1,!1)}}var k=i(97121),D=i(24954),E=i(97145);const V=c.enabled("study_overlay_compare_legend_option"),B=c.enabled("force_exchange_as_title"),R=!c.enabled("hide_study_compare_legend_item"),N=c.enabled("hide_unresolved_symbols_in_legend"),O=c.enabled("symbol_info_price_source");class F extends n.Study{constructor(e,t,i,s){super(e,function(e){return e.hasChild("currencyId")||e.addChild("currencyId",new a.default(null)),e.hasChild("unitId")||e.addChild("unitId",new a.default(null)),e.addExclusion("currencyId"),e.addExclusion("unitId"),e}(t),i,s),this._isActingAsSymbolSource=new E.WatchedValue(!0),this._realignToolsLastParams=null,this._lastResolvedSymbolSource="",this.properties().childs().minTick.subscribe(null,(()=>this._recreatePriceFormattingDependencies())),this.properties().childs().minTick.subscribe(null,(()=>this._model.fullUpdate())),this.properties().childs().currencyId.subscribe(this,this._onCurrencyChanged),this.properties().childs().unitId.subscribe(this,this._onUnitChanged),this._symbolResolvingActive=new E.WatchedValue(!1),this._symbolHibernated=new E.WatchedValue(!1),e.mainSeries().onIntervalChanged().subscribe(this,(()=>e.realignLineTools(this)))}destroy(){this._model.mainSeries().onIntervalChanged().unsubscribeAll(this),super.destroy()}properties(){return this._properties}isActingAsSymbolSource(){return this._isActingAsSymbolSource.readonly()}symbolParams(){return(0,k.symbolParams)(this)}compareSymbolParams(e){return(0,k.compareSymbolParams)(this,e,this._model.unitConversionEnabled())}setSymbolParams(e){this._setSymbolCurrencyUnitInternal(e)}symbol(){return this.properties().childs().inputs.childs().symbol.value()}symbolChanged(){return this.properties().childs().inputs.childs().symbol.listeners()}setSymbol(e){this.setSymbolParams({symbol:e})}symbolInfo(){if(!this._resolvedSymbols)return null;const e=this.symbol();if(!e)return null;let t;return t=this._resolvedSymbols[this._getSymbolForResolve(e)]||null,t}symbolResolved(){return this.symbolsResolved()}symbolResolvingActive(){return this._symbolResolvingActive}symbolHibernated(){return this._symbolHibernated}isVisible(){const e=super.isVisible();return this._symbolHibernated.setValue(!e),e}symbolSameAsCurrent(e){return(0,k.symbolSameAsCurrent)(e,this.symbolInfo())}symbolSameAsResolved(e){return(0, +D.symbolSameAsResolved)(e,this._lastResolvedSymbolSource,this.symbol())}currency(){return this.properties().childs().currencyId.value()||null}setCurrency(e){this.setSymbolParams({currency:e})}isConvertedToOtherCurrency(){return(0,o.isConvertedToOtherCurrency)(this.symbolInfo())}unit(){return this.properties().childs().unitId.value()||null}setUnit(e){this.setSymbolParams({unit:e})}isConvertedToOtherUnit(){return(0,o.isConvertedToOtherUnit)(this.symbolInfo(),this._model.unitConversionEnabled())}style(){return 2}setStyle(e){}interval(){return this._model.mainSeries().interval()}setInterval(e){}symbolSource(){return this}valueAt(e,t){var i,s;return null!==(s=null===(i=this.data().search(e))||void 0===i?void 0:i.value[1])&&void 0!==s?s:null}state(e,t){var i;const r=super.state(e,t);this._model.unitConversionEnabled()||delete r.state.unitId;const n=this.symbol();return r.state.inputs.symbol=(0,o.symbolToSaveInState)(null!==(i=this.symbolInfo())&&void 0!==i?i:this._model.chartApi().lastSymbolResolveInfo(n),n),e&&((0,s.ensureDefined)(r.data).symbols={___snapshot:this.symbolInfo()||void 0}),r}symbolTitle(e,t,i){return this.title(e,!0,{},!1,t)}titleInParts(e,t,i,s,r){var n;const o=this._titleInParts(e,t,i,s,r);return[[o[0],...null!==(n=o[1])&&void 0!==n?n:[]].join(", ")]}tags(){const e=this.symbol();return e?[e]:[]}statusView(){return R?super.statusView():null}guiPlotName(e,t){return this.properties().childs().inputs.childs().symbol.value()}canOverrideMinTick(){return!0}canBeHiddenByGlobalFlag(){return!1}valuesProvider(){return new P(this,this.model())}statusProvider(e){return new L(this,this._model.properties().childs().scalesProperties.childs().textColor)}measureUnitId(){return(0,o.measureUnitId)(this.symbolInfo())}getSymbolString(e){return void 0===e&&(e=this._getSymbolForApi(this.symbol())),(0,l.encodeExtendedSymbolOrGetSimpleSymbolString)(this._getSymbolObject(e))}_createPriceAxisView(e){return new m(this,{plotIndex:"compare"})}_createViews(){this._legendView||(this._legendView=new T(this,this._model)),this._dataWindowView||(this._dataWindowView=new x(this,this._model)),this._statusView||(this._statusView=new I.StudyStatusView(this)),super._createViews()}_onUnitChanged(){"alwaysOff"!==(0,r.currencyUnitVisibilityProperty)().value()&&this._model.fullUpdate(),this._model.unitConversionEnabled()&&this.isStarted()&&this._tryChangeInputs(),this._unitChanged.fire()}_getSymbolObject(e){const t=super._getSymbolObject(e),i=this.currency();null!==i&&(t["currency-id"]=i);const s=this.unit();return this._model.unitConversionEnabled()&&null!==s&&(t["unit-id"]=s),t}_onSymbolResolvingStart(e,t){this._lastResolvedSymbolSource=t,super._onSymbolResolvingStart(e,t),this._symbolResolvingActive.setValue(!0)}_onSymbolError(){super._onSymbolError(),this._symbolResolvingActive.setValue(!1)}_onSymbolResolved(e,t,i){super._onSymbolResolved(e,t,i),this._recreatePriceFormattingDependencies();const s=t===this.symbol()?(0,o.extractSymbolNameFromSymbolInfo)(i,this.symbol()):null,r=(0,o.symbolCurrency)(i),n=(0, +o.symbolUnit)(i,this._model.unitConversionEnabled());this._setSymbolCurrencyUnitInternal({symbol:null!=s?s:void 0,currency:r,unit:n},i),this._symbolResolvingActive.setValue(!1)}async _changeInputsImpl(e,t){await super._changeInputsImpl(e,t),this._realignLineToolsIfParamsChanged()}_createStudyOnServer(){super._createStudyOnServer(),this._realignLineToolsIfParamsChanged()}_tryCreateFormatter(){var e,t;const i=null!==(t=null===(e=null===M.customFormatters||void 0===M.customFormatters?void 0:M.customFormatters.priceFormatterFactory)||void 0===e?void 0:e.call(M.customFormatters,this.symbolInfo(),this.properties().childs().minTick.value()))&&void 0!==t?t:null;return null!==i?i:(0,o.createSeriesFormatter)(this.symbolInfo(),this.properties().childs().minTick.value())}_titleInParts(e,t,i,s,r){const n=this.symbolInfo();return[this._getSymbolTitlePart(n),[this._getExchangeTitlePart(n,r),this._getPriceSourceTitlePart(n)].filter((e=>null!==e))]}_skipHistogramBaseOnAutoScale(){return!0}_getSymbolTitlePart(e){var t;if(null===e)return N?"":this.properties().childs().inputs.childs().symbol.value();const i=(0,o.getSymbolExchange)(e);if(B&&void 0!==i)return i;if(V)switch(this._model.mainSeries().symbolTextSourceProxyProperty().value()){case"description":return e.description;case"ticker-and-description":return`${e.name}, ${e.description}`;case"long-description":return null!==(t=e.long_description)&&void 0!==t?t:e.description}return e.name}_getExchangeTitlePart(e,t){return null===e||t?null:(0,o.getSymbolExchange)(e)}_getPriceSourceTitlePart(e){var t;return O&&!1!==this._model.properties().childs().paneProperties.childs().legendProperties.childs().showPriceSource.value()&&void 0!==(null==e?void 0:e.price_source_id)&&null!==(t=this._model.availablePriceSources(this.getSymbolString(this._getSymbolForApi(this.symbol()))).name(e.price_source_id))&&void 0!==t?t:null}_setSymbolCurrencyUnitInternal(e,t){const{symbol:i,currency:s,unit:r}=e,n=this.properties().childs(),a=n.inputs.childs().symbol.value(),l=n.currencyId.value(),c=n.unitId.value();if(void 0!==i&&n.inputs.childs().symbol.setValueSilently(i),void 0!==s&&n.currencyId.setValueSilently(s),void 0!==r&&n.unitId.setValueSilently(r),t)this._resolvedSymbolsByInput[this.symbol()]=t,this._resolvedSymbols[this._getSymbolForResolve(this.symbol())]=t,this._realignToolsLastParams=null;else{const e=this.symbolInfo();null!==e&&(n.currencyId.setValueSilently((0,o.symbolCurrency)(e)),n.unitId.setValueSilently((0,o.symbolUnit)(e,this._model.unitConversionEnabled())))}n.inputs.childs().symbol.value()!==a&&n.inputs.childs().symbol.listeners().fire(n.inputs.childs().symbol,""),n.currencyId.value()!==l&&n.currencyId.listeners().fire(n.currencyId,""),n.unitId.value()!==c&&n.unitId.listeners().fire(n.unitId,""),this._realignLineToolsIfParamsChanged()}_realignLineToolsIfParamsChanged(){let e=null===this._realignToolsLastParams;if(null!==this._realignToolsLastParams){const t=this.compareSymbolParams(this._realignToolsLastParams);e=t.symbolChanged||t.intervalChanged||t.currencyChanged||t.unitChanged} +e&&(this._model.realignLineTools(this),this._realignToolsLastParams=this.symbolParams())}}},47468:(e,t,i)=>{"use strict";i.d(t,{StudyOverlayBase:()=>_e});var s=i(50151),r=i(49483),n=i(59224),o=i(56827),a=i(81049),l=i(42226),c=i(13497),h=i(42960),d=i(88640),u=i(27856),p=i(14483),_=i(71625),m=i(97121),g=i(24954),f=i(94025),v=i(97034),S=i(86094),y=i(1722),b=i(34256),w=i(97145),C=i(1763),P=i(90830),x=i(11775),T=i(42275),I=i(74304),M=i(78211),A=i(87095);const L=p.enabled("force_exchange_as_title");class k extends T.PriceAxisView{constructor(e){super(),this._source=e}_updateRendererData(e,t,i){e.visible=!1,t.visible=!1;const r=this._source.lastValueData("close",!1);if(r.noData)return;const n=this._source.model(),o=this._source.priceScale();if(null===o)return;if(!n.isPriceScaleVisible(o))return;const a=n.timeScale().visibleBarsStrictRange(),l=n.mainSeries().bars().lastIndex();if(null===a||null===l)return;if(l<=a.lastBar())i.background=(0,A.resetTransparency)(r.color),i.textColor=this.generateTextColor(r.color),e.borderVisible=!1,t.borderVisible=!1;else{const o=n.backgroundColorAtYPercentFromTop(r.coordinate/(0,s.ensureNotNull)(n.paneForSource(this._source)).height());i.background=o,i.textColor=(0,A.resetTransparency)(r.color),i.borderColor=i.textColor,e.borderVisible=!0,t.borderVisible=!0}i.coordinate=r.coordinate,i.floatCoordinate=r.floatCoordinate;const c=this._source.model().properties().childs().scalesProperties.childs();c.showSeriesLastValue.value()&&(e.text=(0,M.getCurrentModePriceText)(o,r),c.seriesLastValueMode.value()!==I.PriceAxisLastValueMode.LastPriceAndPercentageValue?e.secondLine="":e.secondLine=(0,M.getOppositeModePriceText)(o,r),e.visible=!0),t.text="",c.showSymbolLabels.value()&&(t.text=this._paneText(),t.visible=t.text.length>0)}_paneText(){let e="";const t=this._source.symbolInfo();return L?e=(0,h.displayedSymbolExchange)(t):this._source.model().properties().childs().scalesProperties.childs().showSymbolLabels.value()&&(e=(0,h.displayedSymbolName)(t)),e}}var D=i(11527);class E extends D.PriceLineAxisView{constructor(e){super(),this._study=e}_value(){return this._study.lastValueData("",!0)}_priceLineColor(e){return e}_lineWidth(){return 1}_isVisible(){const e=this._study.model().properties().childs().scalesProperties.childs().showSeriesLastValue.value();return this._study.properties().childs().showPriceLine.value()&&e}}var V=i(79849),B=i(74997);class R{constructor(e){this._lineRenderer=new B.HorizontalLineRenderer,this._visible=!1,this._source=e}update(){if(this._visible=!1,!this._source.properties().childs().showPriceLine.value())return;const e=this._source.lastValueData("",!0);e.noData||(this._visible=!0,this._lineRenderer.setData({y:e.coordinate,color:e.color,linewidth:1,linestyle:V.LINESTYLE_DOTTED,visible:this._visible}))}renderer(){return this._visible?this._lineRenderer:null}}var N=i(93835),O=i(15367),F=i(88348),W=i(37591),H=i(27361);const z=r.CheckMobile.any();class U extends N.DataWindowView{constructor(e,t){super(),this._invalidated=!0,this._study=e,this._model=t, +this._valueProvider=this._createValuesProvider(e,t),this._items=this._valueProvider.getItems().map((e=>new N.DataWindowItem(e.id,e.title,""))),this.update()}items(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),this._items}update(){this._invalidated=!0}study(){return this._study}_updateImpl(){var e,t;this._header=this._study.title(W.TitleDisplayTarget.DataWindow);let i;this._showLastPriceAndChangeOnly()?i=this._study.data().lastIndex():(i=this._model.crossHairSource().appliedIndex(),isNaN(i)&&(i=this._study.data().lastIndex(),p.enabled("use_last_visible_bar_value_in_legend")&&(i=null!==(t=null===(e=this._model.timeScale().visibleBarsStrictRange())||void 0===e?void 0:e.lastBar())&&void 0!==t?t:NaN)));const s=this._valueProvider.getValues(i);for(let e=0;ee||t),i.showBarChange.weakReference(),i.showSeriesOHLC.weakReference()),this._visibilityProperty.subscribe(this,this.update)}areValuesVisible(){return this._visibilityProperty.value()}additional(){return this._additional}destroy(){this._backgroundColorSpawn.destroy(),this._visibilityProperty.destroy()}_updateImpl(){super._updateImpl()}_createValuesProvider(e,t){return new j.OverlayLegendValuesProvider(e,t)}}var $=i(43493),Y=i(7138),K=i(57917),Z=i(41800),X=i(8943),J=i(53275),Q=i(28400),ee=i(11740),te=i(18671),ie=i(79586),se=i(48984),re=i(16410);const ne=p.enabled("show_symbol_logos")&&p.enabled("show_symbol_logo_in_legend")&&p.enabled("show_symbol_logo_for_compare_studies"),oe=(r.CheckMobile.any()||ne)&&!1,ae=p.enabled("study_overlay_compare_legend_option"),le=p.enabled("secondary_series_extend_time_scale"),ce=p.enabled("hide_unresolved_symbols_in_legend"),he=!p.enabled("hide_study_overlay_legend_item"),de=p.enabled("symbol_info_price_source"),ue=(0,n.getLogger)("Chart.StudyOverlay");function pe(e,t){return null==e[t]}class _e extends o.Study{constructor(e,t,i,s){super(e,function(e){e.hasChild("currencyId")||e.addChild("currencyId",new d.default(null)),e.hasChild("unitId")||e.addChild("unitId",new d.default(null)),(0,re.allChartStyles)().includes(e.childs().style.value())||e.childs().style.setValueSilently(2);const t=e.childs();if(t.lineStyle.hasChild("styleType")){const e=t.lineStyle.childs(),i=e.styleType.value();let s,r;0===i&&(r=14,s=t.lineWithMarkersStyle.childs()),1===i&&(r=15,s=t.steplineStyle.childs()), +s&&(s.color.setValueSilently(e.color.value()),s.linestyle.setValueSilently(e.linestyle.value()),s.linewidth.setValueSilently(e.linewidth.value()),s.priceSource.setValueSilently(e.priceSource.value())),void 0!==r&&2===t.style.value()&&t.style.setValueSilently(r),t.lineStyle.removeProperty("styleType")}return e.addExclusion("currencyId"),e.addExclusion("unitId"),e}(t),i,s),this._seriesSource=null,this._symbolResolvingActive=new w.WatchedValue(!1),this._symbolHibernated=new w.WatchedValue(!1),this._styleToRecover=null,this._isActingAsSymbolSource=new w.WatchedValue(!0),this._realignToolsLastParams=null,this._precomputedBarStyles=new WeakMap,this._lastResolvedSymbolSource="",this._data=new v.PlotList((0,c.seriesPlotFunctionMap)(),pe),this._quotesProvider=new _.QuotesProvider(void 0,e.collapsed().spawnOwnership()),oe&&this._quotesProvider.quotesUpdate().subscribe(this,this._onQuotesUpdate);const r=this.properties().childs();r.currencyId.subscribe(this,this._onCurrencyChanged),r.unitId.subscribe(this,this._onUnitChanged),r.allowExtendTimeScale.subscribe(this,this._onAllowExtendTimeScaleChanged),this._onAllowExtendTimeScaleChanged(),r.style.subscribe(this,this._onChartStyleChanged),r.lineStyle.childs().priceSource.subscribe(this,this._updateBarFunction),r.lineWithMarkersStyle.childs().priceSource.subscribe(this,this._updateBarFunction),r.steplineStyle.childs().priceSource.subscribe(this,this._updateBarFunction),r.areaStyle.childs().priceSource.subscribe(this,this._updateBarFunction),r.baselineStyle.childs().priceSource.subscribe(this,this._updateBarFunction),r.columnStyle.childs().priceSource.subscribe(this,this._updateBarFunction),this._updateBarFunction(),this._formatter=null,e.mainSeries().onIntervalChanged().subscribe(this,(()=>e.realignLineTools(this)))}destroy(){var e;this._model.mainSeries().onIntervalChanged().unsubscribeAll(this),null===(e=this._quotesProvider)||void 0===e||e.destroy(),super.destroy()}isActingAsSymbolSource(){return this._isActingAsSymbolSource.readonly()}precomputedBarStyle(e){return this._precomputedBarStyles.get(e)}setPrecomputedBarStyle(e,t){this._precomputedBarStyles.set(e,t)}properties(){return this._properties}barColorer(){return new se.SeriesBarColorer({data:()=>this.data(),bars:()=>this.data(),nsBars:()=>new v.PlotList,priceScale:()=>(0,s.ensureNotNull)(this.priceScale()),properties:()=>this.properties(),firstValue:()=>this.firstValue()})}symbolParams(){return(0,m.symbolParams)(this)}compareSymbolParams(e){return(0,m.compareSymbolParams)(this,e,this._model.unitConversionEnabled())}setSymbolParams(e){this._setSymbolParamsInternal(e)}symbol(){return this.properties().childs().inputs.childs().symbol.value()}symbolChanged(){return this.properties().childs().inputs.childs().symbol.listeners()}setSymbol(e){this.setSymbolParams({symbol:e})}symbolInfo(){if(!this._resolvedSymbols)return null;const e=this._properties.childs().inputs.childs().symbol.value();if(!e)return null;let t;return t=this._resolvedSymbols[this._getSymbolForResolve(e)]||null,t}supportsPressedChunks(){return!1}pressedChunks(e,t){ +throw new Error("Pressed chunks are not supported")}data(){return null===this._seriesSource?super.data():this._seriesSource.data().bars()}symbolResolved(){return this.symbolsResolved()}symbolResolvingActive(){return this._symbolResolvingActive}symbolHibernated(){return this._symbolHibernated}isVisible(){const e=super.isVisible();return this._symbolHibernated.setValue(!e),e}symbolSameAsCurrent(e){return(0,m.symbolSameAsCurrent)(e,this.symbolInfo())}symbolSameAsResolved(e){return(0,g.symbolSameAsResolved)(e,this._lastResolvedSymbolSource,this.symbol())}priceSource(){const e=this.properties().childs();switch(e.style.value()){case 2:return e.lineStyle.childs().priceSource.value();case 14:return e.lineWithMarkersStyle.childs().priceSource.value();case 15:return e.steplineStyle.childs().priceSource.value();case 3:return e.areaStyle.childs().priceSource.value();case 10:return e.baselineStyle.childs().priceSource.value();case 13:return e.columnStyle.childs().priceSource.value()}return null}barFunction(){return this._barFunction}quotesProvider(){return this._quotesProvider}quotes(){return this._quotesProvider.quotes()}currency(){return this.properties().childs().currencyId.value()||null}setCurrency(e){this.setSymbolParams({currency:e})}isConvertedToOtherCurrency(){return(0,h.isConvertedToOtherCurrency)(this.symbolInfo())}unit(){return this.properties().childs().unitId.value()||null}setUnit(e){this.setSymbolParams({unit:e})}isConvertedToOtherUnit(){return(0,h.isConvertedToOtherUnit)(this.symbolInfo(),this._model.unitConversionEnabled())}style(){return this.properties().childs().style.value()}setStyle(e){this.setSymbolParams({style:e})}interval(){return this._model.mainSeries().interval()}setInterval(e){}valueAt(e,t){var i,s;return null!==(s=null===(i=this.data().search(e))||void 0===i?void 0:i.value[t])&&void 0!==s?s:null}symbolSource(){return this}barsProvider(){return this}state(e,t){var i;const r=super.state(e,t);this._model.unitConversionEnabled()||delete r.state.unitId;const n=this.symbol();return r.state.inputs.symbol=(0,h.symbolToSaveInState)(null!==(i=this.symbolInfo())&&void 0!==i?i:this._model.chartApi().lastSymbolResolveInfo(n),n),e&&((0,s.ensureDefined)(r.data).symbols={___snapshot:this.symbolInfo()||void 0}),r}symbolTitle(e,t,i){return this.title(e,!0,{},!1,t)}title(e,t,i,s,r){var n;const o=this._titleInParts(e,t,i,s,r);return[o[0],...null!==(n=o[1])&&void 0!==n?n:[]].join(` ${h.symbolTitleSeparator} `)}titleInParts(e,t,i,s,r){return[this.title(e,t,i,s,r)]}isStarted(){return null===this._seriesSource?super.isStarted():this._seriesSource.isStarted()}sourceId(){return null===this._seriesSource?super.sourceId():(0,s.ensureNotNull)(this._seriesSource.instanceId())}moveData(e){null===this._seriesSource?super.moveData(e):this._seriesSource.moveData(e)}firstValue(){const e=this._model.timeScale().visibleBarsStrictRange();if(null===e)return null;const t=e.firstBar();if(0===this.data().size())return this._ownFirstValue;const i=this.data().search(t,S.PlotRowSearchMode.NearestRight,1) +;return this._ownFirstValue=null!==i?this._barFunction(i.value,0):null,this._ownFirstValue}lastValueData(e,t,i){const s={noData:!0},r=this.priceScale();if(this._model.timeScale().isEmpty()||null===r||r.isEmpty()||this.data().isEmpty())return s;const n=this._model.timeScale().visibleBarsStrictRange();if(null===n)return s;const o=this.properties().childs();if(!o.visible.value())return s;const a=this.nearestIndex(n.lastBar(),S.PlotRowSearchMode.NearestLeft,1);if(void 0===a)return s;const l=this.firstValue();if(null===l)return s;const c=this._lastNonEmptyPlotRow(4),h=null!==c&&n.contains(c.index),d=null!==c?c.value:null,u=t||h?d:this.data().valueAt(a);if(null===u)return s;const p=this._barFunction(u,2);if(!(0,y.isNumber)(p))return s;const _=r.priceToCoordinate(p,l);let m;switch(o.style.value()){case 0:m=u[1]<=u[4]?o.barStyle.childs().upColor.value():o.barStyle.childs().downColor.value();break;case 1:case 9:m=u[1]<=u[4]?o.candleStyle.childs().upColor.value():o.candleStyle.childs().downColor.value();break;case 13:m=u[1]<=u[4]?o.columnStyle.childs().upColor.value():o.columnStyle.childs().downColor.value();break;case 2:m=o.lineStyle.childs().color.value();break;case 14:m=o.lineWithMarkersStyle.childs().color.value();break;case 15:m=o.steplineStyle.childs().color.value();break;case 3:m=o.areaStyle.childs().linecolor.value();break;case 16:m=o.hlcAreaStyle.childs().closeLineColor.value();break;case 10:{const e=o.baselineStyle.childs();m=_(0,s.ensureNotNull)(this.priceScale()).height(),color:()=>e.baselineColor.value(),baseLevelPercentage:()=>e.baseLevelPercentage.value()});break}case 12:r=new ie.SeriesHiLoPaneView(this,this._model)}r&&this._paneViews.push(r),null!==i&&this._paneViews.push(i),this._paneViews.push(new R(this)),this._dataWindowView||(this._dataWindowView=new U(this,this._model)),this._legendView||(this._legendView=new q(this,this._model)),this._statusView||(this._statusView=new P.StudyStatusView(this)),this._priceAxisViews=[...this._priceAxisViewsBase],this._labelPaneViews.push(new $.PanePriceAxisView(e,this,this._model))}_createStudyOnServer(){null===this._seriesSource?super._createStudyOnServer():this._modifyStudyOnServer((0,s.ensureDefined)(this._inputs)),this._realignLineToolsIfParamsChanged()}_modifyStudyOnServer(e){null===this._seriesSource?super._modifyStudyOnServer(e,0):(this._seriesSource.modifySeries((0,u.decodeExtendedSymbol)(e.symbol),(0,f.getServerInterval)(this._series.properties().childs().interval.value())),this._seriesSource.isStarted()||this._seriesSource.start())}_stopStudyOnServer(){null===this._seriesSource?super._stopStudyOnServer():this._seriesSource.stop()}_titleInParts(e,t,i,s,r){const n=this.symbolInfo();return[this._getSymbolTitlePart(n),[this._getExchangeTitlePart(n,r),this._getPriceSourceTitlePart(n)].filter((e=>null!==e))]}_getSymbolTitlePart(e){var t;if(null===e)return ce?"":this.properties().childs().inputs.childs().symbol.value();if(ae)switch(this._model.mainSeries().symbolTextSourceProxyProperty().value()){case"description":return e.description;case"ticker-and-description":return`${e.name}, ${e.description}`;case"long-description":return null!==(t=e.long_description)&&void 0!==t?t:e.description}return e.name}_getExchangeTitlePart(e,t){return null===e||t?null:(0,h.getSymbolExchange)(e)}_getPriceSourceTitlePart(e){var t;return de&&!1!==this._model.properties().childs().paneProperties.childs().legendProperties.childs().showPriceSource.value()&&void 0!==(null==e?void 0:e.price_source_id)&&null!==(t=this._model.availablePriceSources(this.getSymbolString(this._getSymbolForApi(this.symbol()))).name(e.price_source_id))&&void 0!==t?t:null}_onAllowExtendTimeScaleChanged(){if(!le)return;const e=this.isStarted();e&&this.stop(!0);const t=this.properties().childs().allowExtendTimeScale.value();this.properties().childs().inputs.childs().extendTimeScale.setValue(t),e&&this.start(!0)}_setSymbolParamsInternal(e,t){ +const{symbol:i,currency:s,unit:r,style:n}=e,o=this.properties().childs(),a=o.inputs.childs().symbol.value(),l=o.currencyId.value(),c=o.unitId.value(),d=o.style.value();if(void 0!==i&&o.inputs.childs().symbol.setValueSilently(i),void 0!==s&&o.currencyId.setValueSilently(s),void 0!==r&&o.unitId.setValueSilently(r),void 0!==n&&o.style.setValueSilently(n),t)this._resolvedSymbolsByInput[this.symbol()]=t,this._resolvedSymbols[this._getSymbolForResolve(this.symbol())]=t,this._realignToolsLastParams=null;else{const e=this.symbolInfo();null!==e&&(o.currencyId.setValueSilently((0,h.symbolCurrency)(e)),o.unitId.setValueSilently((0,h.symbolUnit)(e,this._model.unitConversionEnabled())))}o.inputs.childs().symbol.value()!==a&&o.inputs.childs().symbol.listeners().fire(o.inputs.childs().symbol,""),o.currencyId.value()!==l&&o.currencyId.listeners().fire(o.currencyId,""),o.unitId.value()!==c&&o.unitId.listeners().fire(o.unitId,""),o.style.value()!==d&&o.style.listeners().fire(o.style,""),this._checkStyle(),this._realignLineToolsIfParamsChanged()}_updateBarFunction(){this._barFunction=(0,a.barFunctionByStyle)(this.style(),this.priceSource())}_onChartStyleChanged(){var e;this._updateBarFunction(),(null===(e=this._styleToRecover)||void 0===e?void 0:e.originalStyle)!==this.style()&&(this._styleToRecover=null)}_checkStyle(){const e=this.style();(0,h.isCloseBasedSymbol)(this.symbolInfo())?(0,h.isSingleValueBasedStyle)(e)||(this.setStyle(2),this._styleToRecover={correctedStyle:this.style(),originalStyle:e}):null!==this._styleToRecover&&(this.setStyle(this._styleToRecover.originalStyle),this._styleToRecover=null)}_realignLineToolsIfParamsChanged(){let e=null===this._realignToolsLastParams;if(null!==this._realignToolsLastParams){const t=this.compareSymbolParams(this._realignToolsLastParams);e=t.symbolChanged||t.intervalChanged||t.currencyChanged||t.unitChanged}e&&(this._model.realignLineTools(this),this._realignToolsLastParams=this.symbolParams())}}},45802:(e,t,i)=>{"use strict";i.d(t,{StudyPriceAxisView:()=>o});var s=i(50151),r=i(42275),n=i(87095);class o extends r.PriceAxisView{constructor(e,t){super(),this._model=e.model(),this._source=e,this._data=t}_updateRendererData(e,t,i){e.visible=!1,t.visible=!1;const r=this._source.model(),o=this._source.priceScale();if(null===o)return;if(!r.isPriceScaleVisible(o))return;const a=this._source.lastValueData(this._data.plotIndex,!1);if(a.noData)return;const l=r.timeScale().visibleBarsStrictRange(),c=r.mainSeries().bars().lastIndex();if(null!==l&&null!==c){if(c<=l.lastBar()){i.background=(0,n.resetTransparency)(a.color);let s=a.color;"transparent"===s&&(s=this._model.properties().childs().scalesProperties.childs().backgroundColor.value()),i.textColor=this.generateTextColor(s),i.borderColor=void 0,e.borderVisible=!1,t.borderVisible=!1}else{const o=r.backgroundColorAtYPercentFromTop(a.coordinate/(0,s.ensureNotNull)(r.paneForSource(this._source)).height());i.background=o,i.textColor=(0,n.resetTransparency)(a.color),i.borderColor=(0,n.resetTransparency)(i.textColor),e.borderVisible=!0,t.borderVisible=!0} +i.coordinate=a.coordinate,i.floatCoordinate=a.floatCoordinate,this._showAxisLabel()&&(e.text=a.text,e.visible=!0),this._updatePaneRendererData(t)}}_showPaneLabel(){return!!this._model.properties().childs().scalesProperties.childs().showStudyPlotLabels.value()&&this._source.properties().childs().showLabelsOnPriceScale.value()&&this._source.isPlotVisibleAt(this._data.plotIndex,4)}_showAxisLabel(){return!!this._model.properties().childs().scalesProperties.childs().showStudyLastValue.value()&&this._source.properties().childs().showLabelsOnPriceScale.value()&&this._source.isPlotVisibleAt(this._data.plotIndex,4)}_updatePaneRendererData(e){e.text="",this._showPaneLabel()&&(e.text=this._source.priceLabelText(this._data.plotIndex),e.visible=!0)}}},45574:(e,t,i)=>{"use strict";i.d(t,{applyOverridesToStudy:()=>d,applyOverridesToStudyDefaults:()=>u});var s=i(50151),r=i(72877),n=i(59224);const o={line:r.LineStudyPlotStyle.Line,histogram:r.LineStudyPlotStyle.Histogram,cross:r.LineStudyPlotStyle.Cross,area:r.LineStudyPlotStyle.Area,columns:r.LineStudyPlotStyle.Columns,circles:r.LineStudyPlotStyle.Circles,line_with_breaks:r.LineStudyPlotStyle.LineWithBreaks,area_with_breaks:r.LineStudyPlotStyle.AreaWithBreaks,step_line:r.LineStudyPlotStyle.StepLine,step_line_with_breaks:r.LineStudyPlotStyle.StepLineWithBreaks,step_line_with_diamonds:r.LineStudyPlotStyle.StepLineWithDiamonds},a=(0,n.getLogger)("Chart.Model.StudyPropertiesOverrider");var l,c;function h(e,t,i,s){const r=i.split(".");if(0===r.length||0===r[0].length)return;const n=function(e){const t=e.split(":");return{name:t[0],type:2===t.length?t[1]:null}}(r[0]),o=n.name,h=n.type,d=null!==h,u=!d||"band"===h,p=!d||"area"===h,_=!d||"input"===h,m=!d||"plot"===h?c.getPlotIdByTitle(e,o):null,g=u?c.getBandIndexByName(e,o):null,f=p?c.getFilledAreaIdByTitle(e,o):null,v=_?c.getInputByName(e,o):null,S=t.hasOwnProperty(o);if((null!==m?1:0)+(null!==g?1:0)+(null!==f?1:0)+(null!==v?1:0)+(S?1:0)>1)return void a.logWarn(`Study '${e.description}' has ambiguous identifier '${o}'`);const y=r[1];if(null!==m){if(1===r.length)return void a.logWarn(`Path of sub-property of '${o}' plot for study '${e.description}' must be not empty`);const i=r.slice(1);l.applyPlotProperty(e,t,m,i,s)}else if(null!==v)l.applyInputValue(t,v,s);else if(null!==g){if(void 0===y)return void a.logWarn(`Property name of '${o}' band for study '${e.description}' must be set`);l.applyBandProperty(t,g,y,s)}else if(null!==f){if(void 0===y)return void a.logWarn(`Property name of '${o}' area for study '${e.description}' must be set`);l.applyFilledAreaProperty(t,f,y,s)}else S?l.setRootProperty(t,r,s):a.logWarn(`Study '${e.description}' has no plot or input '${o}'`)}function d(e,t){const i=e.properties(),s=i.state();for(const i in t)t.hasOwnProperty(i)&&h(e.metaInfo(),s,i,t[i]);i.mergeAndFire(s)}function u(e,t,i){for(const s in e){if(!e.hasOwnProperty(s))continue;const r=s.indexOf(".");if(-1===r)continue;const n=s.substring(0,r),o=c.getMetaInfoByDescription(t,n);if(null===o){a.logWarn(`There is no such study ${n}`);continue}const l=i(o) +;null!==l?h(o,l,s.substring(r+1),e[s]):a.logWarn(`Cannot apply overrides for study ${n}`)}}!function(e){e.applyPlotProperty=function(e,t,i,n,l){if(void 0===t.styles)return void a.logWarn("Study does not have styles");const c=n[0];if("color"===c){const o=function(e,t,i){if(void 0===e.plots)return null;for(const s of e.plots){if(!(0,r.isPaletteColorerPlot)(s)||void 0===t.palettes)continue;const e=t.palettes[s.palette];if(s.target===i&&void 0!==e)return e}return null}(e,t,i);return void function(e,t,i,r,n){var o;void 0!==e.styles?null===t&&!isNaN(r)&&r>0?a.logWarn(`Study plot does not have color #${r}`):((0===r||isNaN(r))&&((0,s.ensureDefined)(e.styles[i]).color=String(n),r=0),null!==t&&((0,s.ensureDefined)(null===(o=t.colors)||void 0===o?void 0:o[r]).color=String(n))):a.logWarn("Study does not have styles")}(t,o,i,n.length>1?parseInt(n[1]):NaN,l)}const h=t.styles[i];if(void 0!==h&&h.hasOwnProperty(c)){if("plottype"===c){const e=o[String(l)];if(void 0===e)return void a.logWarn(`Unsupported plot type for plot: ${l}`);l=e}h[c]=l}else a.logWarn(`Study plot does not have property '${c}'`)},e.applyBandProperty=function(e,t,i,s){if(void 0===e.bands)return void a.logWarn("Study does not have bands");const r=e.bands[t];if(void 0!==r&&r.hasOwnProperty(i)){if("plottype"===i){const e=o[String(s)];if(void 0===e)return void a.logWarn(`Unsupported plot type for band: ${s}`);s=e}r[i]=s}else a.logWarn(`Study band does not have property '${i}'`)},e.applyFilledAreaProperty=function(e,t,i,s){if(void 0===e.filledAreasStyle)return void a.logWarn("Study does not have areas");const r=e.filledAreasStyle[t];void 0!==r&&r.hasOwnProperty(i)?r[i]=s:a.logWarn(`Study area does not have property '${i}'`)},e.applyInputValue=function(e,t,i){void 0!==e.inputs&&e.inputs.hasOwnProperty(t)?e.inputs[t]=i:a.logWarn(`Study does not have input '${t}'`)},e.setRootProperty=function(e,t,i){if(0===t.length)return;let s=e;for(const e of t.slice(0,-1)){if(null==s||!s.hasOwnProperty(e))break;s=s[e]}const r=t[t.length-1];null!=s&&s.hasOwnProperty(r)?s[r]=i:a.logWarn(`Study does not have property ${t.join(".")}`)}}(l||(l={})),function(e){e.getInputByName=function(e,t){if(void 0===e.inputs)return null;t=t.toLowerCase();for(const i of e.inputs)if(i.name.toLowerCase()===t)return i.id;return null},e.getPlotIdByTitle=function(e,t){if(void 0===e.styles)return null;t=t.toLowerCase();for(const i in e.styles){const s=e.styles[i];if((void 0!==s&&void 0!==s.title?s.title:i).toLowerCase()===t)return i}return null},e.getFilledAreaIdByTitle=function(e,t){if(void 0===e.filledAreas)return null;t=t.toLowerCase();for(const i of e.filledAreas)if(i.title.toLowerCase()===t)return i.id;return null},e.getBandIndexByName=function(e,t){if(void 0===e.bands)return null;t=t.toLowerCase();for(let i=0;i{"use strict";i.d(t,{ +Study:()=>ti,createStudyError:()=>Xt,prepareStudyProperties:()=>Gt,prepareStudyPropertiesForLoadChart:()=>Kt});var s=i(16230),r=i(27788),n=i(14314),o=i(50151),a=i(30551),l=i(11542),c=i(59224),h=i(49483),d=i(21866),u=i(57898),p=i(87095),_=i(1115),m=i(80842),g=i(34256),f=i(97034),v=i(42856),S=i(12442),y=i(86094),b=i(95586),w=i(70512),C=i(54303),P=i(40484);class x{constructor(e,t){this._study=e,this._model=t,this._showStudyValues=t.properties().childs().paneProperties.childs().legendProperties.childs().showStudyValues,this._hhistBasedStudy=void 0!==e.metaInfo().graphics.hhists,this._valuesProvider=this._createValuesProvider(e,t)}getItems(){return this._valuesProvider.getItems()}getValues(e){const t=this._valuesProvider.getValues(e),i=this._study.properties(),s=this._showStudyValues.value()&&i.childs().showLegendValues.value(),r=e=>!!this._hhistBasedStudy||this._study.isPlotVisibleAt(e,8);for(const e of t)e.visible=e.visible&&s&&r(e.id);return t}_createValuesProvider(e,t){return this._hhistBasedStudy?new P.HHistBasedValuesProvider(e,t):new C.StudyValuesProvider(e,t)}}var T=i(72877);class I extends w.StudyBaseWindowView{constructor(e,t){super(e,t),this._showStudyValues=t.properties().childs().paneProperties.childs().legendProperties.childs().showStudyValues,this._showStudyValues.subscribe(this,this.update);const i=this._study.properties();i.childs().showLegendValues.subscribe(this,this.update);const s=this._study.metaInfo().plots,r=new Set;s.forEach((e=>{var t;if((0,T.isOhlcPlot)(e)){const t=e.target;if(r.has(t))return;r.add(t),i.childs().ohlcPlots.childs()[t].childs().display.subscribe(this,this.update)}else(0,T.isPlotSupportDisplay)(e)&&(null===(t=i.childs().styles.childs()[e.id])||void 0===t||t.childs().display.subscribe(this,this.update))}))}areValuesVisible(){return this._showStudyValues.value()}additional(){return null}destroy(){this._showStudyValues.unsubscribeAll(this);const e=this._study.properties();e.childs().showLegendValues.unsubscribeAll(this);const t=this._study.metaInfo().plots,i=new Set;t.forEach((t=>{var s;if((0,T.isOhlcPlot)(t)){const s=t.target;if(i.has(s))return;i.add(s),e.childs().ohlcPlots.childs()[s].childs().display.unsubscribe(this,this.update)}else(0,T.isPlotSupportDisplay)(t)&&(null===(s=e.childs().styles.childs()[t.id])||void 0===s||s.childs().display.unsubscribe(this,this.update))}))}_createValuesProvider(e,t){return new x(e,t)}}var M=i(88348),A=i(90830),L=i(27856),k=i(19171),D=i(1803),E=i(6892),V=i(1722),B=i(87663);i(37591),i(49475);function R(e,t){return e.studyId.localeCompare(t.studyId)}function N(e){const t=new Set,i=[];return e.forEach((e=>{t.has(e.studyId)||(t.add(e.studyId),i.push(e))})),i}function O(e){const t=e.model().mainSeries();return{studyId:(0,o.ensureNotNull)(e.sourceId()),turnaround:e.turnaround(),sourceStudies:e.parentSources().filter((e=>e!==t)).map((e=>O(e)))}}var F=i(33703),W=i(14483),H=i(19266),z=i(59590);class U extends z.BitmapCoordinatesPaneRenderer{constructor(e){super(),this._data=e}hitTest(e){return null}_drawImpl(e){}_drawBackgroundImpl(e){ +const{context:t,horizontalPixelRatio:i,bitmapSize:s}=e,r=this._data;for(let e=0;e0?(i-=r,s+=r):(i+=r,s-=r);const n=this._study.getMinFirstBarIndexForPlot(this._plotName);if(n>s)return;i=Math.max(n,i);const a=this._study.data();for(const e of a.rangeIterator(i,s)){let i=e.index;const s=e.value;i+=r;const n={timePointIndex:Math.floor(i),left:NaN,center:NaN,right:NaN};let a=(0,V.isNumber)(t)?t:50;a=Math.min(a,100),a=Math.max(a,0);const l=this._colorProvider.getPlotPointStyle(s);void 0!==l.colors[1]&&(n.color=(0,p.generateColor)((0,o.ensureDefined)(l.colors[1]),a)),this._items.push(n)}this._model.timeScale().fillBarBorders(this._items)}}var q,$,Y=i(54358),K=i(80101),Z=i(76058),X=i(37160),J=i(57490),Q=i(13497),ee=i(96759),te=i(86441),ie=i(34026),se=i(50335),re=i(18807),ne=i(50146),oe=i(29764),ae=i(27714),le=i(74359);!function(e){e.Left="left",e.Right="right",e.Center="center"}(q||(q={})),function(e){e.Top="top",e.Bottom="bottom",e.Middle="middle"}($||($={}));const ce=(0,le.createDisconnectedCanvas)(document,(0,ae.size)({width:0,height:0}),1);class he{constructor(e,t,i,s,r,n="center",a=0){this._lines=e.split(/[^\S\r\n]*(?:\r\n|\r|\n)/),this._font=function(e,t,i,s){return(0,oe.makeFont)(s,i,`${e?"bold ":""}${t?"italic ":""}`)}(t,i,s,r), +this._fontSize=r,this._verticalPadding=~~(r/6),this._textAlign=n,this._lineSpacing=a;const l=(0,o.ensureNotNull)(ce.getContext("2d"));l.font=this._font,l.textBaseline="top";let c=0;for(let e=0;e{for(const t of this._lines)n.strokeStyle&&e.strokeText(t,o,a),e.fillText(t,o,a),a+=this._fontSize,a+=this._lineSpacing})),e.restore()}}class de extends ne.AbstractMapContainer{constructor(e){super(),this._maxSize=e,this._keysQueue=[]}get(e){const{fontSize:t,text:i,align:s,font:r,lineSpacing:n=0}=e;if(!i||!t||!s)return null;const o=(0,oe.makeFont)(t,r),a=(0,ne.getDefault3)(this._map,n,s,o,new Map);let l=a.get(i);return void 0!==l||(this._size>=this._maxSize?this._deleteFirstKey():++this._size,this._keysQueue.push([o,s,n,i]),l=new he(i,e.bold,e.italic,r,t,s,n),a.set(i,l)),l}_deleteFirstKey(){const e=this._keysQueue.shift(),[t,i,s,r]=e,n=(0,o.ensureDefined)(this._map.get(s)),a=(0,o.ensureDefined)(n.get(i)),l=(0,o.ensureDefined)(a.get(t));l.delete(r),0===l.size&&a.delete(t),0===a.size&&n.delete(i),0===n.size&&this._map.delete(s)}}var ue=i(46501);class pe{constructor(e,t={skipRenderingOptimizations:!1}){this._items=[],this._barSpacing=0,this._vertOffset=0,this._textCache=t.textCache||new de(5e3),this._drawOperation=t.skipRenderingOptimizations?this._drawWithoutOptimizations.bind(this):this._drawWithOptimizations.bind(this),null!==e&&this.setData(e)}draw(e,t){this._preDrawInit(),this._drawOperation(e,t)}hitTest(e){const t=re.HitTarget.Regular;let i=null;for(const s of this._items){if(!s)continue;const r=this._calcBoundingBox(s);if(r&&(0,ie.pointInBox)(e,r)){const e={tooltip:this._getTooltip(s,r)};i=new re.HitTestResult(t,e)}}return i}setData(e){var t,i,s,r;if(this._height=void 0!==e.height?e.height:e.width,this._width=void 0!==e.width?e.width:e.height,this._color=e.color,this._borderColor=e.borderColor,this._vertOffset=e.vertOffset||0,e.text&&(this._text=e.text,this._fontSize=e.fontSize,this._lineSpacing=e.lineSpacing,this._textColor=e.textColor,this._textAlign=e.textAlign||"center"), +void 0!==e.items&&void 0!==e.barSpacing){const n=null!==(i=null===(t=e.visibleItemsRange)||void 0===t?void 0:t.startItemIndex)&&void 0!==i?i:0,o=null!==(r=null===(s=e.visibleItemsRange)||void 0===s?void 0:s.endItemIndex)&&void 0!==r?r:e.items.length;this.setItems(e.items.slice(n,o),e.barSpacing)}}setItems(e,t){this._setBaseData(e,t)}_calcBoundingBox(e){const t=e.vertOffset,i=this._getTextCache(e);if(!i)return;const s=i.textImageWidth,r=i.textImageHeight,n=s/2,o=e.y+t+e.textVertOffset,a=t>0?0:-r,l=t>0?r:0,c=new te.Point(e.center-n,o+a),h=new te.Point(e.center+n,o+l);return(0,te.box)(c,h)}_unionBox(e,t){const i=Math.min(e.min.x,t.min.x),s=Math.max(e.max.x,t.max.x),r=Math.min(e.min.y,t.min.y),n=Math.max(e.max.y,t.max.y),o=new te.Point(i,r),a=new te.Point(s,n);return(0,te.box)(o,a)}_getTooltip(e,t){if(e.tooltip)return{content:{type:"text",data:e.tooltip},tooltipDelay:200,extendMargin:!0,rect:{x:t.min.x,y:t.min.y,w:Math.abs(t.max.x-t.min.x),h:Math.abs(t.max.y-t.min.y)}}}_setBaseData(e,t){this._items.length=0,this._barSpacing=t;for(const t of e){if((0,se.isNaN)(t.y))continue;const e=void 0===t.width?(0,o.ensureDefined)(this._width):t.width,i=void 0===t.height?(0,o.ensureDefined)(this._height):t.height,s=void 0===t.vertOffset?this._vertOffset:t.vertOffset,r=s>0?i:-i;this._items.push({width:e,height:i,vertOffset:s,textVertOffset:r,shapeWidth:0,shapeHeight:0,stepX:0,stepY:0,...t})}}_drawItemText(e,t,i){const s=this._getTextCache(i);if(null===s)return;const r=i.center,n=i.vertOffset,o=i.y+n+i.textVertOffset;let a;a=i.style&&void 0!==i.style.textColor?i.style.textColor:this._textColor;const l={style:{fillStyle:a},location:{x:r,y:o,horzAlign:q.Center,vertAlign:n>0?$.Top:$.Bottom}};s.paintTo(e,t,l)}_drawWithOptimizations(e,t){let i,s,r=null,n=!1;for(const o of this._items)(0,se.isNaN)(o.y)||(o.style&&void 0!==o.style.color?(i=o.style.color||"rgba(0, 0, 0, 0)",s=o.style.borderColor||"rgba(0, 0, 0, 0)"):(i=this._color,s=this._borderColor),(r!==i||h.isSafari)&&(r=i,n&&this._endPath(e),this._startPath(e,t,i,s)),this._drawItemShape(e,t,o),n=!0);n&&this._endPath(e),e.save();for(const i of this._items)(0,se.isNaN)(i.y)||this._drawItemText(e,t,i);e.restore()}_drawWithoutOptimizations(e,t){let i,s;e.save();for(const r of this._items){if((0,se.isNaN)(r.y))continue;const n=(0,o.ensureDefined)(r.style);i=n.color||"rgba(0, 0, 0, 0)",s=n.borderColor||"rgba(0, 0, 0, 0)",this._startPath(e,t,i,s),this._drawItemShape(e,t,r),this._endPath(e),this._drawItemText(e,t,r)}e.restore()}_drawItemShape(e,t,i){(0,le.drawScaled)(e,t.pixelRatio,t.pixelRatio,(()=>this._drawItemShapeUsingCSSPixels(e,i)))}_drawItemShapeUsingCSSPixels(e,t){}_preDrawInit(){}_startPath(e,t,i,s){}_endPath(e){}_getTextCache(e){var t,i;const s=e.text||this._text,r=e.fontSize||this._fontSize,n=null!==(t=e.lineSpacing)&&void 0!==t?t:this._lineSpacing,o=e.textAlign||this._textAlign,a=null!==(i=e.font)&&void 0!==i?i:ue.CHART_FONT_FAMILY;return this._textCache.get({text:s,bold:!1,italic:!1,font:a,fontSize:r,lineSpacing:n,align:o})}}class _e extends pe{_startPath(e,t,i,s){e.beginPath(), +e.lineWidth=this._lineWidth(t),e.lineCap="butt",e.strokeStyle=i}_endPath(e){e.stroke()}_lineWidth(e){return Math.max(1,Math.floor(2*e.pixelRatio))}}class me extends pe{_startPath(e,t,i,s){e.beginPath(),e.lineWidth=this._lineWidth(t),e.lineCap="butt",e.fillStyle=i,e.strokeStyle=s}_endPath(e){e.fill(),e.stroke()}_lineWidth(e){return Math.max(1,Math.floor(e.pixelRatio))}}class ge extends me{constructor(){super(...arguments),this._sign=0,this._thinArrow=!1,this._thinArrowLineWidth=0,this._headHeight=0,this._arrowWidth=0}setItems(e,t){this._setBaseData(e,t)}_drawItemShape(e,t,i){const s=t.pixelRatio,r=this._lineWidth(t)%2?.5:0,n=this._sign,o=this._arrowWidth,a=this._headHeight,l=Math.abs(i.height),c=Math.round(i.center*s)+r,h=i.vertOffset,d=Math.round((i.y+h+n*l/2)*s)+r,u=(0,X.ceiledEven)(o*s),p=u/2,_=Math.round(l*s),m=Math.round(a*s);e.translate(c,d),this._thinArrow?(e.moveTo(0,0),e.lineTo(-p,-p*n),e.moveTo(0,0),e.lineTo(p,-p*n),e.moveTo(0,0),e.lineTo(0,-_*n),e.moveTo(-p,-_*n),e.lineTo(p,-_*n)):(e.moveTo(0,0),_=0?e.vertOffset:e.vertOffset-e.shapeHeight}}),Pe.set("PaneRendererLabelDown",class extends ve{_calcBoundingBox(e){const t=e.center-e.shapeWidth/2,i=e.center+e.shapeWidth/2,s=e.y-e.shapeHeight+e.vertOffset,r=e.y+e.vertOffset,n=new te.Point(t,s),o=new te.Point(i,r);return(0,te.box)(n,o)}_drawItemShape(e,t,i){const s=t.pixelRatio,r=this._lineWidth(t)%2?.5:0,n=Math.max(1,Math.floor(s))%2?.5:0,o=this._getArrowSize(i);let a=Math.round(o*s);(n+a)%1!=r%1&&(a+=.5);let l=Math.round(i.shapeWidth/2*s);(n+l)%1!=r%1&&(l+=.5);const c=Math.round(i.center*s)+n,h=Math.round((i.y+i.vertOffset)*s)+r,d=c+a,u=Math.round((i.y+i.vertOffset-o)*s)+r,p=c-a,_=c+l,m=Math.round((i.y+i.vertOffset-i.shapeHeight-o)*s)+r,g=c-l;e.moveTo(d,u),e.lineTo(c,h),e.lineTo(p,u),i.shapeWidth<=2*o?(e.lineTo(g,u),this._drawCorner(e,g,m,ye.leftUp,s),this._drawCorner(e,_,m,ye.rightUp,s),e.lineTo(_,u)):(this._drawCorner(e,g,u,ye.leftDown,s),this._drawCorner(e,g,m,ye.leftUp,s),this._drawCorner(e,_,m,ye.rightUp,s),this._drawCorner(e,_,u,ye.rightDown,s)),e.lineTo(d,u)}_getVerticalTextOffset(e){return-e.shapeHeight/2-this._getArrowSize(e)}_calcVertOffset(e){return Math.sign(e.vertOffset)<=0?e.vertOffset:e.vertOffset+e.shapeHeight}}),Pe.set("PaneRendererSquare",class extends me{_drawItemShape(e,t,i){const s=t.pixelRatio,r=Math.max(1,Math.floor(s))%2?.5:0,n=this._lineWidth(t)%2?.5:0;let o=Math.round(i.height/2*s);(r+o)%1!=n%1&&(o+=.5);const a=Math.round(i.center*s)+r,l=Math.round((i.y+i.vertOffset)*s)+r,c=a-o,h=l-o,d=a+o,u=l+o;e.rect(c,h,d-c,u-h)}_calcBoundingBox(e){const t=e.height,i=Math.round(t/2),s=e.center-i,r=e.vertOffset,n=e.y+r-i,o=s,a=s+t,l=n,c=n+t,h=new te.Point(o,l),d=new te.Point(a,c);let u=(0,te.box)(h,d);const p=super._calcBoundingBox(e) +;return p&&(u=this._unionBox(u,p)),u}}),Pe.set("PaneRendererTriangleApexUp",class extends be{_drawItemShape(e,t,i){const s=i.width,r=i.height,n=Math.round(r/3),o=i.vertOffset-2*n,a=t.pixelRatio,l=this._lineWidth(t)%2?.5:0,c=Math.max(1,Math.floor(a)),h=c%2?.5:0;let d=Math.round(s*a);d%2!=c%2&&(d+=1);const u=Math.round(i.center*a)+h,p=Math.round((i.y+o)*a),_=u+d/2,m=Math.round((i.y+o+r)*a)+l,g=u-d/2;e.moveTo(u,p),e.lineTo(_,m),e.lineTo(g,m),e.lineTo(u,p)}}),Pe.set("PaneRendererTriangleApexDown",class extends be{_drawItemShape(e,t,i){const s=i.width,r=i.height,n=Math.round(r/3),o=i.vertOffset-n,a=t.pixelRatio,l=this._lineWidth(t)%2?.5:0,c=Math.max(1,Math.floor(a)),h=c%2?.5:0;let d=Math.round(s*a);d%2!=c%2&&(d+=1);const u=Math.round(i.center*a)+h,p=Math.round((i.y+o)*a)+l,_=u+d/2,m=Math.round((i.y+o+r)*a),g=u-d/2;e.moveTo(g,p),e.lineTo(_,p),e.lineTo(u,m),e.lineTo(g,p)}}),Pe.set("PaneRendererXCross",class extends _e{_drawItemShapeUsingCSSPixels(e,t){const i=t.width,s=t.height,r=t.center-i/2,n=t.vertOffset,o=t.y-s/2+n;e.moveTo(r,o),e.lineTo(r+i,o+s),e.moveTo(r,o+s),e.lineTo(r+i,o)}_calcBoundingBox(e){const t=e.width,i=e.height,s=e.center-t/2,r=e.vertOffset,n=e.y-i/2+r,o=s,a=s+t,l=n,c=n+i,h=new te.Point(o,l),d=new te.Point(a,c);let u=(0,te.box)(h,d);const p=super._calcBoundingBox(e);return p&&(u=this._unionBox(u,p)),u}});class xe extends Ce.StudyPaneViewInplaceUpdatable{constructor(e,t,i,s){var r;super(i),this._renderer=null,this._shapesRenderer=null,this._selectionRenderer=null,this._isMarkersEnabled=W.enabled("source_selection_markers"),this._study=e,this._series=t,this._model=i,this._plotName=s;const n=e.metaInfo().plots;for(let e=0;ethis._createItem(e,null!=t?t:null,c,h,a)));let u=this._series.nearestIndex(r.firstBar(),y.PlotRowSearchMode.NearestRight),p=this._series.nearestIndex(r.lastBar(),y.PlotRowSearchMode.NearestLeft) +;if(void 0===u||void 0===p)return!1;a>0?(u-=a,p+=a):(u+=a,p-=a);const _=this._study.getMinFirstBarIndexForPlot(this._plotName);if(_>p)return!0;u=Math.max(_,u);const m=this._getTranspValue(),g=this._study.properties().childs().styles.childs()[this._plotName].childs(),f=g.color.value(),v=g.textColor?g.textColor.value():void 0,S=f,b=f,w=void 0===v?void 0:v,C=(0,o.ensureNotNull)(this._plotIndex),P=(0,ee.createEmptyStyle)(),x=null!=d?d:(0,o.ensureNotNull)(n.firstIndex()),T=n.rangeIterator(x,(0,o.ensureNotNull)(n.lastIndex())+1);let I=(0,we.lowerbound)(this._items,x+a,((e,t)=>e.timePointIndex9?i-10:0;s.borderColor=(0,p.generateColor)(s.color,e)}void 0!==t.colors[2]&&(s.textColor=(0,p.generateColor)((0,o.ensureDefined)(t.colors[2]),i))}_updateRenderer(e,t){this._makeSureRendererIsValid();const i=this._model.timeScale(),s={},r=this._getTranspValue(),n=i.barSpacing(),o=this._calculateShapeHeight(n),a=this._study.properties().childs().styles.childs()[this._plotName].childs(),l=a.location.value(),c=this._calculateVerticalOffset(l,o+o/2);s.barSpacing=n,s.items=this._items,s.color=(0,p.generateColor)(a.color.value(),r),s.height=o,s.vertOffset=c,s.visibleItemsRange={startItemIndex:e,endItemIndex:t};const h=a.plottype.value(),d=Z.plotShapesData[h],u=new H.CompositeRenderer;d&&(this._shapesRenderer?this._shapesRenderer.setData(s):(this._shapesRenderer=this._createRenderer(d.paneRendererClass,s),u.append(this._shapesRenderer))),this._model.selection().isSelected(this._study)&&this._isMarkersEnabled&&null!==this._selectionData&&(this._selectionData.vertOffset=c,u.append(new K.SelectionRenderer(this._selectionData))),this._renderer=u}_createRenderer(e,t){const i=Pe.get(e);return new((0,o.ensureDefined)(i))(t)}_getSeriesVal(e,t){const i=(0,Q.barFunction)(e),s=this._series.data().valueAt(t);return null===s?null:i(s)}_getTranspValue(){let e=0;const t=this._study.properties().childs();t.transparency&&(e=t.transparency.value(),e=(0,V.isNumber)(e)?e:50);const i=t.styles.childs()[this._plotName].childs();return i.transparency&&(e=i.transparency.value(),e=(0,V.isNumber)(e)?e:50),(0,X.clamp)(e,0,100)}_createItem(e,t,i,s,r){const n=this._study.properties().childs().styles.childs()[this._plotName].childs().location.value(),a={origPrices:{price:NaN},timePointIndex:e+r};if((null===t||0===t)&&n!==b.MarkLocation.Absolute)return a;if(null==t)return a;let l=NaN;switch(n){case b.MarkLocation.AboveBar:{const t=this._getLocationPrice(e,i,r);if(null===t)return a;l=t;break}case b.MarkLocation.BelowBar:{const t=this._getLocationPrice(e,s,r);if(null===t)return a +;l=t;break}case b.MarkLocation.Absolute:l=(0,o.ensureNotNull)(t);break;case b.MarkLocation.Top:case b.MarkLocation.Bottom:l=0;break;default:throw new Error("Bad value: "+n)}return{y:NaN,origPrices:{price:l},timePointIndex:e+r}}_dependsOnSeriesData(){const e=this._study.properties().childs().styles.childs()[this._plotName].childs().location.value();return e===b.MarkLocation.AboveBar||e===b.MarkLocation.BelowBar}_getValueForUpdating(e){const t=e.value[this._plotIndex+1];if(null==t)return null;const i=this._study.properties().childs().styles.childs()[this._plotName].childs().location.value();if(0===t&&i!==b.MarkLocation.Absolute)return null;const s=this._study.offset(this._plotName),{hiPlot:r,loPlot:n}=this._hiLoPlots();switch(i){case b.MarkLocation.AboveBar:return this._getLocationPrice(e.index,r,s);case b.MarkLocation.BelowBar:return this._getLocationPrice(e.index,n,s)}return super._getValueForUpdating(e)}_convertItemsToCoordinates(e,t,i,s){for(let e=i;e{for(let t=i;t19?o-10:0,u=this._calculateVerticalOffset(c,Math.round(1.5*l));n.barSpacing=a,n.items=this.items(),n.color=h,n.borderColor=(0,p.generateColor)(s.color.value(),d),n.height=l,n.vertOffset=u, +n.visibleItemsRange={startItemIndex:e,endItemIndex:t};const _=s.plottype.value(),m=Z.plotShapesData[_],g=this._plotStyleInfo.text;if(void 0!==g&&""!==g.trim()){let e=g.trim().replace(/\\n/gm,"\n");e=(0,Y.cleanButAmpersand)(e,!0),n.text=e,n.fontSize=12;const t=s.textColor?s.textColor.value():void 0;n.textColor=t?(0,p.generateColor)(t,o):h}if(this._renderer&&this._shapesRenderer&&this._selectionRenderer)this._shapesRenderer.setData(n),this._model.selection().isSelected(this._study)&&this._isMarkersEnabled&&null!==this._selectionData?(this._selectionData.vertOffset=u,this._selectionRenderer.setData(this._selectionData)):this._selectionRenderer.setData(null);else{const e=new H.CompositeRenderer;this._shapesRenderer=super._createRenderer(m.paneRendererClass,n),e.append(this._shapesRenderer),this._selectionRenderer=new K.SelectionRenderer(null!==(i=this._selectionData)&&void 0!==i?i:void 0),this._model.selection().isSelected(this._study)&&this._isMarkersEnabled&&null!==this._selectionData?this._selectionData.vertOffset=u:this._selectionRenderer.setData(null),e.append(this._selectionRenderer),this._renderer=e}}}var Ie=i(87795),Me=i.n(Ie),Ae=i(45197);class Le extends pe{constructor(e,t){super(null,t),this._fontSizeEnsured=0,this._ch="",this._fontFamily=ue.CHART_FONT_FAMILY,this._charCache=null,null!==e&&this.setData(e)}setData(e){super.setData(e),this._fontSizeEnsured=(0,o.ensureDefined)(this._height);const t=e.char.slice(0,40);this._ch=Me()(t)[0]||" ",this._fontFamily=e.fontFamily||ue.CHART_FONT_FAMILY}hitTest(e){const t=(0,Ae.interactionTolerance)().series+this._fontSizeEnsured/2;for(const i of this._items){if(new te.Point(i.center,i.y+i.vertOffset).subtract(e).length()<=t)return new re.HitTestResult(re.HitTarget.Regular)}return null}_drawItemShape(e,t,i){const s=i.center,r=i.vertOffset>0?1:-1,n=i.y+i.vertOffset-r*Math.round(this._fontSizeEnsured/2);let o;o=i.style&&void 0!==i.style.color?i.style.color:this._color;const a=this._textImageCache(),l=t.pixelRatio;if(this._fontSizeEnsured<=4/l){e.save();const t=Math.max(1,Math.floor(l));let r=Math.max(1,Math.floor(a.textImageWidth*l));r%2!=t%2&&(r+=r>1?-1:1);const c=Math.round(n*l)+(i.vertOffset>=0?0:-r);return e.fillStyle=o,e.fillRect(Math.round(s*l)+(l%2?.5:0)-r/2,c,r,r),void e.restore()}const c={style:{fillStyle:o},location:{x:s,y:n,horzAlign:q.Center,vertAlign:i.vertOffset>0?$.Top:$.Bottom}};a.paintTo(e,t,c)}_startPath(e,t,i,s){}_endPath(e){}_textImageCache(){return null!==this._charCache&&this._charCache.fontFamily===this._fontFamily&&this._charCache.fontSize===this._fontSizeEnsured||(this._charCache={fontSize:this._fontSizeEnsured,fontFamily:this._fontFamily,cache:new he(this._ch,!1,!1,this._fontFamily,this._fontSizeEnsured,"center",0)}),this._charCache.cache}}class ke extends xe{constructor(){super(...arguments),this._charRenderer=new Le(null)}_updateRenderer(e,t){var i,s;const r=this._getTranspValue(),n=this._model.timeScale().barSpacing();let a;const l=this._study.properties().childs().styles.childs()[this._plotName].childs() +;a=this._plotStyleInfo.size?this._calculateShapeHeight(50,this._plotStyleInfo.size):Math.round(n);const c=l.location.value(),h=(0,p.generateColor)(l.color.value(),r),d=this._calculateVerticalOffset(c,a),u={items:this.items(),barSpacing:n,char:(0,o.ensureDefined)(null!==(s=null===(i=l.char)||void 0===i?void 0:i.value())&&void 0!==s?s:this._plotStyleInfo.char),height:a,vertOffset:d,color:h,visibleItemsRange:{startItemIndex:e,endItemIndex:t}},_=this._plotStyleInfo.text;if(void 0!==_&&""!==_.trim()){let e=_.trim().replace(/\\n/gm,"\n");e=(0,Y.cleanButAmpersand)(e,!0),u.text=e,u.fontSize=12;const t=l.textColor?l.textColor.value():void 0;u.textColor=t?(0,p.generateColor)(t,r):h}this._charRenderer.setData(u);const m=new H.CompositeRenderer;m.append(this._charRenderer),this._model.selection().isSelected(this._study)&&this._isMarkersEnabled&&null!==this._selectionData&&(this._selectionData.vertOffset=d,m.append(new K.SelectionRenderer(this._selectionData))),this._renderer=m}}var De=i(24377);class Ee{constructor(e,t,i,s,r){this.left=NaN,this.right=NaN,this.height=NaN,this.center=e,this.y=t,this.origHeight=i,this.isUp=s,this.origPrices=r,this.timePointIndex=e,this.style={}}}function Ve(e){return Math.round(e/4)}function Be(e){return Math.round(e/2)}class Re extends z.BitmapCoordinatesPaneRenderer{constructor(e){super(),this._data=e}hitTest(e){var t,i,s,r;const n=this._data,o=Be(n.barSpacing),a=Math.round(o/2),l=Math.round(o),c=Ve(n.barSpacing),h=null!==(i=null===(t=n.visibleItemsRange)||void 0===t?void 0:t.startItemIndex)&&void 0!==i?i:0,d=null!==(r=null===(s=n.visibleItemsRange)||void 0===s?void 0:s.endItemIndex)&&void 0!==r?r:n.items.length;for(const t of n.items.slice(h,d)){if(!t)continue;if(!Number.isFinite(t.center)||!Number.isFinite(t.y))continue;const i=Math.abs(t.height),s=t.isUp?-1:1,r=i+l,n=t.y-s*c,o=n-s*r,h=t.center-a,d=t.center+a;if(h0,{hiPlot:r,loPlot:n}=this._hiLoPlots(),a=this._study.offset(this._plotName),l=Math.min(i+a,(0,o.ensureNotNull)(this._series.data().last()).index);if(s){const e=this._getSeriesVal(n,l);if(null!==e)return e}else{const e=this._getSeriesVal(r,l);if(null!==e)return e}return null}_updateItem(e,t){const i=this._getValueForUpdating(e),s=e.value[this._plotIndex+1]>0;return this._items[t].origPrices.price=null!=i?i:NaN,this._items[t].isUp=s,t+1}_createItem(e,t,i,s,r){const n={center:NaN,y:NaN,origPrices:{price:NaN,timePointIndex:NaN},origHeight:NaN};if(n.timePointIndex=e+r,!t)return n;const a=Math.min(e+r,(0,o.ensureNotNull)(this._series.data().last()).index),l=t>0;let c;if(l){const e=this._getSeriesVal(s,a);if(null===e)return n;c=e}else{const e=this._getSeriesVal(i,a);if(null===e)return n;c=e}return new Ee(e+r,c,t,l,{price:c,timePointIndex:e+r})}_dependsOnSeriesData(){return!0}_convertItemsToCoordinates(e,t,i,s){this._convertItemsToCoordinatesImpl(e,t,i,s)}_updateItemsHeights(e){var t,i,s,r,n,a,l,c +;const h=this._study.properties().childs().styles.childs();let d=Math.abs((0,o.ensureDefined)(null!==(i=null===(t=h[this._plotName].childs().minHeight)||void 0===t?void 0:t.value())&&void 0!==i?i:this._plotStyleInfo.minHeight)),u=Math.abs((0,o.ensureDefined)(null!==(r=null===(s=h[this._plotName].childs().maxHeight)||void 0===s?void 0:s.value())&&void 0!==r?r:this._plotStyleInfo.maxHeight));if(d>u){const e=d;d=u,u=e}const p=this._items,_=null!==(a=null===(n=e.visibleItemsRange)||void 0===n?void 0:n.startItemIndex)&&void 0!==a?a:0,m=(null!==(c=null===(l=e.visibleItemsRange)||void 0===l?void 0:l.endItemIndex)&&void 0!==c?c:p.length)-1;let g=0;for(let e=_;e<=m;e++){const t=p[e],i=Math.abs(t.origHeight);i>g&&(g=i)}const f=(u-d)/g;for(let e=_;e<=m;e++){const t=p[e],i=Math.abs(t.origHeight);t.height=i*f+d}}}var Fe=i(77786);class We{constructor(e,t,i,s){this._bars=[],this._invalidated=!1,this._isMarkersEnabled=W.enabled("source_selection_markers"),this._selectionData=null,this._ohlcPlotIndexes=new Map,this._study=e,this._series=t,this._model=i,this._plotName=s,this._isMarkersEnabled=W.enabled("source_selection_markers"),this._colorProvider=(0,j.createStudyPlotColorProvider)(e.metaInfo(),e.properties(),s),this._selectionIndexer=new J.SelectionIndexes(i.timeScale());const r=this._study.metaInfo().plots;for(let e=0;es)return;i=Math.max(r,i);const n=this._study.data(),a=this._study.firstValue();if(null===a)return;const l=n.rangeIterator(i,s),c=(0,o.ensureDefined)(this._study.properties().childs().ohlcPlots).childs()[this._plotName].childs(),h=new Map,d=(e,t)=>{const i=e+"@"+t;if(!h.has(i)){const s=(0,p.generateColor)(e,t);return h.set(i,s),s}return h.get(i)},u=(0,ee.createEmptyStyle)();for(const e of l){let t=e.index;const i=e.value;t=Math.floor(t);let s=!0;const r=new Map;for(let e=1;e<=4;++e){const t=this._ohlcPlotIndexes.get(e);if(void 0===t){s=!1;break}const n=i[t+1];if(null==n){s=!1;break}r.set(e,n)}if(!s)continue;const n=(0,o.ensureDefined)(r.get(1)),a=(0,o.ensureDefined)(r.get(4)),l=(0,o.ensureDefined)(r.get(2)),h=(0,o.ensureDefined)(r.get(3)),p=Math.max(n,l,h,a),_=Math.min(n,l,h,a);let m=(0,o.ensureDefined)(d(c.color.value(),0));const g=this._colorProvider.getPlotPointStyle(i,u);void 0!==g.colors[0]&&(m=(0, +o.ensureDefined)(g.colors[0]));const f={time:Math.round(t),open:n,high:p,low:_,close:a,color:m,wickColor:g.colors[4],borderColor:g.colors[3],hollow:null};this._bars.push(f)}if(e.barPricesToCoordinates(this._bars,a),this._model.timeScale().barIndexesToCoordinates(this._bars),this._model.selection().isSelected(this._study)){const t=this._selectionIndexer.indexes();this._selectionData={points:[],hittestResult:re.HitTarget.Regular,bgColors:[],visible:!0,barSpacing:this._model.timeScale().barSpacing()};const i=(0,o.ensureNotNull)(this._model.paneForSource(this._study)).height(),s=(0,o.ensureDefined)(this._ohlcPlotIndexes.get(4));for(let r=0;r{var e;return this._colorPlotIndex=null!==(e=this._colorPlotIndex)&&void 0!==e?e:{type:1}};for(let t=0;t{null===this._bandAKey&&i.id===e&&(this._bandAKey=s),null===this._bandBKey&&i.id===t&&(this._bandBKey=s)}))}}var at=i(13333),lt=i(4949),ct=i(91280),ht=i(28558),dt=i(97145),ut=i(42960),pt=i(42226),_t=i(45802),mt=i(11527),gt=i(85402);class ft extends gt.AbstractBarColorer{constructor(e,t){super(),this._rgbaFromInteger=(0,Ze.rgbaFromIntegerCached)(),this._study=e,this._plotIndex=t}applyBarStyle(e,t,i,s){var r;if(t)return i;const n=this._study.properties().childs();if(!n.visible.value())return i;const a=this._study.metaInfo(),l=this._study.data();if(!l||0===l.size())return i;const c=a.plots[this._plotIndex],h=this._getOffset();if(this._study.getMinFirstBarIndexForPlot(c.id)>e+h)return i;if(0===n.styles.childs()[c.id].childs().display.value())return i;const d=l.valueAt(e-h);if(null===d)return i;let u=d[this._plotIndex+1];if(null==u)return i;if(u=Math.round(u),a.isRGB)i.barColor=this._rgbaFromInteger(u),i.upColor=i.barColor,i.downColor=i.barColor;else{const e=a.plots[this._plotIndex];if("palette"in e){const t=e.palette,s=n.palettes.childs()[t],l=(0,o.ensureDefined)(null===(r=a.palettes)||void 0===r?void 0:r[t]),c=l.valToIndex?(0,o.ensureDefined)(l.valToIndex[u]):u,h=s.childs().colors.childs()[c].childs().color.value();i.barColor=h,i.upColor=h,i.downColor=h}}return i}firstColoredBar(e){var t;let i=e;for(const s of this._backColorers)i=Math.min(i,null!==(t=s.firstColoredBar(e))&&void 0!==t?t:1/0);const s=this._getOffset();i=Math.min(i,e+s);const r=this._getBars().firstIndex();return Math.max(i,null!=r?r:-1/0)}_getBars(){return this._study.series().bars()}_getOffset(){const e=this._study.metaInfo().plots[this._plotIndex];return this._study.offset(e.id)}}var vt=i(76422),St=i(85804),yt=i(17236),bt=i(46100),wt=i(38349),Ct=i(6674),Pt=i(71766),xt=i(98596),Tt=i(93572),It=(i(74970),i(72007)),Mt=i(1763);const At=(0,c.getLogger)("Chart.Study"),Lt=l.t(null,void 0,i(14177));const kt={symbolsForDisplay:!1,symbolsForChartApi:!0,skipHiddenInputs:!1,skipFakeInputs:!1,skipBooleanInputs:W.enabled("dont_show_boolean_study_arguments"),asObject:!0,skippedGroups:[],skippedInputs:[],noExchanges:!1,noResolution:!1,keepOptionalSymbolsEmpty:!1,skipColorInputs:!1,skipTimeInputs:!1,skipOptionalEmptySymbolInputs:!1,skipTextareaInputs:!1,priceInputsForDisplay:!1},Dt=W.enabled("study_symbol_ticker_description"),Et=W.enabled("hide_main_series_symbol_from_indicator_legend"),Vt=W.enabled("datasource_copypaste"),Bt=W.enabled("hide_unresolved_symbols_in_legend");function Rt(e,t){const i=e.plots[t];if(!i||!(0,T.isOhlcPlot)(i))return!1;const s=i.target,r=e.defaults.styles&&e.defaults.styles[s],n=e.defaults.ohlcPlots&&e.defaults.ohlcPlots[s],o=e.ohlcPlots&&e.ohlcPlots[s];return r&&(0,T.isOhlcPlotStyleBars)(r)||n&&(0,T.isOhlcPlotStyleBars)(n)||!!o&&(0,T.isOhlcPlotStyleBars)(o)}function Nt(e,t){const i=e.plots[t];if(!i||!(0,T.isOhlcPlot)(i))return!1 +;const s=i.target,r=e.defaults.styles&&e.defaults.styles[s],n=e.defaults.ohlcPlots&&e.defaults.ohlcPlots[s],o=e.ohlcPlots&&e.ohlcPlots[s];return r&&(0,T.isOhlcPlotStyleCandles)(r)||n&&(0,T.isOhlcPlotStyleCandles)(n)||!!o&&(0,T.isOhlcPlotStyleCandles)(o)}function Ot(e,t){(0,o.assert)(void 0!==e,"zOrder must be defined"),(0,o.assert)(!t.has(e),"zOrder must be unique")}function Ft(e,t){return e.plots.some((e=>((0,T.isColorerPlot)(e)||(0,T.isDataPlot)(e))&&e.target===t))}function Wt(e){const t={};if(e.plots)for(let i=0;i= 1");const r=v.StudyMetaInfo.getStudyPropertyRootName(e),o=(0,V.clone)(e.defaults),l=Ht();if((0,n.default)(l,Wt(e)),(0,n.default)(l,o),(0,n.default)(l,(0,St.factoryDefaults)(r)),(0,n.default)(l,zt(e,s,r)),(0,n.default)(l,t),(0,n.default)(l,Ut(o,l)),null!==i){const t=i.model().studiesColorRotatorFactory().getColorRotator(e);null!==t&&("Overlay@tv-basicstudies"===e.id?l.lineStyle.color=t.getColor(l.lineStyle.color):(0,n.default)(l,function(e,t){for(const i of Object.keys(e.styles)){const s=e.styles[i];if((0,a.isObject)(s)&&"color"in s){const e=s.color;s.color=t.getColor(e)}}return e}(l,t)))}return l}function Gt(e,t,i,s,r){return function(e,t,i,s,r,n){const o=jt(e,t,i,s);return v.StudyMetaInfo.getSourceInputIds(e).forEach(((e,t)=>{const i=o.inputs[e];t=1&&(0,n.default)(d,Ut(l,d)),d}(e,t,i,s,o);return $t(t||e,r,a)}function Kt(e,t,i,s,r){return Yt(e,t,i,s,v.StudyMetaInfo.getStudyPropertyRootName(e),r)}function Zt(e,t,i){let s=0,r=0;return e.inputs.filter((e=>"source"===e.type)).forEach((e=>{(0,F.getInputValue)(i[e.id]).includes("$")&&s++,(0,F.getInputValue)(t[e.id]).includes("$")&&r++})),Math.sign(r)-Math.sign(s)}function Xt(e,t){return{type:at.StudyStatusType.Error,errorDescription:e}}function Jt(e){return"inherit"===e.type&&(e.type="price"),e}function Qt(e,t,i,s){var r,n;{const t=(0,V.isNumber)(s)?s:void 0,o=null!==(n=null===(r=null===Mt.customFormatters||void 0===Mt.customFormatters?void 0:Mt.customFormatters.studyFormatterFactory)||void 0===r?void 0:r.call(Mt.customFormatters,e,i,t))&&void 0!==n?n:null;if(null!==o)return o}if(null!==t)switch(e.type){case"inherit":case"price":return new Pt.PriceFormatter(t);case"volume":return new xt.VolumeFormatter(Math.log10(t));case"percent":return new Tt.PercentageFormatter(t)}if("inherit"===e.type)return null;const o=(0, +V.isNumber)(e.precision)?Math.pow(10,e.precision):void 0;switch(e.type){case"price":return new Pt.PriceFormatter(o);case"volume":{let t=e.precision;return void 0===t&&(t=i&&(0,V.isNumber)(i.volume_precision)?i.volume_precision:0),new xt.VolumeFormatter(t)}case"percent":return new Tt.PercentageFormatter(o);default:return At.logWarn(`Unsupported format type: ${e.type}`),null}}const ei=new Set(["first_visible_bar_time","last_visible_bar_time","subscribeRealtime"]);class ti extends m.PriceDataSource{constructor(e,t,i,s){var r,n,a;super(e),this._onStart=new u.Delegate,this._restarting=!1,this._paneViews=[],this._legendView=null,this._priceAxisViews=[],this._resolvedSymbols={},this._resolvedSymbolsByInput={},this._priceAxisViewsBase=[],this._priceLinesAxisViews=[],this._labelPaneViews=[],this._ownFirstValue=null,this._formatter=null,this._dataUpdated=new u.Delegate,this._currencySourceSymbolInputProperty=null,this._onHibernationStateChange=new u.Delegate,this._symbolsResolved=new u.Delegate,this._statusChanged=new u.Delegate,this._inputsAnchorsPaneView=null,this._inputsLinesPaneView=null,this._inputsTimeAxisPaneViews=[],this._inputsPriceAxisPaneViews=[],this._sources=[],this._status={type:at.StudyStatusType.Undefined},this._wasCompletedBefore=!1,this._studyId=null,this._isSubscribedToSessionId=!1,this._titleStrCache={},this._titleInPartsCache={},this._children=[],this._numericFormatter=new B.NumericFormatter,this._graphicsPriceAxisViews=[],this._plotOffsets={},this._ongoingDataUpdate=Promise.resolve(),this._studyModified=!1,this._tagsChanged=new u.Delegate,this._studyName="",this._turnaround="st0",this._pendingResolveSymbols=new Map,this._onIsActualIntervalChange=new u.Delegate,this._childStudyByRebind=new u.Delegate,this._lastNonEmptyPlotRowCache={},this._startMovingPoint=null,this._processHibernateBound=this.processHibernate.bind(this,1),this._maxOffset=new dt.WatchedValue(0),this._currencySourceSymbolInfo=null,this._graphicsPriceRangeGroups=null,this._graphicsViewsReady=!1,this._visibleTimeRangeInputs=null,this._turnaroundCounter=0,this._deferredPinePatchProps=!1,this._propertiesPatched=Promise.resolve(),this._aboutToBeDestroyed=new u.Delegate,this._definitionsViewModel=null,this._plotFormatters=new Map,this._onParentSourcesChanges=new u.Delegate,this._chartApi=e.chartApi(),this._properties=t,this._metaInfo=s,this._hideMatches=s.inputs.filter((e=>e.hideWhenPlotsHidden)).map((e=>({id:e.id,plotIds:e.hideWhenPlotsHidden||[]}))),this._series=this._model.mainSeries(),this._series.onIntervalChanged().subscribe(this,this._calcIsActualInterval),this._showStudyArgumentsProperty=e.properties().childs().paneProperties.childs().legendProperties.childs().showStudyArguments,e.collapsed().subscribe(this._processHibernateBound),this._sources=i,v.StudyMetaInfo.setChildStudyMetaInfoPropertiesSourceId(s,null===(r=this._sources[0])||void 0===r?void 0:r.id(),t),i.forEach((e=>{e.setChild(this)})),[this._series,...i].forEach((e=>{e.currencyChanged().subscribe(this,this._onSourceCurrencyChanged), +e.unitChanged().subscribe(this,this._onSourceUnitChanged),e.priceRangeReadyChanged().subscribe(this,this._onSourcePriceRangeReadyChanged),e.formatterChanged().subscribe(this,this._onSourceFormatterChanged),e.priceStepChanged().subscribe(this,this._onSourcePriceStepChanged)})),Dt&&this._model.mainSeries().properties().childs().statusViewStyle.childs().symbolTextSource.listeners().subscribe(this,(()=>{this.invalidateTitleCache(!0)}));const l=this._properties.childs();for(const e of v.StudyMetaInfo.getSourceInputIds(s))null===(n=l.inputs.childs()[e])||void 0===n||n.subscribe(this,this._onSourceInputChanged);this._properties.subscribe(this,this._onPropertiesChanged),l.visible.subscribe(this,this._visibleChanged),l.visible.subscribe(this,(()=>this.processHibernate())),l.intervalsVisibilities.subscribe(this,this._calcIsActualInterval),l.inputs.listeners().subscribe(this,this._updateMaxOffsetValue),void 0!==l.offsets&&l.offsets.listeners().subscribe(this,this._updateMaxOffsetValue),void 0!==l.offset&&l.offset.listeners().subscribe(this,this._updateMaxOffsetValue),this._initializeCurrencySource(),M.hideAllIndicators().subscribe(this,this._visibleChanged);for(let e=0;e{this.processHibernate(),this.invalidateTitleCache()}))}for(const e of Object.keys(this._metaInfo.graphics))for(const t of Object.keys(this._metaInfo.graphics[e])){const i=null===(a=l.graphics.childs()[e])||void 0===a?void 0:a.childs()[t];i&&i.childs().visible&&(0,o.ensureDefined)(i.childs().visible).subscribe(this,(()=>this.processHibernate()))}this._isActualInterval=(0,lt.isActualInterval)(this._series.intervalObj(),l.intervalsVisibilities),this._initializeStudyInputsPaneViews(),this._handler=e=>this._onData(e),this._handler.isTVScriptStrategy=this._metaInfo.isTVScriptStrategy,this._valuesProvider=new C.StudyValuesProvider(this,e),this._graphics=new S.LiveStudyGraphics(s.graphics),this._chartApi=e.chartApi(),this._invalidateLastNonEmptyPlotRowCache(),this._data=new f.PlotList((0,It.studyPlotFunctionMap)(this._metaInfo),It.studyEmptyPlotValuePredicate),this._createViews(),this._recreatePriceFormattingDependencies(this._series.symbolInfo()),l.precision.subscribe(this,this._precisionChanged),this._showStudyArgumentsProperty.subscribe(this,(()=>this.invalidateTitleCache(!0))),l.inputs.listeners().subscribe(this,(()=>this.invalidateTitleCache(!0))),W.enabled("update_study_formatter_on_symbol_resolve")&&e.mainSeries().dataEvents().symbolResolved().subscribe(this,this._recreatePriceFormattingDependencies),e.mainSeries().dataEvents().symbolResolved().subscribe(this,(()=>this.invalidateTitleCache(!0)));const c=new Set;if(this._simplePlotsCount=s.plots.filter(((e,t)=>{if((0,T.isLinePlot)(e))return!0;if((0,T.isOhlcPlot)(e)){const t=e.target;return!c.has(t)&&(c.add(t),!0)}return!1})).length,this.hasBarColorer()&&l.visible.listeners().subscribe(this,(()=>e.mainSeries().invalidateBarStylesCache)),this._definitionsViewModel=null, +this._updateMaxOffsetValue(),s.inputs.some((e=>ei.has(e.id)))){this._visibleTimeRangeInputs=e.visibleRangeStudiesInputs().spawn();const t=this._visibleTimeRangeInputs.value();let i=null!==t;this._visibleTimeRangeInputs.subscribe((e=>{this._onVisibleTimeRangeInputsChanged(e),i!==(null!==e)&&(i=null!==e,!i||this._restarting||this.isStarted()||this.start(!0))})),t&&this._updateVisibleTimeRangeInputs(t,!1)}}destroy(){var e,t,i;null===(e=this._signlePerformanceValue)||void 0===e||e.destroy(),this._aboutToBeDestroyed.fire(),null!==this._definitionsViewModel&&(this._definitionsViewModel.destroy(),this._definitionsViewModel=null),this._showStudyArgumentsProperty.unsubscribeAll(this),this._model.mainSeries().dataEvents().symbolResolved().unsubscribeAll(this);this.parentSources().forEach((e=>{e.currencyChanged().unsubscribeAll(this),e.unitChanged().unsubscribeAll(this),e.priceRangeReadyChanged().unsubscribeAll(this),e.formatterChanged().unsubscribeAll(this),e.priceStepChanged().unsubscribeAll(this)})),this._series.properties().childs().statusViewStyle.childs().symbolTextSource.unsubscribeAll(this),this._series.onIntervalChanged().unsubscribeAll(this),this.formatterChanged().unsubscribe(this,this.invalidateTitleCache),M.hideAllIndicators().unsubscribe(this,this._visibleChanged),this._model.collapsed().unsubscribe(this._processHibernateBound),null!==this._currencySourceSymbolInputProperty&&this._currencySourceSymbolInputProperty.unsubscribeAll(this),null===(t=this._legendView)||void 0===t||t.destroy(),null===(i=this._visibleTimeRangeInputs)||void 0===i||i.destroy(),super.destroy()}properties(){return this._properties}propertiesPatched(){return this._propertiesPatched}isDraggable(){return!this._metaInfo.linkedToSeries}logs(){return null}logLevelMask(){const e=this._properties.childs().inputs.childs().__log_level.value();if(!(0,V.isNumber)(e)||e<0||e>7)throw new Error(`Value of log level is unexpected, current value is ${e}, but expected values from 0 to 7`);return{error:Boolean(1&e),warning:Boolean(2&e),info:Boolean(4&e)}}setLogLevelMask(e){const t=(Number(e.error)&&1)|(Number(e.warning)&&2)|(Number(e.info)&&4);this._properties.childs().inputs.childs().__log_level.setValue(t)}performance(){return new dt.WatchedValue(null)}profilingEnabled(){return this._properties.childs().inputs.childs().__profile.value()}enableProfiling(e){this._properties.childs().inputs.childs().__profile.setValue(e)}onAboutToBeDestroyed(){return this._aboutToBeDestroyed}lastValueData(e,t,i){const s={noData:!0},r=this.priceScale();if(this._model.timeScale().isEmpty()||null===r||r.isEmpty()||this.data().isEmpty())return s;const n=this._model.timeScale().visibleBarsStrictRange(),o=this.firstValue(!0);if(null===n||null===o)return s;if(!this._properties.childs().visible.value())return s;const a=this._properties.childs().styles,l=this._properties.childs().ohlcPlots;let c,h;if(a&&a.childs()[e]&&(c=a.childs()[e]),l&&l.childs()[e]&&(c=l.childs()[e]),!c||0===c.childs().display.value())return s;const d=this.metaInfo().plots;for(h=0;he.id()));if(c.length&&(l.parentSources=c),e){let e=this.data();const t=this._model.timeScale(),i=this._seriesDataRangeToSave(e);null!==i&&(e=e.range(i.firstBar(),i.lastBar())),l.data=e.state(),l.data.symbols=this._resolvedSymbols,l.data.graphics=(0,S.saveStudyGraphics)(this.graphics(),t.visibleBarsStrictRange()),l.data.plotOffsets=this._plotOffsets}this.ownerSource()&&(l.ownerSource=null===(i=this.ownerSource())||void 0===i?void 0:i.id());for(let e=0;e=0?e:0}}if(null===(s=l.state)||void 0===s?void 0:s.inputs){const e=l.metaInfo.inputs.find((e=>"ILScript"===e.name));e&&delete l.state.inputs[e.id],delete l.state.inputs.__log_level,delete l.state.inputs.__profile}const d=this.stateCustomFields();return d&&(l.customFields=d),l}stateCustomFields(){}restoreStateCustomFields(e){}restoreData(e){var t,i;this._invalidateLastNonEmptyPlotRowCache(),this.data().restoreState(e),this._resolvedSymbols=null!==(t=e.symbols)&&void 0!==t?t:{},this._graphics=e.graphics?(0,S.loadStudyGraphics)(e.graphics):(0,S.emptyStudyGraphics)(),this._postProcessGraphics(),this._plotOffsets=null!==(i=e.plotOffsets)&&void 0!==i?i:{},this._setStatus({type:at.StudyStatusType.Completed},!0)}hasStateForAlert(){return!1}stateForAlert(){throw new Error("Not implemented")}idForAlert(){return super.idForAlert()}hasBarColorer(){return(0,o.ensureNotNull)(this._metaInfo).plots.some(T.isBarColorerPlot)}barColorer(){const e=this._metaInfo.plots;let t=null;for(let i=0;i"bar_time"!==e.type))}restart(e){this._restarting=!0,this.clearData(),(e||W.enabled("stop_study_on_restart"))&&this.stop(),setTimeout(this.start.bind(this),0)}stop(e,t){if(!0===e&&this._children)for(const e of this._children)e.stop(!0);this._stopStudyOnServer(),this.clearData(),this._unsubscribeToSessionId(),this.recalculate()}disconnect(){this._studyId=null,this._model.isSnapshot()||(this._resolvedSymbols={},this._resolvedSymbolsByInput={})}sourceId(){return this._studyId}parentSources(){return this._sources}symbolSource(){return this._firstSourceOrSeries().symbolSource()}valueAt(e,t){return this.symbolSource().valueAt(e,t)}barsProvider(){return this._firstSourceOrSeries().barsProvider()}ownerSource(){return this.isChildStudy()?this._sources[0]:super.ownerSource()}isChildStudy(){return this._sources.length>0}hasChildren(){return this._children.length>0}isStarted(){return Boolean(this._studyId)}isRestarting(){return this._restarting}isActualInterval(){return this._isActualInterval}onIsActualIntervalChange(){return this._onIsActualIntervalChange}isVisible(){var e,t,i;const s=this._properties.childs();if(this._model.collapsed().value()||!s.visible.value()||!this.isActualInterval())return!1;const r=this.metaInfo();if(r.plots.length>0)for(let e=0;ee.isHibernated())).map((e=>e.start())));const r=!(this.isHibernationAllowed()&&!this.isVisible())||!0===t;if(this._chartApi&&this._chartApi.isConnected().value()&&r)try{await this._allSymbolsAreResolved(),await this._startAfterSymbolsResolved(e,t)}catch(e){const t=`ERROR: ${this._debugId()} start failed, ${e}`;At.logError(t),this._restarting=!1,"TooManyStudies"===(null==e?void 0:e.cause)&&(0,d.showTooManyStudiesNotice)(this._chartApi.getStudyCounter())}}replaceData(e,t,i){this._invalidateLastNonEmptyPlotRowCache(),this.data().remove(e+1),this.data().addTail(i,t)}inputs(e){const t=(0,n.default)((0,V.clone)(kt),e||{});t.skipOptionalEmptySymbolInputs&&(t.keepOptionalSymbolsEmpty=!0);const i=(0,r.default)(this._buildInputs(t));return t.patchSosInputs&&v.StudyMetaInfo.patchSoSInputs(i,(e=>{var t,i;return null!==(i=null===(t=this._sources.find((t=>t.id()===e)))||void 0===t?void 0:t.sourceId())&&void 0!==i?i:null})),i}data(){return this._data}moveData(e){ +this._ongoingDataUpdate=this._ongoingDataUpdate.then((()=>{this._invalidateLastNonEmptyPlotRowCache(),this.data().move(e)}))}plots(){return this.data()}metaInfo(){return this._metaInfo}status(){return this._status}name(e){return e?this.metaInfo().shortDescription||"Study":this.metaInfo().description||"Study"}title(e,t,i,s,r){s=void 0===s?!this._showStudyArgumentsProperty.value():s;const n=JSON.stringify([e,t,i,s,r]);if(this._titleStrCache[n])return this._titleStrCache[n];if(this._titleInPartsCache[n])return this._joinTitlesParts(this._titleInPartsCache[n]);const o=this._title(e,t,i,s,r);return this._titleStrCache[n]=o,o}titleInParts(e,t,i,s,r){s=void 0===s?!this._showStudyArgumentsProperty.value():s;const n=JSON.stringify([e,t,i,s,r]);if(this._titleInPartsCache[n])return this._titleInPartsCache[n];const o=this._titleInParts(e,t,i,s,r);return this._titleInPartsCache[n]=o,o}invalidateTitleCache(e){if(this._titleStrCache={},this._titleInPartsCache={},!0===e&&this._children)for(let t=0;tt.update(e))),this._labelPaneViews.forEach((t=>t.update(e))),null===(t=this._dataWindowView)||void 0===t||t.update(),null===(i=this._legendView)||void 0===i||i.update(),null===(s=this._statusView)||void 0===s||s.update(),this._priceAxisViews.forEach((t=>t.update(e))),this._priceLinesAxisViews.forEach((t=>t.update(e))),null===(r=this._inputsLinesPaneView)||void 0===r||r.update(e),null===(n=this._inputsAnchorsPaneView)||void 0===n||n.update(e),this._inputsTimeAxisPaneViews.forEach((t=>t.update(e))),this._inputsPriceAxisPaneViews.forEach((t=>t.update(e))),"data-source-change"===e.type&&e.sourceId===this.id()&&e.clearData&&this._children.forEach((e=>e.updateAllViews({type:"data-source-change",sourceId:e.id(),clearData:!0})))}removeByRemoveAllStudies(){return!0}getStudyName(){return this._studyName}nearestIndex(e,t,i){var s;return null===(s=this.data().search(e,t,i))||void 0===s?void 0:s.index}getMinFirstBarIndexForPlot(e){var t,i,s,r,n,o,a,l,c,h,d,u,p,_,m +;const g=this._properties.childs(),f=this._metaInfo,v=null!==(m=null!==(u=null!==(c=null!==(o=null!==(s=null===(i=null===(t=g.styles.childs()[e])||void 0===t?void 0:t.child("showLast"))||void 0===i?void 0:i.value())&&void 0!==s?s:null===(n=null===(r=g.filledAreasStyle.childs()[e])||void 0===r?void 0:r.child("showLast"))||void 0===n?void 0:n.value())&&void 0!==o?o:null===(l=null===(a=f.styles)||void 0===a?void 0:a[e])||void 0===l?void 0:l.showLast)&&void 0!==c?c:null===(d=null===(h=g.ohlcPlots.childs()[e])||void 0===h?void 0:h.child("showLast"))||void 0===d?void 0:d.value())&&void 0!==u?u:null===(_=null===(p=f.ohlcPlots)||void 0===p?void 0:p[e])||void 0===_?void 0:_.showLast)&&void 0!==m?m:null;if(null===v)return-1/0;const S=this.data().lastIndex();return null===S?-1/0:S-v+1}guiPlotName(e,t){var i,s,r;return null!==(r=null===(s=null===(i=this._metaInfo.styles)||void 0===i?void 0:i[t])||void 0===s?void 0:s.title)&&void 0!==r?r:this.title(e)}childStudyByRebind(){return this._childStudyByRebind}isPine(){return void 0!==this._metaInfo.pine}isStandardPine(){return this.isPine()&&v.StudyMetaInfo.isStandardPine(this._metaInfo.id)}isLinkedToSeries(){return!0===this._metaInfo.linkedToSeries}defaultPlotIdForAlert(){return this._metaInfo.plots.length?this._metaInfo.plots[0].id:null}resolvedSymbolInfoBySymbol(e){return this._resolvedSymbols&&e&&this._resolvedSymbols[this._getSymbolForResolve(e)]||null}hasPendingUnresolvedSymbols(){return this._pendingResolveSymbols.size>0}hasSymbolInputs(){return this._metaInfo.inputs.some((e=>"symbol"===e.type))}currency(){if(null!==this._currencySourceSymbolInfo)return(0,ut.symbolCurrency)(this._currencySourceSymbolInfo);const e=this.metaInfo();return Boolean(e)&&e.is_price_study?this._firstSourceOrSeries().currency():null}currencySourceSymbolInfo(){var e,t,i;return null!==(e=this._currencySourceSymbolInfo)&&void 0!==e?e:null!==(i=null===(t=this.symbolSource())||void 0===t?void 0:t.symbolInfo())&&void 0!==i?i:null}unit(){const e=this.metaInfo();return Boolean(e)&&e.is_price_study?this._firstSourceOrSeries().unit():null}canOverrideMinTick(){return!1}dataWindowView(){return this._dataWindowView}statusView(){return this._statusView}legendView(){return this._legendView}inputsForAlertState(){return this.inputs()}sessionId(){return this._firstSourceOrSeries().sessionId()}sessionIdChanged(){return this._firstSourceOrSeries().sessionIdChanged()}getSymbolString(e){return""===e?"":(0,L.encodeExtendedSymbolOrGetSimpleSymbolString)(this._getSymbolObject(e))}onStatusChanged(){return this._statusChanged}symbolsResolved(){return this._symbolsResolved}onHibernationStateChange(){return this._onHibernationStateChange}valuesProvider(){return new x(this,this.model())}statusProvider(e){return new E.StudyStatusProvider(this,this._model.properties().childs().scalesProperties.childs().textColor)}correctScaleMargins(e){if("Volume"===this.metaInfo().shortId){const t=this.model().paneForSource(this);return null!==t&&t.isOverlay(this)&&t.containsMainSeries()?{top:.75,bottom:0}:{top:e.top,bottom:0}}return e} +canBeHiddenByGlobalFlag(){return!0}isSourceHidden(){return!this.isVisible()||this.canBeHiddenByGlobalFlag()&&M.hideAllIndicators().value()}paneViews(e){if(this.isSourceHidden()||!e.hasPriceDataSource(this))return null;const t=[];return!this._startMovingPoint&&this._wasCompletedBefore&&t.push(...this._paneViews),this._inputsLinesPaneView&&(this._startMovingPoint||this._model.selection().isSelected(this))&&t.push(this._inputsLinesPaneView),this._inputsAnchorsPaneView&&t.push(this._inputsAnchorsPaneView),t}labelPaneViews(){return this.isSourceHidden()?null:this._labelPaneViews}timeAxisViews(){return this._model.selection().isSelected(this)?this._inputsTimeAxisPaneViews:null}priceAxisViews(e,t){const i=this._properties.childs().oldShowLastValue;if(i&&!i.value())return null;let s=this._priceAxisViews.slice();return this._model.selection().isSelected(this)&&(s=s.concat(this._inputsPriceAxisPaneViews)),e.findTargetPriceAxisViews(this,t,s,this._priceLinesAxisViews)}movable(){return null!==this._inputsAnchorsPaneView}startMoving(e,t,i,s){this._startMovingPoint=e,this.stop()}move(e,t,i,s){if(void 0!==e.logical&&null!==this._startMovingPoint){if(Array.isArray(t)){const i=t;this._updateInputValue(e.logical,i[0]),this._updateInputValue(e.logical,i[1])}else this._updateInputValue(e.logical,t);this.updateAllViews((0,ht.sourceChangeEvent)(this.id()))}}endMoving(e,t){return this._startMovingPoint=null,this.start(),{indexesChanged:!1,pricesChanged:!1}}clearData(){var e;this._invalidateLastNonEmptyPlotRowCache(),this.data().clear(),this._graphics instanceof S.LiveStudyGraphics&&(null===(e=this._graphics)||void 0===e||e.clear()),this._plotOffsets={},this.hasBarColorer()&&this._model.mainSeries().invalidateBarStylesCache(),this.updateAllViews((0,ht.sourceChangeEvent)({sourceId:this.id(),clearData:!0}))}convertYCoordinateToPriceForMoving(e,t){const i=this.priceScale();if(!t||!i||i.isEmpty())return null;const s=t.firstValue();return null===s?null:i.coordinateToPrice(e,s)}processHibernate(e){const t=this.isVisible();if(!this.isStarted()&&t&&(this._sources.forEach((e=>{e.processHibernate()})),this.start(void 0,void 0,e),this._onHibernationStateChange.fire(!1)),this.isHibernationAllowed()&&this.isStarted()&&!t){for(const e of this._children)e.processHibernate();this.stop(void 0,e),this._onHibernationStateChange.fire(!0)}}isHibernationAllowed(){return!this.metaInfo().historyCalculationMayChange&&(!this.hasChildren()||!!this._model.collapsed().value()&&this._children.every((e=>e.isHibernationAllowed())))}isPlotVisibleAt(e,t){let i;const s=this.metaInfo().plots.find((t=>t.id===e));if(i=void 0!==s?(0,T.isOhlcPlot)(s)?this._properties.childs().ohlcPlots.childs()[s.target]:this._properties.childs().styles.childs()[e]:this._properties.childs().ohlcPlots.childs()[e],void 0===i)throw new Error(`Study does not contain ${e} plot`);const r=i.childs().display.value();return null!==r&&(r&t)===t}recalculate(){const e=this._model.paneForSource(this);this._model.recalculatePane(e,(0,ht.sourceChangeEvent)(this.id())),this._model.updateSource(this)}maxOffset(){ +return this._maxOffset}onStart(){return this._onStart}onParentSourcesChanges(){return this._onParentSourcesChanges}isHibernated(){return!this.isVisible()&&!this.isStarted()}graphicsViewsReady(){return this._graphicsViewsReady}turnaround(e){if(!e)return this._turnaround;return function(e,t){let i=t.turnaround,s=[t];for(;s.length>0;){let e=[];const t=[];s.forEach((i=>{const s=N(i.sourceStudies).sort(R);if(s.length>0){e=e.concat(s);const i=s.map((e=>e.turnaround)).join("_");t.push(i)}})),t.length&&(i=t.join("_")+"_"+i),s=e}return e+"_"+i}(this._series.seriesSource().turnaround(),O(this))}canHaveChildren(){var e;return this._canHaveChildren=null!==(e=this._canHaveChildren)&&void 0!==e?e:v.StudyMetaInfo.canHaveChildren(this._metaInfo),this._canHaveChildren}setChild(e){-1===this._children.indexOf(e)&&this._children.push(e)}unsetChild(e){const t=this._children.indexOf(e);~t&&this._children.splice(t,1)}getAllChildren(){const e=this._children.slice();for(let t=0;te.id()===i)))&&void 0!==t?t:null}return this._series}priceStep(){return this._priceStep||this._firstSourceOrSeries().priceStep(!1)}recreatePriceFormatter(){this._recreatePriceFormattingDependencies()}setOwnerSource(e){super.setOwnerSource(e),this._recreatePriceFormattingDependencies()}onTagsChanged(){return this._tagsChanged}getPropertyDefinitionsViewModel(){return null===this._definitionsViewModel?this._getPropertyDefinitionsViewModelClass().then((e=>null===e||this._isDestroyed?null:(null===this._definitionsViewModel&&(this._definitionsViewModel=new e(this._model.undoModel(),this)),this._definitionsViewModel))):Promise.resolve(this._definitionsViewModel)}_getPropertyDefinitionsViewModelClass(){return Promise.resolve(null)}_alertMetaInfo(){return this.metaInfo()}_createStudyOnServer(){if(this._isDestroyed)return;const e=this._getStudyIdWithLatestVersion();this._studyId=(0,k.makeNextStudyId)(),this._incrementTurnaround(),this._studyName=e;const t=(0,V.clone)((0,o.ensureDefined)(this._inputs));v.StudyMetaInfo.patchSoSInputs(t,(e=>{var t,i;return null!==(i=null===(t=this._sources.find((t=>t.id()===e)))||void 0===t?void 0:t.sourceId())&&void 0!==i?i:null})),this._chartApi.createStudy(this._studyId,this._turnaround,this.isChildStudy()?(0,o.ensureNotNull)(this._sources[0].sourceId()):(0,o.ensureNotNull)(this._series.seriesSource().instanceId()),this._studyName,t,this._handler,this.isChildStudy())}_stopStudyOnServer(){this._chartApi&&this._chartApi.isConnected().value()&&this.isStarted()&&(this._chartApi.removeStudy((0,o.ensureNotNull)(this._studyId),this.isChildStudy()),this._setStatus({type:at.StudyStatusType.Undefined})),this._studyId=null}_modifyStudyOnServer(e,t){const i=(0,V.clone)((0,o.ensureDefined)(e));v.StudyMetaInfo.patchSoSInputs(i,(e=>{var t,i ;return null!==(i=null===(t=this._sources.find((t=>t.id()===e)))||void 0===t?void 0:t.sourceId())&&void 0!==i?i:null})),this._chartApi.modifyStudy((0,o.ensureNotNull)(this._studyId),this._turnaround,i,this._handler,t)}_transformData(e){}_invalidateLastNonEmptyPlotRowCache(){this._lastNonEmptyPlotRowCache={}}_collectDepsForAlert(){throw new Error("Not implemented")}_allInputsAreValid(){var e;if(null===(null===(e=this._visibleTimeRangeInputs)||void 0===e?void 0:e.value()))return!1;for(const e of this._metaInfo.inputs)if("bar_time"===e.type){const t=e.id;if(null==this._properties.childs().inputs.childs()[t].value())return!1}return!0}async _startAfterSymbolsResolved(e,t){await Promise.all(this._sources.map((e=>!e.isStarted()||e.isRestarting()?new Promise((t=>{e.onStart().subscribe(this,t,!0)})):Promise.resolve()))),this.isStarted()&&!this._restarting||(this._restarting=!1,this._allInputsAreValid()&&!this.metaInfo().isTVScriptStub&&(this._inputs=this._apiInputs(),this._createStudyOnServer(),this._subscribeToSessionId(),this._onStart.fire(),!0===e&&this._children&&await this._children.map((e=>e.start(!0,t)))))}async _changeInputsImpl(e,t){var s;const r=this._calcSources();let n=!0;const a=Zt(this._metaInfo,e,t);if(r.length!==this._sources.length||r[0]!==this._sources[0])n=await this._rebindToSourceOrRestorePreviousValue(null!==(s=r[0])&&void 0!==s?s:this._series,e,t),n&&(this._inputs=e);else{const s=()=>{for(const i of this._metaInfo.inputs){if("source"!==i.type)continue;const s=e[i.id].v,r=t[i.id].v;if(s!==r){(0,o.ensureDefined)(this._properties.childs().inputs.child(i.id)).setValue(r)}}};if(this.isStarted()&&this._chartApi.isConnected().value()&&a>0&&!this._chartApi.canCreateStudy(!0)){const e=window.user.pro_plan;return createGoProDialog({feature:"studyOnStudy",actions:e&&e===ExpertPlans.PremiumExpert?[{text:l.t(null,void 0,i(75139)),action:PredefinedAction.Close}]:void 0}),void s()}this._inputs=e;let n=!1;const c=Object.values(F.RangeDependentStudyInputNames);for(const i of Object.keys(e))if(JSON.stringify(e[i])!==JSON.stringify(t[i])&&!c.includes(i)){n=!0;break}this._incrementTurnaround(),n&&this.disablePriceRangeReady();try{await this._updateParentSources(r,a,!0),this._modifyStudyOnServer(e,a)}catch(e){At.logError(`Error applying parent sources: ${e}`),s()}}this.invalidateTitleCache(),n&&(this._studyModified=n)}_createPriceAxisView(e){return new _t.StudyPriceAxisView(this,{plotIndex:e})}_createPriceLineAxisView(e){return new mt.StudyPriceLineAxisView(this,e)}_createStudyPlotPaneView(e){return new Ge.StudyPlotPaneView(this,this._series,this._model,e)}_createViews(){var e,t,i,s;this._priceAxisViewsBase=[],this._priceLinesAxisViews=[],this._paneViews=[],this._labelPaneViews=[];const r=new Set,n=this.metaInfo(),a=Boolean(n.usePlotsZOrder),l=new Map,c=this._properties.childs();if(c.filledAreasStyle&&n.filledAreas)for(let e=0;e{const i=c.bands.childs()[t];if(i&&i.childs().visible.value()){const t=new it(i,this),s=a?(0,o.ensureDefined)(e.zorder):l.size;Ot(s,l),l.set(s,{paneViews:[t]})}})),c.bandsBackground&&((0,o.assert)(!a,"'usePlotsZOrder' flag does not supported"),l.set(l.size,{paneViews:[new nt(this)]}));const h=this._paneViews;this._createGraphicsPaneViews().then((e=>{for(let t=0;te-t));for(let e=0;e0){const t=(0,o.ensureNotNull)(this.barColorer()).firstColoredBar(e[0].index);null!==t&&this._model.mainSeries().invalidateBarStylesCache(t)}null!==t&&this._postProcessGraphics();const r=this._model.paneForSource(this);this._model.recalculatePane(r,(0,ht.sourceChangeEvent)({sourceId:this.id(),firstUpdatedTimePointIndex:null!=s?s:void 0,nonSeriesOnly:0===e.length})),this._updateSources()}_titleInputs(e,t,i){return this.inputs(this._titleInputsOptions(e,t,i))}_titleInputsOptions(e,t,i){return{symbolsForDisplay:!0,skipHiddenInputs:!0,skipFakeInputs:!1,fakeInputsForDisplay:!0,asObject:!0,skippedGroups:[],noExchanges:t,noResolution:i,priceInputsForDisplay:!0,skipOptionalEmptySymbolInputs:Et,displayMask:e}}_postProcessGraphics(){this._graphicsPriceAxisViews=this._createGraphicsPriceAxisViews(),this._concatPriceAxisViews()}async _createGraphicsPaneViews(){return(0,S.createGraphicsPaneViews)(this,this.model())}_createGraphicsPriceAxisViews(){return(0,S.createGraphicsPriceAxisViews)(this)}_subscribeToSessionId(){!this._isSubscribedToSessionId&&this.hasSymbolInputs()&&(this.sessionIdChanged().subscribe(this,this._onSessionIdChanged),this._isSubscribedToSessionId=!0)}_recreateFormatter(e){this._recreatePlotsFormatters(e),this._formatter=this._tryCreateFormatter(e),this._formatterChanged.fire();const t=this.priceScale();null!==t&&t.updateFormatter(),this.getAllChildren().forEach((e=>{e.recreatePriceFormatter()})),this._model.fullUpdate()}_recreatePriceFormattingDependencies(e){this._recreateFormatter(e),this._recreatePriceStep()}_title(e,t,i,s,r){const n=this._titleInParts(e,t,i,s,r);return this._joinTitlesParts(n)}_postProcessPriceRange(e){if(e&&e.minValue()===e.maxValue()&&!this.metaInfo().is_price_study){const t=.005*e.minValue();e=new g.PriceRange(e.minValue()-t,e.maxValue()+t)}const t=this.priceScale();return t&&t.isLog()&&e?new g.PriceRange(t.priceToLogical(e.minValue()),t.priceToLogical(e.maxValue())):e}_titleInParts(e,t,s,r,n){var a;const c=this.name(t);s=s||{};const h=[l.t(c,{context:"study"},i(68716))];let d=[];if(!r){const i=this._getMTFResolutionInputTitle();null!==i&&i.length>0&&h.push(i);const r=this.metaInfo(),l=this._titleInputs(e,n,!0),c=r.inputs.filter((e=>l.hasOwnProperty(e.id))).map((e=>({meta:e,value:l[e.id]})));if(c.length>0){const i={};if(this.isChildStudy())for(let s=0;s=0){const s=this.parentSourceForInput(h) -;if(s instanceof ti){const r=s.metaInfo(),o=s.title(e,t,{},!0,n);if(1===r.plots.length)i[h]=o;else{const e=h.split("$")[1],t=null===(a=r.plots[parseInt(e)])||void 0===a?void 0:a.id,s=r.styles&&r.styles[t],n=s&&s.title||t;i[h]=o+": "+n}}}}d=c.map((({meta:e,value:t})=>{if("time"===e.type)return new Date(t).toISOString();let r=(0,V.isNumber)(t)?this._numericFormatter.format(t):i&&i[t.toString()]||t.toString();return s&&s[r.toString()]&&(r=s[r.toString()]),r}))}}return[h.join(" · "),d]}_seriesDataRangeToSave(e){return this._model.timeScale().visibleExtendedDataRange(e,0)}_getSymbolForResolve(e){return this.getSymbolString(this._getSymbolForApi(e))}_getSymbolForApi(e){return e}_getSymbolObject(e){const t={symbol:e},i=this.currency();return null!==this._currencySourceSymbolInputProperty&&null!==this._currencySourceSymbolInfo&&this._getSymbolForApi(this._currencySourceSymbolInputProperty.value())===e&&(t["currency-id"]=i),t.session=this.sessionId(),t}_onSymbolResolved(e,t,i){this._onCurrencyMayChange()}_onSymbolResolvingStart(e,t){}_onSymbolError(){}_setStatus(e,t){var i;const s=this.isFailed();this._status=e,e.type===at.StudyStatusType.Completed?this._wasCompletedBefore=!0:e.type!==at.StudyStatusType.Error&&e.type!==at.StudyStatusType.Undefined||(this._wasCompletedBefore=!1),t||(null===(i=this._statusView)||void 0===i||i.update(),this._model.updateSource(this),this._statusChanged.fire(e)),s!==this.isFailed()&&this._updateAlertCreationAvailable()}_onPropertiesChanged(){this._restarting||(this._inputs?this._tryChangeInputs():this._chartApi&&this._chartApi.isConnected().value()&&this.restart()),this._recreatePaneViews(),(0,vt.emit)("study_properties_changed",this._id)}_lastNonEmptyPlotRow(e){var t;if(!(0,V.isInteger)(e))return At.logDebug("_lastNonEmptyPlotRow: incorrect plotIndex"),null;let i=null!==(t=this._lastNonEmptyPlotRowCache[e])&&void 0!==t?t:null;if(null!==i)return i;return i=this.data().findLast(((t,i)=>void 0!==i[e]),1e3),null===i?null:(this._lastNonEmptyPlotRowCache[e]=i,i)}_onCurrencyChanged(){"alwaysOff"!==(0,pt.currencyUnitVisibilityProperty)().value()&&this._model.fullUpdate(),this.isStarted()&&this._tryChangeInputs(),this._currencyChanged.fire()}_apiInputs(){return this.inputs({keepOptionalSymbolsEmpty:!0})}async _tryChangeInputs(){var e;const t=this.isStarted()&&this._chartApi.isConnected().value(),i=this._allInputsAreValid(),s=(0,o.ensureDefined)((0,V.clone)(this._inputs)),r=this._apiInputs(),n=JSON.stringify(r),a=n!==JSON.stringify(this._inputs);if(t&&i)try{if(await this._allSymbolsAreResolved(),n!==JSON.stringify(this._apiInputs()))return this._tryChangeInputs();if(this._isStopped())return void(a&&this.disablePriceRangeReady());a&&await this._changeInputsImpl(r,(0,o.ensureDefined)((0,V.clone)(this._inputs)))}catch(e){At.logError(`ERROR: ${this._debugId()} _tryChangeInputs: cannot modify study, ${e}`)}else if(t&&!i&&this.stop(!0),!t&&i&&this.start(!0),a){const t=this._calcSources() -;if(t.length!==this._sources.length||t[0]!==this._sources[0])await this._rebindToSourceOrRestorePreviousValue(null!==(e=t[0])&&void 0!==e?e:this._series,r,s);else{const e=Zt(this._metaInfo,r,s);this._updateParentSources(t,e,!0)}this._inputs=r}this._tagsChanged.fire()}_onCurrencyMayChange(){if(null!==this._currencySourceSymbolInputProperty){const e=this.currency();this._updateCurrencySourceSymbolInfo(),e!==this.currency()&&this._onCurrencyChanged()}}_fillPrecalculatedAutoscaleInfo(e,t){const i=this._metaInfo,s=this.properties().childs(),r=new Set,n=this._metaInfo.filledAreas||[];for(let e=0;e!(0,T.isPlotWithTechnicalValues)(e))).filter((e=>r.has(e.id)||this.isPlotVisibleAt(e.id,1))).reduce(((i,s)=>this._applyPlotToPrecalculatedAutoscaleInfo(e,t,i,s)),{fields:[],useMainSeriesRange:!1,baseValueMinMax:null})}_firstSourceOrSeries(){var e;return null!==(e=this._sources[0])&&void 0!==e?e:this._series}_skipHistogramBaseOnAutoScale(){return!1}_tryCreateFormatter(e){const t=void 0===e?this.symbolSource().symbolInfo():e;return Qt(this._metaInfo.format,this._priceScaleByProperties(),t,this.properties().childs().precision.value())}_mergeData(e){return this._invalidateLastNonEmptyPlotRowCache(),this.data().merge(e)}_incrementTurnaround(){this._turnaround="st"+ ++this._turnaroundCounter}_checkTurnaround(e){return e===this._turnaround||e===this._model.mainSeries().seriesSource().turnaround()||e===this.turnaround(!0)}_updateMaxOffsetValue(){let e=-1/0;for(const t of this._metaInfo.plots)e=Math.max(this.offset(t.id),e);this._maxOffset.setValue(e)}_rightOffsetToUnixTime(e){if(this._series.bars().size()>=e){const t=(0,o.ensureNotNull)(this._series.bars().lastIndex())-e;return(0,o.ensureNotNull)(this._series.bars().valueAt(t))[0]}return null}_concatPriceAxisViews(){this._priceAxisViews=[...this._priceAxisViewsBase,...this._graphicsPriceAxisViews]}_onStudyLoading(){var e;this._setStatus({type:at.StudyStatusType.Loading,startTime:Date.now()}),null===(e=this._statusView)||void 0===e||e.update(),this._model.updateSource(this)}_handleStudyError(e){var t;this.clearData(),this._setStatus(e),null===(t=this._statusView)||void 0===t||t.update(),this._model.updateSource(this)}_onStudyError(e){this._handleStudyError(this._createStudyError(e)),this._enablePriceRangeReady()}_createStudyError(e){var t;return Xt("string"==typeof e?{error:this._getStudyErrorText(e)}:e,null===(t=this.symbolSource().symbolInfo())||void 0===t||t.exchange)}_onStudyCompleted(e){var t;this._studyModified&&(this.clearData(),this._studyModified=!1),this._setStatus({type:at.StudyStatusType.Completed}),null===(t=this._statusView)||void 0===t||t.update();const i=this._model.paneForSource(this);this._model.recalculatePane(i,(0,ht.sourceChangeEvent)(this.id())),this._updateSources();const s=ct.InvalidationMask.full();null!==this._model.appliedTimeFrame().value()&&s.lockVisibleTimeRangeOnResize(),this._model.invalidate(s)}_updateSources(){ -this._model.updateSource(this),this.hasBarColorer()&&this._model.updateSource(this._model.mainSeries())}_unsubscribeToSessionId(){this._isSubscribedToSessionId&&(this.sessionIdChanged().unsubscribe(this,this._onSessionIdChanged),this._isSubscribedToSessionId=!1)}_onSessionIdChanged(){this.restart(!0)}_recreatePriceStep(){var e;let t=null;const i=null!==(e=this._priceScaleByProperties())&&void 0!==e?e:this._priceScaleByMetaInfo();null!==i&&(t=1/i),this._priceStep!==t&&(this._priceStep=t,this._priceStepChanged.fire())}_recreatePlotsFormatters(e){var t,i;this._plotFormatters.clear();const s=this._metaInfo.format,r=this._priceScaleByProperties(),n=void 0===e?this.symbolSource().symbolInfo():e;for(const[e,i]of Object.entries(null!==(t=this._metaInfo.ohlcPlots)&&void 0!==t?t:{}))if(null==i?void 0:i.format){const t=Qt(Jt({...s,...null==i?void 0:i.format}),r,n,this.properties().childs().precision.value());t&&this._plotFormatters.set(e,t)}for(const[e,t]of Object.entries(null!==(i=this._metaInfo.styles)&&void 0!==i?i:{}))if(null==t?void 0:t.format){const i=Qt(Jt({...s,...null==t?void 0:t.format}),r,n,this.properties().childs().precision.value());i&&this._plotFormatters.set(e,i)}for(const e of this._metaInfo.plots)if((0,T.isOhlcPlot)(e)){const t=this._plotFormatters.get(e.target);t&&this._plotFormatters.set(e.id,t)}}_joinTitlesParts(e){const t=e[1]?e[1].join(", "):"";return e[0]+(t.length>0?" ("+t+")":"")}_getMTFResolutionInputTitle(){const e=this.metaInfo();for(let t=0;ts),(()=>s)).then(this._onDataUnpacked.bind(this,e,t.indexes,i)),this._ongoingDataUpdate}_allSymbolsAreResolved(){const e=this._inputSymbols(),t=[];let i=!1;for(const s of e){const e=this._getSymbolForResolve(s);if(""!==e)if(this._resolvedSymbols[e])i=!0;else{const i=this._resolveSymbol(e,s);t.push(i)}}if(0===t.length){const e=Promise.resolve();return i?e.then((()=>this._symbolsResolved.fire())):e}return Promise.all(t).catch((e=>(this._inputSymbols().includes(e)&&this.stop(!0),this._setStatus({type:at.StudyStatusType.Error,errorDescription:{error:Lt}}),this._model.updateSource(this),Promise.reject("Invalid symbol, "+e)))).then((()=>{this._symbolsResolved.fire(),this._recheckLineToolsActuality()}))}_resolveSymbol(e,t){if(""===e)return Promise.resolve();let i=this._pendingResolveSymbols.get(e);return void 0!==i||(i=new Promise(((i,s)=>{this._onSymbolResolvingStart(e,t),this._chartApi.resolveSymbol((0,k.makeNextSymbolId)(),e,(r=>{switch(this._pendingResolveSymbols.delete(e),r.method){case"symbol_resolved":{this._setStatus({type:at.StudyStatusType.Undefined});const s=r.params[1];this._resolvedSymbols[e]=s,this._resolvedSymbolsByInput[t]=s,this._onSymbolResolved(e,t,s),this.invalidateTitleCache(!0),i();break -}case"symbol_error":if(this._setStatus({type:at.StudyStatusType.Error,errorDescription:{error:r.params[1]}}),this._onSymbolError(),r.params[1]===D.permissionDenied&&r.params[2]){if(r.params[2]!==D.SymbolErrorPermissionDeniedReason.Symbol)return void this._resolveSymbol(r.params[2],t).then(i);if(r.params[3])return void this._resolveSymbol(r.params[3],t).then(i)}0,s(t)}}))})),this._pendingResolveSymbols.set(e,i)),i}_recheckLineToolsActuality(){const e=this._model.paneForSource(this);null!==e&&e.sourcesByGroup().lineSourcesForAllSymbols().forEach((e=>{e.ownerSource()===this&&e.calcIsActualSymbol()}))}_sendTelemetryCounter(e,t){void 0===t&&(t=this._getTelemetryAdditionalData());const i={count:1,additional:t};telemetry.sendChartReport(e,i)}_getTelemetryAdditionalData(){let e="";return this._metaInfo.pine&&this._metaInfo.pine.version&&this._metaInfo.shortId.indexOf("USER")>=0&&(e="_v"+this._metaInfo.pine.version),{symbol:this.series().actualSymbol(),resolution:this.series().interval(),study:this._metaInfo.shortId+e}}_onSourceFormatterChanged(){null===this._formatter&&(null!==this._priceScale&&this._priceScale.updateFormatter(),this._formatterChanged.fire())}_onSourcePriceStepChanged(){null===this._priceStep&&this._priceStepChanged.fire()}_bandsFirstValue(e){const t=this._metaInfo;if(!t.bands)return null;for(let i=0;i=0?t:e}return e}if(this._metaInfo.isTVScript||this._metaInfo.pine){if("text"===o)return null!==(n=null===(r=this._metaInfo.defaults.inputs)||void 0===r?void 0:r.text)&&void 0!==n?n:"";if("pineId"===o)return this._metaInfo.scriptIdPart;if("pineVersion"===o)return this._metaInfo.pine?this._metaInfo.pine.version:"-1";if("color"===e.type&&this._metaInfo.isRGB){const e=a.inputs.childs()[o].value();return(0,p.colorToInteger)(e)}if("price"===e.type){const e=a.inputs.childs()[o].value();return t.priceInputsForDisplay?this.formatter().format(e):e}}return a.inputs.childs()[o].value()}_getAllOwnerSources(){const e=[];let t=this.ownerSource();for(;null!==t;)e.push(t),t=t.ownerSource();return e}_getStudyIdWithLatestVersion(){return v.StudyMetaInfo.getStudyIdWithLatestVersion(this.metaInfo())}_debugId(){const e=[];return this._studyId&&e.push(this._studyId),e.push(this._metaInfo.fullId),e.push(this._metaInfo.description),JSON.stringify({study:e})}_hasAvailableAlertPlots(){return!1}_hasAlertConditions(){return!1}_hasAlertFunction(){return!1}async _updateParentSources(e,t,i){if(this._sources.forEach((e=>e.unsetChild(this))),i&&await Promise.all(e.map((e=>e.isStarted()?Promise.resolve():e.start(!1,!0)))),e.forEach((e=>e.setChild(this))),this._setSources(e),this._recreatePriceFormattingDependencies(),0!==t&&this._sources.length<=1){const e=this._firstSourceOrSeries(),t=this._priceScale,i=(0,o.ensureNotNull)(e.priceScale());if(t!==i){const t=this._model.paneForSource(this),s=(0,o.ensureNotNull)(this._model.paneForSource(e));t===s&&s.move(this,i,!0)}}}_calcSources(){const e=this._properties.childs().inputs.state();return v.StudyMetaInfo.getSourceIdsByInputs(this._metaInfo.inputs,e).map((e=>{if("high"===e||"open"===e||"low"===e||"close"===e||"hl2"===e||"ohl3"===e||"ohlc4"===e)return null;{const t=this._model.allStudies().find((t=>t.canHaveChildren()&&t.id()===e));return null!=t?t:null}})).filter(V.notNull)}_isStopped(){return!this.isStarted()}_onDataUnpacked(e,t,i,s){if(this._isDestroyed)return;"nochange"!==t&&this._processPlotOffsets(s),this._transformData(e);const r=this._mergeData(e);null!==s&&(s.indexes_replace?((0,o.assert)("nochange"!==t),this._graphics.replaceIndexesTo(t)):("nochange"!==t&&this._graphics.replaceIndexesTo(t),void 0!==s.graphicsCmds&&this._graphics.processCommands(s.graphicsCmds))),this._onDataUpdated(e,s,t,r&&r.index),this.priceRangeReady()||this._enablePriceRangeReady(),this._dataUpdated.fire(i,!1,r)}_processPlotOffsets(e){if(e&&e.indexes_replace)return;const t=this._plotOffsets;this._plotOffsets=e&&e.offsets||{},(0, -s.default)(t,this._plotOffsets)||this.updateAllViews((0,ht.sourceChangeEvent)({sourceId:this.id(),clearData:!0})),this._updateMaxOffsetValue()}_applyPlotToPrecalculatedAutoscaleInfo(e,t,i,s){var r,n,a;const l=s.id,c=this._properties.childs().styles.childs()[l],h=(0,T.isShapesPlot)(s)||(0,T.isCharsPlot)(s);i.useMainSeriesRange=i.useMainSeriesRange||(0,T.isArrowsPlot)(s);let d=(0,T.isLinePlot)(s)||(0,T.isOhlcPlot)(s);if(h){const e=(0,o.ensureDefined)(c).childs().location.value(),t=[b.MarkLocation.Absolute,b.MarkLocation.Top,b.MarkLocation.Bottom].indexOf(e)<0;i.useMainSeriesRange=i.useMainSeriesRange||h&&t,d=d||e===b.MarkLocation.Absolute}if(!d)return i;const u={name:l,offset:this.offset(l)},p=c.childs().plottype.value();if(!this._skipHistogramBaseOnAutoScale()&&[T.LineStudyPlotStyle.Histogram,T.LineStudyPlotStyle.Columns,T.LineStudyPlotStyle.Area].indexOf(p)>=0){const s=null===(a=null===(n=null!==(r=this._metaInfo.styles)&&void 0!==r?r:{})||void 0===n?void 0:n[l])||void 0===a?void 0:a.histogramBase;if(void 0===s)return i;const o=this.data().minMaxOnRangeCached(e,t,[u]);return(0,V.isNumber)(s)&&null!==o&&(i.baseValueMinMax=(0,f.mergeMinMax)(i.baseValueMinMax,{min:s,max:s}),i.baseValueMinMax=(0,f.mergeMinMax)(i.baseValueMinMax,o)),i}return i.fields.push(u),i}async _onSourceInputChanged(){var e;if(!this.isStarted()){const t=this._calcSources();(t.length!==this._sources.length||t[0]!==this._sources[0])&&await this._rebindToSource(null!==(e=t[0])&&void 0!==e?e:this._series,this._apiInputs())}}async _rebindToSourceOrRestorePreviousValue(e,t,i){let s=!0;if(!await this._rebindToSource(e,t)){const e=this._properties.childs().inputs.state(),r=v.StudyMetaInfo.getSourceIdsByInputs(this._metaInfo.inputs,e)[0];for(const e of Object.keys(i)){const n=(0,F.getInputValue)(i[e]),a=(0,F.getInputValue)(t[e]);if(i.hasOwnProperty(e)&&n!==a&&r&&(0,V.isString)(a)&&0===a.indexOf(r)){const t=(0,o.ensureDefined)(this._properties.childs().inputs.child(e)),r=(0,F.getInputValue)(i[e]);t.setValue(r),s=!1;break}}}return s}async _rebindToSource(e,t){const i=this.isStarted()&&this._chartApi.isConnected().value();i&&e instanceof ti&&!e.isStarted()&&await e.start(!1,!0);const s=this._firstSourceOrSeries();let r;const n=(0,V.clone)((0,o.ensureDefined)(t)),a=e instanceof ti?[e,...this._sources]:this._sources;if(i&&v.StudyMetaInfo.patchSoSInputs(n,(e=>{var t,i;return null!==(i=null===(t=a.find((t=>t.id()===e)))||void 0===t?void 0:t.sourceId())&&void 0!==i?i:null})),!this.isChildStudy())return At.logError("Unable to rebind study to source of this type"),!1;{let t;this._sources[0].unsetChild(this);let s=null;if(e===this._model.mainSeries())this._setSources([]),this._ownerSource=null,t=this._series.seriesSource().instanceId(),s=2;else{if(!(e instanceof ti))return At.logError("Unable to rebind study to source of this type"),!1;this._ownerSource=e,this._setSources([e]),t=e.sourceId(),e.setChild(this),null===t&&(r=e)}i&&null!==t&&(this._incrementTurnaround(),this.disablePriceRangeReady(),this._chartApi.rebindStudy((0, -o.ensureNotNull)(this._studyId),this._turnaround,t,this._studyName,n,this._handler,s))}r&&(this.isStarted()&&this.stop(),r.start(!0)),s instanceof ti&&s.processHibernate();const l=this._priceScale,c=(0,o.ensureNotNull)(e.priceScale());if(l!==c){const t=this._model.paneForSource(this),i=(0,o.ensureNotNull)(this._model.paneForSource(e));t===i&&i.move(this,c,!0)}const h=this._firstSourceOrSeries();return s.formatterChanged().unsubscribe(this,this._onSourceFormatterChanged),h.formatterChanged().subscribe(this,this._onSourceFormatterChanged),s.priceStepChanged().unsubscribe(this,this._onSourcePriceStepChanged),h.priceStepChanged().subscribe(this,this._onSourcePriceStepChanged),s.currencyChanged().unsubscribeAll(this),h.currencyChanged().subscribe(this,this._onSourceCurrencyChanged),s.unitChanged().unsubscribeAll(this),h.unitChanged().subscribe(this,this._onSourceUnitChanged),s.priceRangeReadyChanged().unsubscribeAll(this),h.priceRangeReadyChanged().subscribe(this,this._onSourcePriceRangeReadyChanged),this._recreatePriceFormattingDependencies(),!0}_buildInputs(e){(0,o.assert)(!!e,"options not set");let t={};try{t=this._prepareInputs(e)}catch(e){At.logWarn("Failed to prepare study inputs: "+e)}if(e.asObject){const e={};return Object.keys(t).forEach((i=>{null!=t[i]&&(e[i]=t[i])})),e}{const e=[];return Object.keys(t).forEach((i=>{null!=t[i]&&e.push(t[i])})),e}}_prepareInput(e,t){const i=this._prepareInputValue(e,t);return!e.isFake||t.fakeInputsForDisplay||t.onlyAtomValues?i:{v:i,f:!0,t:e.type}}_plotsForAlert(){return[]}_dependenciesForAlerts(){throw new Error("Not implemented")}_calcIsActualInterval(){const e=this._isActualInterval;this._isActualInterval=(0,lt.isActualInterval)(this._series.intervalObj(),this._properties.childs().intervalsVisibilities),e!==this._isActualInterval&&(this._onIsActualIntervalChange.fire(),this._visibleChanged(),this.processHibernate())}_visibleChanged(){this._series.invalidateBarColorerCache()}_getNonPriceParent(){const e=this._sources;for(const t of e)if(t instanceof ti){const e=t.metaInfo();return e.is_price_study&&"Compare@tv-basicstudies"!==e.id?t._getNonPriceParent():t}return null}_updateInputValue(e,t){const i=this._properties.childs().inputs.childs();if(i[t.id])if("price"===t.type)i[t.id].setValue(e.price);else if("time"===t.type){const s=this._model.timeScale().indexToTimePoint(e.index);null!==s&&i[t.id].setValue(1e3*s)}}_initializeStudyInputsPaneViews(){}_updateCurrencySourceSymbolInfo(){var e;null!==this._currencySourceSymbolInputProperty&&(this._currencySourceSymbolInfo=null!==(e=this._resolvedSymbolsByInput[this._currencySourceSymbolInputProperty.value()])&&void 0!==e?e:null)}_initializeCurrencySource(){var e,t;const i=this.metaInfo(),s="symbolInputSymbolSource"===(null===(e=i.symbolSource)||void 0===e?void 0:e.type)&&(null===(t=i.symbolSource)||void 0===t?void 0:t.inputId),r=i.inputs.find((e=>e.id===s)),n="symbol"===(null==r?void 0:r.type);if("string"==typeof s&&n&&i.is_price_study){const e=this._properties.childs().inputs.childs()[s] -;void 0!==e&&(e.subscribe(this,this._onCurrencyMayChange),this._currencySourceSymbolInputProperty=e)}}_recreatePaneViews(){this.hasBarColorer()&&this._model.mainSeries().invalidateBarStylesCache(),this._createViews(),this.recalculate(),this.updateAllViews((0,ht.sourceChangeEvent)(this.id()))}_pinePatchProps(){throw new Error("Not implemented")}_areStudyInputsModified(e){if(0===Object.keys(e).length)return!1;if(void 0===this._oldStudyInputs)return!0;const t=Object.keys(this._oldStudyInputs);(0,o.assert)(t.length===Object.keys(e).length,"keys quantity should be equal");for(const i of t)if((0,o.assert)(e.hasOwnProperty(i),`key '${i}' should exist in study inputs`),(0,o.ensureDefined)(this._oldStudyInputs)[i]!==e[i])return!0;return!1}_onVisibleTimeRangeInputsChanged(e){null!==e?this._updateVisibleTimeRangeInputs(e):this.isStarted()&&this._chartApi.isConnected().value()&&this.stop(!0)}_updateVisibleTimeRangeInputs(e,t=!0){const i={first_visible_bar_time:e.firstVisibleBarTime,last_visible_bar_time:e.lastVisibleBarTime,subscribeRealtime:e.subscribeRealtime},s=this.metaInfo().inputs,r=[];for(const e of s)i.hasOwnProperty(e.id)&&r.push(e.id);const n=this.properties().childs().inputs;for(const e of r)n.childs()[e].setValueSilently(i[e]);t&&r.length>0&&n.listeners().fire(n,"")}_getStudyErrorText(e){return e.split(":",2)[0]}_priceScaleByProperties(){if("default"===this.properties().childs().precision.value())return null;const e=parseInt(this.properties().childs().precision.value());return isFinite(e)?Math.pow(10,e):null}_priceScaleByMetaInfo(){const e=this.metaInfo().format,t="inherit"!==e.type?e.precision:void 0,i=(0,V.isNumber)(t)?Math.pow(10,t):void 0;if("price"===e.type||"percent"===e.type)return i||100;if("volume"===e.type){if(void 0===e.precision){const e=this.series().symbolInfo();if(null!==e&&(0,V.isNumber)(e.volume_precision))return Math.pow(10,e.volume_precision)}return 1}return"inherit"===e.type||At.logWarn("Unsupported format type: "+e.type),null}_inputSymbols(){return this.metaInfo().inputs.filter((e=>"symbol"===e.type)).map((e=>(0,o.ensureDefined)(this._properties.childs().inputs.child(e.id)).value()))}_precisionChanged(){this._recreatePriceFormattingDependencies()}_setSources(e){this.invalidateTitleCache(),this._sources=e,this._onParentSourcesChanges.fire()}}window.TradingView.Study=ti},76058:(e,t,i)=>{"use strict";i.d(t,{plotShapesData:()=>r});var s=i(11542);const r={shape_arrow_down:{guiName:s.t(null,void 0,i(48732)),id:"shape_arrow_down",paneRendererClass:"PaneRendererArrowDown",pineName:"shape.arrowdown",icon:"arrow_down"},shape_arrow_up:{guiName:s.t(null,void 0,i(10650)),id:"shape_arrow_up",paneRendererClass:"PaneRendererArrowUp",pineName:"shape.arrowup",icon:"arrow_up"},shape_circle:{guiName:s.t(null,void 0,i(90068)),id:"shape_circle",paneRendererClass:"PaneRendererCircleShape",pineName:"shape.circle",icon:"circle"},shape_cross:{guiName:s.t(null,void 0,i(29908)),id:"shape_cross",paneRendererClass:"PaneRendererCrossShape",pineName:"shape.cross",icon:"cross"},shape_diamond:{guiName:s.t(null,void 0,i(73720)), -id:"shape_diamond",paneRendererClass:"PaneRendererDiamond",pineName:"shape.diamond",icon:"diamond"},shape_flag:{guiName:s.t(null,void 0,i(21524)),id:"shape_flag",paneRendererClass:"PaneRendererFlagShape",pineName:"shape.flag",icon:"flag"},shape_label_down:{guiName:s.t(null,void 0,i(18528)),id:"shape_label_down",paneRendererClass:"PaneRendererLabelDown",pineName:"shape.labeldown",icon:"label_down"},shape_label_up:{guiName:s.t(null,void 0,i(13046)),id:"shape_label_up",paneRendererClass:"PaneRendererLabelUp",pineName:"shape.labelup",icon:"label_up"},shape_square:{guiName:s.t(null,void 0,i(44904)),id:"shape_square",paneRendererClass:"PaneRendererSquare",pineName:"shape.square",icon:"square"},shape_triangle_down:{guiName:s.t(null,void 0,i(83356)),id:"shape_triangle_down",paneRendererClass:"PaneRendererTriangleApexDown",pineName:"shape.triangledown",icon:"triangle_down"},shape_triangle_up:{guiName:s.t(null,void 0,i(28340)),id:"shape_triangle_up",paneRendererClass:"PaneRendererTriangleApexUp",pineName:"shape.triangleup",icon:"triangle_up"},shape_xcross:{guiName:s.t(null,void 0,i(7050)),id:"shape_xcross",paneRendererClass:"PaneRendererXCross",pineName:"shape.xcross",icon:"x_cross"}}},11526:(e,t,i)=>{"use strict";var s=i(18923).Version,r=i(59224).getLogger("Chart.StudyMigration");function n(e){this._studyId=e,this._maxToVers=s.ZERO,this._maxFromVers=s.ZERO,this._migrs=[]}n.prototype.addMigration=function(e,t,i){var r=s.parse(e),n=s.parse(t);r.isGreater(this._maxFromVers)&&(this._maxFromVers=r),n.isGreater(this._maxToVers)&&(this._maxToVers=n),this._migrs.push({fromVers:r,toVers:n,rules:i})},n.prototype.updateInputs=function(e,t,i){if(!i)return i;for(var s=TradingView.clone(i),n=e;n.isLess(t);){var o=this._findMigration(n);if(null==o)break;if(r.logNormal("Migrating study inputs from "+o.fromVers+" to "+o.toVers+" version, studyId: "+this._studyId+", migration: "+JSON.stringify(o)+", inputs: "+JSON.stringify(i)),s=this._applyMigration(s,o),!n.isLess(o.toVers))throw new Error("Problems in study migration process... Possible infinite cycle has been detected and stopped.");n=o.toVers}return n>e&&r.logNormal("Study inputs migration is done, studyId: "+this._studyId+", inputs: "+JSON.stringify(s)),s},n.prototype._findMigration=function(e){for(var t=-1,i=this._maxFromVers,s=0;s=0||t.indexOf(e)>=0},n._applyInputChangedMinMaxRule=function(e,t){if("adjustValIfNeeded"!==t.action)throw new Error("Unknown action "+t.action+" for rule with type "+t.type);var i=e[t.inputId];return it.maxVal&&(e[t.inputId]=t.maxVal),r.logNormal("Input "+t.inputId+"="+i+" adjusted to value "+e[t.inputId]),e},n._applyInputChangedOptionsRule=function(e,t){if(!(["text"].indexOf(t.inputType)>=0&&"resetToDefValIfNeeded"===t.action))throw new Error("Unexpected rule.inputType="+t.inputType+" in rule.action="+t.action);var i=e[t.inputId];return t.options.indexOf(i)<0&&(e[t.inputId]=t.defVal,r.logNormal("Input "+t.inputId+"="+i+" reset to default value "+t.defVal)),e},e.exports=n},64063:(e,t,i)=>{"use strict";var s=i(38243).OverlayLegendValuesProvider,r=i(26481).OverlayStatusProvider,n=i(47468).StudyOverlayBase;t.study_Overlay=class extends n{constructor(e,t,i,s){super(e,t,i,s),this._paneView=null;var r=this;this.properties().minTick.listeners().subscribe(null,(function(){r._recreatePriceFormattingDependencies(),r.updateAllViews(),r._model.fullUpdate()}))}_onQuotesUpdate(e,t){!this._legendView||void 0===t.values.change&&void 0===t.values.change_percent||(this._legendView.update(),this._model.updateSource(this))}destroy(){this._quotesProvider.quotesUpdate().unsubscribeAll(this),this._quotesProvider.destroy(),super.destroy()}tags(){var e=[],t=this.symbolInfo();return t?e.push(t.name):this._properties.inputs.symbol.value()&&e.push(this._properties.inputs.symbol.value()),e}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(2285),i.e(2578),i.e(8882),i.e(3986),i.e(8167),i.e(607)]).then(i.bind(i,89204))).StudyOverlayDefinitionsViewModel}defaultPlotIdForAlert(){return""}valuesProvider(){return new s(this,this.model())}statusProvider(e){return new r(this,this.model())}}},43583:(e,t,i)=>{"use strict";var s=i(50151).assert,r=i(1722).clone,n=i(56827).Study,o=i(97034).PlotList,a=i(72007).studyPlotFunctionMap,l=i(72007).studyEmptyPlotValuePredicate;class c{constructor(e,t,i){ -this._strategyPlotIndex=e,this._targetPlotIndex=t,this._startIndex=i}rebuildData(e){var t=this._targetPlotIndex+1,i=this._strategyPlotIndex+1,s=null,r=null;e.range(this._startIndex||e.firstIndex(),e.lastIndex()).each((function(n,o){var a=o[t],l=o[i]?Math.round(o[i]):null;if(o[t]=null,o[i]=null,!l||l>0)return!1;var c=n+l,h={pointIndex:c,value:a};if(r){if(r.pointIndex!==h.pointIndex){c>=0&&(e.valueAt(c)[t]=a);var d=!1;s&&(d=s.value<=r.value&&r.value<=a||s.value>=r.value&&r.value>=a),d?r.pointIndex>=0&&(e.valueAt(r.pointIndex)[t]=null):s=r,r=h}}else r=h;return!1}))}}t.study_ScriptWithDataOffset=class extends n{constructor(e,t,i,s){super(e,t,i,s),this._underlyingData=new o(a(s),l)}clearData(){super.clearData(),this._underlyingData.clear()}_mergeData(e){this._invalidateLastNonEmptyPlotRowCache();var t=this._underlyingData.firstIndex();this._underlyingData.merge(e),t!==this._underlyingData.firstIndex()&&(this._data=new o(a(this._metaInfo),l));var i=this._data.lastIndex();this._underlyingData.range(i,this._underlyingData.lastIndex()).each(function(e,t){return this._data.add(e,r(t)),!1}.bind(this)),this._plotsForStrategyProcessing().forEach((function(e){new c(e.strategyIndex,e.targetIndex,i).rebuildData(this._data)}),this)}_plotsForStrategyProcessing(){var e=[];return this._metaInfo.plots.forEach((function(t,i){if("dataoffset"===t.type){var r=this._metaInfo.plots.findIndex((function(e){return e.id===t.target}));s(r>=0,"target plot not found for strategy plot "+t.id);var n={strategyIndex:i,targetIndex:r};e.push(n)}}),this),e}}},6674:(e,t,i)=>{"use strict";i.d(t,{StudyVersioning:()=>p});var s=i(11526),r=i.n(s);const n=(0,i(59224).getLogger)("Chart.Study.Versioning");var o=i(50151).assert,a=i(18923).Version,l=i(76861),c=i(42856).StudyMetaInfo,h=i(14905).extractPineId,d=i(97087).migrateMetaInfoAndPropState;const u=1e12;class p extends class{constructor(e,t){if(this._migrations={},!e)throw new Error("No studies metainfo");if(this._studiesMetainfo=e,!t)throw new Error("No studies migrations");this._studiesMigrations=t;for(let e=0;e{if(0===this._studiesMetainfo.length||!e.isTVScript||e.version>=22)return t;const i={};let s=0,r=0,n=t[r];for(;void 0!==n;){const e=t[n.id];n.isFake&&(n.id="in_"+s++),i[r]=n,i[n.id]=e,r++,n=t[r]}return i}]}}{updateMetaInfo(e){if(!e)return e;o(!e.isTVScript,"This method should update only built-in java indicators metaInfo. For Pine indicators use updateMetaInfoAsync");for(var t=null,i=this._studiesMetainfo,s=0;s=12&&a<=26){var l={};for(o=0;o=12&&a<=26){var h=r.columns;r.columns=[];for(var d=0;d1e12&&n.logWarn("Bad integer input max value in metaInfo id="+e.id+" title="+e.description))}}static _fixInputsMaxValue(e,t){ -if(!TradingView.isAbsent(t)){var i=u;if(t.inputs)for(var s=0;si&&(a.max=i))}if(e&&e.inputs){var r=p.splitInputs(e.inputs),n=r.arr;for(var o in n){var a;"integer"===(a=n[o]).type&&(a.max&&a.max>i&&(a.max=i))}e.inputs=TradingView.merge(r.obj,r.arr)}}}patchPropsStateAndMetaInfo(e,t,i){"Script$BOOKER"!==t.productId||t.alerts||delete e.alerts,p._fixInputsOrder(e,t),p._fixInputsMaxValue(e,t);var s=p.splitInputs(e.inputs);e.inputs=s.obj;var r=c.versionOf(t);ri&&(i=r))}e[i+1]=t}static splitInputs(e){var t={},i={};for(var s in e)isNumber(parseInt(s,10))?t[s]=e[s]:i[s]=e[s];return{arr:t,obj:i}}static findInputKeyById(e,t){var i=null -;for(var s in e)if(isNumber(parseInt(s,10))&&e[s].id===t){i=s;break}return i}static getInputKeyById(e,t){var i=p.findInputKeyById(e,t);if(!i)throw new Error("Cannot find input with id: "+t);return i}}},24954:(e,t,i)=>{"use strict";function s(e,t,i){return e===t||e===i}i.d(t,{symbolSameAsResolved:()=>s})},11678:(e,t,i)=>{"use strict";i.d(t,{translateSessionDescription:()=>n,translateSessionShortDescription:()=>a});var s=i(11542);const r=new Map([["Premarket",s.t(null,{context:"sessions"},i(56935))],["Postmarket",s.t(null,{context:"sessions"},i(98801))],["Regular Trading Hours",s.t(null,{context:"sessions"},i(24380))],["Extended Trading Hours",s.t(null,{context:"sessions"},i(97442))],["Electronic Trading Hours",s.t(null,{context:"sessions"},i(75610))]]);function n(e){var t;return null!==(t=r.get(e))&&void 0!==t?t:e}const o=new Map([["Premarket",s.t(null,{context:"sessions"},i(56137))],["Postmarket",s.t(null,{context:"sessions"},i(32929))],["Regular Trading Hours",s.t(null,{context:"sessions"},i(63798))],["Extended Trading Hours",s.t(null,{context:"sessions"},i(33021))],["Electronic Trading Hours",s.t(null,{context:"sessions"},i(33021))]]);function a(e){var t;return null!==(t=o.get(e))&&void 0!==t?t:e}},97121:(e,t,i)=>{"use strict";i.d(t,{areEqualSymbols:()=>a,compareSymbolParams:()=>d,symbolParams:()=>h,symbolSameAsCurrent:()=>c});var s=i(14483),r=i(42960),n=i(36274);const o=s.enabled("uppercase_instrument_names");function a(e,t){return void 0===e?void 0===t:void 0!==t&&(o?e.toUpperCase()===t.toUpperCase():e===t)}function l(e,t){return e.some((e=>a(t,e)))}function c(e,t){if(null===t)return!1;if(t){if(a(t.full_name,e)||a(t.pro_name,e))return!0;if(a(t.ticker,e))return!0;if(t.aliases&&l(t.aliases,e))return!0;if(t.alternatives&&l(t.alternatives,e))return!0;if(0===e.indexOf("FRA:")&&a(t.pro_name,e.replace("FRA:","FWB:")))return!0}return!1}function h(e){return{symbol:e.symbol(),currency:e.currency(),unit:e.unit(),interval:e.interval(),style:e.style()}}function d(e,t,i,s){const{symbol:o,currency:a,unit:l,style:c}=t;let h=t.interval;const d=e.symbolInfo(),u=void 0!==o&&!e.symbolSameAsResolved(o);let p,_,m;if(null!==d?(p=void 0!==a&&!function(e,t){return null===e&&!(0,r.isConvertedToOtherCurrency)(t)||e===(0,r.symbolCurrency)(t)}(a,d),_=void 0!==l&&!function(e,t,i){return null===e&&!(0,r.isConvertedToOtherUnit)(t,i)||e===(0,r.symbolUnit)(t,i)}(l,d,i)):(p=void 0!==a&&a!==e.currency(),_=void 0!==l&&l!==e.unit()),void 0!==h&&!u&&s){const e=s(h);n.Interval.isEqual(e,h)||(h=e,m=h)}return{symbolChanged:u,intervalChanged:void 0!==h&&!n.Interval.isEqual(e.interval(),h),currencyChanged:p,unitChanged:_,styleChanged:void 0!==c&&c!==e.style(),correctedInterval:m,styleChangeRequiresRestart:void 0!==c&&(0,r.styleChangeRequiresRestart)(c,e.style())}}},34565:(e,t,i)=>{"use strict";i.d(t,{TextWidthCache:()=>s});class s{constructor(e=150){this._actualSize=0,this._usageTick=1,this._oldestTick=1,this._tick2Labels=new Map,this._cache=new Map,this._maxSize=e}reset(){this._actualSize=0,this._cache.clear(),this._usageTick=1,this._oldestTick=1, -this._tick2Labels.clear()}measureText(e,t){return this.getMetrics(e,t).width}yMidCorrection(e,t){const i=this.getMetrics(e,t);return"actualBoundingBoxAscent"in i&&"actualBoundingBoxDescent"in i?(i.actualBoundingBoxAscent-i.actualBoundingBoxDescent)/2:0}getMetrics(e,t){const i=this._cache.get(t);if(void 0!==i)return i.metrics;if(this._actualSize===this._maxSize){const e=this._tick2Labels.get(this._oldestTick);this._tick2Labels.delete(this._oldestTick),this._cache.delete(e),this._oldestTick++,this._actualSize--}e.save(),e.textBaseline="middle";const s=e.measureText(t);return e.restore(),0===s.width&&t.length||(this._cache.set(t,{metrics:s,tick:this._usageTick}),this._tick2Labels.set(this._usageTick,t),this._actualSize++,this._usageTick++),s}}},21550:(e,t,i)=>{"use strict";var s=i(57898).Delegate;function r(){this._marksByIndex=new Map,this._marksBySpan=[],this.changed=new s,this.minIndex=void 0,this.maxIndex=void 0}r.prototype.reset=function(){this._resetImpl(),this.changed.fire()},r.prototype._resetImpl=function(){this._marksByIndex=new Map,this._marksBySpan=[],this.minIndex=void 0,this.maxIndex=void 0,this._cache=void 0},r.prototype.merge=function(e){if(0!==e.length){var t=e[0].index,i=e[e.length-1].index;t<=this.minIndex&&i>=this.maxIndex&&this._resetImpl();for(var s=this._marksBySpan,r=new Set,n=0;n=this.maxIndex&&this.maxIndex--,this.maxIndex2;){if(1e3*this._marksByIndex.get(t).time===e)return t;if(1e3*this._marksByIndex.get(i).time===e)return i;var s=Math.round((t+i)/2);1e3*this._marksByIndex.get(s).time>e?i=s:t=s}return t},r.prototype.build=function(e,t){var i=Math.ceil(t/e);if(this._maxbar===i&&this._cache)return this._cache;this._maxbar=i;for(var s=[],r=this._marksBySpan.length;r--;)if(this._marksBySpan[r]){var n=s;s=[];for(var o=n.length,a=0,l=this._marksBySpan[r],c=l.length,h=1/0,d=-1/0,u=0;u=i&&_-d>=i&&(s.push(p),d=_)}for(;ae.index>=i&&e.index<=s))}return{marks:t=t.map((function(e){return[e.span,e.time,e.index]})),version:2}},r.prototype.restoreState=function(e){if(this._marksByIndex=new Map,this._marksBySpan=[],this.maxIndex=void 0,this.minIndex=void 0,e&&e.marks&&e.marks.length)if(2===e.version){var t=e.marks.map((function(e){return{span:e[0],time:e[1],index:e[2]}}));this.merge(t)}else this.merge(e.marks)},e.exports.Tickmarks=r},34951:(e,t,i)=>{"use strict";i.d(t,{TimeAxisView:()=>o});var s=i(87095),r=i(74359);class n{constructor(){this._data=null}setData(e){this._data=e}draw(e,t,i){if(null===this._data||!this._data.visible||0===this._data.text.length)return;const s=this._data;e.font=t.font;const n=Math.round(t.widthCache.measureText(e,s.text));if(n<=0)return;e.save();const o=t.paddingHorizontal,a=n+2*o,l=a/2;let c=s.coordinate,h=Math.floor(c-l)+.5;if(s.alwaysInViewPort){const e=s.width;h<0?(c+=Math.abs(0-h),h=Math.floor(c-l)+.5):h+a>e&&(c-=Math.abs(e-(h+a)),h=Math.floor(c-l)+.5)}const d=h+a,u=Math.ceil(0+t.borderSize+t.offsetSize+t.paddingTop+t.fontSize+t.paddingBottom);e.fillStyle=s.background;const p=Math.round(h*i),_=Math.round(0*i),m=Math.round(d*i),g=Math.round(u*i),f=Math.round(2*i);e.beginPath(),e.moveTo(p,_),e.lineTo(p,g-f),e.arcTo(p,g,p+f,g,f),e.lineTo(m-f,g),e.arcTo(m,g,m,g-f,f),e.lineTo(m,_),e.fill();const v=0+t.borderSize+t.offsetSize+t.paddingTop+t.fontSize/2;e.textAlign="left",e.textBaseline="middle",e.fillStyle=s.color;const S=t.widthCache.yMidCorrection(e,"Apr0");e.translate((h+o)*i,(v+S)*i),(0,r.drawScaled)(e,i,i,(()=>e.fillText(s.text,0,0))),e.restore()}}class o{constructor(e){this._renderer=new n,this._rendererData={background:"",color:"",coordinate:0,text:"",visible:!1,width:0,alwaysInViewPort:!0},this._invalidated=!0,this._model=e,this._renderer.setData(this._rendererData)}update(){this._invalidated=!0}renderer(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),this._renderer}coordinate(){return this._rendererData.coordinate}_getAlwaysInViewPort(){return!0}_getText(e){ -const t=this._model.timeScale().indexToUserTime(e);return null!==t?this._model.dateTimeFormatter().format(t):""}_updateImpl(){const e=this._rendererData;if(e.visible=!1,this._model.timeScale().isEmpty()||!this._isVisible())return;const t=this._getIndex();null!==t&&Number.isFinite(t)&&(e.visible=!0,e.width=this._model.timeScale().width(),e.background=this._getBgColor(),e.color=(0,s.colorFromBackground)(e.background),e.coordinate=this._model.timeScale().indexToCoordinate(t),e.alwaysInViewPort=this._getAlwaysInViewPort(),e.text=this._getText(t),this._invalidated=!1)}}},61401:(e,t,i)=>{"use strict";i.d(t,{INVALID_TIME_POINT_INDEX:()=>s,UNPLOTTABLE_TIME_POINT_INDEX:()=>r});const s=-2e6,r=-1e6},16164:(e,t,i)=>{"use strict";i.d(t,{restoreTimeHoursFormatSettingsValue:()=>l,timeHoursFormatProperty:()=>a});var s=i(56840),r=i(59680);const n="time_hours_format";function o(){return s.getValue(n,"24-hours")}const a=(0,r.createPrimitiveProperty)(o());function l(){a.setValue("24-hours"),s.remove(n)}s.onSync.subscribe(null,(()=>a.setValue(o()))),a.subscribe(null,(()=>s.setValue(n,a.value())))},42609:(e,t,i)=>{"use strict";i.r(t),i.d(t,{DAY_SPAN:()=>a,DEFAULT_BAR_SPACING:()=>d,HOUR_SPAN:()=>o,MILLISECOND_SPAN:()=>s,MINUTE_SPAN:()=>n,MONTH_SPAN:()=>c,SECOND_SPAN:()=>r,WEEK_SPAN:()=>l,YEAR_SPAN:()=>h});const s=5,r=10,n=20,o=30,a=40,l=50,c=60,h=70,d=6},92216:(e,t,i)=>{"use strict";i.d(t,{getHourMinuteFormat:()=>r,getHourMinuteSecondFormat:()=>n,getTimeFormatForInterval:()=>o});var s=i(79206);function r(e){return"12-hours"===e?s.twelveHourMinuteFormat:s.hourMinuteFormat}function n(e){return"12-hours"===e?s.twelveHourMinuteSecondFormat:s.hourMinuteSecondFormat}function o(e,t){if(e.isRange())return function(e){return"12-hours"===e?s.twelveHourMinuteNonZeroSecondFormat:s.hourMinuteNonZeroSecondFormat}(t);if(e.isTicks())return s.hourMinuteSecondMillisecFormat;return e.isSeconds()||e.isTicks()?n(t):r(t)}},8775:(e,t,i)=>{"use strict";i.d(t,{trackChartStyleChanged:()=>a,trackDrawingCloned:()=>o,trackDrawingCreated:()=>r,trackDrawingPasted:()=>n});i(50151),i(88732);function s(e,t){0}function r(e){s()}function n(e){s()}function o(e){s()}function a(e){0}},11321:(e,t,i)=>{"use strict";i.d(t,{translatedIntervalString:()=>r});var s=i(94025);function r(e){const t=(0,s.getTranslatedResolutionModel)(e,!0);return null===t?e:t.multiplier+(t.mayOmitShortKind?"":t.shortKind)}},37846:(e,t,i)=>{"use strict";i.d(t,{ApplyLineToolTemplateUndoCommand:()=>r});var s=i(62591);class r extends s.UndoCommand{constructor(e,t,i){super(i),this._source=e,this._newState=t,this._oldState=e.properties().state()}redo(){this._source.applyTemplate(this._newState)}undo(){this._source.applyTemplate(this._oldState)}}},74007:(e,t,i)=>{"use strict";i.d(t,{CreateLineToolUndoCommand:()=>c});var s=i(50151),r=i(11542),n=i(36298),o=i(20114),a=i(59656);const l=new n.TranslatedString("create {tool}",r.t(null,void 0,i(81791)));class c extends o.LineToolSynchronizeUndoCommand{constructor({model:e,pane:t,lineTool:i,ownerSource:s,drawOnAllChartsMode:r=0,id:o}){super(e,l.format({ -tool:new n.TranslatedString(i,a.lineToolsLocalizedNames[i])}),!1),this._lineId=null,this._lineState=null,this._paneIndex=e.panes().indexOf(t),this._lineTool=i,this._ownerSourceId=s.id(),this._lineId=null!=o?o:null,this._drawOnAllChartsMode=r}startCreatingLine(e,t,i,s){var r;const n=this._chartModel.panes()[this._paneIndex],o=this._chartModel.dataSourceForId(this._ownerSourceId),a=this._chartModel.createLineTool(n,e,this._lineTool,t,i,s,o||void 0,null!==(r=this._lineId)&&void 0!==r?r:void 0);return this._lineId=a.id(),!this._chartModel.lineBeingCreated()}continueCreatingLine(e,t,i,s){const r=this._chartModel.continueCreatingLine(e,t,i,s);return r&&this._chartModel.setShouldBeSavedEvenIfHidden(!0),r}line(){return null===this._lineId?null:this._chartModel.dataSourceForId(this._lineId)}drawOnAllCharts(){return 0!==this._drawOnAllChartsMode}_redo(){if(null===this._lineState)return;const e=this._chartModel.restoreSource(!1,this._paneIndex,null,(0,s.ensureNotNull)(this._lineState),null);null!==e&&(this._lineId=e.id(),this._lineState=null,e.share(this._drawOnAllChartsMode))}_undo(){const e=this.line();null!==e&&(this._lineState=e.state(!1),this._chartModel.removeSource(e),this._lineId=null)}}},93562:(e,t,i)=>{"use strict";i.d(t,{ExcludeLineToolsFromGroupUndoCommand:()=>c});var s=i(50151),r=(i(42053),i(11542)),n=i(36298),o=i(1722),a=i(62591);const l=new n.TranslatedString("exclude line tools from group {group}",r.t(null,void 0,i(63391)));class c extends a.UndoCommand{constructor(e,t,i){super(l.format({group:t.name().value()})),this._model=e,this._groupId=t.id,this._groupName=t.name().value(),this._lineToolsIds=i.map((e=>e.id()))}redo(){const e=(0,s.ensureNotNull)(this._model.lineToolsGroupModel().groupForId(this._groupId)),t=this._lineToolsIds.map((e=>this._model.dataSourceForId(e))).filter(o.notNull);e.excludeLineTools(t),0===e.lineTools().length&&this._model.lineToolsGroupModel().removeGroup(e)}undo(){const e=this._lineToolsIds.map((e=>this._model.dataSourceForId(e))),t=this._model.lineToolsGroupModel().groupForId(this._groupId);null!==t?t.addLineTools(e):this._model.lineToolsGroupModel().createGroup(e,this._groupName,this._groupId)}}},20114:(e,t,i)=>{"use strict";i.d(t,{LineToolSynchronizeUndoCommand:()=>r});var s=i(62591);class r extends s.UndoCommand{constructor(e,t,i){super(t,i),this._invalidateViaSync=!1,this._chartModel=e}redo(){this._invalidateViaSync?this._chartModel.lineToolsSynchronizer().executeSyncedAction((()=>this._redo())):this._redo()}undo(){this._invalidateViaSync?this._chartModel.lineToolsSynchronizer().executeSyncedAction((()=>this._undo())):this._undo()}}},11235:(e,t,i)=>{"use strict";i.d(t,{MergeDownUndoCommand:()=>a,MergeToTargetPane:()=>l,MergeUpUndoCommand:()=>o});var s=i(50151),r=i(38071);class n extends r.MoveSourceUndoCommand{constructor(e,t,i,s){super(e,t,i),this._restorePane=!1,this._keepZOrder=null!=s&&s,this._initialZOrder=t.zorder()}redo(){const e=this._chartModel.panes().length,t=this._chartModel.panes()[this._targetPaneIndex()],i=(0, -s.ensureNotNull)(this._chartModel.dataSourceForId(this._sourceId)),r=(0,s.ensureNotNull)(this._chartModel.paneForSource(i)),n=this._chartModel.children(i,!0);r.bulkActionMacro((()=>{n.forEach((e=>this._chartModel.detachSource(e))),this._restorePane=this._chartModel.detachSource(i)}));const o="overlay"===this._initialPriceScalePosition?this._initialPriceScalePosition:void 0,a=t.findSuitableScale(i,void 0,o),l=0===a.dataSources().length;if(t.bulkActionMacro((()=>{t.addDataSource(i,a,this._keepZOrder),n.forEach((e=>t.addDataSource(e,a,this._keepZOrder)))})),i===this._chartModel.mainSeries()){const e=t.priceScalePosition(a);t.movePriceScale(a,e,0)}if(l){const e=(0,s.ensureNotNull)(i.priceScale());e.restoreState(this._newPriceScaleState(t.isOverlay(i))),e.setHeight(t.height())}this._chartModel.fullUpdate(),e!==this._chartModel.panes().length&&this._chartModel.setShouldBeSavedEvenIfHidden(!0)}undo(){let e;e=this._restorePane?this._chartModel.createPane(this._initialPaneIndex):this._chartModel.panes()[this._initialPaneIndex];const t=(0,s.ensureNotNull)(this._chartModel.dataSourceForId(this._sourceId)),i=(0,s.ensureNotNull)(this._chartModel.paneForSource(t)),r=this._chartModel.children(t,!0);i.bulkActionMacro((()=>{r.forEach((e=>this._chartModel.detachSource(e))),this._chartModel.detachSource(t)}));let n=e.getPriceScaleById(this._initialPriceScaleId);null===n&&(n=e.createPriceScaleAtPosition(this._initialPriceScalePosition,this._initialPriceScaleIndex)),e.bulkActionMacro((()=>{t.setZorder(this._initialZOrder),e.addDataSource(t,n,!0),r.forEach((t=>e.addDataSource(t,n,!1)))}));const o=(0,s.ensureNotNull)(t.priceScale());o.restoreState(this._originalPriceScaleState()),o.setHeight(e.height()),this._chartModel.fullUpdate()}}class o extends n{constructor(e,t,i){super(e,t,i)}_targetPaneIndex(){return this._initialPaneIndex-1}}class a extends n{constructor(e,t,i){super(e,t,i)}_targetPaneIndex(){return this._initialPaneIndex+1}}class l extends n{constructor(e,t,i,s,r){super(e,t,s,r),this._targetPane=i}_targetPaneIndex(){return this._targetPane}}},38071:(e,t,i)=>{"use strict";i.d(t,{MoveSourceUndoCommand:()=>n});var s=i(50151),r=i(62591);class n extends r.UndoCommand{constructor(e,t,i){super(i),this._chartModel=e,this._sourceId=t.id();const r=(0,s.ensureNotNull)(t.priceScale());this._initialPriceScaleId=r.id(),this._initialPriceScaleState=(0,s.ensureNotNull)(t.priceScale()).state();const n=(0,s.ensureNotNull)(e.paneForSource(t));this._initialPriceScalePosition=n.priceScalePosition(r),this._initialPriceScaleIndex=n.priceScaleIndex(r,this._initialPriceScalePosition),this._initialPaneIndex=e.panes().indexOf(n)}_newPriceScaleState(e){const t={...this._initialPriceScaleState};return delete t.m_isLockScale,delete t.id,delete t.m_topMargin,delete t.m_bottomMargin,t}_originalPriceScaleState(){return this._initialPriceScaleState}}},99778:(e,t,i)=>{"use strict";i.d(t,{MoveToExistingPriceScaleUndoCommand:()=>a,MoveToNewPriceScaleUndoCommand:()=>o});var s=i(50151),r=i(38071);class n extends r.MoveSourceUndoCommand{constructor(e,t,i,s){ -super(e,t,s),this._sourcePaneRemoved=!1,this._targetPaneIndex=e.panes().indexOf(i)}redo(){const e=this._chartModel.panes()[this._initialPaneIndex],t=this._chartModel.panes()[this._targetPaneIndex],i=e!==t,r=this._targetPriceScale(t),n=(0,s.ensureNotNull)(this._chartModel.dataSourceForId(this._sourceId)),o=this._chartModel.children(n,!0);for(const e of o)i?(this._chartModel.detachSource(e),t.addDataSource(e,r,!1)):t.move(e,r);i?(this._sourcePaneRemoved=this._chartModel.detachSource(n),t.addDataSource(n,r,!1)):t.move(n,r);const a=t.priceScalePosition(r);t.movePriceScale(r,a,this._targetPriceScaleIndex(n)),this._chartModel.fullUpdate()}undo(){this._sourcePaneRemoved&&this._chartModel.createPane(this._initialPaneIndex);const e=this._chartModel.panes()[this._initialPaneIndex],t=e!==this._chartModel.panes()[this._targetPaneIndex],i=(0,s.ensureNotNull)(this._chartModel.dataSourceForId(this._sourceId));let r=e.getPriceScaleById(this._initialPriceScaleId);null===r&&(r=e.createPriceScaleAtPosition(this._initialPriceScalePosition,this._initialPriceScaleIndex));const n=this._chartModel.children(i,!0);for(const i of n)t?(this._chartModel.detachSource(i),e.addDataSource(i,r,!1)):e.move(i,r);t?(this._chartModel.detachSource(i),e.addDataSource(i,r,!1)):e.move(i,r);const o=(0,s.ensureNotNull)(i.priceScale());o.restoreState(this._originalPriceScaleState()),o.setHeight(e.height()),this._chartModel.fullUpdate()}}class o extends n{constructor(e,t,i,s,r){super(e,t,i,r),this._targetPriceScalePosition=s}_targetPriceScale(e){const t=e.createPriceScaleAtPosition(this._targetPriceScalePosition);return t.restoreState(this._newPriceScaleState("overlay"===this._targetPriceScalePosition)),t.setHeight(e.height()),t}_targetPriceScaleIndex(e){return e===this._chartModel.mainSeries()?0:void 0}}class a extends n{constructor(e,t,i,s,r){super(e,t,i,r),this._targetPriceScaleId=s.id()}_targetPriceScale(e){return(0,s.ensureNotNull)(e.getPriceScaleById(this._targetPriceScaleId))}_targetPriceScaleIndex(e){}}},67521:(e,t,i)=>{"use strict";i.d(t,{PriceScaleChangeUndoCommand:()=>h});var s=i(50151),r=i(11542),n=i(36298),o=i(59224),a=i(62591);const l=(0,o.getLogger)("Chart.ChartUndoModel"),c=new n.TranslatedString("scale price",r.t(null,void 0,i(47222)));class h extends a.UndoCommand{constructor(e,t,i,s,r){super(c,!1),this._newPriceScaleState=null,this._model=e,this._paneIndex=e.panes().indexOf(t),this._priceScaleId=i.id(),this._state=s,this._timestamp=r?performance.now():null}undo(){if(null!==this._newPriceScaleState)return void l.logDebug("PriceScaleChangeUndoCommand.undo: Command is already undone");const[e,t]=this._paneAndScale();this._newPriceScaleState=t.state(),this._model.restorePriceScaleState(e,t,this._state)}redo(){if(null===this._newPriceScaleState)return void l.logDebug("PriceScaleChangeUndoCommand.redo: Command is not undone");const[e,t]=this._paneAndScale();this._model.restorePriceScaleState(e,t,this._newPriceScaleState),this._newPriceScaleState=null}canMerge(e){ -return e instanceof h&&null!==this._timestamp&&null!==e._timestamp&&null===this._newPriceScaleState&&e._model===this._model&&e._paneIndex===this._paneIndex&&e._priceScaleId===this._priceScaleId&&Math.abs(e._timestamp-this._timestamp)<1e3}merge(e){this._timestamp=e._timestamp}_paneAndScale(){const e=this._model.panes()[this._paneIndex],t=(0,s.ensureNotNull)(e.getPriceScaleById(this._priceScaleId));return[e,t]}}},47513:(e,t,i)=>{"use strict";i.d(t,{RemoveSourcesUndoCommand:()=>m});var s=i(50151),r=i(11542),n=i(36298),o=i(20114),a=i(92249),l=i(59224),c=i(35115),h=i(28853),d=i(93562);class u extends o.LineToolSynchronizeUndoCommand{constructor({chartModel:e,title:t,lineDataSourceIds:i}){super(e,t),this._excludeLineToolsFromGroupUndoCommands=[],this._undoState=[],this._lineDataSourceIds=i}_redo(){const e=this._lineDataSourceIds.map((e=>(0,s.ensureNotNull)(this._chartModel.dataSourceForId(e))));this._groupLineToolsByGroups(e).forEach(((e,t)=>{const i=new d.ExcludeLineToolsFromGroupUndoCommand(this._chartModel,t,e);i.redo(),this._excludeLineToolsFromGroupUndoCommands.push(i)})),e.forEach((e=>{this._undoState.push({state:e.state(!1),paneIndex:this._chartModel.panes().indexOf((0,s.ensureNotNull)(this._chartModel.paneForSource(e))),sharingMode:e.sharingMode().value()}),this._chartModel.removeSource(e)}))}_undo(){var e;for(let t=this._undoState.shift();t;t=this._undoState.shift())null===(e=this._chartModel.restoreSource(!1,t.paneIndex,null,t.state,null))||void 0===e||e.share(t.sharingMode);this._excludeLineToolsFromGroupUndoCommands.forEach((e=>e.undo()))}_groupLineToolsByGroups(e){const t=this._chartModel.lineToolsGroupModel();return e.reduce(((e,i)=>{const s=t.groupForLineTool(i);if(null!==s){const t=e.get(s)||[];t.push(i),e.set(s,t)}return e}),new Map)}}const p=(0,l.getLogger)("Chart.RemoveSourcesUndoCommand"),_=new n.TranslatedString("remove line data sources",r.t(null,void 0,i(66414)));class m extends o.LineToolSynchronizeUndoCommand{constructor(e,t,i){super(e,i),this._removeLineDataSourcesUndoCommand=null,this._initialPriceScaleMode=null;const[r,n]=(0,c.closeSourcesSet)(e,t).reduce(((e,t)=>((0,a.isLineTool)(t)?e[1].push(t.id()):e[0].push(t.id()),e)),[[],[]]);this._sourceIds=r,this._lineDataSourceIds=n,this._sourceStates=[],this._paneIndexes=[],this._priceScalePositionIds=[],this._paneStates=[],this._restorePanes=[];const o=t[0];1===t.length&&(0,h.isStudy)(o)&&(this._initialPriceScaleMode=(0,s.ensureNotNull)(o.priceScale()).mode())}removedIds(){return[...this._sourceIds,...this._lineDataSourceIds]}_redo(){this._chartModel.panes().length;const e=this._sourceIds.map((e=>(0,s.ensureNotNull)(this._chartModel.dataSourceForId(e))));this._sourceStates=e.map((e=>(0,s.ensureNotNull)(e.state(!1))));const t=e.map((e=>(0,s.ensureNotNull)(this._chartModel.paneForSource(e))));this._paneIndexes=t.map((e=>this._chartModel.panes().indexOf(e))),this._lineDataSourceIds.length>0&&(this._removeLineDataSourcesUndoCommand=new u({title:_,chartModel:this._chartModel,lineDataSourceIds:this._lineDataSourceIds}), -this._removeLineDataSourcesUndoCommand.redo()),this._priceScalePositionIds=e.map(((e,i)=>{const s=e.priceScale();if(null===s)return null;const r=t[i].priceScalePosition(s);return{id:s.id(),position:r,priceScaleIndex:t[i].priceScaleIndex(s,r)}}));const i=new Set;e.forEach(((e,t)=>{i.add(this._paneIndexes[t])})),this._paneStates=e.map(((e,s)=>{const r=this._paneIndexes[s];return i.has(r)?t[s].state(!1,!0):null})),this._restorePanes=e.map((e=>this._chartModel.removeSource(e)))}_undo(){const e=[];for(let t=this._sourceStates.length-1;t>=0;t--){const i=this._chartModel.restoreSource(this._restorePanes[t],this._paneIndexes[t],this._paneStates[t],this._sourceStates[t],this._priceScalePositionIds[t]);i&&e.push(i)}e.some(((t,i)=>t.id()!==this._sourceIds[e.length-i-1]))&&p.logError("Source was restored improperly - source ids does not match"),null!==this._initialPriceScaleMode&&(0,s.ensureNotNull)(e[0].priceScale()).setMode(this._initialPriceScaleMode),this._removeLineDataSourcesUndoCommand&&this._removeLineDataSourcesUndoCommand.undo()}}},4505:(e,t,i)=>{"use strict";i.d(t,{RestoreDefaultsPreferencesUndoCommand:()=>v});var s=i(50151),r=i(11542),n=i(36298),o=i(62591),a=i(12416),l=i(83407),c=i(16164),h=i(98425),d=i(42226),u=i(39875),p=i(78159),_=i(3228),m=i(40493),g=i(11095);const f=new n.TranslatedString("apply all chart properties",r.t(null,void 0,i(64034)));class v extends o.UndoCommand{constructor(e){super(f),this._trading=null,this._oldShowSellBuyButtons=null,this._oldNoConfirmEnabled=null,this._oldShowOnlyRejectionNotifications=null,this._oldShowPricesWithZeroVolume=null,this._oldShowPricesWithSpread=null,this._oldOrderExecutedSoundEnabled=null,this._prevWatermarkPreferences=null,this._prevAlertPreferences=null,this._model=e,this._trading=(0,m.tradingService)(),null!==this._trading&&(this._oldShowSellBuyButtons=this._trading.showSellBuyButtons.value(),this._oldNoConfirmEnabled=this._trading.noConfirmEnabled.value(),this._oldShowOnlyRejectionNotifications=this._trading.showOnlyRejectionNotifications.value(),this._oldShowPricesWithZeroVolume=this._trading.showPricesWith().zeroVolume.value(),this._oldShowPricesWithSpread=this._trading.showPricesWith().spread.value(),this._oldOrderExecutedSoundEnabled=this._trading.orderExecutedSoundParams.enabled.value()),this._defaultsPreferences=(0,a.defaultsPreferencesByWhiteList)(this._model,this._model.mainSeries()),this._oldPreferences=e.preferences(),this._prevDateFormat=l.dateFormatProperty.value(),this._prevTimeHoursFormat=c.timeHoursFormatProperty.value(),this._prevAddPlusButton=g.addPlusButtonProperty.value(),this._prevShowOpenMarkerStatus=h.showMarketOpenStatusProperty.value(),this._prevCurrencyUnitVisibility=(0,d.currencyUnitVisibilityProperty)().value(),this._prevAutoLogButtonsVisibility=(0,u.autoLogButtonsVisibilityProperty)().value(),this._prevNavigationButtonsVisibility=(0,p.property)().value(),this._prevPaneButtonsVisibility=(0,_.property)().value();const t=this._model.watermarkSource();null!==t&&(this._prevWatermarkPreferences=t.properties().state())}redo(){ -null!==this._trading&&(this._trading.showSellBuyButtons.setValue(!0),this._trading.noConfirmEnabled.setValue(!1),this._trading.showOnlyRejectionNotifications.setValue(!1),this._trading.showPricesWith().zeroVolume.setValue(!0),this._trading.showPricesWith().spread.setValue(!0),this._trading.orderExecutedSoundParams.enabled.setValue(!1)),this._model.applyPreferences(this._defaultsPreferences),this._model.updateScales(),(0,l.restoreDateFormatSettingsValue)(),(0,c.restoreTimeHoursFormatSettingsValue)(),(0,g.restoreAddPlusButtonSettingsValue)(),(0,h.restoreShowMarketOpenStatusProperty)(),(0,d.restoreCurrencyUnitVisibilitySettingsValue)(),(0,u.restoreAutoLogButtonsVisibilitySettingsValue)(),(0,p.restoreNavigationButtonsVisibilitySettingsValue)(),(0,_.restorePaneButtonsVisibilitySettingsValue)();const e=this._model.watermarkSource();null!==e&&e.restorePropertiesDefaults()}undo(){null!==this._trading&&(this._trading.showSellBuyButtons.setValue((0,s.ensureNotNull)(this._oldShowSellBuyButtons)),this._trading.noConfirmEnabled.setValue((0,s.ensureNotNull)(this._oldNoConfirmEnabled)),this._trading.showOnlyRejectionNotifications.setValue((0,s.ensureNotNull)(this._oldShowOnlyRejectionNotifications)),this._trading.showPricesWith().zeroVolume.setValue((0,s.ensureNotNull)(this._oldShowPricesWithZeroVolume)),this._trading.showPricesWith().spread.setValue((0,s.ensureNotNull)(this._oldShowPricesWithSpread)),this._trading.orderExecutedSoundParams.enabled.setValue((0,s.ensureNotNull)(this._oldOrderExecutedSoundEnabled))),this._model.applyPreferences(this._oldPreferences),this._model.updateScales(),l.dateFormatProperty.setValue(this._prevDateFormat),c.timeHoursFormatProperty.setValue(this._prevTimeHoursFormat),h.showMarketOpenStatusProperty.setValue(this._prevShowOpenMarkerStatus),g.addPlusButtonProperty.setValue(this._prevAddPlusButton),(0,d.currencyUnitVisibilityProperty)().setValue(this._prevCurrencyUnitVisibility),(0,u.autoLogButtonsVisibilityProperty)().setValue(this._prevAutoLogButtonsVisibility),(0,p.property)().setValue(this._prevNavigationButtonsVisibility),(0,_.property)().setValue(this._prevPaneButtonsVisibility);const e=this._model.watermarkSource();null!==e&&null!==this._prevWatermarkPreferences&&e.properties().mergeAndFire(this._prevWatermarkPreferences)}}},87115:(e,t,i)=>{"use strict";i.d(t,{SetPriceScaleCurrencyUndoCommand:()=>o});var s=i(50151),r=i(62591),n=i(42960);class o extends r.UndoCommand{constructor(e,t,i,r){super(r),this._newSourcesCurrencies=new Map,this._oldSourcesCurrencies=new Map,this._showFade=!1,this._chartWidget=i;const o=i.model().mainSeries();for(const i of e.seriesLikeSources()){if(!i.isVisible()||!i.isActingAsSymbolSource().value())continue;const e=t||(0,n.symbolOriginalCurrency)((0,s.ensureNotNull)(i.symbolInfo()));this._newSourcesCurrencies.set(i.id(),e),this._oldSourcesCurrencies.set(i.id(),i.currency()),this._showFade=this._showFade||i===o&&i.currency()!==e}}redo(){this._applyCurrencies(this._newSourcesCurrencies)}undo(){this._applyCurrencies(this._oldSourcesCurrencies)}_applyCurrencies(e){ -const t=this._chartWidget.model().model();e.forEach(((e,i)=>{(0,s.ensureNotNull)(t.dataSourceForId(i)).setCurrency(e)})),this._chartWidget.model().selectionMacro((e=>{e.clearSelection()})),this._showFade&&this._chartWidget.screen.show(!0)}}},95367:(e,t,i)=>{"use strict";i.d(t,{SetPriceScaleModeCommand:()=>o});var s=i(46100),r=i(62591),n=i(28558);class o extends r.UndoCommand{constructor(e,t,i,s){super(i),this._newMode=e,this._priceScaleId=t.id(),this._model=s,this._oldMode=t.mode()}redo(){this._applyMode(this._newMode)}undo(){this._applyMode(this._oldMode)}_applyMode(e){const t=this._findPriceScaleById();null!==t&&((0,s.saveDefaultProperties)(!0),t.setMode(e),(0,s.saveDefaultProperties)(!1),this._model&&(this._model.recalculateAllPanes((0,n.viewportChangeEvent)()),this._model.lightUpdate()))}_findPriceScaleById(){const e=this._model.panes();for(let t=0;t{"use strict";i.d(t,{SetPriceScaleSelectionStrategyCommand:()=>a});var s=i(50151),r=i(62591),n=i(49535);class o{constructor(e){this._leftScales=e.leftPriceScales().map((e=>e.id())),this._rightScales=e.rightPriceScales().map((e=>e.id()))}restorePane(e){this._leftScales.reverse().map((t=>(0,s.ensureNotNull)(e.getPriceScaleById(t)))).forEach((t=>e.movePriceScale(t,"left"))),this._rightScales.reverse().map((t=>(0,s.ensureNotNull)(e.getPriceScaleById(t)))).forEach((t=>e.movePriceScale(t,"right")))}}class a extends r.UndoCommand{constructor(e,t,i){super(i),this._chartModel=e,this._targetStrategy=(0,n.createPriceScaleSelectionStrategy)(t),this._initialState=e.panes().map((e=>new o(e)))}redo(){this._chartModel.panes().forEach((e=>e.setPriceScaleSelectionStrategy(this._targetStrategy))),this._chartModel.fullUpdate()}undo(){const e=this._chartModel.panes();for(let t=0;t{"use strict";i.d(t,{SetPriceScaleUnitUndoCommand:()=>o});var s=i(50151),r=i(62591),n=i(42960);class o extends r.UndoCommand{constructor(e,t,i,r){super(r),this._newSourcesUnits=new Map,this._oldSourcesUnits=new Map,this._showFade=!1,this._chartWidget=i;const o=i.model().mainSeries();for(const i of e.seriesLikeSources()){if(!i.isVisible()||!i.isActingAsSymbolSource().value())continue;const e=t||(0,n.symbolOriginalUnit)((0,s.ensureNotNull)(i.symbolInfo()),this._chartWidget.model().model().unitConversionEnabled());this._newSourcesUnits.set(i.id(),e),this._oldSourcesUnits.set(i.id(),i.unit()),this._showFade=this._showFade||i===o&&i.unit()!==e}}redo(){this._applyUnits(this._newSourcesUnits)}undo(){this._applyUnits(this._oldSourcesUnits)}_applyUnits(e){const t=this._chartWidget.model().model();e.forEach(((e,i)=>{(0,s.ensureNotNull)(t.dataSourceForId(i)).setUnit(e)})),this._chartWidget.model().selectionMacro((e=>{e.clearSelection()})),this._showFade&&this._chartWidget.screen.show(!0)}}},610:(e,t,i)=>{"use strict";i.d(t,{SetScaleRatioPropertiesCommand:()=>o});var s=i(62591),r=i(46100),n=i(28558) -;class o extends s.UndoCommand{constructor(e,t,i,s){super(i),this._property=e,this._newValue=t,this._model=s,this._priceScale=this._model.mainSeries().priceScale(),this._oldValue=this._property.value(),this._oldMode=this._priceScale.mode()}redo(){this._oldValue=this._property.value(),this._oldMode=this._priceScale.mode(),(0,r.saveDefaultProperties)(!0),this._priceScale.setMode({autoScale:!1,percentage:!1,log:!1}),this._property.setValue(this._newValue),(0,r.saveDefaultProperties)(!1),this._model.recalculateAllPanes((0,n.viewportChangeEvent)()),this._model.lightUpdate()}undo(){(0,r.saveDefaultProperties)(!0),this._property.setValue(this._oldValue),this._priceScale.setMode(this._oldMode),(0,r.saveDefaultProperties)(!1),this._model.recalculateAllPanes((0,n.viewportChangeEvent)()),this._model.lightUpdate()}}},69718:(e,t,i)=>{"use strict";i.d(t,{SetWatchedValueCommand:()=>r});var s=i(62591);class r extends s.UndoCommand{constructor(e,t,i){super(i),this._wv=e,this._newValue=t,this._oldValue=e.value()}redo(){this._wv.setValue(this._newValue)}undo(){this._wv.setValue(this._oldValue)}}},35115:(e,t,i)=>{"use strict";function s(e,t){let i=[];const r=e.children(t,!1);for(let t=0;t{e.children(t,!1).forEach((e=>{i.has(e)||(i.add(e),r(e))}))};return t.forEach(r),t.filter((e=>!i.has(e))).map((t=>s(e,t))).reduce(((e,t)=>e.concat(t)),[])}i.d(t,{closeSourcesSet:()=>r})},51674:(e,t,i)=>{"use strict";i.d(t,{TimeScaleChangeUndoCommand:()=>o});var s=i(59224),r=i(62591);const n=(0,s.getLogger)("Chart.ChartUndoModel");class o extends r.UndoCommand{constructor(e,t,i){super(i,!1),this._newRightOffsetAndBarSpacing=null,this.setCustomFlag("doesnt_affect_save",!0),this._model=e,this._rightOffsetAndBarSpacing=t}undo(){if(null!==this._newRightOffsetAndBarSpacing)return void n.logDebug("TimeScaleChangeUndoCommand.undo: Command is already undone");const e=this._model.timeScale();this._newRightOffsetAndBarSpacing={barSpacing:e.barSpacing(),rightOffset:e.rightOffset()},e.setBarSpacing(this._rightOffsetAndBarSpacing.barSpacing),e.setRightOffset(this._rightOffsetAndBarSpacing.rightOffset),this._model.lightUpdate()}redo(){if(null===this._newRightOffsetAndBarSpacing)return void n.logDebug("TimeScaleChangeUndoCommand.redo: Command is not undone");const e=this._model.timeScale();e.setBarSpacing(this._newRightOffsetAndBarSpacing.barSpacing),e.setRightOffset(this._newRightOffsetAndBarSpacing.rightOffset),this._model.lightUpdate(),this._newRightOffsetAndBarSpacing=null}}},62591:(e,t,i)=>{"use strict";i.d(t,{UndoCommand:()=>r});var s=i(36298);class r{constructor(e,t=!0){this._customFlags={},this._text=e||new s.TranslatedString("",""),this._executeOnPush=t}text(){return this._text}executeOnPush(){return this._executeOnPush}customFlag(e){return this._customFlags[e]}setCustomFlag(e,t){this._customFlags[e]=t}canMerge(e){return!1}merge(e){throw new Error("Should be re-implemented in child classes")}}},18687:(e,t,i)=>{"use strict";i.d(t,{createUndoHistory:()=>h}) -;var s=i(50151),r=i(93244),n=i(68452),o=i(69718),a=i(59224),l=i(57898);const c=(0,a.getLogger)("Common.UndoHistory");function h(){const e=[],t=new r.UndoStack,i=new r.UndoStack,a=new l.Delegate;function h(s){if(e.length>0)e[e.length-1].addCommand(s);else{i.clear();const e=t.head(),r=e&&e.text().originalText();e&&e.canMerge(s)?e.merge(s):t.push(s);const n=s.text().originalText();""!==n&&n!==r&&c.logNormal("DO: "+n)}s.executeOnPush()&&s.redo(),e.length||a.fire(d())}function d(){const e=t.head(),s=i.head(),r=void 0===e?void 0:e.text(),n=void 0===s?void 0:s.text();return{enableUndo:!t.isEmpty(),undoCommandCount:t.size(),undoText:void 0!==r?r.translatedText():r,enableRedo:!i.isEmpty(),redoCommandCount:i.size(),redoText:void 0!==n?n.translatedText():n,originalUndoText:void 0!==r?r.originalText():void 0,originalRedoText:void 0!==n?n.originalText():void 0}}return{beginUndoMacro:function(t){const i=new n.UndoMacroCommand(t);return e.push(i),i},clearStack:function(){t.clear(),i.clear(),a.fire(d())},createUndoCheckpoint:function(){return{lastActualCommand:t.isEmpty()?null:t.head()}},endUndoMacro:function(){const t=(0,s.ensureDefined)(e.pop());t.isEmpty()||h(t)},pushUndoCommand:h,redo:function(){if(i.isEmpty())return!1;const e=i.pop();return!!e&&(e.redo(),t.push(e),c.logNormal("REDO: "+e.text().originalText()),a.fire(d()),!0)},redoStack:function(){return i},setWatchedValue:function(e,t,i,s){if(e.value()!==t){const r=new o.SetWatchedValueCommand(e,t,i);r.setCustomFlag("doesnt_affect_save",!!s),h(r),r.redo()}},undo:function(){if(t.isEmpty())return!1;const e=t.pop();return!!e&&(e.undo(),i.push(e),c.logNormal("UNDO: "+e.text().originalText()),a.fire(d()),!0)},undoStack:function(){return t},undoToCheckpoint:function(e){for(;!t.isEmpty()&&e.lastActualCommand!==t.head();)t.pop().undo();i.clear(),a.fire(d())},state:d,onChange:function(){return a}}}},68452:(e,t,i)=>{"use strict";i.d(t,{UndoMacroCommand:()=>r});var s=i(62591);class r extends s.UndoCommand{constructor(e){super(e,!1),this._subcommands=[]}addCommand(e){this._subcommands.push(e)}isEmpty(){return 0===this._subcommands.length}redo(){for(let e=0;e=0;e--)this._subcommands[e].undo()}commands(){return this._subcommands}}},93244:(e,t,i)=>{"use strict";i.d(t,{UndoStack:()=>o});var s=i(62591),r=i(57898);const n=(0,i(59224).getLogger)("Common.UndoStack");class o{constructor(){this._commands=[],this._onChange=new r.Delegate}onChange(){return this._onChange}isEmpty(){return 0===this._commands.length}size(){return this._commands.length}clear(){this.isEmpty()||(this._commands.length=0,this._onChange.fire())}push(e){if(!(e instanceof s.UndoCommand))throw new TypeError("argument must be an instance of UndoCommand");this._commands.push(e),this._onChange.fire(e)}pop(){if(this.isEmpty())return void n.logDebug("pop: undo stack is empty");const e=this._commands.pop();return this._onChange.fire(e),e}head(){if(!this.isEmpty())return this._commands[this._commands.length-1]}}},95529:(e,t,i)=>{ -"use strict";i.d(t,{UnmergeDownUndoCommand:()=>o,UnmergeToNewBottomPane:()=>l,UnmergeUpUndoCommand:()=>a});var s=i(50151),r=i(38071);class n extends r.MoveSourceUndoCommand{constructor(e,t,i){super(e,t,i)}redo(){const e=(0,s.ensureNotNull)(this._chartModel.dataSourceForId(this._sourceId)),t=(0,s.ensureNotNull)(this._chartModel.paneForSource(e)),i=this._chartModel.children(e,!0);t.bulkActionMacro((()=>{i.forEach((e=>this._chartModel.detachSource(e))),this._chartModel.detachSource(e)}));const r=this._chartModel.createPane(this.targetPaneIndex()),n=r.findSuitableScale(e);r.bulkActionMacro((()=>{r.addDataSource(e,n,!1),i.forEach((e=>r.addDataSource(e,n,!1)))}));const o=(0,s.ensureNotNull)(e.priceScale());o.restoreState(this._newPriceScaleState(r.isOverlay(e))),o.setHeight(r.height()),this._chartModel.fullUpdate(),this._chartModel.setShouldBeSavedEvenIfHidden(!0)}undo(){const e=(0,s.ensureNotNull)(this._chartModel.dataSourceForId(this._sourceId)),t=(0,s.ensureNotNull)(this._chartModel.paneForSource(e)),i=this._chartModel.children(e,!0);t.bulkActionMacro((()=>{i.forEach((e=>this._chartModel.detachSource(e)));const t=this._chartModel.detachSource(e);(0,s.assert)(t,"Undo of detaching must remove pane")}));const r=this._chartModel.panes()[this._initialPaneIndex];let n=r.getPriceScaleById(this._initialPriceScaleId);null===n&&(n=r.createPriceScaleAtPosition(this._initialPriceScalePosition,this._initialPriceScaleIndex)),r.bulkActionMacro((()=>{r.addDataSource(e,n,!0),i.forEach((e=>r.addDataSource(e,n,!1)))}));const o=(0,s.ensureNotNull)(e.priceScale());o.restoreState(this._originalPriceScaleState()),o.setHeight(r.height()),this._chartModel.fullUpdate()}}class o extends n{constructor(e,t,i){super(e,t,i)}targetPaneIndex(){return this._initialPaneIndex+1}}class a extends n{constructor(e,t,i){super(e,t,i)}targetPaneIndex(){return this._initialPaneIndex}}class l extends n{constructor(e,t,i){super(e,t,i)}targetPaneIndex(){return this._chartModel.panes().length}}},26512:(e,t,i)=>{"use strict";i.d(t,{sourceNewUnitOnPinningToPriceScale:()=>o,unitConvertibleGroups:()=>n});var s=i(18611),r=i(42960);function n(e,t,i){const s=(0,r.symbolUnitConvertibleGroupsIfExist)(e,!0);if(null!==s)return s;const n=i.unitGroupById(t);return null===n?[]:[n]}function o(e,t,i,r){let o=null;if(i.unitConversionEnabled()&&(0,s.isSymbolSource)(e)){const s=i.availableUnits(),a=t.unit(s),l=e.unit(),c=null===l?[]:n(e.symbolInfo(),l,s);null!==a&&null!==a.selectedUnit&&!a.allUnitsAreOriginal&&a.selectedUnit!==l&&(r&&null===l||null!==l&&s.convertible(l,c))&&(o=a.selectedUnit)}return o}},29542:(e,t,i)=>{"use strict";i.d(t,{createVisibilityController:()=>c});var s=i(11542),r=i(32563),n=i(59680),o=i(56840);const a="visibleOnMouseOver";function l(e){return"alwaysOn"===e||"alwaysOff"===e?e:a}function c(e,t){let c,h;function d(){if(!c){c=(0,n.createPrimitiveProperty)();let i=o.getValue(e);void 0===i&&void 0!==t&&(i=o.getValue(t)),c.setValue(l(i)),c.subscribe(c,(t=>{o.setValue(e,l(t.value()))}))}return c}return{property:d,availableValues:function(){return[{ -id:"visibleOnMouseOver",value:"visibleOnMouseOver",title:s.t(null,void 0,i(89960))},{id:"alwaysOn",value:"alwaysOn",title:s.t(null,void 0,i(71997))},{id:"alwaysOff",value:"alwaysOff",title:s.t(null,void 0,i(9408))}]},actualBehavior:function(){if(!h){h=(0,n.createPrimitiveProperty)();const e=d(),t=()=>{let t=e.value();"alwaysOn"!==t&&"alwaysOff"!==t&&(t=r.mobiletouch?"alwaysOn":"visibleOnMouseOver"),h&&h.setValue(t)};e.subscribe(h,t),t()}return h},restoreDefaultValue:function(){d().setValue(a),o.remove(e)}}}},65632:(e,t,i)=>{"use strict";i.r(t),i.d(t,{restoreWatermarkPropertyDefaults:()=>h,watermarkProperty:()=>c});var s=i(56840),r=i(88640);const n="symbolWatermark",o={visibility:!1,color:"rgba(80, 83, 94, 0.25)"};function a(){const e=s.getJSON(n);return Object.assign({},o,e)}let l=null;function c(){return null===l&&(l=new r.default(a()),s.onSync.subscribe(null,(()=>{null!==l&&l.mergeAndFire(a())})),l.listeners().subscribe(null,(()=>{null!==l&&s.setJSON(n,l.state())}))),l}function h(){null!==l&&l.mergeAndFire(o)}},30255:(e,t,i)=>{"use strict";var s=i(11321).translatedIntervalString,r=i(58557).getTranslatedSymbolDescription,n=i(46501).CHART_FONT_FAMILY,o=i(65632),a=o.watermarkProperty,l=o.restoreWatermarkPropertyDefaults,c=i(74359).drawScaled,h=i(85804).applyDefaultsOverrides,d=i(85804).applyPropertiesOverrides;const u="symbolWatermark";t.Watermark=function(e,t){var i={},o=a();function p(e,t){var s=e.font;return i.hasOwnProperty(s)||(i[s]={}),i[s].hasOwnProperty(t)||(i[s][t]=e.measureText(t).width),i[s][t]}h(o,void 0,!1,u),o.listeners().subscribe(this,(function(){e.updateSource(this)})),this.destroy=function(){o.listeners().unsubscribeAll(this)},this.properties=function(){return o},this.restorePropertiesDefaults=function(){l()},this.applyOverrides=function(e){d(o,void 0,!1,e,u)};var _={renderer:function(i,a){return{draw:function(l,h){c(l,h.pixelRatio,h.pixelRatio,(function(){var c=t.symbolInfo();l.fillStyle=o.color.value();var h,d=c.name;/QUANDL/.test(c.exchange)&&((h=d.split(/\//)).length&&(d=h[h.length-1]));var u={description:c.description,short_description:c.short_description,pro_name:c.pro_name,short_name:c.name,local_description:c.local_description,language:c.language};const _=e.watermarkContentProvider(),m=_?_({symbolInfo:c,interval:t.interval()}):null;for(var g=(m?m.map((e=>({text:e.text,font:`${e.fontSize}px ${n}`,lineHeight:e.lineHeight,vertOffset:e.vertOffset}))):null)||[{text:d?d+", "+s(t.interval()):"",font:"96px "+n,lineHeight:117,vertOffset:0},{text:r(u)||"",font:"48px "+n,lineHeight:58,vertOffset:5}],f=0,v=0;va?a/S:1,f+=b.lineHeight*b.zoom}}var y=Math.max((i-f)/2,0);for(v=0;v{"use strict";i.d(t,{ -moveAfterSource:()=>k,moveBeforeSource:()=>D,newLineToolZOrder:()=>w,newStudyZOrder:()=>C,reorderDataSourcesStateZOrder:()=>S});var s=i(92249),r=i(28853),n=i(76544),o=i(53588),a=i(78071);function l(e){return(0,s.isLineTool)(e)&&!e.isSpeciallyZOrderedSource()}function c(e){return(0,r.isStudy)(e)&&!e.isSpeciallyZOrderedSource()}function h(e,t){return e.zorder-t.zorder}function d(e,t){(0,o.isMainSeriesState)(e)?e.zorder=0:e.zorder=t}function u(e,t){e.setZorder(t)}function p(e){return e.zorder()}function _(e){return Math.round(1e3*e)/1e3}function m(e,t){const i=Math.max(e,t),s=Math.min(e,t);return Math.max(0,Math.ceil(i)-Math.floor(s)-1)}function g(e,t,i){let s=0;const r=function(e,t){const i=1e3;return Math.abs(t*i-e*i)/i}(t,e);var n;return r>i?(e=Math.trunc(e),s=Math.floor(r/(i+1))):(n=r/(i+1),s=Math.floor(1e3*n)/1e3),{startZOrder:e,zOrderStep:s}}function f(e,t,i,s){let r=e.length,n=t;for(let t=e.length-1;t>=-1;t--)if(-1===t||s(e[t])){const s=t;let o=x(n);if(r-1===s)s>=0&&i(e[s],o);else{const t=m(r,s);let a=0;for(;0===a;){const e=g(n,o,t);n=e.startZOrder,a=e.zOrderStep,0===a&&(o-=1e4,0===o&&(o-=1e4))}let l=r-1;for(;l>s;){const t=_(n-a);i(e[l],t),n=t,l--}s>=0&&i(e[s],o)}n=o,r=s}}function v(e,t,i,s){let r=-1,n=t;for(let t=0;t<=e.length;t++)if(t===e.length||s(e[t])){const s=t;let o=P(n);if(r+1===s)s<=e.length-1&&i(e[s],o);else{const t=m(r,s);let a=0;for(;0===a;){const e=g(n,o,t);n=e.startZOrder,a=e.zOrderStep,0===a&&(o+=1e4,0===o&&(o+=1e4))}let l=r+1;for(;l<=s-1;){const t=_(n+a);i(e[l],t),n=t,l++}s<=e.length-1&&i(e[s],o)}n=o,r=s}}function S(e){!function(e,t,i,s,r,n){let o=null;const a=[];for(const r of e)t(r)?(a.push(r),o=r):(i(r)||s(r))&&a.push(r);a.sort(n),null!==o&&r(o,0);const l=null===o?-1:a.indexOf(o);-1!==l?(f(a.slice(0,l),0,r,i),v(a.slice(l+1),0,r,i)):v(a,0,r,i)}(e,o.isMainSeriesState,o.isStudyState,o.isLineToolState,d,h)}function y(e,t){const i=Math.floor(e/1e4);let s=t.get(i);return void 0===s&&(s=[],t.set(i,s)),s}function b(e,t,i,s,r,n){let o=-1/0,a=1/0,l=-1/0,c=0;const h=new Map;for(let s=0;sr(e)-r(t)));let p=x(r(u[0]));const m=P(p),f=g(p,m,u.length+1).zOrderStep;return 0!==f?(u.forEach((e=>{const t=_(p+f);s(e,t),p=t})),_(p+f)):_(m+5e3)}function w(e,t){return b(e,l,c,u,p,t)}function C(e){let t=-1e4;for(const i of e)c(i)&&(t=Math.min(t,i.zorder()-1e4));return 0===t?-1e4:t}function P(e){const t=1e4*Math.ceil(e/1e4);return t===e?t+1e4:t}function x(e){const t=1e4*Math.floor(e/1e4);return t===e?t-1e4:t}function T(e,t,i,s,r,n,o){const l=t.length,{newItems:c,movedItemsStartIndex:h}=i>0?(0,a.moveAfter)(e,t,i-1):(0,a.moveBefore)(e,t,0);let d=!1;for(let t=h;tr(e)))?function(e,t,i,s,r,n){let o,a,l=-1,c=-1;0===i?(c=I(e,i+t,s),a=n(e[c])):i+t===e.length?(l=M(e,i-1,s),o=n(e[l])):(l=M(e,i-1,s),o=n(e[l]),c=I(e,i+t,s),a=n(e[c]));if((void 0===o||o<0)&&void 0!==a&&a<=0)f(e.slice(0,c),a,r,s);else if((void 0===a||a>0)&&void 0!==o&&o>=0)v(e.slice(l+1),o,r,s);else{i+t0)&&void 0!==a&&a>=0){c=a;const e=g(c,void 0!==l?l:P(a),t);c=e.startZOrder,p=e.zOrderStep,d=i,u=d+t,h=1}if(0!==p)for(;d!==u;){const t=_(c+h*p);n(e[d],t),c=t,d+=h}else{const t=e.findIndex((e=>r(e)));-1!==t?(f(e.slice(0,t),0,n,s),v(e.slice(t+1),0,n,s)):v(e,0,n,s)}}(c,l,h,r,s,n,o)}function I(e,t,i){for(;t=0&&i(e[t]);)t--;return Math.max(0,t)}function A(e,t,i,s,r,n,o){const a=e.indexOf(i)+1;T(e,t,a,s,r,n,o)}function L(e,t,i,s,r,n,o){const a=e.indexOf(i);T(e,t,a,s,r,n,o)}function k(e,t,i){A(e,t,i,n.isSeries,c,u,p)}function D(e,t,i){L(e,t,i,n.isSeries,c,u,p)}},65106:(e,t,i)=>{"use strict";i.d(t,{getSymbolSearchCompleteOverrideFunction:()=>n,setSymbolSearchCompleteOverrideFunction:()=>r});let s=(e,t)=>{var i;return Promise.resolve({symbol:e,name:null!==(i=null==t?void 0:t.symbol)&&void 0!==i?i:e})};function r(e){s=e}function n(){return s}},60762:(e,t,i)=>{"use strict";i.d(t,{StudyMetaInfoBase:()=>u});var s=i(27147),r=i(50151),n=i(33703);const o=new Set(["CorrelationCoefficient@tv-basicstudies","Correlation - Log@tv-basicstudies-1"]),a=new Set([]),l=new Set(["line"]),c=new Map([["AnchoredVWAP@tv-basicstudies","linetoolanchoredvwap"],["RegressionTrend@tv-basicstudies","linetoolregressiontrend"],["VbPAnchored@tv-basicstudies","linetoolanchoredvp"]]),h=/^([^\$]+)\$\d+$/,d=["bool","color","time","text_area"];class u{static getSourceIdsByInputs(e,t){if(!Array.isArray(e)||!t)return[];const i=[];for(const r of e)if(u.isSourceInput(r)&&(0,s.default)(t[r.id])){const e=t[r.id];e.includes("$")&&i.push(e.split("$")[0])}return i}static isSourceInput(e){return Boolean(e.id&&(("source"===e.id||"src"===e.id)&&("text"===e.type||"source"===e.type)||"source"===e.type))}static getSourceInputIds(e){const t=[];for(const i of e.inputs)u.isSourceInput(i)&&t.push(i.id);return t}static setChildStudyMetaInfoPropertiesSourceId(e,t,i){for(const s of e.inputs){if(!u.isSourceInput(s))continue;const e=i.childs().inputs&&i.childs().inputs.childs()[s.id];if(e){const i=e.value(),s=h.exec(i);if(2===(null==s?void 0:s.length)){if("{pid}"===s[1]){const s=i.replace(/^[^\$]+/,t);e.setValue(s)}}}}}static patchSoSInputs(e,t){const i=e=>{const i=h.exec(e);if(2===(null==i?void 0:i.length)){const s=i[1],n=`${(0,r.ensureNotNull)(t(s))}` -;return e.replace(/^[^\$]+/,n)}return e};for(const t in e)if(/in_[\d+]/.test(t)||"source"===t){const r=e[t];(0,s.default)(r)?e[t]=i(r):(0,n.isExtendedInput)(r)&&(0,n.isExtendedInputSource)(r)&&(r.v=i(r.v))}}static canBeChild(e){if((0,s.default)(e))return!0;if(!e)return!1;if(e.extra&&!u.isAllowedSourceInputsCount(e.extra.sourceInputsCount)||!0===e.canNotBeChild||!1===e.canBeChild||o.has(e.id))return!1;let t=0;for(const i of e.inputs)u.isSourceInput(i)&&(t+=1);return u.isAllowedSourceInputsCount(t)}static isAllowedSourceInputsCount(e){return 1===e}static canHaveChildren(e){if(e){if(e.isTVScriptStrategy||e.TVScriptSourceCode&&isStrategy(e.TVScriptSourceCode))return!1;if(e.id&&!a.has(e.id)&&Array.isArray(e.plots))for(const t of e.plots)if(l.has(t.type))return!0}return!1}static getChildSourceInputTitles(e,t,i){var s;const r={};if(t.plots&&t.plots.length&&e.options&&e.options.length)for(const n of e.options){const e=n?+n.split("$")[1]:NaN,o=isFinite(e)&&t.plots[e];o&&l.has(o.type)&&(r[n]=t.styles&&t.styles[o.id]&&(null===(s=t.styles[o.id])||void 0===s?void 0:s.title)||o.id,i&&(r[n]=i+": "+r[n]))}return r}static canPlotBeSourceOfChildStudy(e){return l.has(e)}static getStudyPropertyRootName(e){const t=c.get(e.id);if(void 0!==t)return t;let i="study_"+e.id;return e.pine&&e.pine.version&&(i+="_"+e.pine.version.replace(".","_")),i}static getStudyPropertyRootNameById(e){const t=c.get(e);return void 0!==t?t:"study_"+e}_updateInputDisplayDefaults(){this.inputs.filter((e=>void 0===e.display)).forEach((e=>{d.includes(e.type)?e.display=n.InputDisplayFlags.None:e.display=n.InputDisplayFlags.All}))}}},42856:(e,t,i)=>{"use strict";i.d(t,{StudyMetaInfo:()=>a});var s=i(59224).getLogger("Chart.Study.MetaInfo"),r=i(45574).applyOverridesToStudyDefaults,n=i(60762).StudyMetaInfoBase,o={};class a extends n{constructor(e){super(),TradingView.merge(this,{palettes:{},inputs:[],plots:[],graphics:{},defaults:{}}),TradingView.merge(this,e);var t=e.fullId||e.id;TradingView.merge(this,a.parseIdString(t)),this._updateInputDisplayDefaults()}static versionOf(e){var t="_metainfoVersion"in e&&isNumber(e._metainfoVersion)?e._metainfoVersion:0;return t<0&&s.logError("Metainfo format version cannot be negative: "+t),t}static parseIdString(e){var t={};if(-1===e.indexOf("@"))t.shortId=e,t.packageId="tv-basicstudies",t.id=e+"@"+t.packageId,t.version=1;else{var i=e.split("@");t.shortId=i[0];var s=i[1].split("-");if(3===s.length)t.packageId=s.slice(0,2).join("-"),t.id=t.shortId+"@"+t.packageId,t.version=s[2];else if(1===s.length&&"decisionbar"===s[0])t.packageId="les-"+s[0],t.id=t.shortId+"@"+t.packageId,t.version=1;else{if(1!==s.length)throw new Error("unexpected study id:"+e);t.packageId="tv-"+s[0],t.id=t.shortId+"@"+t.packageId,t.version=1}}if(t.fullId=t.id+"-"+t.version,"tv-scripting"===t.packageId){var r=t.shortId;if(0===r.indexOf("Script$")||0===r.indexOf("StrategyScript$")){var n=r.indexOf("_");t.productId=n>=0?r.substring(0,n):t.packageId}else t.productId=t.packageId}else t.productId=t.packageId;return t}static getPackageName(e){ -return(/^[^@]+@([^-]+-[^-]+)/.exec(e||"")||[0,"tv-basicstudies"])[1]}static cutDollarHash(e){var t=e.indexOf("$"),i=e.indexOf("@");return-1===t?e:e.substring(0,t)+(i>=0?e.substring(i):"")}static hasUserIdSuffix(e){return/^USER;[\d\w]+;\d+$/.test(e)}static hasPubSuffix(e){return/^PUB;.+$/.test(e)}static hasStdSuffix(e){return/^STD;.+$/.test(e)}static isStandardPine(e){return/^(Strategy)?Script\$STD;.*@tv-scripting$/.test(e)}static getStudyIdWithLatestVersion(e){const t=a.cutDollarHash(e.id);let i=t;return t.indexOf("@tv-scripting")>=0?i+="-101!":t.endsWith("CP@tv-basicstudies")?i+="-"+Math.min(e.version,207):t.endsWith("CP@tv-chartpatterns")?i+="-"+Math.min(e.version,9):i+="-"+e.version,i}defaultInputs(){for(var e=[],t=0;t0?e[0].id:null}createDefaults(){if(this.defaults){var e=TradingView.clone(this.defaults);e.precision="default";var t=a.getStudyPropertyRootName(this);defaults.create(t,e)}}removeDefaults(){defaults.remove(a.getStudyPropertyRootName(this))}static findStudyMetaInfoByDescription(e,t){if(e){for(var i=0;i{"use strict";window.TradingView=window.TradingView||{},i(2298),i(32563).setClasses(),i(95374),i(56186).install(),i(49483),i(1722),i(42053),i(11417),i(54358),i(56696),i(56840)},48324:(e,t,i)=>{"use strict";var s=i(95171),r=i(43370),n=i(50151),o=i(10066),a=i(11542),l=(i(62168),i(14483));const c=(0,o.getChartingLibraryGlobalContext)();JSON.parse(c.urlParams.disabledFeatures).forEach((e=>{l.setEnabled(e,!1)})),JSON.parse(c.urlParams.enabledFeatures).forEach((e=>{l.setEnabled(e,!0)}));i(58005);var h=i(85804),d=(i(89173),i(56840));const u=(0,o.getChartingLibraryGlobalContext)(),p=(0,o.getChartingLibraryOwner)();u.__settingsOverrides=p.settingsOverrides||{};const _=p.settingsAdapter;null!=_?(d.setSettingsAdapter(_),d.sync()):l.enabled("use_localstorage_for_settings")&&d.sync();var m=i(46501);const g=(0,o.getChartingLibraryGlobalContext)() -;g.urlParams.customFontFamily&&(0,m.setChartFontFamily)(g.urlParams.customFontFamily);var f=i(38881);class v extends f.ChunkLoader{_startLoading(){return Promise.all([i.e(3236),i.e(2666),i.e(4015),i.e(3842),i.e(6),i.e(5649),i.e(8056),i.e(5993),i.e(6752),i.e(8149),i.e(6639),i.e(6036),i.e(6106),i.e(5166),i.e(1033),i.e(4894),i.e(6025),i.e(3939),i.e(6949),i.e(524),i.e(1803),i.e(962),i.e(2544),i.e(2052),i.e(5516)]).then(i.bind(i,2464)).then((e=>e.getRestrictedToolSet()))}}var S=i(69774),y=i(24899);function b(e=[],t=[]){const i=document.createElement("div"),s=document.createElement("div");return i.appendChild(s),i.classList.add(y.container),s.classList.add(y.inner),e.forEach((e=>{i.classList.add(y[e])})),t.forEach((e=>{i.classList.add(y[e])})),i}class w extends f.ChunkLoader{constructor(e,t){super(),this._toolsBootloader=e,this._headerProps=t,this._headerProps.resizerBridge.negotiateHeight(S.HEADER_TOOLBAR_HEIGHT_EXPANDED),this._headerProps.resizerBridge.container.value().appendChild(b())}_startLoading(){return Promise.all([this._toolsBootloader.load(),this._loadHeaderToolbar()]).then((([e,t])=>new t(this._headerProps.resizerBridge.container.value(),{...this._headerProps,tools:e})))}_loadHeaderToolbar(){return Promise.all([i.e(3066),i.e(962),i.e(6918),i.e(3005)]).then(i.bind(i,46618)).then((e=>e.HeaderToolbarRenderer))}}var C=i(14873),P=i(9438);class x extends f.ChunkLoader{constructor(e){super(),this._opts=e,C.isDrawingToolbarVisible.value()&&(this._opts.resizerBridge.negotiateWidth(P.TOOLBAR_WIDTH_EXPANDED),this._opts.resizerBridge.container.value().appendChild(b()))}_startLoading(){return Promise.all([i.e(3175),i.e(2666),i.e(4015),i.e(3842),i.e(5649),i.e(5993),i.e(6752),i.e(6036),i.e(3980),i.e(5166),i.e(1033),i.e(1109),i.e(3939),i.e(3914),i.e(962),i.e(1740),i.e(2544),i.e(1890),i.e(5664),i.e(2846),i.e(2878)]).then(i.bind(i,75038)).then((e=>new e.DrawingToolbarRenderer(this._opts.resizerBridge.container.value(),{...this._opts})))}}var T=i(66501),I=i(32563),M=i(11014),A=i(45345);var L=i(58844),k=i(4741),D=i(3343);function E(e){if("number"==typeof e)return e;switch(e.toLowerCase()){case"ctrl":return D.Modifiers.Control;case"shift":return D.Modifiers.Shift;case"alt":return D.Modifiers.Alt;default:return e.toUpperCase().charCodeAt(0)}}function V(e){let t=0;for(let i=0;i{if(!z)return void this._renameActionHandler(e,t,s,r) -;const{newValue:n,dialogClose:o}=e,l=(await this._doLoad()).find((e=>e.name===n));o(),void 0!==l?this._hide=await(0,H.showConfirm)({title:a.t(null,void 0,i(56996)),text:a.t(null,void 0,i(30192)),onConfirm:({dialogClose:e})=>{e(),this._doOverwriteExistingLayout(l.id,n,t,s,r)},onCancel:({dialogClose:e})=>{e(),this._showRenameDialog(n,t,s,r)}}):this._renameActionHandler({newValue:n,dialogClose:o},t,s,r)},onClose:()=>this._visibility.setValue(!1)})}_doSaveCurrentLayout(e,t,i,s){const r=this._chartWidgetCollection.metaInfo.name.value();this._chartWidgetCollection.metaInfo.name.setValue(e),this._doSave(t,i,(()=>{this._chartWidgetCollection.metaInfo.name.setValue(r),null==s||s()}))}_doOverwriteExistingLayout(e,t,i,s,r){const n=this._chartWidgetCollection.metaInfo.name.value();this._chartWidgetCollection.metaInfo.id.setValue(e),this._chartWidgetCollection.metaInfo.name.setValue(t),this._doSave(i,s,(()=>{this._chartWidgetCollection.metaInfo.name.setValue(n),null==r||r()}))}}class j extends U{cloneChart(){this._cloneChart().then((()=>this._visibility.setValue(!0)))}show(){(0,O.checkAuthBeforeSaveLoad)((()=>this.cloneChart()),{source:"Clone chart"})}_renameDialogTitle(){return a.t(null,void 0,i(87898))}_renameDialogText(){return a.t(null,void 0,i(24435))+":"}_renameActionHandler({newValue:e,dialogClose:t}){l.enabled("saveload_storage_customization")&&this._doCloneCurrentLayout(e),t()}async _cloneChart(){let e;try{e=await W()}catch(e){return void showErrorDialog({content:a.t(null,void 0,i(56670))})}e&&(this._hide=await this._showRenameDialog(this._getInitialRenameDialogInput()))}_doCloneCurrentLayout(e){const t=this._chartWidgetCollection.metaInfo.name.value();this._chartWidgetCollection.metaInfo.uid.deleteValue(),this._chartWidgetCollection.metaInfo.id.deleteValue(),this._chartWidgetCollection.metaInfo.name.setValue(e),this._doSave(void 0,void 0,(()=>{this._chartWidgetCollection.metaInfo.name.setValue(t)}))}_getInitialRenameDialogInput(){return a.t(null,{context:"ex: AAPL chart copy"},i(16493)).format({title:this._chartWidgetCollection.metaInfo.name.value()})}}class G extends U{show(e,t,i){const s="function"==typeof e?e:void 0;this._saveNewChart(s,t,i).then((()=>this._visibility.setValue(!0)))}_renameDialogTitle(){return a.t(null,void 0,i(10520))}_renameDialogText(){return a.t(null,void 0,i(24435))+":"}_renameActionHandler({newValue:e,dialogClose:t},i,s,r){this._doSaveCurrentLayout(e,i,s,r),t()}async _saveNewChart(e,t,s){let r;try{r=await W()}catch(e){return void showErrorDialog({content:a.t(null,void 0,i(56670))})}const n=this._chartWidgetCollection.metaInfo.name.value();this._hide=await this._showRenameDialog(n,e,t,s)}}class q extends U{show(){(0,O.checkAuthBeforeSaveLoad)((()=>this._show()),{source:"Rename chart"})}_renameDialogTitle(){return a.t(null,void 0,i(4142))}_renameDialogText(){return a.t(null,void 0,i(24435))+":"}_renameActionHandler({newValue:e,dialogClose:t}){this._doSaveCurrentLayout(e),t()}async _show(){await this._renameChart(),this._visibility.setValue(!0)}async _renameChart(){ -const e=this._chartWidgetCollection.metaInfo.name.value();this._hide=await this._showRenameDialog(e)}}class ${constructor(e,t){var i;if(this._autosaveTimer=null,this._watchedAutoSaveEnabled=new R.WatchedValue,this._toggleAutoSaveEnabledHandler=this._toggleAutoSaveEnabled.bind(this),this._doSave=(e,t,i,s)=>{const r=this._chartWidgetCollection;void 0!==e&&e();const n=this._chartChangesWatcher.changes();this._chartSaver.saveChartSilently((e=>{var i;i=r.metaInfo.uid.value(),"/chart/"===location.pathname&&(location.href="/chart/"+i),void 0!==t&&t(e)}),(()=>{void 0!==i&&i()}),{autoSave:Boolean(s),changes:n})},this._doLoad=()=>F.backend.getCharts(),this._chartWidgetCollection=e,this._chartSaver=t,this._createController=new G(e,this._doSave,this._doLoad),this._renameController=new q(e,this._doSave,this._doLoad),this._saveAsController=new j(e,this._doSave,this._doLoad),this._chartChangesWatcher=new T.ChartChangesWatcher(e,t,N),e.saveKeysPressed().subscribe(this,this.saveChartOrShowTitleDialog),this._chartChangesWatcher.getOnChange().subscribe(this,this._onStateChanged),l.enabled("saveload_separate_drawings_storage")){const e=!0;e&&this._enableAutoSave(),this._watchedAutoSaveEnabled.setValue(e),this._watchedAutoSaveEnabled.subscribe(this._toggleAutoSaveEnabledHandler),null===(i=this._autoSaveEnabledSetting)||void 0===i||i.getOnChange().subscribe(this,this._autoSaveEnabledSettingHandler)}}autoSaveEnabled(){return this._watchedAutoSaveEnabled}destroy(){var e;l.enabled("saveload_separate_drawings_storage")&&(this._watchedAutoSaveEnabled.unsubscribe(),delete this._watchedAutoSaveEnabled,null===(e=this._autoSaveEnabledSetting)||void 0===e||e.destroy(),delete this._autoSaveEnabledSetting)}getCreateController(){return this._createController}getRenameController(){return this._renameController}getSaveAsController(){return this._saveAsController}cloneChart(){this._saveAsController.cloneChart()}saveChartAs(){this._saveAsController.show()}renameChart(){this._renameController.show()}saveNewChart(e,t,i){this._createController.show(e,t,i)}saveExistentChart(e,t,i){this._doSave(e,t,i)}changes(){return this._chartChangesWatcher.changes()}hasChanges(){return 0!==this._chartChangesWatcher.changes()}saveChartOrShowTitleDialog(e,t,i){const s=window.saver.isSaveInProcess(),r=this._chartChangesWatcher.hasChanges(),n=!!this._chartWidgetCollection.metaInfo.id.value();window.is_authenticated&&(s||!r&&n)||(0,O.checkAuthBeforeSaveLoad)((()=>{null!=this._chartWidgetCollection.metaInfo.id.value()?this.saveExistentChart(e,t,i):this.saveNewChart(e,t,i)}),{source:"Save chart",sourceMeta:"Chart"})}saveToJSON(e){return this._chartSaver.saveToJSON(e)}saveChartSilently(e,t,i){this._chartSaver.saveChartSilently(e,t,i)}setAutoSaveEnabled(e){window.is_authenticated&&window.saver.isSaveInProcess()||(0,O.checkAuthBeforeSaveLoad)((()=>{this._watchedAutoSaveEnabled.setValue(e)}),{source:"AutoSave chart"})}saveChartLineTools(e,t,i,s){return this._chartSaver.saveChartLineTools(e,t,i,s)}layoutId(){return this._chartWidgetCollection.metaInfo.uid.value()} -_autoSaveEnabledSettingHandler(e){0}_toggleAutoSaveEnabled(e){}_enableAutoSave(){0}_disableAutoSave(){0}_onStateChanged(e){e?this._startAutosave():this._stopAutosave()}_startAutosave(){l.enabled("charts_auto_save")&&null===this._autosaveTimer&&(this._autosaveTimer=setTimeout((()=>{this._autosaveTimer=null,this._chartWidgetCollection.metaInfo.id.value()&&this._doSave(void 0,void 0,void 0,!0)}),6e4))}_stopAutosave(){null!==this._autosaveTimer&&(clearInterval(this._autosaveTimer),this._autosaveTimer=null)}}var Y=i(10638),K=i(51768),Z=i(57898);const X=(0,i(59224).getLogger)("Platform.StudyTemplates"),J=a.t(null,void 0,i(97065));class Q{constructor(e){this._chartWidgetCollection=e.chartWidgetCollection,this._favoriteStudyTemplatesService=e.favoriteStudyTemplatesService,window.loginStateChange.subscribe(null,F.backend.invalidateStudyTemplatesList),this._list=new R.WatchedValue([]),this._onChange=new Z.Delegate,this._list.subscribe((()=>this._onChange.fire()))}findRecordByName(e){return this._list.value().find((t=>t.name===e))||null}showSaveAsDialog(){const e=this._chartWidgetCollection.activeChartWidget.value().model();Promise.all([i.e(2666),i.e(956),i.e(2109),i.e(5145),i.e(855),i.e(6),i.e(2191),i.e(6221),i.e(3502),i.e(6639),i.e(4215),i.e(6884),i.e(3610),i.e(7149),i.e(962),i.e(6408),i.e(5057),i.e(7550),i.e(6631)]).then(i.bind(i,13932)).then((t=>{new t.StudyTemplateSaver({controller:e,onSave:e=>{this._list.setValue(e)}}).show()}))}applyTemplate(e){const t=this.findRecordByName(e);null!==t?window.runOrSignIn((()=>{const e=this._chartWidgetCollection.activeChartWidget.value(),i=i=>{(0,K.trackEvent)("GUI","Load Study Template"),e.model().applyStudyTemplate(JSON.parse(i.content),t.name)};void 0!==t.id?t.is_default?F.backend.getStandardStudyTemplateContentById(t.id,i):F.backend.getStudyTemplateContentById(t.id,i):F.backend.getStudyTemplateContent(t.name).then(i)}),{source:"Study templates apply"}):X.logNormal(`Template ${e} not found in cache`)}deleteStudyTemplate(e,t){const i=this.findRecordByName(e);null!==i?this._removeTemplate(i,t):X.logNormal(`Template ${e} not found in cache`)}list(){return this._list.value()}getOnChange(){return this._onChange}refreshStudyTemplateList(e){F.backend.getStudyTemplatesList().then((t=>{this._list.setValue(t),void 0!==e&&e()}))}invalidate(){F.backend.invalidateStudyTemplatesList()}_removeTemplate(e,t){window.runOrSignIn((()=>{(0,H.showConfirm)({text:J.format({name:e.name}),onConfirm:({dialogClose:i})=>new Promise((s=>{const r=()=>{this.refreshStudyTemplateList((()=>{const r=this.list();this._list.setValue(r.filter((t=>t!==e))),this._favoriteStudyTemplatesService&&this._favoriteStudyTemplatesService.remove(e.name),s(),i(),null==t||t()}))};F.backend.invalidateStudyTemplatesList(),void 0!==e.id?F.backend.removeStudyTemplateById(e.id,r):F.backend.removeStudyTemplate(e.name).then(r)}))})}),{source:"Study templates delete"})}}var ee=i(35423),te=i(82992),ie=i(83854),se=i(1763);class re{constructor(e,t){this._visibility=new R.WatchedValue(!1),this._dialogPromise=null,this._dialog=null, -this._chartWidgetCollection=e,this._options=t}visible(){return this._visibility.readonly()}show(e,t,i){var s,r,n;const o=Array.isArray(e)?e:[],a=Array.isArray(e)?void 0:e;null===this._dialog&&this._requestDialog(null!=o?o:[],t,i,a),null===(s=this._dialog)||void 0===s||s.open(null!=o?o:[],null===(n=null===(r=this._options)||void 0===r?void 0:r.indicatorsPreloader)||void 0===n?void 0:n.getIndicatorPromises(),t,i,a)}hide(){var e;null===(e=this._dialog)||void 0===e||e.hide()}getDialog(){return this._dialog}resetAllPages(){var e;null===(e=this._dialog)||void 0===e||e.resetAllStudies()}_requestDialog(e,t,s,r){if(null===this._dialogPromise){let n;n=Promise.all([i.e(2666),i.e(956),i.e(2109),i.e(5145),i.e(855),i.e(2191),i.e(2587),i.e(6752),i.e(7350),i.e(6494),i.e(962),i.e(6408),i.e(5057),i.e(6456)]).then(i.bind(i,57979)).then((e=>new e.IndicatorsLibraryContainer(this._chartWidgetCollection,this._options))),this._dialogPromise=n.then((i=>{var n,o;this._dialog=i,this._dialog.visible().subscribe((e=>{this._visibility.setValue(e)})),this._dialog.open(e,null===(o=null===(n=this._options)||void 0===n?void 0:n.indicatorsPreloader)||void 0===o?void 0:o.getIndicatorPromises(),t,s,r)}))}return this._dialogPromise}}var ne=i(21097),oe=i(51608),ae=i(30888),le=i(36174),ce=i(63821),he=i(78159),de=i(3228),ue=i(83407),pe=i(16164),_e=i(41249),me=i(38618),ge=i(96429);const fe=/^Etc\/GMT([+-])(\d{1,2}):?(\d\d)?$/,ve=new Map;function Se(e){if(ve.has(e))return ve.get(e);const t=fe.test(e);return ve.set(e,t),t}const ye=new Map;function be(e){if(ye.has(e))return ye.get(e);const t=function(e){const t=e.match(fe);if(!t)return 0;const i="+"===t[1]?-1:1;return 60*(60*parseInt(t[2],10)+parseInt(t[3]||"0",10))*i}(e),i={time:[1924992e3+t],offset:[t]};return ye.set(e,i),i}let we=null;const Ce=new Map;class Pe{constructor(){this._customTimezones=new Map}addTimezones(e){e.forEach((e=>{const{id:t,...i}=e;this._addTimezone(t,i)})),this.updateChartTimezones()}listTimezoneIds(){return[...this._customTimezones.keys()]}listTimezones(){return[...this._customTimezones.entries()].map((([e,t])=>({id:e,...t})))}getTimezoneInfo(e){if(!this.timezoneIsAvailable(e))throw new Error("Provided timezone alias is not within the list of supported timezones.");return(0,n.ensure)(this._customTimezones.get(e))}getAllTimezoneInfo(){return this.listTimezones()}getAliasTimezone(e){return this.getTimezoneInfo(e).alias}timezoneIsAvailable(e){return this._customTimezones.has(e)}updateChartTimezones(){(0,me.updateAvailableTimezones)(this.getAllTimezoneInfo())}getTimezoneData(e){if(Ce.has(e))return Ce.get(e);let t=null;if(Se(e))t=be(e);else if(this.timezoneIsAvailable(e)){const i=this.getAliasTimezone(e);ge.tzData[i]&&(t=ge.tzData[i]),!t&&Se(i)&&(t=be(i))}return t&&Ce.set(e,t),t}static instance(){return null===we&&(we=new Pe),we}_addTimezone(e,t){try{if((0,n.ensure)(e,"Custom timezone ID"),(0,n.ensure)(t.alias,"Custom timezone alias"),(0,n.ensure)(t.title,"Custom timezone title"),(0, -me.timezoneIsAvailable)(e)&&!this.timezoneIsAvailable(e))throw new Error("Custom timezone id already exists.");if(!(0,me.timezoneIsSupported)(t.alias)&&!Se(t.alias))throw new Error("Custom timezone alias is not a supported timezone.");if(e.length<1)throw new Error("Custom timezone id is empty");if(t.title.length<1)throw new Error("Custom timezone title is empty");this._customTimezones.set(e,t)}catch(e){console.warn(`Unable to add custom timezone. ${e}`)}}}(0,_e.setCustomTimezones)(Pe);var xe=i(42226);let Te=null;var Ie=i(36274),Me=i(31940);class Ae{constructor(e){this._document=e,this.isFullscreen=new R.WatchedValue;const t=()=>{const e=["fullscreenElement","webkitFullscreenElement","mozFullscreenElement","mozFullScreenElement","msFullscreenElement"];for(let t=0;t{this.isVisible.setValue(!e[r])},i(),e.addEventListener(t,i,!1);break}}this.destroy=()=>{i&&(e.removeEventListener(t,i,!1),i=null)}}}var ke=i(84015),De=i(49483);function Ee(e,t){let i=0;for(const{min:s,max:r}of t){if(e0&&t.push({min:e,max:s})}return t.sort(((e,t)=>e.min-t.min||e.max-t.max)),t}function Be(e,t){if(e.length!==t.length)return!1;for(let i=e.length;i--;){if(e[i].min!==t[i].min)return!1;if(e[i].max!==t[i].max)return!1}return!0}const Re=l.enabled("no_min_chart_width"),Ne=l.enabled("bypass_chart_height_check");function Oe(e){const t=l.enabled("side_toolbar_in_fullscreen_mode"),i=l.enabled("header_in_fullscreen_mode");return"center"===e||"left"===e&&t||"top"===e&&i}var Fe=i(2438),We=i(98310),He=i(16216),ze=(i(26665),i(3162)),Ue=i.n(ze),je=i(241),Ge=i(88348),qe=i(15367),$e=i(68335) -;const Ye=["LineToolTrendLine","LineToolRay","LineToolInfoLine","LineToolExtended","LineToolRegressionTrend","LineToolRotatedRectangle","LineToolParallelChannel","LineToolFlatBottom","LineToolDisjointAngle","LineToolPitchfork","LineToolSchiffPitchfork","LineToolSchiffPitchfork2","LineToolInsidePitchfork","LineToolVertLine","LineToolCrossLine","LineToolHorzLine","LineToolHorzRay","LineToolTrendAngle"];function Ke(e,t=!1,s=!1){if(!l.enabled("popup_hints"))return;const r=e.getContainer();let o=null,c=null;function h(e,t){if(o)o.show(e,p.bind(null,t));else{const s=Ge.tool.value();Promise.all([i.e(6214),i.e(962),i.e(6166)]).then(i.bind(i,5015)).then((i=>{o=new i.ChartEventHintRenderer(r),s===Ge.tool.value()&&o.show(e,p.bind(null,t))}))}}function u(e){return!Boolean(d.getBool(e))}function p(e){d.setValue(e,!0,{forceFlush:!0}),(0,n.ensureNotNull)(o).destroy(),null!==c&&c(),o=null}Ge.tool.subscribe((function(){const e=Ge.tool.value(),t=De.CheckMobile.any();if(s&&t&&function(e){return Ye.includes(e)}(e))return void async function(e){0}();if(!u("hint.touchPainting"))return;const r=(0,qe.isLineToolDrawWithoutPoints)(e);!(0,qe.isStudyLineToolName)(e)||"LineToolRegressionTrend"===e||r||t?(0,qe.isLineToolName)(e)&&!(0,qe.isLineDrawnWithPressedButton)(e)&&!r&&t?h(a.t(null,void 0,i(67861)),"hint.touchPainting"):o&&o.hide():h(a.t(null,void 0,i(32234)),"hint.touchPainting")})),Ge.createdLineTool.subscribe(null,(function(){const e=Ge.tool.value();"LineToolPath"===e&&u("hint.finishBuildPathByDblClick")?h(a.t(null,void 0,i(5828)),"hint.finishBuildPathByDblClick"):"LineToolPolyline"===e&&u("hint.finishBuildPolylineByDblClick")&&h(a.t(null,void 0,i(63898)),"hint.finishBuildPolylineByDblClick")})),Ge.finishedLineTool.subscribe(null,(function(){if(o){const e=Ge.tool.value();"LineToolPath"===e?p("hint.finishBuildPathByDblClick"):"LineToolPolyline"===e&&p("hint.finishBuildPolylineByDblClick")}})),e.layoutSizesChanged().subscribe((function(){if(!u("hint.startResizingChartInLayout"))return;h(a.t(null,void 0,i(35273)),"hint.startResizingChartInLayout")})),t||De.CheckMobile.any()||!u("hint.startFocusedZoom")||(c=function(e,t){let i=!1;const s=r=>{r?(i&&t(r),e.onZoom().unsubscribe(null,s)):i||(t(r),i=!0)};return e.onZoom().subscribe(null,s),()=>e.onZoom().unsubscribe(null,s)}(e,(function(e){if(!u("hint.startFocusedZoom"))return;if(e)o&&(c=null,p("hint.startFocusedZoom"));else{const e=$e.isMacKeyboard?"⌘":"Ctrl";h(a.t(null,void 0,i(35963)).format({key:e}),"hint.startFocusedZoom")}})))}var Ze=i(2269),Xe=i.n(Ze),Je=i(42856),Qe=i(75117),et=i.n(Qe),tt=(i(24172),i(46544),i(78136)),it=i(88732),st=i(74649),rt=i(97906),nt=i(67980),ot=i(27714),at=i(12481),lt=i(86441),ct=i(34026),ht=i(33013),dt=i(15742),ut=i(18807),pt=i(61345),_t=i(87095),mt=i(88275),gt=i(74359);var ft=i(68441),vt=i(34565),St=i(66103),yt=i(70893),bt=i(50946);i(77275) -;const wt=new Map([["logo-old-style",bt],["tradingview-old-style",yt]]),Ct=l.enabled("adaptive_logo"),Pt=l.enabled("small_no_display"),xt=l.enabled("38914"),Tt="site_branding",It="widget_branding",Mt="widget_referral_branding",At="widget_custom_branding",Lt="widget_custom_no_powered_branding",kt="fundamental_branding",Dt="fundamental_custom_branding",Et="fundamental_custom_no_powered_branding",Vt="library_branding",Bt="library_custom_branding",Rt="library_custom_no_powered_branding",Nt=navigator.userAgent.toLowerCase().indexOf("chrome")>-1&&-1===navigator.userAgent.toLowerCase().indexOf("edge"),Ot=window.urlParams||{},Ft=window.initData||{};Ot.no_referral_id&&enable(Ot.referral_id||"","aggressive");const Wt=a.t(null,void 0,i(26619)),Ht=xt?a.t(null,void 0,i(5607)):a.t(null,void 0,i(68111)),zt=(a.t(null,void 0,i(82128)),a.t(null,void 0,i(88841)),a.t(null,void 0,i(99769)),(0,De.onWidget)(),{brandCircleSize:32,textAsImageWidthCompensation:0,leftOffset:0,bottomOffset:-23,logoLeftOffset:1,maximizedWidthsCompensation:0,logoTextOffset:6});class Ut extends dt.CustomSourceBase{constructor(e,t,i){super(e,t),this._canvasWidth=0,this._paneHeight=0,this._left=13,this._bottom=36,this._layout=Tt,this._needToShow=!0,this._showBranding=!1,this._customLogoSrc="",this._customLogoLink="",this._cubicBezier=new pt.CubicBezier(.4,.01,.22,1),this._openAnimation=null,this._closeAnimation=null,this._powBy=null,this._custom=null,this._destroyed=!1,this._mainSeries=this._model.mainSeries(),this._visible=i,this._showForPro=!t.onWidget();const s=()=>this._model.updateSource(this);this._visible.subscribe(s),this._dark=t.dark().spawn(),this._dark.subscribe(s),this._checkLayout(),this._layout!==At&&this._layout!==Dt||(this._left=8,this._bottom=5);const r=()=>{this._needToShow?this._showBranding=!0:this._showBranding=!1};this._resizeHandlerDelayed=(0,at.default)(r,200),r(),window.addEventListener("resize",this._resizeHandlerDelayed),this._model.isSnapshot()?this._init():(this._mainSeries.dataEvents().symbolResolved().subscribe(this,this._init),null!==this._mainSeries.symbolInfo()&&this._init()),this._renderer={draw:this.draw.bind(this),hitTest:this.hitTest.bind(this)},t.onWidget()||window.loginStateChange.subscribe(this,this._init)}destroy(){window.removeEventListener("resize",this._resizeHandlerDelayed),this._mainSeries.dataEvents().symbolResolved().unsubscribeAll(this),this._powBy&&this._powBy.destroy(),this._model.onWidget()||window.loginStateChange.unsubscribeAll(this),this._visible.release(),this._dark.destroy(),this._destroyed=!0}paneViews(e){if(window.TradingView.printing&&this._layout!==Lt&&this._layout!==Et)return[];if(!this._visible.value())return[];if(this._layout===Tt&&!this._showForPro&&window.user&&window.user.is_pro)return[];const t=l.enabled("move_logo_to_main_pane");let i=!1;if(e.maximized().value())i=!0;else if(t)i=this._model.mainPane().collapsed().value()?e===this._model.panes().find((e=>!e.collapsed().value())):e.isMainPane();else if(this._model.lastPane().collapsed().value()){const t=this._model.panes() -;for(let s=t.length-1;s>=0;--s){const r=t[s];if(!r.collapsed().value()){i=r===e;break}}}else i=e.isLast();return i?[{renderer:this.renderer.bind(this)}]:[]}labelPaneViews(e){return[]}priceAxisViews(e,t){return[]}updateAllViews(){}updateViewsForPane(e){}priceScale(){return null}renderer(e,t){return this._paneHeight=e,this._canvasWidth=t,this._renderer}hasContextMenu(){return!1}onClickOutside(){this._hasAnimation()&&this._startCloseAnimation()}hitTest(e){if(!this._showBranding||l.enabled("logo_without_link"))return null;if(this._powBy&&this._layout!==Lt&&this._layout!==Et&&(this._powBy.hitTest(e)||this._custom&&this._custom.hitTest(e))){const e=!0;return new ut.HitTestResult(ut.HitTarget.Custom,{hideCrosshairLinesOnHover:!0,cursorType:e?St.PaneCursorType.Pointer:St.PaneCursorType.Default,clickHandler:()=>{this._openLink()},tapHandler:()=>{this._hasAnimation()?this._toggleOpenAnimatedOrOpenLink():this._openLink()},mouseEnterHandler:()=>{this._hasAnimation()&&this._startOpenAnimation()},mouseLeaveHandler:()=>{this._hasAnimation()&&this._startCloseAnimation()},mouseDownHandler:()=>{0},mouseUpHandler:()=>{0}})}return null}tvUrl(){var e,t,i;const s="https://"+function(e){return({ar_AE:"ar",de_DE:"de",en:"www",es:"es",ca_ES:"es",fa_IR:"www",fr:"fr",he_IL:"il",id:"id",in:"in",it:"it",ja:"jp",kr:"kr",ms_MY:"my",pl:"pl",br:"br",ru:"ru",sv_SE:"se",th_TH:"th",tr:"tr",uk:"uk",vi_VN:"vn",zh_CN:"cn",zh_TW:"tw"}[e]||"www")+".tradingview.com"}((null!==(t=null===(e=Ft.querySettings)||void 0===e?void 0:e.locale)&&void 0!==t?t:null===(i=Ft.currentLocaleInfo)||void 0===i?void 0:i.language)||"en");let r=new URL(s);if(this._customLogoLink)return this._customLogoLink;if(this._layout===Vt||this._layout===Bt){let e;switch(!0){case l.enabled("charting_library"):e="library";break;case l.enabled("trading_terminal"):e="trading-terminal"}r.searchParams.append("utm_source",window.location.origin),r.searchParams.append("utm_medium","library"),e&&r.searchParams.append("utm_campaign",e)}return r.toString()}draw(e,t){if(!this._showBranding)return;let i=0;Ot.utm=!0,(0,gt.drawScaled)(e,t.pixelRatio,t.pixelRatio,(()=>{if(this._powBy&&this._powBy.show){i=this._powBy.height,e.save();const s=new lt.Point(this._left,this._paneHeight-this._bottom-i);this._powBy.draw(s,e,t,this._canvasWidth),e.restore()}if(this._custom&&this._custom.show){e.save();const s=new lt.Point(this._left,this._paneHeight-this._bottom-i-this._custom.height);this._custom.draw(s,e,t),e.restore()}}))}_init(){this._checkLayout();const e=this._mainSeries.symbolInfo();this._powBy&&this._powBy.destroy(),this._powBy=new Qt(this._layout,(null==e?void 0:e.name)||"",this._model,(()=>this._model.fullUpdate())),this._custom=new ei(this._layout,this._customLogoSrc,(()=>this._model.fullUpdate())),this._openAnimation=null,this._closeAnimation=null,this._model.lightUpdate()}_checkLayout(){if(l.enabled("widget"))0;else{{const e=JSON.parse(Ot.logo)||{};e.image?(this._customLogoSrc=e.image,this._customLogoLink=e.link,this._needToShow=l.enabled("widget_logo"), -l.enabled("link_to_tradingview")?this._layout=Bt:this._layout=Rt):(this._layout=Vt,this._needToShow=l.enabled("widget_logo"))}}}_startOpenAnimation(){null===this._openAnimation&&(null!==this._closeAnimation&&(this._closeAnimation.stop(),this._closeAnimation=null),this._openAnimation=(0,mt.doAnimate)({from:this._currentStateForAnimation(),to:this._openedStateForAnimation(),duration:200,easing:this._cubicBezier.easingFunc,onStep:this._animatedDrawStep.bind(this)}))}_startCloseAnimation(){null===this._closeAnimation&&(null!==this._openAnimation&&(this._openAnimation.stop(),this._openAnimation=null),this._closeAnimation=(0,mt.doAnimate)({from:this._currentStateForAnimation(),to:this._closedStateForAnimation(),duration:200,easing:this._cubicBezier.easingFunc,onStep:this._animatedDrawStep.bind(this)}))}_currentStateForAnimation(){return(0,n.ensureNotNull)(this._powBy).width}_closedStateForAnimation(){return(0,n.ensureNotNull)(this._powBy).minimizedAnimationWidth()}_openedStateForAnimation(){return(0,n.ensureNotNull)(this._powBy).maximizedAnimationWidth()}_animatedDrawStep(e,t){(0,n.ensureNotNull)(this._powBy).animatedDrawStep(e,t),this._model.lightUpdate()}_hasAnimation(){return null!==this._powBy&&this._powBy.hasAnimation()}_openGoPro(){0}_openLink(){if(this._layout===Tt)return this._openGoPro(),!1;l.enabled("widget");return(0,n.ensureNotNull)(window.open(this.tvUrl(),"_blank")).opener=null,!0}_toggleOpenAnimatedOrOpenLink(){null!==this._openAnimation&&this._openAnimation.completed()?this._openLink()||this._startCloseAnimation():this._startOpenAnimation()}}function jt(e){return!Pt||e>480}function Gt(e){return!Ct||e>500}const qt={customBrandingTradingViewText:ht.colorsPalette["color-brand"],customBrandingText:ht.colorsPalette["color-cold-gray-850"],background:ht.colorsPalette["color-cold-gray-900"],shadow:ht.colorsPalette["color-cold-gray-700"],text:ht.colorsPalette["color-white"],staticTextBackground:(0,_t.generateColor)(ht.colorsPalette["color-cold-gray-800"],20),logo:ht.colorsPalette["color-white"]},$t={customBrandingTradingViewText:ht.colorsPalette["color-brand"],customBrandingText:ht.colorsPalette["color-cold-gray-850"],background:ht.colorsPalette["color-white"],shadow:ht.colorsPalette["color-cold-gray-150"],text:ht.colorsPalette["color-cold-gray-900"],staticTextBackground:(0,_t.generateColor)(ht.colorsPalette["color-white"],20),logo:ht.colorsPalette["color-cold-gray-900"]};function Yt(e,t){return new Promise((i=>{const s=e.replace(/fill="#[\da-f]{6}"/gi,`fill="${t}"`),r=new Image;r.onload=()=>{r.onload=null,i(r)},r.src=URL.createObjectURL(new Blob([s],{type:"image/svg+xml"}))}))}let Kt={},Zt={};function Xt(e,t,i,s){const r=Zt,o=[e,t,s&&"tradeWith"].filter(Boolean).join("-"),a=r[o];if(void 0!==a)return a;const[l,c]=function(e,t){return t?["logo-trade-with","tradingview-trade-with"]:["logo-old-style","tradingview-old-style"]}(0,s),h=(0,n.ensureDefined)(wt.get(l)),d=(0,n.ensureDefined)(wt.get(c)),u=Yt(h,t),p=Yt(d,t);return Promise.all([u,p]).then((([e,t])=>{const s={logoImage:e,textImage:t};r[o]=s,i(s)})),null}class Jt{ -constructor(){this._topLeftPoint=null}hitTest(e){const t=this._getHitTestBox();if(t)return(0,ct.pointInBox)(e,t)}_getHitTestBox(){const e=this._topLeftPoint;if(e){const{x:t,y:i}=e;return(0,lt.box)(e,new lt.Point(t+this.width,i+this.height))}}}class Qt extends Jt{constructor(e,t,i,s){super(),this.show=!0,this.hovered=!1,this.active=!1,this._needDisplayImage=!1,this._animatedWidth=zt.brandCircleSize,this._font=`px ${m.CHART_FONT_FAMILY}`,this._txt="TradingView",this._textWidth=0,this._maximizedAnimationTextWidth=0,this._textWidthCache=new vt.TextWidthCache,this._pixelRatio=1,this._onLogoImageReady=e=>{this._requestRepaint()},this._model=i,this._layout=e,this._symbol=t,this._showTradeWithLogo=!1,this._showAnimatedBranding=l.enabled("show_animated_logo")||this._layout===It,this._alwaysMaximized=l.enabled("logo_always_maximized")||!1,this._fontSize=this._showAnimatedBranding||this._layout===Mt?11:14,this._showAnimatedBranding||this._layout!==At&&this._layout!==Dt||(this._fontSize=12),this.width=zt.brandCircleSize,this.height=this._fontSize+2,this._requestRepaint=s,this._init(),this._checkFontLoaded(),this._recalculateMetrics()}destroy(){this._model.properties().childs().paneProperties.childs().background.unsubscribeAll(this),this._model.onChartThemeLoaded().unsubscribeAll(this)}hasAnimation(){return this._showAnimatedBranding&&!this._alwaysMaximized}minimizedAnimationWidth(){return zt.brandCircleSize}maximizedAnimationWidth(){return zt.brandCircleSize+zt.logoTextOffset+this._maximizedAnimationTextWidth}animatedDrawStep(e,t){this._animatedWidth=t}draw(e,t,i,s){const{brandCircleSize:r,logoLeftOffset:n,leftOffset:o,bottomOffset:a}=zt;this._needDisplayImage&&jt(s)&&(e=new lt.Point(e.x+o,e.y-a)),this._topLeftPoint=e,t.translate(e.x,e.y),i.pixelRatio!==this._pixelRatio&&(this._textWidthCache.reset(),this._pixelRatio=i.pixelRatio);const l=this._colors;if(this._showAnimatedBranding){const e=this._getLogoImage(l.logo);this._needDisplayImage&&e&&this._drawLogo(t,e,this._animatedWidth,this._animatedWidth-r,this._animatedWidth>r)}else if(this._layout===At||this._layout===Dt){t.font=this._fontSize+this._font;const e=t.measureText(this._txt).width+2;this.width=e+t.measureText("TradingView").width+2,t.save(),t.globalAlpha=.7,t.fillStyle=this._colors.customBrandingText,t.fillText(this._txt,0,12),t.fillStyle=this._colors.customBrandingTradingViewText,t.fillText("TradingView",e,12),t.restore()}else if(jt(s)&&this._layout===Mt){const e=this._getLogoImage(l.logo),i=this.maximizedAnimationWidth();e&&this._drawLogo(t,e,i,i,!0)}else if(jt(s)){const e=this._getLogoImage(l.logo);if(this._needDisplayImage&&e){t.save(),this._drawBgCircle(t,r/2);const i=new lt.Point(Math.round((r-e.logoImage.width)/2)-1+n,Math.floor((r-e.logoImage.height)/2)+1);this._drawLogoImage(t,i,e.logoImage);const o=Gt(s);o&&(t.translate(r+5,Math.round(this._fontSize*("px EuclidCircular"===this._font?.1:0))),this._drawTextStroke(t),this._drawTextFill(t)),t.restore(),this.width=r,o&&(this.width+=this._maximizedAnimationTextWidth)}else{const e=Gt(s);e&&(t.save(), -t.translate(Nt?-.5:0,-.5),this._drawTextStroke(t),this._drawTextFill(t),t.restore()),e&&(this.width=this._maximizedAnimationTextWidth)}}else this.width=0}showTradeWithLogo(e){this._showTradeWithLogo=e}_drawTradeWithLogo(e,t,i){0}_drawLogo(e,t,i,s,r){const{brandCircleSize:n,logoLeftOffset:o,logoTextOffset:a}=zt;e.save(),this._drawFillRectWithRoundedCorner(e,-.5,0,i,n,n/2);const l=new lt.Point(Math.round((n-t.logoImage.width)/2)-1+o,Math.floor((n-t.logoImage.height)/2)+1);if(this._drawLogoImage(e,l,t.logoImage),r){const i=new lt.Point(l.x+t.logoImage.width+a,l.y);this._drawImageCropWidth(e,i,t.textImage,s),this.width=t.logoImage.width+Math.min(t.textImage.width,s)}e.restore()}_init(){Zt={},Kt={},this._checkLayout(),this.show&&(this._updateColors(),this.height=this._needDisplayImage?zt.brandCircleSize:this._fontSize+2,this._model.properties().childs().paneProperties.childs().background.subscribe(this,this._updateColors),this._model.onChartThemeLoaded().subscribe(this,this._updateColors))}_checkFontLoaded(){if(!this._showAnimatedBranding&&document.fonts&&document.fonts.check&&document.fonts.load){document.fonts.check(`${this._fontSize}px EuclidCircular`)?this._font="px EuclidCircular":document.fonts.load(`${this._fontSize}px EuclidCircular`,this._txt).then((()=>{this._font="px EuclidCircular",this._recalculateMetrics(),this._requestRepaint()}))}}_recalculateMetrics(){const e=(0,gt.createDisconnectedCanvas)(document,(0,ot.size)({width:0,height:0})),t=(0,gt.getPrescaledContext2D)(e);t.font=this._fontSize+this._font;const i=this._needDisplayImage?Xt(this._model.dark().value()?"dark":"light",this._colors.logo,(()=>this._recalculateMetrics())):null;this._textWidth=i?i.textImage.width+zt.textAsImageWidthCompensation:Math.ceil(t.measureText(this._txt).width)+2+8;let s=this._textWidth;s%2==0&&(s+=1),this._maximizedAnimationTextWidth=s,this._textWidthCache.reset(),this._alwaysMaximized&&(this._animatedWidth=this.maximizedAnimationWidth())}_updateColors(){this._colors=this._model.dark().value()?qt:$t}_getLogoImage(e){return Xt(this._model.dark().value()?"dark":"light",e,this._onLogoImageReady,this._showTradeWithLogo)}_checkLayout(){switch(this._layout){case It:case Mt:case At:case kt:case Dt:case Bt:case Vt:case Tt:this.show=!0;break;case Lt:case Et:case Rt:this.show=!1}switch(this._layout){case Vt:this._needDisplayImage=!0,this._txt=Wt;break;case Bt:this._txt=Ht}}_drawTextStroke(e){e.save(),e.textBaseline="middle",e.textAlign="start",e.font=this._fontSize+this._font,e.strokeStyle=this._colors.staticTextBackground,e.lineWidth=4,e.lineJoin="round",e.strokeText(this._txt,0,zt.brandCircleSize/2+this._textWidthCache.yMidCorrection(e,this._txt)),e.restore()}_drawTextFill(e){e.save(),e.textBaseline="middle",e.textAlign="start",e.font=this._fontSize+this._font,e.fillStyle=this._colors.text,e.fillText(this._txt,0,zt.brandCircleSize/2+this._textWidthCache.yMidCorrection(e,this._txt)),e.restore()}_drawImageCropWidth(e,t,i,s){e.save(),e.beginPath(),e.rect(t.x,t.y,s,this.height),e.clip(),e.drawImage(i,t.x,t.y),e.restore()}_drawBgCircle(e,t){ -const i=2*Math.PI;e.save(),e.beginPath(),e.fillStyle=this._colors.shadow,e.arc(t,t,t+1,0,i),e.fill(),e.closePath(),e.restore(),e.save(),e.beginPath(),e.fillStyle=this._colors.background,e.arc(t,t,t,0,i,!1),e.fill(),e.closePath(),e.restore()}_drawFillRectWithRoundedCorner(e,t,i,s,r,n,o){e.save(),(0,ft.drawRoundRect)(e,t-1,i-1,s+2,r+2,n),e.fillStyle=this._backgroundShadowFillStyle(),e.fill(),e.closePath(),e.restore(),e.save(),(0,ft.drawRoundRect)(e,t,i,s,r,null!=o?o:n),e.fillStyle=this._backgroundFillStyle(),e.fill(),e.closePath(),e.restore()}_tradeWithLogoBackgroundColor(){return""}_backgroundShadowFillStyle(){return this._colors.shadow}_backgroundFillStyle(){return this._colors.background}_drawLogoImage(e,t,i){e.drawImage(i,t.x,t.y)}}class ei extends Jt{constructor(e,t,i){super(),this.show=!1,this.width=0,this.height=0,this._ready=!1,this._layout=e,this._src=t,this._onReadyCallback=i,this._checkLayout();const s=new Image;this._img=s,this.show&&(s.addEventListener("load",(()=>{this.width=Math.round(s.width),this.height=Math.round(s.height),this._ready=!0,this._onReadyCallback&&this._onReadyCallback()})),s.crossOrigin="anonymous",s.src=this._src)}draw(e,t,i){this._topLeftPoint=e,this._ready&&(t.translate(e.x,e.y),t.drawImage(this._img,-.5,-.5,this.width,this.height))}_checkLayout(){switch(this._layout){case At:case Lt:case Dt:case Et:case Bt:case Rt:this.show=!0;break;case Tt:case It:case Mt:case kt:case Vt:this.show=!1}}}var ti=i(97304),ii=i(65106);class si{constructor(e,t){this._headerToolbar=e,this._dropdownId=t}applyOptions(e){this._headerToolbar.updateDropdown(this._dropdownId,e)}remove(){this._headerToolbar.removeDropdown(this._dropdownId)}}var ri=i(90194),ni=i(75593);class oi{constructor(e){this._symbolModel=e}getVisible(){return this._symbolModel.visible().value()}setVisible(e){return this._symbolModel.visible().setValue(e),this}getIcon(){return this._symbolModel.icon().value()}setIcon(e){return this._symbolModel.icon().setValue(e),this}getColor(){return this._symbolModel.color().value()}setColor(e){return this._symbolModel.color().setValue(e),this}getTooltip(){return this._symbolModel.tooltip().value()}setTooltip(e){return this._symbolModel.tooltip().setValue(e),this}getDropDownContent(){return this._symbolModel.tooltipContent().value()}setDropDownContent(e){return this._symbolModel.tooltipContent().setValue(e),this}}class ai{symbol(e){return new oi(this._model().getSymbolCustomStatus(e))}hideAll(){this._model().hideAll()}static getInstance(){return null===this._instance&&(this._instance=new ai),this._instance}_model(){return ni.CustomStatusModel.getInstance()}}ai._instance=null;var li=i(39347),ci=i(16838);var hi,di=i(98731),ui=i(71026),pi=i(78325),_i=i(37292);(0,I.setClasses)();const mi=(0,o.getChartingLibraryGlobalContext)(),gi=(0,o.getChartingLibraryOwner)(),fi=new class{constructor(e,t){this._updateDocumentHeight=e=>{"visual"===this._viewportType&&this._window.document.documentElement.style.setProperty("height",`${e}px`,"important")},this._window=e,this._fullscreenApi=new Ae(e.document), -this._viewportType=De.CheckMobile.iOS()&&!(0,ke.isOnMobileAppPage)("any")&&this._window.visualViewport?"visual":"quirks","visual"===this._viewportType?this._viewport=(0,n.ensure)(this._window.visualViewport):this._viewport=this._window;const i=this._layoutSizeSensor=this._window.document.createElement("div");i.id="layout-size-sensor",i.style.position="fixed",i.style.top="0",i.style.left="0",i.style.right="0",i.style.bottom="0",i.style.pointerEvents="none",i.style.visibility="hidden",this._initFullscreen()}allocate(){this.free();const e=this._window.document,t=e.createElement("div");t.classList.add("js-rootresizer__contents"),t.style.position="relative",t.style.width="100%",t.style.height="100%",e.body.insertAdjacentElement("afterbegin",t),e.body.insertAdjacentElement("afterbegin",this._layoutSizeSensor),this._visibilityApi=new Le(this._window.document);const i={alive:new R.WatchedValue(!0),fullscreenable:new R.WatchedValue(!0),container:new R.WatchedValue(t),width:new R.WatchedValue,height:new R.WatchedValue,availWidth:new R.WatchedValue,availHeight:new R.WatchedValue,visible:this._visibilityApi.isVisible,fullscreen:this._fullscreenApi.isFullscreen,remove:()=>{i.alive.setValue(!1)},attach:()=>{i.alive.setValue(!1),this._window.close()},requestFullscreen:()=>{this._requestFullscreen()},exitFullscreen:()=>{this._exitFullscreen()}};return i.alive.subscribe((e=>{e||i!==this._area||this.free()})),this._area=i,this._resizeHandler=()=>{const e=this._width(i)||800,t=this._height(i)||600;i.availHeight.setValue(t),i.availWidth.setValue(e),i.height.setValue(t),i.width.setValue(e)},this._area.height.subscribe(this._updateDocumentHeight,{callWithLast:!0}),this._resizeHandler(),this._viewport.addEventListener("resize",this._resizeHandler),new Me.ResizerDetacherState(i).bridge()}free(){if(this._resizeHandler&&(this._viewport.removeEventListener("resize",this._resizeHandler),this._resizeHandler=void 0),this._visibilityApi&&(this._visibilityApi.destroy(),this._visibilityApi=void 0),this._area){const e=this._area;this._area=void 0,e.height.unsubscribe(this._updateDocumentHeight),e.alive.setValue(!1);const t=e.container.value(),i=null==t?void 0:t.parentElement;i&&(i.removeChild(t),i.removeChild(this._layoutSizeSensor))}}_height(e){if("visual"===this._viewportType)return this._layoutSizeSensor.clientHeight;return e.container.value().clientHeight}_width(e){return e.container.value().clientWidth}_requestFullscreen(){this._fullscreenApi.enter()}_exitFullscreen(){this._fullscreenApi.exit()}_initFullscreen(){this._fullscreenApi.isFullscreen.subscribe((e=>{this._resizeHandler&&this._resizeHandler()}))}}(window),vi=new class{constructor(e){this._processVisibility=e=>{const t=e.container.value();return this.affectsLayout(e.name)?(t&&t.classList.toggle("js-hidden",!1),!0):(t&&t.classList.toggle("js-hidden",!0),!1)},this._setWidth=(e,t,i)=>{let s=i;this._fullscreenArea!==e.name&&(e.availWidth.setValue(i),e.canNegotiate.width&&(s=Ee(i,e.negotiations.width))),t||(s=0);const r=e.container.value();return r&&t&&(r.style.width=s+"px"), -e.width.setValue(s),s},this._setHeight=(e,t,i)=>{let s=i;this._fullscreenArea!==e.name&&(e.availHeight.setValue(i),e.canNegotiate.height&&(s=Ee(i,e.negotiations.height))),t||(s=0);const r=e.container.value();return r&&t&&(r.style.height=s+"px"),e.height.setValue(s),s};const t=e.container.value();if(!t)throw new Error("bridge.container.value() must be an element");this._container=t,this._availableAreas=["left","tradingpanel","right","top","bottom","center","topleft","extratop"],this._areas={},this._bridge=e,this._width=e.width,this._height=e.height,this._width.subscribe((()=>this.recalculate())),this._height.subscribe((()=>this.recalculate())),this._bridge.visible.subscribe((()=>this._updateVisibility())),this._bridge.fullscreen.subscribe((()=>this._onParentFullscreenChange())),this.recalculate()}allocate(e){const t=e&&e.areaName;if(-1===this._availableAreas.indexOf(t))throw new Error("unknown options.areaName");this.free(t);const i=this._createDOM(t),s={name:t,canNegotiate:{width:"left"===t||"right"===t||"tradingpanel"===t||"topleft"===t,height:"top"===t||"bottom"===t||"topleft"===t||"extratop"===t},negotiations:{width:[],height:[]},remove:()=>{for(const e in this._areas)this._areas[e]===s&&this.free(e)},negotiateWidth:e=>{if(!s.canNegotiate.width)return;const t=Ve(e);Be(s.negotiations.width,t)||(s.negotiations.width=t,this.recalculate())},negotiateHeight:e=>{if(!s.canNegotiate.height)return;const t=Ve(e);Be(s.negotiations.height,t)||(s.negotiations.height=t,this.recalculate())},requestFullscreen:()=>{this._fullscreenArea||("right"!==t&&"center"!==t||(this._fullscreenArea=t),"center"===t&&this._bridge.requestFullscreen(),this._updateFullscreen())},exitFullscreen:()=>{t===this._fullscreenArea&&(this._fullscreenArea=void 0,"center"===t&&this._bridge.exitFullscreen(),this._updateFullscreen())},width:new R.WatchedValue,height:new R.WatchedValue,availWidth:new R.WatchedValue,availHeight:new R.WatchedValue,alive:new R.WatchedValue(!0),container:new R.WatchedValue(i),visible:new R.WatchedValue(!0),fullscreen:new R.WatchedValue(!1),fullscreenable:new R.WatchedValue("right"===t||"center"===t),rdState:new Me.ResizerDetacherState};return s.rdState.pushOwner(s),this._areas[t]=s,s.rdState.owner.subscribe((e=>{const i=s.container.value();if(e!==s)i&&(i.innerHTML="",i.parentElement&&i.parentElement.removeChild(i));else{let e=null;for(let i=this._availableAreas.indexOf(t);i--;){const t=this._availableAreas[i];if(this.affectsLayout(t)){e=this._areas[t].container.value();break}}i&&(e&&i.parentElement?i.insertAdjacentElement("afterend",e):this._container.appendChild(i))}this.recalculate()}),{callWithLast:!0}),s.rdState.bridge()}free(e){const t=this._areas[e];if(!t)return;this._areas[e]=void 0;const i=t.container.value();i&&i.parentElement&&i.parentElement.removeChild(i),t.alive.setValue(!1)}recalculate(){const e={};this._recalcSingleRunToken=e -;const t=this._areas.topleft,i=this._areas.left,s=this._areas.tradingpanel,r=this._areas.right,n=this._areas.top,o=this._areas.bottom,a=this._areas.center,l=this._areas.extratop,c=this._width.value(),h=this._height.value();let d=0,u=0,p=0,_=0,m=0,g=0,f=0,v=0;if(e===this._recalcSingleRunToken&&l){const e=this._processVisibility(l);v=this._setHeight(l,e,h),this._setWidth(l,e,c)}if(e===this._recalcSingleRunToken&&t){const e=this._processVisibility(t);f=this._setHeight(t,e,h),g=this._setWidth(t,e,c);const i=t.container.value();e&&i&&(i.style.top=v+"px")}let S=0;if(e===this._recalcSingleRunToken&&n){const e=this._processVisibility(n),t=n.container.value();e&&t&&(t.style.left=g+"px",t.style.top=v+"px");const i=c-g;this._setWidth(n,e,i),d=this._setHeight(n,e,h),d&&(S=1)}if(e===this._recalcSingleRunToken&&i){const e=this._processVisibility(i),t=Math.max(f,d);p=this._setWidth(i,e,c),p&&(p+=4),p&&1===S&&(S=4);const s=i.container.value();e&&s&&(s.style.top=t+v+S+"px"),this._setHeight(i,e,h-t-v)}if(e===this._recalcSingleRunToken&&s){const e=this._processVisibility(s);let t=c-p;Re||(t-=300),m=this._setWidth(s,e,t),m&&1===S&&(S=4),this._setHeight(s,e,h-v-d-S)}if(e===this._recalcSingleRunToken&&r){const e=this._processVisibility(r);let t=c-p-m;Re||(t-=300),_=this._setWidth(r,e,t),_&&1===S&&(S=4),this._setHeight(r,e,h-v-d-S);const i=r.container.value();e&&i&&(i.style.top=d+v+S+"px")}const y=m+_;let b=0,w=c-p-m-_-(y?4:0);const C=Boolean(m||!y);if(!_&&m&&(w+=4),e===this._recalcSingleRunToken&&o){const e=this._processVisibility(o),t=o.container.value();e&&t&&(t.style.left=p+"px",t.classList.toggle("no-border-top-left-radius",!p),t.classList.toggle("no-border-top-right-radius",C)),this._setWidth(o,e,w);const i=h-v;b=Math.min(300,i-0),u=this._setHeight(o,e,i)+4}const P=Boolean(d&&(p||y));if(this._container.classList.toggle("layout-with-border-radius",P),e===this._recalcSingleRunToken&&a){const e=this._processVisibility(a),t=a.container.value();e&&t&&(t.style.left=p+"px",t.style.top=d+v+S+"px",t.classList.toggle("no-border-bottom-left-radius",!u||!p),t.classList.toggle("no-border-bottom-right-radius",C||!u),t.classList.toggle("no-border-top-left-radius",Boolean(!p&&y)),t.classList.toggle("no-border-top-right-radius",C)),this._setWidth(a,e,w);const i=h-d-u-v-S;this._setHeight(a,e,Math.max(i,b))}if(e===this._recalcSingleRunToken&&s&&this.affectsLayout("tradingpanel")){const e=s.container.value();e&&(e.style.right=m&&_?`${_+4}px`:`${_}px`,e.style.top=v+d+S+"px",e.style.borderTopRightRadius=P&&_?"4px":"0px")}e===this._recalcSingleRunToken&&this._updateVisibility()}affectsLayout(e){const t=this._areas[e];if(!t)return!1;if(t.rdState.owner.value()!==t)return!1;if(this._fullscreenArea&&this._fullscreenArea!==e)return Oe(e);if(this._width.value()<=567||this._height.value()<=445&&!Ne){if(!["center","top","left","topleft","extratop"].includes(e))return!1}return!0}_updateVisibility(){const e=this._bridge.visible.value();for(let t=0;t{mi.ChartApiInstance.start()})),"function"==typeof wi){const e=wi(st);e&&e.then?e.then((e=>{if(!Array.isArray(e))return console.warn("custom_indicators_getter should be a function that returns a Promise object which result is an array of custom indicators"),void Ci.resolve();const t=mi.JSServer;t.studyLibrary.push.apply(t.studyLibrary,e),Ci.resolve(),console.log("{0} custom indicators loaded.".format(e.length))})).catch((e=>{console.warn("Error loading custom indicators "+e),Ci.resolve()})):(console.warn("custom_indicators_getter should be a function that returns a Promise object"),Ci.resolve())}else Ci.resolve();mi.widgetReady=e=>{N.subscribe("onChartReady",e,null)};const ki=null===(hi=yi.theme)||void 0===hi?void 0:hi.toLowerCase();function Di(e){mi.__defaultsOverrides=mi.__defaultsOverrides||{},(0,ae.deepExtend)(mi.__defaultsOverrides,e),void 0!==TradingView.defaultProperties&&void 0!==TradingView.defaultProperties.chartproperties&&((0,h.applyDefaultsOverrides)(TradingView.defaultProperties.chartproperties),(0,h.applyDefaultOverridesToLinetools)())}!function(e){if(!e)return;M.themes[e]&&(0,A.setTheme)(e)}(ki),mi.applyStudiesOverrides=e=>{var t,i;e&&(mi.chartWidgetCollection?null===(i=(t=mi.chartWidgetCollection).applyStudiesOverrides)||void 0===i||i.call(t,e):Je.StudyMetaInfo.mergeDefaultsOverrides(e))},mi.applyOverrides=e=>{Di(e),mi.chartWidgetCollection&&mi.chartWidgetCollection.applyOverrides(e)}, -mi.doWhenApiIsReady=e=>{mi.tradingViewApi?e():Pi.promise.then(e)},mi.applyTradingCustomization=e=>{for(const t in e.order)TradingView.defaultProperties.linetoolorder[t]=e.order[t];for(const t in e.position)TradingView.defaultProperties.linetoolposition[t]=e.position[t]},mi.changeTheme=(e,t)=>{const i=M.themes[e.toLowerCase()];return i?mi.tradingViewApi.themes().setStdTheme(i.name,!0,t&&t.disableUndo):Promise.resolve()},mi.getTheme=()=>mi.tradingViewApi.themes().getCurrentThemeName(),mi.is_authenticated=!1;JSON.parse(mi.urlParams.brokerConfig);a.t(null,void 0,i(65911)),a.t(null,void 0,i(68111)),a.t(null,void 0,i(5607));let Ei=null;const Vi=(0,oe.createDeferredPromise)();let Bi;const Ri=()=>{if(l.setEnabled("charting_library_export_chart_data",!mi.configurationData.is_tradingview_data),l.setEnabled("charting_library_debug_mode","true"===yi.debug),l.setEnabled("chart_property_page_trading",!1),l.enabled("remove_library_container_border")){const e=document.querySelector("#library-container");null!==e&&(e.style.border="0px",e.style.padding="1px")}l.enabled("no_min_chart_width")&&(document.body.style.minWidth="0px"),null!=yi.studiesOverrides&&Je.StudyMetaInfo.mergeDefaultsOverrides(JSON.parse(yi.studiesOverrides)),(0,n.assert)(void 0===TradingView.defaultProperties,"Default properties are inited before applying overrides"),Di(JSON.parse(yi.overrides));const e=yi.numeric_formatting?JSON.parse(yi.numeric_formatting):void 0;e&&"string"==typeof e.decimal_sign&&(ie.formatterOptions.decimalSign=e.decimal_sign[0]),mi.ChartApiInstance=new(Xe())(gi.datafeed);const t=gi.customFormatters;t&&(t.timeFormatter&&(se.customFormatters.timeFormatter=t.timeFormatter),t.dateFormatter&&(se.customFormatters.dateFormatter=t.dateFormatter),t.tickMarkFormatter&&(se.customFormatters.tickMarkFormatter=t.tickMarkFormatter),t.priceFormatterFactory&&(se.customFormatters.priceFormatterFactory=t.priceFormatterFactory),t.studyFormatterFactory&&(se.customFormatters.studyFormatterFactory=t.studyFormatterFactory)),gi.customTimezones&&Pe.instance().addTimezones(gi.customTimezones),mi.ChartApiInstance.setStudiesAccessController(mi.ChartApiInstance.createStudiesAccessController(yi.studiesAccess));const s=yi.chartContent?JSON.parse(yi.chartContent).json:void 0,o=yi.chartContentExtendedData?JSON.parse(yi.chartContentExtendedData):s?s.extendedData:void 0,c=yi.interval||"D",h=function(e){const t=/(\d+)(\w+)/;return e.map((e=>{const s=(0,n.ensureNotNull)(t.exec(e.text)),r=s[2].toLowerCase(),o=parseInt(s[1]),l="y"===r?12*o+"M":o+r,c=Ie.Interval.parse(e.resolution);return{text:e.title||o+a.t(r,{context:"dates",count:o},i(673)),description:e.description||"",value:{value:l.toUpperCase(),type:"period-back"},targetResolution:c.value(),requiresIntraday:c.isIntraday()}}))}(JSON.parse(yi.timeFrames)),u={resizerBridge:Li,padding:l.enabled("border_around_the_chart")?2:0,content:s,widgetOptions:{addToWatchlistEnabled:!1,hideIdeas:!0,addVolume:(0,n.ensureDefined)(mi.ChartApiInstance.studiesAccessController).isToolEnabled("Volume"),muteSessionErrors:!0,timezone:yi.timezone, -defSymbol:s?"":yi.symbol,defInterval:s?"":c,compareSymbols:yi.compareSymbols&&JSON.parse(yi.compareSymbols),defTimeframe:(p=gi.timeframe,p?"string"==typeof p?p:{...p,type:"time-range"}:p),paneContextMenuEnabled:l.enabled("pane_context_menu"),paneContextMenu:{mainSeriesTrade:Si},priceScaleContextMenuEnabled:l.enabled("scales_context_menu"),currencyConversionEnabled:l.enabled("pricescale_currency"),unitConversionEnabled:l.enabled("pricescale_unit"),legendWidgetEnabled:l.enabled("legend_widget"),legendWidget:{contextMenu:{settings:l.enabled("show_chart_property_page"),showOpenMarketStatus:l.enabled("display_market_status")}},sourceStatusesWidget:{errorSolution:!1},marketStatusWidgetEnabled:l.enabled("display_market_status"),chartWarningWidget:{subscriptionFullInfo:!1},timeScaleWidget:{contextMenuEnabled:l.enabled("scales_context_menu"),timezoneMenuEnabled:l.enabled("timezone_menu"),priceAxisLabelsOptions:{showLabels:l.enabled("main_series_scale_menu")}},timeScale:{preserveBarSpacing:!1,lockVisibleTimeRangeOnResize:l.enabled("lock_visible_time_range_on_resize"),rightBarStaysOnScroll:l.enabled("right_bar_stays_on_scroll"),minBarSpacing:yi.time_scale&&JSON.parse(yi.time_scale).min_bar_spacing},goToDateEnabled:l.enabled("go_to_date"),crossHair:{menuEnabled:l.enabled("chart_crosshair_menu")},handleScale:{mouseWheel:l.enabled("mouse_wheel_scale"),pinch:l.enabled("pinch_scale"),axisPressedMouseMove:{time:l.enabled("axis_pressed_mouse_move_scale"),price:l.enabled("axis_pressed_mouse_move_scale")}},handleScroll:{mouseWheel:l.enabled("mouse_wheel_scroll"),pressedMouseMove:l.enabled("pressed_mouse_move_scroll"),horzTouchDrag:l.enabled("horz_touch_drag_scroll"),vertTouchDrag:l.enabled("vert_touch_drag_scroll")},shiftVisibleRangeOnNewBar:l.enabled("shift_visible_range_on_new_bar"),croppedTickMarks:l.enabled("cropped_tick_marks"),countdownEnabled:l.enabled("countdown"),indicatorsDialogShortcutEnabled:l.enabled("insert_indicator_dialog_shortcut")},seriesControlBarEnabled:l.enabled("timeframes_toolbar"),seriesControlBar:{timeFramesWidgetEnabled:!0,timeFramesWidget:{goToDateEnabled:l.enabled("go_to_date"),availableTimeFrames:(e,t)=>{if(!e)return[];if(t!==it.STATUS_DELAYED&&t!==it.STATUS_DELAYED_STREAMING&&t!==it.STATUS_EOD&&t!==it.STATUS_READY)return[];return h.filter((t=>!(t.requiresIntraday&&!e.has_intraday)&&!(e.supported_resolutions&&!e.supported_resolutions.includes(t.targetResolution))))}},timeWidgetEnabled:!0,timeWidget:{timezoneMenuEnabled:l.enabled("timezone_menu")},adjustForDividendsButtonEnabled:!1,sessionIdButtonEnabled:l.enabled("pre_post_market_sessions"),backAdjustmentButtonEnabled:!1,settlementAsCloseButtonEnabled:!1,percentageScaleButtonEnabled:!0,logScaleButtonEnabled:!0,autoScaleButtonEnabled:!0,fullscreenButtonEnabled:!0,mobileChangeLayoutEnabled:!1},globalEvents:!0,snapshotUrl:yi.snapshotUrl,mobileForceChartMaximizeEnabled:!1,saveChartEnabled:l.enabled("save_shortcut")};var p;xi&&((0,je.createFavoriteDrawingToolbar)(),u.widgetOptions.isDrawingToolbarVisible=C.isDrawingToolbarVisible),o&&(u.metaInfo={id:o.uid, -name:o.name,description:o.description,uid:o.uid,username:""}),gi.additionalSymbolInfoFields&&(0,ti.setAdditionalSymbolInfoFields)(gi.additionalSymbolInfoFields);const _=gi.symbolSearchComplete;_&&(0,ii.setSymbolSearchCompleteOverrideFunction)(_);const m=mi.chartWidgetCollection=new(Ue())(u);let g=!1;m.onAboutToBeDestroyed.subscribe(null,(()=>{g=!0}),!0),function(e){e.addCustomSource("branding",((t,i)=>{const s=(0,rt.combine)(((e,t)=>{const s=null!=e?e:t;return null!==s&&s.hasModel()&&s.model().model()===i}),e.maximizedChartWidget().weakReference(),e.leftBottomChartWidget().weakReference());return new Ut(t,i,s.ownership())}),nt.CustomSourceLayer.Topmost)}(m),mi.studyMarket=new re(m),He.registerService(We.CHART_WIDGET_COLLECTION_SERVICE,m),m.activeChartWidget.subscribe((e=>{N.emit("activeChartChanged",m.getAll().indexOf(e))})),mi.saver=new B.ChartSaver(m);const f=new $(m,mi.saver);m.setSaveChartService(f);const S=new Y.LoadChartService(m);mi.chartWidget=m.activeChartWidget.value(),mi.pro=new TradingView.Pro;const y=function(e){if(!Mi)return null;const t=new T.ChartChangesWatcher(e.chartWidgetCollection,mi.saver,N),s=JSON.parse(yi.favorites);let r,n;s.intervals=s.intervals.map((e=>{let t=""+e;return t.match(/1[DWMYdwmy]/)&&(t=t.slice(1)),t})),l.enabled("study_templates")&&(r=new ee.FavoriteStudyTemplateService(ne.TVXWindowEvents,d),Bi=new Q({chartWidgetCollection:e.chartWidgetCollection,favoriteStudyTemplatesService:r}));const o=yi.header_widget_buttons_mode;"fullsize"===o&&(n=["full"]);"compact"===o&&(n=["small"]);const a=(0,di.shouldShowQuickSearchOnLib)()?function(){const e=e=>Promise.all([i.e(3951),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(2587),i.e(2639),i.e(3502),i.e(6752),i.e(8149),i.e(9842),i.e(6639),i.e(7807),i.e(3353),i.e(9916),i.e(6985),i.e(9403),i.e(962),i.e(1740),i.e(6408),i.e(2544),i.e(5057),i.e(750),i.e(1890),i.e(2846),i.e(9754)]).then(i.bind(i,72539)).then((t=>{const i=new(0,t.GlobalSearchDialogRenderer);return null!==Te&&Te.hide(),i.show(e),Te=i,i}));return(0,k.createGroup)({desc:"GlobalSearch"}).add({desc:"Open",hotkey:k.Modifiers.Mod+75,handler:()=>e()}),e}():void 0;return new w(new v,{chartSaver:mi.saver,chartApiInstance:mi.ChartApiInstance,chartWidgetCollection:e.chartWidgetCollection,defaultFavoriteStyles:s.chartTypes,defaultFavoriteIntervals:s.intervals,resizerBridge:Mi,studyMarket:mi.studyMarket,studyTemplates:Bi,favoriteStudyTemplatesService:r,allowedModes:n,saveChartService:e.saveChartService,loadChartService:e.loadChartService,chartChangesWatcher:t,onClick:Hi,snapshotUrl:e.snapshotUrl,openGlobalSearch:a})}({chartWidgetCollection:m,saveChartService:f,loadChartService:S,snapshotUrl:yi.snapshotUrl});null!==y?y.load().then((e=>{Ei=e.getComponent(),Vi.resolve()})):(Vi.promise.catch((()=>{})),Vi.reject("header widget is not loaded"));const b=function(e){if(Ai){const t=yi.toolbarbg&&/^[0-9a-f]+$/i.test(yi.toolbarbg)?String(yi.toolbarbg):void 0;if(t){const e=document.createElement("style") -;e.textContent="body,.chart-controls-bar,#footer-chart-panel{background-color:#"+t+" !important}",document.head.appendChild(e)}return new x({bgColor:t,chartWidgetCollection:e,drawingsAccess:yi.drawingsAccess?JSON.parse(yi.drawingsAccess):void 0,resizerBridge:Ai,onClick:Hi})}return null}(m),P=null;mi.tradingViewApi=new(et())({chartWidgetCollection:m,chartApiInstance:mi.ChartApiInstance,saveChartService:f,loadChartService:S,studyMarket:null});if(te.linking.bindToChartWidgetCollection(m),isNaN(yi.studyCountLimit)||(TradingView.STUDY_COUNT_LIMIT=Math.max(2,+(0,n.ensureDefined)(yi.studyCountLimit))),!isNaN(yi.ssreqdelay)){const e=Math.max(0,+(0,n.ensureDefined)(yi.ssreqdelay));(0,tt.setSearchRequestDelay)(e)}mi.ChartApiInstance.connect(),(async()=>{const{default:e}=await 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.t.bind(i,26916,23));g||(mi.lineToolPropertiesToolbar=new e(m))})();const I=document.querySelector(".tv-content");null!==I&&I.addEventListener("contextmenu",(e=>{e.target instanceof Element&&"input"!==e.target.tagName.toLowerCase()&&"textarea"!==e.target.tagName.toLowerCase()&&e.preventDefault()})),Pi.resolve(),m.undoHistory.undoStack().onChange().subscribe(null,(0,r.default)((e=>{e&&!e.customFlag("doesnt_affect_save")&&N.emit("onAutoSaveNeeded")}),1e3*(Number(yi.autoSaveDelay)||5),{leading:!1,trailing:!0}));let A=!1;function L(){b&&b.load(bi.signal),P&&P.load(bi.signal).then((e=>{mi.footerWidget=e.getComponent()}))}mi.chartWidget.withModel(null,(()=>{mi.ChartApiInstance.on("realtime_tick",(e=>{N.emit("onTick",e)}));if(!M.savedThemeName()&&ki){const e=M.getStdTheme(ki);e&&e.content&&void 0===s&&m.applyTheme({theme:e.content,onlyActiveChart:!1,restoreNonThemeDefaults:!1,themeName:ki,standardTheme:!0,syncState:!0,noUndo:!0}).then((()=>mi.applyOverrides(mi.__defaultsOverrides)))}if(l.enabled("charting_library_debug_mode")&&N.subscribeToAll(((...e)=>{console.log('Event "{0}", arguments: {1}'.format(e[0],JSON.stringify(e.slice(1))))})),A)return;A=!0,Ke(m),function(e,t){const s=a.t(null,void 0,i(78104)).format({emoji:"👍"}),r=a.t(null,void 0,i(12011)).format({emoji:"👍"}),o=a.t(null,void 0,i(79393)).format({emoji:"👍"});N.on("onServerScreenshotCopiedToClipboard",(()=>h(s)),null),N.on("onClientScreenshotCopiedToClipboard",(()=>h(r)),null),N.on("onServerScreenshotEmbedCodeCopiedToClipboard",(()=>h(o)),null);let l=null;const c=e.getContainer();function h(e){l?l.show(e):Promise.all([i.e(2109),i.e(3896),i.e(962),i.e(92)]).then(i.bind(i,89168)).then((i=>{l||(l=new i.ChartScreenshotHintRenderer((0,n.ensureNotNull)(c),{bottomPadding:t.seriesControlBarEnabled}),l.show(e))}))}}(m,{seriesControlBarEnabled:l.enabled("timeframes_toolbar")});ri.WatermarkApi.getInstance().setWidgetCollection(mi.chartWidgetCollection)})),m.getAll().some((e=>e.isInitialized()))?L():function(e,t){const i=e.getAll(),s=()=>{t(), -i.forEach((e=>{e.chartWidgetInitialized().unsubscribe(null,s)}))};i.forEach((e=>{e.chartWidgetInitialized().subscribe(null,s,!0)}))}(m,L),N.subscribe("chart_load_requested",(e=>{mi.tradingViewApi.loadChart({json:JSON.parse(e.content),extendedData:e})}),null)};window.addEventListener("unload",(()=>{bi.abort(),mi.widgetbar&&(mi.widgetbar.destroy(),mi.widgetbar=null),mi.chartWidgetCollection&&(mi.chartWidgetCollection.destroy(),mi.chartWidgetCollection=null),mi.ChartApiInstance&&mi.ChartApiInstance.disconnect(),(0,Fe.destroyQuoteSessions)(),mi.ChartApiInstance&&(mi.ChartApiInstance.destroy(),mi.ChartApiInstance=null)})),l.enabled("saveload_storage_customization")&&(gi.saveLoadAdapter?L.setCustomAdapter(gi.saveLoadAdapter):mi.urlParams.chartsStorageUrl&&mi.urlParams.clientId?L.initialize(mi.urlParams.clientId,mi.urlParams.userId,mi.urlParams.chartsStorageUrl,mi.urlParams.chartsStorageVer||"1.0"):(l.setEnabled("saveload_storage_customization",!1),l.setEnabled("header_saveload",!1)));const Ni=(0,oe.createDeferredPromise)();function Oi(){Ni.resolve()}gi.loadLastChart&&l.enabled("saveload_storage_customization")?L.getCharts().then((e=>{if(0===e.length)return void Oi();const t=e.sort(((e,t)=>t.modified_iso-e.modified_iso))[0];L.getChartContent(t).then((e=>{const t=e,i=JSON.parse(t.content);i.extendedData=e,yi.chartContent=JSON.stringify({json:i}),Oi()})).catch(Oi)})).catch(Oi):Oi();const Fi=(0,_i.loadLineToolsSynchronizer)(),Wi=(0,oe.createDeferredPromise)();function Hi(){const e=TradingView.bottomWidgetBar;e&&e.turnOffMaximize()}Promise.all([Wi.promise,Ni.promise,mi.loadedCustomCss,Fi]).then((()=>{const e=document.querySelector(".loading-indicator");if(e&&(e.style.display="none"),setTimeout(Ri,0),l.enabled("14851")&&Math.random()<=.02){t=window,i=document,s="script",r="ga",t.GoogleAnalyticsObject=r,t.ga=t.ga||function(){(t.ga.q=t.ga.q||[]).push(arguments)},t.ga.l=Number(new Date),o=i.createElement(s),a=i.getElementsByTagName(s)[0],o.async=1,o.src="//www.google-analytics.com/analytics.js",a.parentNode.insertBefore(o,a);const e=(0,n.ensureNotNull)(document.URL.match(new RegExp("(:?.*://)([^/]+)/.*")))[2];mi.ga("create","UA-112911840-1","auto"),mi.ga("set","anonymizeIp",!0),mi.ga("set",{hostname:e,page:e,referrer:e}),mi.ga("send","pageview")}var t,i,s,r,o,a})),(()=>{let e=!0;gi.datafeed.onReady((t=>{e&&console.warn("`onReady` should return result asynchronously. Use `setTimeout` with 0 interval to execute the callback function."),mi.configurationData=t,Wi.resolve()})),e=!1})(),mi.createShortcutAction=(()=>{const e=k.createGroup({desc:"API"});return(t,i)=>{var s;e.add({hotkey:(s=t,"number"==typeof s?s:"string"==typeof s?V(s.split("+")):Array.isArray(s)?V(s):0),handler:i})}})(),mi.initializationFinished=()=>{mi.chartWidgetCollection.undoHistory.clearStack()},mi.headerReady=()=>Vi.promise,mi.createButton=e=>{if(null===Ei)throw new Error("Cannot create button: header widget is not ready or is not loaded - use `headerReady` to wait until header is ready");return(e=e||{}).align=e.align||"left", -e.useTradingViewStyle=e.useTradingViewStyle||!1,Ei.addButton((0,le.randomHash)(),e)},mi.createDropdown=e=>{if(void 0===e)throw new Error("Cannot create dropdown without any parameters. Please refer to the documentation");void 0===e.align&&(e.align="left");const t=(0,le.randomHash)();return Ei?(Ei.addDropdown(t,e),Promise.resolve(new si(Ei,t))):Vi.promise.then((()=>((0,n.ensureNotNull)(Ei).addDropdown(t,e),new si((0,n.ensureNotNull)(Ei),t))))},mi.getAllFeatures=()=>{const e=l.getAllFeatures();return Object.keys(e).forEach((t=>{isNaN(parseFloat(t))||delete e[t]})),e},mi.getNavigationButtonsVisibility=(0,s.default)((()=>(0,ce.convertPropertyToWatchedValue)((0,he.property)()))),mi.getPaneButtonsVisibility=(0,s.default)((()=>(0,ce.convertPropertyToWatchedValue)((0,de.property)()))),mi.getDateFormat=(0,s.default)((()=>(0,ce.convertPropertyToWatchedValue)(ue.dateFormatProperty))),mi.getTimeHoursFormat=(0,s.default)((()=>(0,ce.convertPropertyToWatchedValue)(pe.timeHoursFormatProperty))),mi.getCurrencyAndUnitVisibility=(0,s.default)((()=>(0,ce.convertPropertyToWatchedValue)((0,xe.currencyUnitVisibilityProperty)()))),mi.customSymbolStatus=()=>ai.getInstance();const zi=yi.locale||"en",Ui=ui.AriaChartDescription.getInstance();Ui.createElement(document),Ui.setLocale(zi),mi.customChartDescriptionFunction&&Ui.setCustomProvider(mi.customChartDescriptionFunction);const ji=pi.AriaCrosshairPriceDescription.getInstance();ji.createElement(document),ji.setLocale(zi),function(){const e=l.enabled("accessible_keyboard_shortcuts")?(0,D.humanReadableHash)(9):`${(0,D.humanReadableModifiers)(D.Modifiers.Alt,!1)} + ${(0,D.humanReadableHash)(90)}`,t=`${(0,D.humanReadableModifiers)(D.Modifiers.Mod,!1)} + ${(0,D.humanReadableHash)(75)}`,s=a.t(null,void 0,i(48890)),r=[a.t(null,{replace:{shortcut:e}},i(29787)),a.t(null,{replace:{shortcut:t}},i(4868)),a.t(null,void 0,i(71705)),a.t(null,void 0,i(35696)),a.t(null,void 0,i(21585)),a.t(null,void 0,i(14702))],n=document.createElement("p");n.innerText=s;const o=document.createElement("ul");r.forEach((e=>{const t=document.createElement("li");t.innerText=e,o.appendChild(t)}));const c=document.createElement("div");c.setAttribute("role","contentinfo"),c.setAttribute("aria-hidden","false"),c.style.fontSize="0",c.appendChild(n),c.appendChild(o),document.body.insertBefore(c,document.body.firstChild)}(),new li.Action({actionId:"UnknownAction",options:{label:"",onExecute:()=>{window.dispatchEvent(new CustomEvent("keyboard-navigation-activation",{bubbles:!0}));const[e]=Array.from(document.querySelectorAll('button:not([disabled]):not([aria-disabled]):not([tabindex="-1"]), input:not([disabled]):not([aria-disabled]):not([tabindex="-1"]), [tabindex]:not([disabled]):not([aria-disabled]):not([tabindex="-1"])')).filter((0,ci.createScopedVisibleElementFilter)(document.documentElement)).sort(ci.navigationOrderComparator);void 0!==e&&e.focus()},hotkeyHash:l.enabled("accessible_keyboard_shortcuts")?9:k.Modifiers.Alt+90,hotkeyGroup:(0,k.createGroup)({desc:"Global shortcuts"}),disabled:!ci.PLATFORM_ACCESSIBILITY_ENABLED}})}, -10066:(e,t,i)=>{"use strict";function s(){return window}function r(){const e=s();return e.parent[e.urlParams.uid]}i.d(t,{getChartingLibraryGlobalContext:()=>s,getChartingLibraryOwner:()=>r})},54358:(e,t,i)=>{e=i.nmd(e),TradingView.cleanButAmpersand=function(e,t){var i=t?["&"]:["&"];return TradingView.clean(e,t,i)},TradingView.strip_tags=function(e){return e&&e.replace?e.replace(/(<([^>]+)>)/gi,""):e},TradingView.encodeSpread=function(e){return encodeURIComponent(e)},TradingView.clean=function(e,t,i){var s=[["&","&"],["<","<"],[">",">"],['"',"""],["'","'"],["'","'"]],r=e;if(!e||!e.replace)return r;for(var n=0;n{"use strict";i.r(t);var s=i(21097),r=i(51768),n=i(76422),o=i(38780);function a(e,t=!1){"loading"!==document.readyState?t?setTimeout((()=>e()),1):e():document.addEventListener("DOMContentLoaded",(()=>e()))}new Promise((e=>{a(e)}));function l(e,t="x"){let i=!1;return"x"!==t&&"both"!==t||(i=i||e.offsetWidth(t.nodeType===Node.TEXT_NODE&&e.push(t.textContent||""),e)),[]).join("").trim()),i}function u(e,t){let i=!1;const s=e.children;for(let e=0;e{document.addEventListener("mouseenter",(e=>{const t=e.target;if(t instanceof HTMLElement&&t.matches(".apply-overflow-tooltip")){const e=h(t);if(t.matches(".apply-overflow-tooltip--check-children-recursively")){if(!c(t,e))return}else if(t.matches(".apply-overflow-tooltip--check-children")){if(!u(t,e))return}else if(!l(t,e))return;(0,o.showOnElement)(t,{text:d(t)});const i=()=>{(0,o.hide)(),["mouseleave","mousedown"].forEach((e=>t.removeEventListener(e,i)))};["mouseleave","mousedown"].forEach((e=>t.addEventListener(e,i)))}}),!0),document.addEventListener("focus",(e=>{const t=e.target;if(t instanceof HTMLElement&&(t.matches(".apply-overflow-tooltip-focus")||t.querySelector(".apply-overflow-tooltip-focus"))){const e=t.matches(".apply-overflow-tooltip")?t:t.querySelector(".apply-overflow-tooltip"),i=h(e);if(e.matches(".apply-overflow-tooltip--check-children-recursively")){if(!c(e,i))return}else if(e.matches(".apply-overflow-tooltip--check-children")){if(!u(e,i))return}else if(!l(e,i))return;(0,o.showOnElement)(t,{ -text:d(e)});const s=()=>{(0,o.hide)(),t.removeEventListener("blur",s)};t.addEventListener("blur",s)}}),!0)}));var p=i(57898),_=i(11417);var m=i(30888);let g;function f(e){const t=window.user.available_offers||{};window.TVSettings&&window.TVSettings.sync(window.user.settings),window.is_authenticated?(e||(initOfferLoginStateChangeButton(),onGoPro()&&window.location.reload()),!1===window.user.profile_data_filled&&((0,r.trackEvent)("Conversion","First login"),delete window.user.profile_data_filled)):(Object.keys(t).forEach((e=>{const i=e;t[i].available_for_anons||delete t[i]})),window.user={username:"Guest",following:"0",followers:"0",ignore_list:[],available_offers:t},_.TVLocalStorage.removeItem("trial_availiable"))}g=window.loginStateChange?window.loginStateChange:window.loginStateChange=new p.Delegate,g.subscribe(null,f),s.TVXWindowEvents.on("loginStateChange",(e=>{const t=JSON.parse(e);window.user=t.user,window.is_authenticated=!!t.is_authenticated,g.fire()})),s.TVXWindowEvents.on("signOut",(()=>{!function(){if(window.initData.lfs){const e=document.getElementsByClassName("js-admin-warning")[0];document.body.removeChild(e)}let e=!0;[/^\/chart\//,/^\/share-your-love\//].forEach((t=>{t.test(window.location.pathname)&&(e=!1)})),e&&window.location.reload()}()})),(()=>{const e="user-obj-changed",t={};window.crossTabSyncUserAttr=t=>{const i={};t instanceof Array?t.forEach((e=>{i[e]=window.user[e]})):i[t]=window.user[t],s.TVXWindowEvents.emit(e,JSON.stringify(i))},s.TVXWindowEvents.on(e,(e=>{const i=JSON.parse(e);let s;for(s in i)if(i.hasOwnProperty(s)){window.user[s]=i[s];(t[s]||[]).forEach((e=>{e.fire(i[s])}))}}))})(),window.TradingView.changeLoginState=e=>{window.is_authenticated=!!e,s.TVXWindowEvents.emit("loginStateChange",JSON.stringify({is_authenticated:window.is_authenticated,user:window.user})),g.fire(),window.is_authenticated&&n.emit("GLOBAL_EVENT_SIGN_IN_SUCCESS")},window.loginUser=function(e){window.user=(0,m.deepExtend)({},e),window.TradingView.changeLoginState(!0)},window.loginRequiredDelegate=new p.Delegate,window.runOrSignIn=(e,t)=>{t||(t={}),e()},window.onLoginStateChange=f,window.TradingView.setTrialAvailiable=e=>{_.TVLocalStorage.setItem("trial_availiable",e?"1":"0")},window.TradingView.notificationsChanged=new p.Delegate},87095:(e,t,i)=>{"use strict";i.r(t),i.d(t,{alphaToTransparency:()=>o,applyAlpha:()=>n,applyTransparency:()=>l,colorFromBackground:()=>u,colorToInteger:()=>f,generateColor:()=>r,getLuminance:()=>h,gradientColorAtPercent:()=>p,isColorDark:()=>_,isHexColor:()=>d,resetTransparency:()=>c,rgbaFromInteger:()=>m,rgbaToInteger:()=>g,transparencyToAlpha:()=>a});var s=i(24377);function r(e,t,i){if(t=t||0,!d(e))return i?(0,s.rgbaToString)((0,s.rgba)((0,s.parseRgb)(e),(0,s.normalizeAlphaComponent)(a(t)))):e;const[r,n,o]=(0,s.parseRgb)(e),l=(0,s.normalizeAlphaComponent)(a(t));return(0,s.rgbaToString)([r,n,o,l])}function n(e,t){return r(e,o(t),!0)}function o(e){return 100*(1-e)}function a(e){if(e<0||e>100)throw new Error("invalid transparency");return 1-e/100}function l(e,t){ -if("transparent"===e)return e;const i=(0,s.parseRgba)(e),r=i[3];return(0,s.rgbaToString)((0,s.rgba)(i[0],i[1],i[2],a(t)*r))}function c(e){return"transparent"===e?e:d(e)?e.slice(0,7):(0,s.rgbaToString)((0,s.rgba)((0,s.parseRgb)(e),(0,s.normalizeAlphaComponent)(1)))}function h(e){const t=(0,s.parseRgb)(e).map((e=>(e/=255)<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4)));return Number((.2126*t[0]+.7152*t[1]+.0722*t[2]).toFixed(3))}function d(e){return 0===e.indexOf("#")}function u(e){return"black"===(0,s.rgbToBlackWhiteString)((0,s.parseRgb)(e),150)?"#ffffff":"#000000"}function p(e,t,i){const[r,n,o,a]=(0,s.parseRgba)(e),[l,c,h,d]=(0,s.parseRgba)(t),u=(0,s.rgba)(Math.round(r+i*(l-r)),Math.round(n+i*(c-n)),Math.round(o+i*(h-o)),a+i*(d-a));return(0,s.rgbaToString)(u)}function _(e){return h(c(e))<.5}function m(e){const t=(e=Math.round(e))%256;e-=t;const i=(e/=256)%256;e-=i;const s=(e/=256)%256;e-=s;return`rgba(${t},${i},${s},${(e/=256)/255})`}function g(e){const t=Math.round(255*e[3]);return e[0]+256*e[1]+65536*e[2]+16777216*t}function f(e){const t=(0,s.tryParseRgba)(e);return null===t?0:g(t)}},88275:(e,t,i)=>{"use strict";function s(e,t,i){return e*(1-i)+t*i}i.d(t,{doAnimate:()=>o,lerp:()=>s});const r={from:0,duration:250,easing:i(61345).easingFunc.easeOutCubic};class n{constructor(e){this._doing=!0,this._completed=!1,this._options={...r,...e};const t=performance.now();window.requestAnimationFrame((e=>{this._animation(t,this._options.from,e)}))}stop(){this._doing=!1}completed(){return this._completed}_animation(e,t,i){if(!this._doing)return void this._finishAnimation();const r=(i=!i||i<1e12?performance.now():i)-e,n=r>=this._options.duration||t===this._options.to,o=s(this._options.from,this._options.to,this._options.easing(r/this._options.duration)),a=n?this._options.to:o,l=a-t;this._options.onStep(l,a),n?this._finishAnimation():window.requestAnimationFrame((t=>{this._animation(e,a,t)}))}_finishAnimation(){this._options.onComplete&&this._options.onComplete(),this._completed=!0}}function o(e){return new n(e)}},69798:(e,t,i)=>{"use strict";i.d(t,{fetch:()=>s});(0,i(59224).getLogger)("Fetch");function s(e,t,i={}){return window.fetch(e,t)}},59224:(e,t,i)=>{"use strict";i.r(t),i.d(t,{LOGLEVEL:()=>s.LOGLEVEL,getLogHistory:()=>s.getLogHistory,getLogLevel:()=>s.getLogLevel,getLogger:()=>s.getLogger,getRawLogHistory:()=>s.getRawLogHistory,isHighRateEnabled:()=>s.isHighRateEnabled,loggingOff:()=>s.loggingOff,loggingOn:()=>s.loggingOn,serializeLogHistoryEntry:()=>s.serializeLogHistoryEntry,setLogLevel:()=>s.setLogLevel});var s=i(44441)},29764:(e,t,i)=>{"use strict";function s(e,t,i,s){return`${s?s+" ":""}${i?i+" ":""}${e}px ${t}`}i.d(t,{makeFont:()=>s,parseFont:()=>n});const r=/(bold )?(italic )?(\d+)(px|pt) (.*)$/;function n(e){const t=r.exec(e);return null===t?null:{family:t[5],size:parseInt(t[3])*("pt"===t[4]?.75:1),bold:Boolean(t[1]),italic:Boolean(t[2])}}},2298:()=>{"use strict";(()=>{if(window.matchMedia("").addEventListener)return;const e=window.matchMedia;window.matchMedia=(...t)=>{const i=e(...t) -;return i.addEventListener=(e,t)=>i.addListener(t),i.removeEventListener=(e,t)=>i.removeListener(t),i}})()},2663:(e,t,i)=>{"use strict";i.d(t,{visitObject:()=>n});var s=i(1722);function r(e,t,i){return(0,s.isArray)(e)?function(e,t,i){return e.map((e=>{const s=r(e,t,i),n=t(s);return void 0!==n?n:s}))}(e,t,i):(0,s.isObject)(e)&&((0,s.isHashObject)(e)||i&&i.visitInstances)?function(e,t,i){const s={};return Object.keys(e).forEach((n=>{const o=r(e[n],t,i),a=t(o);s[n]=void 0!==a?a:o})),s}(e,t,i):e}function n(e,t,i){const s=r(e,t,i),n=t(s);return void 0!==n?n:s}},12812:(e,t,i)=>{"use strict";i.d(t,{getPersistentLogger:()=>r});let s=null;function r(){return s}},52157:(e,t,i)=>{"use strict";function s(e){return e.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}i.d(t,{regExpEscape:()=>s})},54282:(e,t,i)=>{"use strict";i.d(t,{rgbaFromIntegerCached:()=>o});var s=i(48874),r=i(87095),n=i(42449);function o(e=1e3){const t=s.default.Cache;s.default.Cache=n.CircularCacheBuffer.bind(n.CircularCacheBuffer,e);const i=(0,s.default)(r.rgbaFromInteger);return s.default.Cache=t,i}},38223:(e,t,i)=>{"use strict";i.r(t),i.d(t,{detectAutoDirection:()=>g,forceLTRStr:()=>c,forceLTRStrSsr:()=>h,forceRTLStr:()=>d,getLTRScrollLeft:()=>u,getLTRScrollLeftOffset:()=>p,isRtl:()=>r,startWithLTR:()=>l,stripLTRMarks:()=>a});var s=i(64531);const r=()=>"rtl"===window.document.dir,n="‬",o=new RegExp("‎|‪|‫|‬","g");function a(e){return""!==e&&r()&&null!=e?e.replace(o,""):e}function l(e){return""!==e&&r()&&null!=e?"‎"+e:e}function c(e){return""!==e&&r()&&null!=e?"‪"+e+n:e}function h(e){return"‪"+e+n}function d(e){return""!==e&&r()&&null!=e?"‫"+e+n:e}function u(e){return(0,s.getNormalizedScrollLeft)(e,"rtl")}function p(e,t){const i=(0,s.detectScrollType)();if("indeterminate"===i)return 0;switch(i){case"negative":t=e.clientWidth-e.scrollWidth+t;break;case"reverse":t=e.scrollWidth-e.clientWidth-t}return t}const _=/[^\u0000-\u0040\u005B-\u0060\u007B-\u00BF\u00D7\u00F7\u02B9-\u02FF\u2000-\u200E\u2010-\u2029\u202C\u202F-\u2BFF]/,m=/[\u0590-\u07FF\u200F\u202B\u202E\uFB1D-\uFDFD\uFE70-\uFEFC]/;function g(e){const t=_.exec(e);return t?m.test(t[0])?"rtl":"ltr":""}},61345:(e,t,i)=>{"use strict";i.d(t,{CubicBezier:()=>s.CubicBezier,dur:()=>s.dur,easingFunc:()=>s.easingFunc});var s=i(74991)},43960:(e,t,i)=>{"use strict";function s(){return Promise.all([i.e(2666),i.e(956),i.e(6221),i.e(9138),i.e(962),i.e(6408),i.e(2077)]).then(i.bind(i,57163))}i.d(t,{loadChangeIntervalDialog:()=>s})},54270:(e,t,i)=>{"use strict";i.d(t,{showChangeIntervalDialogAsync:()=>n});var s=i(43960);let r=null;function n(e){const t=r=(0,s.loadChangeIntervalDialog)().then((i=>{t===r&&i.showChangeIntervalDialog(e)}));return t}},64358:(e,t,i)=>{"use strict";function s(e){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(5993),i.e(2191),i.e(6221),i.e(2639),i.e(4215),i.e(6625),i.e(2486),i.e(2260),i.e(962),i.e(4370),i.e(6408),i.e(2544),i.e(5057),i.e(4403),i.e(4713),i.e(5983),i.e(1859)]).then(i.bind(i,91952)).then((t=>t.showGoToDateDialog(e)))}i.d(t,{showGoToDateDialog:()=>s}) -},39080:(e,t,i)=>{"use strict";i.d(t,{runOrSigninWithFeature:()=>s});const s=(e,t)=>{e()}},21866:(e,t,i)=>{"use strict";i.d(t,{showTooManyStudiesNotice:()=>n});var s=i(11542),r=i(3615);function n(e){"number"!=typeof e&&(e=TradingView.STUDY_COUNT_LIMIT),(0,r.showWarning)({title:s.t(null,void 0,i(33603)),text:s.t(null,void 0,i(70213)).format({number:e})})}},97304:(e,t,i)=>{"use strict";i.d(t,{getAdditionalSymbolInfoFields:()=>n,setAdditionalSymbolInfoFields:()=>r});let s=[];function r(e){s=e}function n(){return s}},5894:(e,t,i)=>{"use strict";function s(e){Promise.all([i.e(2666),i.e(956),i.e(2109),i.e(5145),i.e(855),i.e(8056),i.e(7807),i.e(8450),i.e(8287),i.e(962),i.e(6408),i.e(5057),i.e(7663),i.e(9374)]).then(i.bind(i,63065)).then((({SymbolInfoDialogImpl:t})=>{t.getInstance().show(e)}))}i.d(t,{showSymbolInfoDialog:()=>s})},26676:(e,t,i)=>{"use strict";i.d(t,{ChartSaverBase:()=>c});var s=i(16230),r=i(66501),n=i(23024),o=i(1722),a=i(57898),l=i(14483);new WeakMap;new TextEncoder;class c{constructor(e){this._prevChartState=null,this._chartSavedDelegate=new a.Delegate,this._chartWidgetCollection=e}async saveChartLineTools(e,t,s,r){if(l.enabled("saveload_separate_drawings_storage")){const o=await(0,n.getChartStorage)(),a=this._chartWidgetCollection.metaInfo.uid.value(),l=i=>o.saveLineToolsAndGroups(i,e,t,s,r);if(!a){this._chartSavedDelegate.subscribe(null,(e=>{if(e){const e=this._chartWidgetCollection.metaInfo.uid.value();l(e)}}),!0);const{SavingLineToolsLibraryError:e}=await i.e(5565).then(i.bind(i,98653));throw new e("Layout ID not yet created.",!0)}return l(a)}return Promise.reject("Line tools storage is not supported")}layoutId(){return this._chartWidgetCollection.metaInfo.uid.value()}_getCommonSavingInfo(e){const t=this._chartWidgetCollection,i=this._chartWidgetCollection.chartsSymbols(),s=i[t.activeChartWidget.value().id()],r={...(n=s,{...n,legs:JSON.stringify(null!==(o=n.legs)&&void 0!==o?o:[])})};var n,o;const a=t.metaInfo;return a.id.value()&&(r.id=a.id.value()),r.name=a.name.value()||"",r.description=a.description.value()||"",r.charts_symbols=function(e){const t={};for(const i of Object.keys(e))t[i]={symbol:e[i].symbol};return JSON.stringify(t)}(i),r.is_realtime=r.is_realtime=e?"0":"1",r}async _saveLineToolsToStorage(){if(!l.enabled("saveload_separate_drawings_storage"))return Promise.resolve();{this.layoutId();0;const e=this._chartWidgetCollection.getAll().map((e=>{var t,i;return null!==(i=null===(t=e.lineToolsSynchronizer())||void 0===t?void 0:t.flushPendingSavings())&&void 0!==i?i:null})).filter(o.notNull);e.length&&await Promise.all(e)}}_invalidateAllLineTools(){this._chartWidgetCollection.getAll().forEach((e=>{var t;return null===(t=e.lineToolsSynchronizer())||void 0===t?void 0:t.invalidateAll()}))}async _saveChart(e,t,n,o){var a;const c=this._chartWidgetCollection.metaInfo;let h=null!==(a=o.changes)&&void 0!==a?a:r.changedAll;l.enabled("saveload_separate_drawings_storage")&&this._invalidateAllLineTools();let d=!0;if(2&h||l.enabled("saveload_separate_drawings_storage"))try{await this._saveLineToolsToStorage() -}catch(e){h|=1;const{SavingLineToolsLibraryError:t}=await i.e(5565).then(i.bind(i,98653));e instanceof t&&e.safe||(d=!1)}if(1&h){const i=e(d);if((0,s.default)(this._prevChartState,i)&&null!==c.id.value())return this._chartSavedDelegate.fire(!0),void t(c,i);0;const r=(e,i)=>(d||this._chartWidgetCollection.getAll().forEach((e=>{var t;return null===(t=e.lineToolsSynchronizer())||void 0===t?void 0:t.markAsValidatedBecauseOfSavingToContent(!0)})),t(e,i));return this._saveChartImpl(i,c,r,n,o,e)}this._chartSavedDelegate.fire(!0),t(c,null)}}},80147:(e,t,i)=>{"use strict";var s=i(50151).assert,r=i(61595).backend,n=i(26676).ChartSaverBase,o=i(57898).Delegate,a=i(14483);i.tf(null,void 0,i(8162)),i.tf(null,void 0,i(17994)),i.tf(null,void 0,i(87375));function l(e,t){e.content=JSON.stringify(t)}t.ChartSaver=class extends n{constructor(e){super(e),this._chartAboutToBeSavedDelegate=new o,this._chartSavedDelegate=new o,this._chartSizeLimitExceededDelegate=new o}chartSizeLimitExceeded(){return this._chartSizeLimitExceededDelegate}chartAboutToBeSaved(){return this._chartAboutToBeSavedDelegate}chartSaved(){return this._chartSavedDelegate}saveToJSON(e){var t=e&&!1===e.includeDrawings||void 0,i=this._getCommonSavingInfo(!1);return l(i,this._getChartWidgetCollectionState(!1,!0,t,void 0,t)),i}_getChartWidgetCollectionState(e,t,i,s,r){return e||(t=!0,s=!1),t?this._chartWidgetCollection.state(!!e,i,s,r):this._chartWidgetCollection.activeChartWidget.value().state(!!e,i,s,r)}publishChart(e){}publishScript(e,t,i){}onPublish(e,t){}_saveChartImpl(e,t,i,s,n,o){var a=i,l=s;if(a=function(s){t.id.value()||(t.id.setValue(s),t.uid.setValue(s)),"function"==typeof i&&i(t,e)},!e.name)return console.warn("Saving chart with empty name is not allowed"),void s();r.saveChart(e.name,e.short_name,e.resolution,e,t).then(a.bind(this)).catch(l.bind(this))}saveChartSilently(e,t,i){i=i||{};var r=function(e){var t=e&&a.enabled("saveload_separate_drawings_storage"),s=this._getChartWidgetCollectionState(!1,void 0,void 0,void 0,t),r=this._getCommonSavingInfo(!1,t);return l(r,s),i.chartName&&(r.name=i.chartName),r.name&&0!==r.name.length||!i.defaultChartName||(r.name=i.defaultChartName),i.autoSave&&(r.autoSave=!0),r}.bind(this);this._isSaveInProcess=!0,this._chartAboutToBeSavedDelegate.fire(),this._saveChart(r,function(t,i){s(!this._chartWidgetCollection.readOnly(),"Trying to save layout in read-only mode"),i&&this._chartWidgetCollection.metaInfo.name.setValue(i.name),this._prevChartState=i,this._chartSavedDelegate.fire(!0),this._isSaveInProcess=!1,e&&e({uid:t.uid.value(),data:i}),this._prevChartState&&delete this._prevChartState.savingToken}.bind(this),function(){this._chartSavedDelegate.fire(!1),this._isSaveInProcess=!1,t&&t.apply(null,arguments)}.bind(this),i)}isSaveInProcess(){return this._isSaveInProcess}}},58557:(e,t,i)=>{"use strict";i.d(t,{getTranslatedSymbolDescription:()=>s});i(11542);function s(e){return e.description||""}},53180:(e,t,i)=>{"use strict";function s(e){return e+"…"}i.d(t,{appendEllipsis:()=>s})},45884:(e,t,i)=>{"use strict";function s(e){ -if(!o(e))throw e}function r(e){return(null==e?void 0:e.aborted)?Promise.reject(n()):new Promise(((t,i)=>{null==e||e.addEventListener("abort",(()=>i(n())),{once:!0})}))}function n(){return new DOMException("Aborted","AbortError")}function o(e){return e instanceof Error&&"AbortError"===e.name}function a(e,t){return Promise.race([r(e),t])}async function l(e,t){let i;try{await a(e,new Promise((e=>{i=setTimeout(e,t)})))}finally{clearTimeout(i)}}i.d(t,{delay:()=>l,isAbortError:()=>o,respectAbort:()=>a,skipAbortError:()=>s})},22767:(e,t,i)=>{"use strict";function s(e){let t;if("object"!=typeof e||null==e||"number"==typeof e.nodeType)t=e;else if(e instanceof Date)t=new Date(e.valueOf());else if(Array.isArray(e)){t=[];let i=0;const r=e.length;for(;is})},30888:(e,t,i)=>{"use strict";function s(e,...t){return e&&"object"==typeof e?(0===t.length||t.forEach((t=>{null!=t&&"object"==typeof t&&Object.keys(t).forEach((i=>{const n=e[i],o=t[i];if(o===e)return;const a=Array.isArray(o);if(o&&(r(o)||a)){let t;t=a?n&&Array.isArray(n)?n:[]:n&&r(n)?n:{},e[i]=s(t,o)}else void 0!==o&&(e[i]=o)}))})),e):e}function r(e){if(!e||"[object Object]"!==Object.prototype.toString.call(e))return!1;const t=Object.getPrototypeOf(e);if(!t)return!0;const i=Object.hasOwnProperty.toString,s=t.hasOwnProperty("constructor")&&t.constructor;return"function"==typeof s&&i.call(s)===i.call(Object)}i.d(t,{deepExtend:()=>s})},51608:(e,t,i)=>{"use strict";function s(){let e,t;return{promise:new Promise(((i,s)=>{e=i,t=s})),reject:t,resolve:e}}i.d(t,{createDeferredPromise:()=>s})},93544:(e,t,i)=>{"use strict";function s(e){if(void 0===e)return"";if(e instanceof Error){let t=e.message;return e.stack&&(t+=" "+e.stack),t}return"string"==typeof e?e.toString():JSON.stringify(e)}i.d(t,{errorToString:()=>s})},68616:(e,t,i)=>{"use strict";i.d(t,{getTwemojiUrl:()=>r});var s=i(18438);function r(e,t){let i="";return s.default.parse(e,(e=>(i=s.default.base+("svg"===t?`svg/${e}.svg`:`72x72/${e}.png`),!1))),i}s.default.base="https://cdnjs.cloudflare.com/ajax/libs/twemoji/13.0.1/"},36174:(e,t,i)=>{"use strict";i.r(t),i.d(t,{guid:()=>r,randomHash:()=>n,randomHashN:()=>o});const s="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";function r(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(e=>{const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))}function n(){return o(12)}function o(e){let t="";for(let i=0;i{"use strict";i.d(t,{parseHtml:()=>r,parseHtmlElement:()=>n});const s=new WeakMap;function r(e,t){let i,r;return i=null==t?document.documentElement:9===t.nodeType?t.documentElement:t,s&&(r=s.get(i)),r||(r=i.ownerDocument.createRange(),r.selectNodeContents(i),s&&s.set(i,r)),r.createContextualFragment(e)}function n(e,t){const i=r(e,t),s=i.firstElementChild -;return null!==s&&i.removeChild(s),s}},21861:(e,t,i)=>{"use strict";function s(e){e.preventDefault()}i.d(t,{preventDefault:()=>s,preventDefaultForContextMenu:()=>n});const r=["input:not([type])",'input[type="text"]','input[type="email"]','input[type="password"]','input[type="search"]','input[type="number"]','input[type="url"]',"textarea","a[href]",'*[contenteditable="true"]',"[data-allow-context-menu]"];function n(e){const t=e.target;t&&!t.closest(r.join(", "))&&e.preventDefault()}},94474:(e,t,i)=>{"use strict";i.d(t,{capitalizeFirstLetterInWord:()=>h,htmlEscape:()=>a,removeSpaces:()=>c,removeTags:()=>l});const s=/[<"'&>]/g,r=e=>`&#${e.charCodeAt(0)};`,n={"<":"<",">":">",""":'"',"'":"'","&":"&","<":"<",">":">",""":'"',"'":"'","'":"'","&":"&"},o=Object.assign({},...Object.entries(n).map((([e,t])=>({[t]:e}))));new RegExp(Object.keys(n).join("|"),"g"),new RegExp(Object.keys(o).join("|"),"g");function a(e){return e.replace(s,r)}function l(e=""){return e.replace(/(<([^>]+)>)/gi,"")}function c(e=""){return e.replace(/\s+/g,"")}function h(e=""){return e.replace(/\b\w/g,(e=>e.toUpperCase()))}},15051:(e,t,i)=>{"use strict";function s(e){return e.reduce((function(e,t,i){return~e.indexOf(t)||e.push(t),e}),[])}i.r(t),i.d(t,{uniq:()=>s})},50946:e=>{e.exports=''},70893:e=>{ +;this._onStudyCompleted(e.params[e.params.length-1]);break;case"data_update":if(e.params.customId!==this.sourceId()||!this._checkTurnaround(e.params.turnaround))return;(0,o.assert)(!!e.params.nonseries,"data.params.nonseries is missing"),this._onDataUpdate(e.params.plots,(0,o.ensureDefined)(e.params.nonseries),e.params.lastBar);break;case"clear_data":this._checkTurnaround(e.params.turnaround)&&this.clearData()}}_getTelemetryObjectName(){return"study"}_onDataUpdated(e,t,i,s){if(this.hasBarColorer()&&e.length>0){const t=(0,o.ensureNotNull)(this.barColorer()).firstColoredBar(e[0].index);null!==t&&this._model.mainSeries().invalidateBarStylesCache(t)}null!==t&&this._postProcessGraphics();const r=this._model.paneForSource(this);this._model.recalculatePane(r,(0,ht.sourceChangeEvent)({sourceId:this.id(),firstUpdatedTimePointIndex:null!=s?s:void 0,nonSeriesOnly:0===e.length})),this._updateSources()}_titleInputs(e,t,i){return this.inputs(this._titleInputsOptions(e,t,i))}_titleInputsOptions(e,t,i){return{symbolsForDisplay:!0,skipHiddenInputs:!0,skipFakeInputs:!1,fakeInputsForDisplay:!0,asObject:!0,skippedGroups:[],skippedInputs:this._skippedTitleInputs(),noExchanges:t,noResolution:i,priceInputsForDisplay:!0,skipOptionalEmptySymbolInputs:Et,displayMask:e}}_postProcessGraphics(){this._graphicsPriceAxisViews=this._createGraphicsPriceAxisViews(),this._concatPriceAxisViews()}async _createGraphicsPaneViews(){return(0,S.createGraphicsPaneViews)(this,this.model())}_createGraphicsPriceAxisViews(){return(0,S.createGraphicsPriceAxisViews)(this)}_subscribeToSessionId(){!this._isSubscribedToSessionId&&this.hasSymbolInputs()&&(this.sessionIdChanged().subscribe(this,this._onSessionIdChanged),this._isSubscribedToSessionId=!0)}_recreateFormatter(e){this._recreatePlotsFormatters(e),this._formatter=this._tryCreateFormatter(e),this._formatterChanged.fire();const t=this.priceScale();null!==t&&t.updateFormatter(),this.getAllChildren().forEach((e=>{e.recreatePriceFormatter()})),this._model.fullUpdate()}_recreatePriceFormattingDependencies(e){this._recreateFormatter(e),this._recreatePriceStep()}_title(e,t,i,s,r){const n=this._titleInParts(e,t,i,s,r);return this._joinTitlesParts(n)}_postProcessPriceRange(e){if(e&&e.minValue()===e.maxValue()&&!this.metaInfo().is_price_study){const t=.005*e.minValue();e=new g.PriceRange(e.minValue()-t,e.maxValue()+t)}const t=this.priceScale();return t&&t.isLog()&&e?new g.PriceRange(t.priceToLogical(e.minValue()),t.priceToLogical(e.maxValue())):e}_titleInParts(e,t,s,r,n){var a;const c=this.name(t);s=s||{};const h=[l.t(c,{context:"study"},i(68716))];let d=[];if(!r){const i=this._getMTFResolutionInputTitle();null!==i&&i.length>0&&h.push(i);const r=this.metaInfo(),l=this._titleInputs(e,n,!0),c=r.inputs.filter((e=>l.hasOwnProperty(e.id))).map((e=>({meta:e,value:l[e.id]})));if(c.length>0){const i={};if(this.isChildStudy())for(let s=0;s=0){const s=this.parentSourceForInput(h);if(s instanceof ti){const r=s.metaInfo(),o=s.title(e,t,{},!0,n);if(1===r.plots.length)i[h]=o;else{const e=h.split("$")[1],t=null===(a=r.plots[parseInt(e)])||void 0===a?void 0:a.id,s=r.styles&&r.styles[t],n=s&&s.title||t;i[h]=o+": "+n}}}}d=c.map((({meta:e,value:t})=>{if("time"===e.type)return new Date(t).toISOString();let r=(0,V.isNumber)(t)?this._numericFormatter.format(t):i&&i[t.toString()]||t.toString();return s&&s[r.toString()]&&(r=s[r.toString()]),r}))}}return[h.join(" · "),d]}_seriesDataRangeToSave(e){return this._model.timeScale().visibleExtendedDataRange(e,0)}_getSymbolForResolve(e){return this.getSymbolString(this._getSymbolForApi(e))}_getSymbolForApi(e){return e}_getSymbolObject(e){const t={symbol:e},i=this.currency();return null!==this._currencySourceSymbolInputProperty&&null!==this._currencySourceSymbolInfo&&this._getSymbolForApi(this._currencySourceSymbolInputProperty.value())===e&&(t["currency-id"]=i),t.session=this.sessionId(),t}_onSymbolResolved(e,t,i){this._onCurrencyMayChange()}_onSymbolResolvingStart(e,t){}_onSymbolError(){}_setStatus(e,t){var i;const s=this.isFailed();this._status=e,e.type===at.StudyStatusType.Completed?this._wasCompletedBefore=!0:e.type!==at.StudyStatusType.Error&&e.type!==at.StudyStatusType.Undefined||(this._wasCompletedBefore=!1),t||(null===(i=this._statusView)||void 0===i||i.update(),this._model.updateSource(this),this._statusChanged.fire(e)),s!==this.isFailed()&&this._updateAlertCreationAvailable()}_onPropertiesChanged(){this._restarting||(this._inputs?this._tryChangeInputs():this._chartApi&&this._chartApi.isConnected().value()&&this.restart()),this._recreatePaneViews(),(0,vt.emit)("study_properties_changed",this._id)}_lastNonEmptyPlotRow(e){var t;if(!(0,V.isInteger)(e))return At.logDebug("_lastNonEmptyPlotRow: incorrect plotIndex"),null;let i=null!==(t=this._lastNonEmptyPlotRowCache[e])&&void 0!==t?t:null;if(null!==i)return i;return i=this.data().findLast(((t,i)=>void 0!==i[e]),1e3),null===i?null:(this._lastNonEmptyPlotRowCache[e]=i,i)}_onCurrencyChanged(){"alwaysOff"!==(0,pt.currencyUnitVisibilityProperty)().value()&&this._model.fullUpdate(),this.isStarted()&&this._tryChangeInputs(),this._currencyChanged.fire()}_apiInputs(){return this.inputs({keepOptionalSymbolsEmpty:!0})}async _tryChangeInputs(){var e;const t=this.isStarted()&&this._chartApi.isConnected().value(),i=this._allInputsAreValid(),s=(0,o.ensureDefined)((0,V.clone)(this._inputs)),r=this._apiInputs(),n=JSON.stringify(r),a=n!==JSON.stringify(this._inputs);if(t&&i)try{if(await this._allSymbolsAreResolved(),n!==JSON.stringify(this._apiInputs()))return this._tryChangeInputs();if(this._isStopped())return void(a&&this.disablePriceRangeReady());a&&await this._changeInputsImpl(r,(0,o.ensureDefined)((0,V.clone)(this._inputs)))}catch(e){At.logError(`ERROR: ${this._debugId()} _tryChangeInputs: cannot modify study, ${e}`)}else if(t&&!i&&this.stop(!0),!t&&i&&this.start(!0),a){const t=this._calcSources() +;if(t.length!==this._sources.length||t[0]!==this._sources[0])await this._rebindToSourceOrRestorePreviousValue(null!==(e=t[0])&&void 0!==e?e:this._series,r,s);else{const e=Zt(this._metaInfo,r,s);this._updateParentSources(t,e,!0)}this._inputs=r}this._tagsChanged.fire()}_onCurrencyMayChange(){if(null!==this._currencySourceSymbolInputProperty){const e=this.currency();this._updateCurrencySourceSymbolInfo(),e!==this.currency()&&this._onCurrencyChanged()}}_fillPrecalculatedAutoscaleInfo(e,t){const i=this._metaInfo,s=this.properties().childs(),r=new Set,n=this._metaInfo.filledAreas||[];for(let e=0;e!(0,T.isPlotWithTechnicalValues)(e))).filter((e=>r.has(e.id)||this.isPlotVisibleAt(e.id,1))).reduce(((i,s)=>this._applyPlotToPrecalculatedAutoscaleInfo(e,t,i,s)),{fields:[],useMainSeriesRange:!1,baseValueMinMax:null})}_firstSourceOrSeries(){var e;return null!==(e=this._sources[0])&&void 0!==e?e:this._series}_skipHistogramBaseOnAutoScale(){return!1}_tryCreateFormatter(e){const t=void 0===e?this.symbolSource().symbolInfo():e;return Qt(this._metaInfo.format,this._priceScaleByProperties(),t,this.properties().childs().precision.value())}_mergeData(e){return this._invalidateLastNonEmptyPlotRowCache(),this.data().merge(e)}_skippedTitleInputs(){return this._hideMatches.filter((e=>e.plotIds.every((e=>0===this._getPlotDisplayValue(e))))).map((e=>e.id))}_getPlotDisplayValue(e){var t,i,s,r,n,o,a;return null===(a=null===(o=null===(n=null===(r=null===(s=null===(i=null===(t=this.properties())||void 0===t?void 0:t.childs())||void 0===i?void 0:i.styles)||void 0===s?void 0:s.childs())||void 0===r?void 0:r[e])||void 0===n?void 0:n.childs())||void 0===o?void 0:o.display)||void 0===a?void 0:a.value()}_incrementTurnaround(){this._turnaround="st"+ ++this._turnaroundCounter}_checkTurnaround(e){return e===this._turnaround||e===this._model.mainSeries().seriesSource().turnaround()||e===this.turnaround(!0)}_updateMaxOffsetValue(){let e=-1/0;for(const t of this._metaInfo.plots)e=Math.max(this.offset(t.id),e);this._maxOffset.setValue(e)}_rightOffsetToUnixTime(e){if(this._series.bars().size()>=e){const t=(0,o.ensureNotNull)(this._series.bars().lastIndex())-e;return(0,o.ensureNotNull)(this._series.bars().valueAt(t))[0]}return null}_concatPriceAxisViews(){this._priceAxisViews=[...this._priceAxisViewsBase,...this._graphicsPriceAxisViews]}_onStudyLoading(){var e;this._setStatus({type:at.StudyStatusType.Loading,startTime:Date.now()}),null===(e=this._statusView)||void 0===e||e.update(),this._model.updateSource(this)}_handleStudyError(e){var t;this.clearData(),this._setStatus(e),null===(t=this._statusView)||void 0===t||t.update(),this._model.updateSource(this)}_onStudyError(e){this._handleStudyError(this._createStudyError(e)),this._enablePriceRangeReady()}_createStudyError(e){var t;return Xt("string"==typeof e?{error:this._getStudyErrorText(e)}:e,null===(t=this.symbolSource().symbolInfo())||void 0===t||t.exchange)} +_onStudyCompleted(e){var t;this._studyModified&&(this.clearData(),this._studyModified=!1),this._setStatus({type:at.StudyStatusType.Completed}),null===(t=this._statusView)||void 0===t||t.update();const i=this._model.paneForSource(this);this._model.recalculatePane(i,(0,ht.sourceChangeEvent)(this.id())),this._updateSources();const s=ct.InvalidationMask.full();null!==this._model.appliedTimeFrame().value()&&s.lockVisibleTimeRangeOnResize(),this._model.invalidate(s)}_updateSources(){this._model.updateSource(this),this.hasBarColorer()&&this._model.updateSource(this._model.mainSeries())}_unsubscribeToSessionId(){this._isSubscribedToSessionId&&(this.sessionIdChanged().unsubscribe(this,this._onSessionIdChanged),this._isSubscribedToSessionId=!1)}_onSessionIdChanged(){this.restart(!0)}_recreatePriceStep(){var e;let t=null;const i=null!==(e=this._priceScaleByProperties())&&void 0!==e?e:this._priceScaleByMetaInfo();null!==i&&(t=1/i),this._priceStep!==t&&(this._priceStep=t,this._priceStepChanged.fire())}_recreatePlotsFormatters(e){var t,i;this._plotFormatters.clear();const s=this._metaInfo.format,r=this._priceScaleByProperties(),n=void 0===e?this.symbolSource().symbolInfo():e;for(const[e,i]of Object.entries(null!==(t=this._metaInfo.ohlcPlots)&&void 0!==t?t:{}))if(null==i?void 0:i.format){const t=Qt(Jt({...s,...null==i?void 0:i.format}),r,n,this.properties().childs().precision.value());t&&this._plotFormatters.set(e,t)}for(const[e,t]of Object.entries(null!==(i=this._metaInfo.styles)&&void 0!==i?i:{}))if(null==t?void 0:t.format){const i=Qt(Jt({...s,...null==t?void 0:t.format}),r,n,this.properties().childs().precision.value());i&&this._plotFormatters.set(e,i)}for(const e of this._metaInfo.plots)if((0,T.isOhlcPlot)(e)){const t=this._plotFormatters.get(e.target);t&&this._plotFormatters.set(e.id,t)}}_joinTitlesParts(e){const t=e[1]?e[1].join(", "):"";return e[0]+(t.length>0?" ("+t+")":"")}_getMTFResolutionInputTitle(){const e=this.metaInfo();for(let t=0;ts),(()=>s)).then(this._onDataUnpacked.bind(this,e,t.indexes,i)),this._ongoingDataUpdate}_allSymbolsAreResolved(){const e=this._inputSymbols(),t=[];let i=!1;for(const s of e){const e=this._getSymbolForResolve(s);if(""!==e)if(this._resolvedSymbols[e])i=!0;else{const i=this._resolveSymbol(e,s);t.push(i)}}if(0===t.length){const e=Promise.resolve();return i?e.then((()=>this._symbolsResolved.fire())):e}return Promise.all(t).catch((e=>(this._inputSymbols().includes(e)&&this.stop(!0),this._setStatus({type:at.StudyStatusType.Error,errorDescription:{error:Lt}}),this._model.updateSource(this),Promise.reject("Invalid symbol, "+e)))).then((()=>{this._symbolsResolved.fire(),this._recheckLineToolsActuality()}))}_resolveSymbol(e,t){ +if(""===e)return Promise.resolve();let i=this._pendingResolveSymbols.get(e);return void 0!==i||(i=new Promise(((i,s)=>{this._onSymbolResolvingStart(e,t),this._chartApi.resolveSymbol((0,k.makeNextSymbolId)(),e,(r=>{switch(this._pendingResolveSymbols.delete(e),r.method){case"symbol_resolved":{this._setStatus({type:at.StudyStatusType.Undefined});const s=r.params[1];this._resolvedSymbols[e]=s,this._resolvedSymbolsByInput[t]=s,this._onSymbolResolved(e,t,s),this.invalidateTitleCache(!0),i();break}case"symbol_error":if(this._setStatus({type:at.StudyStatusType.Error,errorDescription:{error:r.params[1]}}),this._onSymbolError(),r.params[1]===D.permissionDenied&&r.params[2]){if(r.params[2]!==D.SymbolErrorPermissionDeniedReason.Symbol)return void this._resolveSymbol(r.params[2],t).then(i);if(r.params[3])return void this._resolveSymbol(r.params[3],t).then(i)}0,s(t)}}))})),this._pendingResolveSymbols.set(e,i)),i}_recheckLineToolsActuality(){const e=this._model.paneForSource(this);null!==e&&e.sourcesByGroup().lineSourcesForAllSymbols().forEach((e=>{e.ownerSource()===this&&e.calcIsActualSymbol()}))}_sendTelemetryCounter(e,t){void 0===t&&(t=this._getTelemetryAdditionalData());const i={count:1,additional:t};telemetry.sendChartReport(e,i)}_getTelemetryAdditionalData(){let e="";return this._metaInfo.pine&&this._metaInfo.pine.version&&this._metaInfo.shortId.indexOf("USER")>=0&&(e="_v"+this._metaInfo.pine.version),{symbol:this.series().actualSymbol(),resolution:this.series().interval(),study:this._metaInfo.shortId+e}}_onSourceFormatterChanged(){null===this._formatter&&(null!==this._priceScale&&this._priceScale.updateFormatter(),this._formatterChanged.fire())}_onSourcePriceStepChanged(){null===this._priceStep&&this._priceStepChanged.fire()}_bandsFirstValue(e){const t=this._metaInfo;if(!t.bands)return null;for(let i=0;i=0?t:e}return e}if(this._metaInfo.isTVScript||this._metaInfo.pine){if("text"===o)return null!==(n=null===(r=this._metaInfo.defaults.inputs)||void 0===r?void 0:r.text)&&void 0!==n?n:"";if("pineId"===o)return this._metaInfo.scriptIdPart;if("pineVersion"===o)return this._metaInfo.pine?this._metaInfo.pine.version:"-1";if("color"===e.type&&this._metaInfo.isRGB){const e=a.inputs.childs()[o].value();return(0,p.colorToInteger)(e)}if("price"===e.type){const e=a.inputs.childs()[o].value();return t.priceInputsForDisplay?this.formatter().format(e):e}}return a.inputs.childs()[o].value()}_getAllOwnerSources(){const e=[];let t=this.ownerSource();for(;null!==t;)e.push(t),t=t.ownerSource();return e}_getStudyIdWithLatestVersion(){return v.StudyMetaInfo.getStudyIdWithLatestVersion(this.metaInfo())}_debugId(){const e=[];return this._studyId&&e.push(this._studyId),e.push(this._metaInfo.fullId),e.push(this._metaInfo.description),JSON.stringify({study:e})}_hasAvailableAlertPlots(){return!1}_hasAlertConditions(){return!1}_hasAlertFunction(){return!1}async _updateParentSources(e,t,i){if(this._sources.forEach((e=>e.unsetChild(this))),i&&await Promise.all(e.map((e=>e.isStarted()?Promise.resolve():e.start(!1,!0)))),e.forEach((e=>e.setChild(this))),this._setSources(e),this._recreatePriceFormattingDependencies(),0!==t&&this._sources.length<=1){const e=this._firstSourceOrSeries(),t=this._priceScale,i=(0,o.ensureNotNull)(e.priceScale());if(t!==i){const t=this._model.paneForSource(this),s=(0,o.ensureNotNull)(this._model.paneForSource(e));t===s&&s.move(this,i,!0)}}}_calcSources(){const e=this._properties.childs().inputs.state();return v.StudyMetaInfo.getSourceIdsByInputs(this._metaInfo.inputs,e).map((e=>{if("high"===e||"open"===e||"low"===e||"close"===e||"hl2"===e||"ohl3"===e||"ohlc4"===e)return null;{const t=this._model.allStudies().find((t=>t.canHaveChildren()&&t.id()===e));return null!=t?t:null}})).filter(V.notNull)}_isStopped(){return!this.isStarted()}_onDataUnpacked(e,t,i,s){if(this._isDestroyed)return;"nochange"!==t&&this._processPlotOffsets(s),this._transformData(e);const r=this._mergeData(e) +;null!==s&&(s.indexes_replace?((0,o.assert)("nochange"!==t),this._graphics.replaceIndexesTo(t)):("nochange"!==t&&this._graphics.replaceIndexesTo(t),void 0!==s.graphicsCmds&&this._graphics.processCommands(s.graphicsCmds))),this._onDataUpdated(e,s,t,r&&r.index),this.priceRangeReady()||this._enablePriceRangeReady(),this._dataUpdated.fire(i,!1,r)}_processPlotOffsets(e){if(e&&e.indexes_replace)return;const t=this._plotOffsets;this._plotOffsets=e&&e.offsets||{},(0,s.default)(t,this._plotOffsets)||this.updateAllViews((0,ht.sourceChangeEvent)({sourceId:this.id(),clearData:!0})),this._updateMaxOffsetValue()}_applyPlotToPrecalculatedAutoscaleInfo(e,t,i,s){var r,n,a;const l=s.id,c=this._properties.childs().styles.childs()[l],h=(0,T.isShapesPlot)(s)||(0,T.isCharsPlot)(s);i.useMainSeriesRange=i.useMainSeriesRange||(0,T.isArrowsPlot)(s);let d=(0,T.isLinePlot)(s)||(0,T.isOhlcPlot)(s);if(h){const e=(0,o.ensureDefined)(c).childs().location.value(),t=[b.MarkLocation.Absolute,b.MarkLocation.Top,b.MarkLocation.Bottom].indexOf(e)<0;i.useMainSeriesRange=i.useMainSeriesRange||h&&t,d=d||e===b.MarkLocation.Absolute}if(!d)return i;const u={name:l,offset:this.offset(l)},p=c.childs().plottype.value();if(!this._skipHistogramBaseOnAutoScale()&&[T.LineStudyPlotStyle.Histogram,T.LineStudyPlotStyle.Columns,T.LineStudyPlotStyle.Area].indexOf(p)>=0){const s=null===(a=null===(n=null!==(r=this._metaInfo.styles)&&void 0!==r?r:{})||void 0===n?void 0:n[l])||void 0===a?void 0:a.histogramBase;if(void 0===s)return i;const o=this.data().minMaxOnRangeCached(e,t,[u]);return(0,V.isNumber)(s)&&null!==o&&(i.baseValueMinMax=(0,f.mergeMinMax)(i.baseValueMinMax,{min:s,max:s}),i.baseValueMinMax=(0,f.mergeMinMax)(i.baseValueMinMax,o)),i}return i.fields.push(u),i}async _onSourceInputChanged(){var e;if(!this.isStarted()){const t=this._calcSources();(t.length!==this._sources.length||t[0]!==this._sources[0])&&await this._rebindToSource(null!==(e=t[0])&&void 0!==e?e:this._series,this._apiInputs())}}async _rebindToSourceOrRestorePreviousValue(e,t,i){let s=!0;if(!await this._rebindToSource(e,t)){const e=this._properties.childs().inputs.state(),r=v.StudyMetaInfo.getSourceIdsByInputs(this._metaInfo.inputs,e)[0];for(const e of Object.keys(i)){const n=(0,F.getInputValue)(i[e]),a=(0,F.getInputValue)(t[e]);if(i.hasOwnProperty(e)&&n!==a&&r&&(0,V.isString)(a)&&0===a.indexOf(r)){const t=(0,o.ensureDefined)(this._properties.childs().inputs.child(e)),r=(0,F.getInputValue)(i[e]);t.setValue(r),s=!1;break}}}return s}async _rebindToSource(e,t){const i=this.isStarted()&&this._chartApi.isConnected().value();i&&e instanceof ti&&!e.isStarted()&&await e.start(!1,!0);const s=this._firstSourceOrSeries();let r;const n=(0,V.clone)((0,o.ensureDefined)(t)),a=e instanceof ti?[e,...this._sources]:this._sources;if(i&&v.StudyMetaInfo.patchSoSInputs(n,(e=>{var t,i;return null!==(i=null===(t=a.find((t=>t.id()===e)))||void 0===t?void 0:t.sourceId())&&void 0!==i?i:null})),!this.isChildStudy())return At.logError("Unable to rebind study to source of this type"),!1;{let t;this._sources[0].unsetChild(this) +;let s=null;if(e===this._model.mainSeries())this._setSources([]),this._ownerSource=null,t=this._series.seriesSource().instanceId(),s=2;else{if(!(e instanceof ti))return At.logError("Unable to rebind study to source of this type"),!1;this._ownerSource=e,this._setSources([e]),t=e.sourceId(),e.setChild(this),null===t&&(r=e)}i&&null!==t&&(this._incrementTurnaround(),this.disablePriceRangeReady(),this._chartApi.rebindStudy((0,o.ensureNotNull)(this._studyId),this._turnaround,t,this._studyName,n,this._handler,s))}r&&(this.isStarted()&&this.stop(),r.start(!0)),s instanceof ti&&s.processHibernate();const l=this._priceScale,c=(0,o.ensureNotNull)(e.priceScale());if(l!==c){const t=this._model.paneForSource(this),i=(0,o.ensureNotNull)(this._model.paneForSource(e));t===i&&i.move(this,c,!0)}const h=this._firstSourceOrSeries();return s.formatterChanged().unsubscribe(this,this._onSourceFormatterChanged),h.formatterChanged().subscribe(this,this._onSourceFormatterChanged),s.priceStepChanged().unsubscribe(this,this._onSourcePriceStepChanged),h.priceStepChanged().subscribe(this,this._onSourcePriceStepChanged),s.currencyChanged().unsubscribeAll(this),h.currencyChanged().subscribe(this,this._onSourceCurrencyChanged),s.unitChanged().unsubscribeAll(this),h.unitChanged().subscribe(this,this._onSourceUnitChanged),s.priceRangeReadyChanged().unsubscribeAll(this),h.priceRangeReadyChanged().subscribe(this,this._onSourcePriceRangeReadyChanged),this._recreatePriceFormattingDependencies(),!0}_buildInputs(e){(0,o.assert)(!!e,"options not set");let t={};try{t=this._prepareInputs(e)}catch(e){At.logWarn("Failed to prepare study inputs: "+e)}if(e.asObject){const e={};return Object.keys(t).forEach((i=>{null!=t[i]&&(e[i]=t[i])})),e}{const e=[];return Object.keys(t).forEach((i=>{null!=t[i]&&e.push(t[i])})),e}}_prepareInput(e,t){const i=this._prepareInputValue(e,t);return!e.isFake||t.fakeInputsForDisplay||t.onlyAtomValues?i:{v:i,f:!0,t:e.type}}_plotsForAlert(){return[]}_dependenciesForAlerts(){throw new Error("Not implemented")}_calcIsActualInterval(){const e=this._isActualInterval;this._isActualInterval=(0,lt.isActualInterval)(this._series.intervalObj(),this._properties.childs().intervalsVisibilities),e!==this._isActualInterval&&(this._onIsActualIntervalChange.fire(),this._visibleChanged(),this.processHibernate())}_visibleChanged(){this._series.invalidateBarColorerCache()}_getNonPriceParent(){const e=this._sources;for(const t of e)if(t instanceof ti){const e=t.metaInfo();return e.is_price_study&&"Compare@tv-basicstudies"!==e.id?t._getNonPriceParent():t}return null}_updateInputValue(e,t){const i=this._properties.childs().inputs.childs();if(i[t.id])if("price"===t.type)i[t.id].setValue(e.price);else if("time"===t.type){const s=this._model.timeScale().indexToTimePoint(e.index);null!==s&&i[t.id].setValue(1e3*s)}}_initializeStudyInputsPaneViews(){}_updateCurrencySourceSymbolInfo(){var e +;null!==this._currencySourceSymbolInputProperty&&(this._currencySourceSymbolInfo=null!==(e=this._resolvedSymbolsByInput[this._currencySourceSymbolInputProperty.value()])&&void 0!==e?e:null)}_initializeCurrencySource(){var e,t;const i=this.metaInfo(),s="symbolInputSymbolSource"===(null===(e=i.symbolSource)||void 0===e?void 0:e.type)&&(null===(t=i.symbolSource)||void 0===t?void 0:t.inputId),r=i.inputs.find((e=>e.id===s)),n="symbol"===(null==r?void 0:r.type);if("string"==typeof s&&n&&i.is_price_study){const e=this._properties.childs().inputs.childs()[s];void 0!==e&&(e.subscribe(this,this._onCurrencyMayChange),this._currencySourceSymbolInputProperty=e)}}_recreatePaneViews(){this.hasBarColorer()&&this._model.mainSeries().invalidateBarStylesCache(),this._createViews(),this.recalculate(),this.updateAllViews((0,ht.sourceChangeEvent)(this.id()))}_pinePatchProps(){throw new Error("Not implemented")}_areStudyInputsModified(e){if(0===Object.keys(e).length)return!1;if(void 0===this._oldStudyInputs)return!0;const t=Object.keys(this._oldStudyInputs);(0,o.assert)(t.length===Object.keys(e).length,"keys quantity should be equal");for(const i of t)if((0,o.assert)(e.hasOwnProperty(i),`key '${i}' should exist in study inputs`),(0,o.ensureDefined)(this._oldStudyInputs)[i]!==e[i])return!0;return!1}_onVisibleTimeRangeInputsChanged(e){null!==e?this._updateVisibleTimeRangeInputs(e):this.isStarted()&&this._chartApi.isConnected().value()&&this.stop(!0)}_updateVisibleTimeRangeInputs(e,t=!0){const i={first_visible_bar_time:e.firstVisibleBarTime,last_visible_bar_time:e.lastVisibleBarTime,subscribeRealtime:e.subscribeRealtime},s=this.metaInfo().inputs,r=[];for(const e of s)i.hasOwnProperty(e.id)&&r.push(e.id);const n=this.properties().childs().inputs;for(const e of r)n.childs()[e].setValueSilently(i[e]);t&&r.length>0&&n.listeners().fire(n,"")}_getStudyErrorText(e){return e.split(":",2)[0]}_priceScaleByProperties(){if("default"===this.properties().childs().precision.value())return null;const e=parseInt(this.properties().childs().precision.value());return isFinite(e)?Math.pow(10,e):null}_priceScaleByMetaInfo(){const e=this.metaInfo().format,t="inherit"!==e.type?e.precision:void 0,i=(0,V.isNumber)(t)?Math.pow(10,t):void 0;if("price"===e.type||"percent"===e.type)return i||100;if("volume"===e.type){if(void 0===e.precision){const e=this.series().symbolInfo();if(null!==e&&(0,V.isNumber)(e.volume_precision))return Math.pow(10,e.volume_precision)}return 1}return"inherit"===e.type||At.logWarn("Unsupported format type: "+e.type),null}_inputSymbols(){return this.metaInfo().inputs.filter((e=>"symbol"===e.type)).map((e=>(0,o.ensureDefined)(this._properties.childs().inputs.child(e.id)).value()))}_precisionChanged(){this._recreatePriceFormattingDependencies()}_setSources(e){this.invalidateTitleCache(),this._sources=e,this._onParentSourcesChanges.fire()}}window.TradingView.Study=ti},76058:(e,t,i)=>{"use strict";i.d(t,{plotShapesData:()=>r});var s=i(11542);const r={shape_arrow_down:{guiName:s.t(null,void 0,i(48732)),id:"shape_arrow_down", +paneRendererClass:"PaneRendererArrowDown",pineName:"shape.arrowdown",icon:"arrow_down"},shape_arrow_up:{guiName:s.t(null,void 0,i(10650)),id:"shape_arrow_up",paneRendererClass:"PaneRendererArrowUp",pineName:"shape.arrowup",icon:"arrow_up"},shape_circle:{guiName:s.t(null,void 0,i(90068)),id:"shape_circle",paneRendererClass:"PaneRendererCircleShape",pineName:"shape.circle",icon:"circle"},shape_cross:{guiName:s.t(null,void 0,i(29908)),id:"shape_cross",paneRendererClass:"PaneRendererCrossShape",pineName:"shape.cross",icon:"cross"},shape_diamond:{guiName:s.t(null,void 0,i(73720)),id:"shape_diamond",paneRendererClass:"PaneRendererDiamond",pineName:"shape.diamond",icon:"diamond"},shape_flag:{guiName:s.t(null,void 0,i(21524)),id:"shape_flag",paneRendererClass:"PaneRendererFlagShape",pineName:"shape.flag",icon:"flag"},shape_label_down:{guiName:s.t(null,void 0,i(18528)),id:"shape_label_down",paneRendererClass:"PaneRendererLabelDown",pineName:"shape.labeldown",icon:"label_down"},shape_label_up:{guiName:s.t(null,void 0,i(13046)),id:"shape_label_up",paneRendererClass:"PaneRendererLabelUp",pineName:"shape.labelup",icon:"label_up"},shape_square:{guiName:s.t(null,void 0,i(44904)),id:"shape_square",paneRendererClass:"PaneRendererSquare",pineName:"shape.square",icon:"square"},shape_triangle_down:{guiName:s.t(null,void 0,i(83356)),id:"shape_triangle_down",paneRendererClass:"PaneRendererTriangleApexDown",pineName:"shape.triangledown",icon:"triangle_down"},shape_triangle_up:{guiName:s.t(null,void 0,i(28340)),id:"shape_triangle_up",paneRendererClass:"PaneRendererTriangleApexUp",pineName:"shape.triangleup",icon:"triangle_up"},shape_xcross:{guiName:s.t(null,void 0,i(7050)),id:"shape_xcross",paneRendererClass:"PaneRendererXCross",pineName:"shape.xcross",icon:"x_cross"}}},11526:(e,t,i)=>{"use strict";var s=i(18923).Version,r=i(59224).getLogger("Chart.StudyMigration");function n(e){this._studyId=e,this._maxToVers=s.ZERO,this._maxFromVers=s.ZERO,this._migrs=[]}n.prototype.addMigration=function(e,t,i){var r=s.parse(e),n=s.parse(t);r.isGreater(this._maxFromVers)&&(this._maxFromVers=r),n.isGreater(this._maxToVers)&&(this._maxToVers=n),this._migrs.push({fromVers:r,toVers:n,rules:i})},n.prototype.updateInputs=function(e,t,i){if(!i)return i;for(var s=TradingView.clone(i),n=e;n.isLess(t);){var o=this._findMigration(n);if(null==o)break;if(r.logNormal("Migrating study inputs from "+o.fromVers+" to "+o.toVers+" version, studyId: "+this._studyId+", migration: "+JSON.stringify(o)+", inputs: "+JSON.stringify(i)),s=this._applyMigration(s,o),!n.isLess(o.toVers))throw new Error("Problems in study migration process... Possible infinite cycle has been detected and stopped.");n=o.toVers}return n>e&&r.logNormal("Study inputs migration is done, studyId: "+this._studyId+", inputs: "+JSON.stringify(s)),s},n.prototype._findMigration=function(e){for(var t=-1,i=this._maxFromVers,s=0;s=0||t.indexOf(e)>=0},n._applyInputChangedMinMaxRule=function(e,t){if("adjustValIfNeeded"!==t.action)throw new Error("Unknown action "+t.action+" for rule with type "+t.type);var i=e[t.inputId];return it.maxVal&&(e[t.inputId]=t.maxVal),r.logNormal("Input "+t.inputId+"="+i+" adjusted to value "+e[t.inputId]),e},n._applyInputChangedOptionsRule=function(e,t){if(!(["text"].indexOf(t.inputType)>=0&&"resetToDefValIfNeeded"===t.action))throw new Error("Unexpected rule.inputType="+t.inputType+" in rule.action="+t.action);var i=e[t.inputId];return t.options.indexOf(i)<0&&(e[t.inputId]=t.defVal,r.logNormal("Input "+t.inputId+"="+i+" reset to default value "+t.defVal)),e},e.exports=n},64063:(e,t,i)=>{"use strict";var s=i(38243).OverlayLegendValuesProvider,r=i(26481).OverlayStatusProvider,n=i(47468).StudyOverlayBase;t.study_Overlay=class extends n{constructor(e,t,i,s){super(e,t,i,s),this._paneView=null;var r=this;this.properties().minTick.listeners().subscribe(null,(function(){r._recreatePriceFormattingDependencies(),r.updateAllViews(),r._model.fullUpdate()}))}_onQuotesUpdate(e,t){!this._legendView||void 0===t.values.change&&void 0===t.values.change_percent||(this._legendView.update(),this._model.updateSource(this))}destroy(){this._quotesProvider.quotesUpdate().unsubscribeAll(this),this._quotesProvider.destroy(),super.destroy()}tags(){var e=[],t=this.symbolInfo() +;return t?e.push(t.name):this._properties.inputs.symbol.value()&&e.push(this._properties.inputs.symbol.value()),e}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(2285),i.e(2578),i.e(8882),i.e(3986),i.e(8167),i.e(607)]).then(i.bind(i,89204))).StudyOverlayDefinitionsViewModel}defaultPlotIdForAlert(){return""}valuesProvider(){return new s(this,this.model())}statusProvider(e){return new r(this,this.model())}}},43583:(e,t,i)=>{"use strict";var s=i(50151).assert,r=i(1722).clone,n=i(56827).Study,o=i(97034).PlotList,a=i(72007).studyPlotFunctionMap,l=i(72007).studyEmptyPlotValuePredicate;class c{constructor(e,t,i){this._strategyPlotIndex=e,this._targetPlotIndex=t,this._startIndex=i}rebuildData(e){var t=this._targetPlotIndex+1,i=this._strategyPlotIndex+1,s=null,r=null;e.range(this._startIndex||e.firstIndex(),e.lastIndex()).each((function(n,o){var a=o[t],l=o[i]?Math.round(o[i]):null;if(o[t]=null,o[i]=null,!l||l>0)return!1;var c=n+l,h={pointIndex:c,value:a};if(r){if(r.pointIndex!==h.pointIndex){c>=0&&(e.valueAt(c)[t]=a);var d=!1;s&&(d=s.value<=r.value&&r.value<=a||s.value>=r.value&&r.value>=a),d?r.pointIndex>=0&&(e.valueAt(r.pointIndex)[t]=null):s=r,r=h}}else r=h;return!1}))}}t.study_ScriptWithDataOffset=class extends n{constructor(e,t,i,s){super(e,t,i,s),this._underlyingData=new o(a(s),l)}clearData(){super.clearData(),this._underlyingData.clear()}_mergeData(e){this._invalidateLastNonEmptyPlotRowCache();var t=this._underlyingData.firstIndex();this._underlyingData.merge(e),t!==this._underlyingData.firstIndex()&&(this._data=new o(a(this._metaInfo),l));var i=this._data.lastIndex();this._underlyingData.range(i,this._underlyingData.lastIndex()).each(function(e,t){return this._data.add(e,r(t)),!1}.bind(this)),this._plotsForStrategyProcessing().forEach((function(e){new c(e.strategyIndex,e.targetIndex,i).rebuildData(this._data)}),this)}_plotsForStrategyProcessing(){var e=[];return this._metaInfo.plots.forEach((function(t,i){if("dataoffset"===t.type){var r=this._metaInfo.plots.findIndex((function(e){return e.id===t.target}));s(r>=0,"target plot not found for strategy plot "+t.id);var n={strategyIndex:i,targetIndex:r};e.push(n)}}),this),e}}},6674:(e,t,i)=>{"use strict";i.d(t,{StudyVersioning:()=>p});var s=i(11526),r=i.n(s);const n=(0,i(59224).getLogger)("Chart.Study.Versioning");var o=i(50151).assert,a=i(18923).Version,l=i(76861),c=i(42856).StudyMetaInfo,h=i(14905).extractPineId,d=i(97087).migrateMetaInfoAndPropState;const u=1e12;class p extends class{constructor(e,t){if(this._migrations={},!e)throw new Error("No studies metainfo");if(this._studiesMetainfo=e,!t)throw new Error("No studies migrations");this._studiesMigrations=t;for(let e=0;e{if(0===this._studiesMetainfo.length||!e.isTVScript||e.version>=22)return t;const i={};let s=0,r=0,n=t[r];for(;void 0!==n;){const e=t[n.id];n.isFake&&(n.id="in_"+s++),i[r]=n,i[n.id]=e,r++,n=t[r]}return i}]}}{updateMetaInfo(e){if(!e)return e;o(!e.isTVScript,"This method should update only built-in java indicators metaInfo. For Pine indicators use updateMetaInfoAsync");for(var t=null,i=this._studiesMetainfo,s=0;s=12&&a<=26){var l={};for(o=0;o=12&&a<=26){var h=r.columns;r.columns=[];for(var d=0;d1e12&&n.logWarn("Bad integer input max value in metaInfo id="+e.id+" title="+e.description))}}static _fixInputsMaxValue(e,t){if(!TradingView.isAbsent(t)){var i=u;if(t.inputs)for(var s=0;si&&(a.max=i))}if(e&&e.inputs){var r=p.splitInputs(e.inputs),n=r.arr;for(var o in n){var a;"integer"===(a=n[o]).type&&(a.max&&a.max>i&&(a.max=i))}e.inputs=TradingView.merge(r.obj,r.arr)}}}patchPropsStateAndMetaInfo(e,t,i){"Script$BOOKER"!==t.productId||t.alerts||delete e.alerts,p._fixInputsOrder(e,t),p._fixInputsMaxValue(e,t);var s=p.splitInputs(e.inputs);e.inputs=s.obj;var r=c.versionOf(t);ri&&(i=r))}e[i+1]=t}static splitInputs(e){var t={},i={};for(var s in e)isNumber(parseInt(s,10))?t[s]=e[s]:i[s]=e[s];return{arr:t,obj:i}}static findInputKeyById(e,t){var i=null;for(var s in e)if(isNumber(parseInt(s,10))&&e[s].id===t){i=s;break}return i}static getInputKeyById(e,t){var i=p.findInputKeyById(e,t);if(!i)throw new Error("Cannot find input with id: "+t);return i}}},24954:(e,t,i)=>{"use strict";function s(e,t,i){return e===t||e===i}i.d(t,{symbolSameAsResolved:()=>s})},11678:(e,t,i)=>{"use strict";i.d(t,{translateSessionDescription:()=>n,translateSessionShortDescription:()=>a});var s=i(11542);const r=new Map([["Premarket",s.t(null,{context:"sessions"},i(56935))],["Postmarket",s.t(null,{context:"sessions"},i(98801))],["Regular Trading Hours",s.t(null,{context:"sessions"},i(24380))],["Extended Trading Hours",s.t(null,{context:"sessions"},i(97442))],["Electronic Trading Hours",s.t(null,{context:"sessions"},i(75610))]]);function n(e){var t;return null!==(t=r.get(e))&&void 0!==t?t:e}const o=new Map([["Premarket",s.t(null,{context:"sessions"},i(56137))],["Postmarket",s.t(null,{context:"sessions"},i(32929))],["Regular Trading Hours",s.t(null,{context:"sessions"},i(63798))],["Extended Trading Hours",s.t(null,{context:"sessions"},i(33021))],["Electronic Trading Hours",s.t(null,{context:"sessions"},i(33021))]]);function a(e){var t;return null!==(t=o.get(e))&&void 0!==t?t:e}},97121:(e,t,i)=>{"use strict";i.d(t,{areEqualSymbols:()=>a,compareSymbolParams:()=>d,symbolParams:()=>h,symbolSameAsCurrent:()=>c});var s=i(14483),r=i(42960),n=i(36274);const o=s.enabled("uppercase_instrument_names");function a(e,t){return void 0===e?void 0===t:void 0!==t&&(o?e.toUpperCase()===t.toUpperCase():e===t)}function l(e,t){return e.some((e=>a(t,e)))}function c(e,t){if(null===t)return!1;if(t){if(a(t.full_name,e)||a(t.pro_name,e))return!0;if(a(t.ticker,e))return!0;if(t.aliases&&l(t.aliases,e))return!0;if(t.alternatives&&l(t.alternatives,e))return!0;if(0===e.indexOf("FRA:")&&a(t.pro_name,e.replace("FRA:","FWB:")))return!0}return!1}function h(e){return{symbol:e.symbol(),currency:e.currency(),unit:e.unit(),interval:e.interval(),style:e.style()}}function d(e,t,i,s){const{symbol:o,currency:a,unit:l,style:c}=t;let h=t.interval;const d=e.symbolInfo(),u=void 0!==o&&!e.symbolSameAsResolved(o);let p,_,m;if(null!==d?(p=void 0!==a&&!function(e,t){return null===e&&!(0,r.isConvertedToOtherCurrency)(t)||e===(0,r.symbolCurrency)(t)}(a,d),_=void 0!==l&&!function(e,t,i){return null===e&&!(0,r.isConvertedToOtherUnit)(t,i)||e===(0,r.symbolUnit)(t,i)}(l,d,i)):(p=void 0!==a&&a!==e.currency(),_=void 0!==l&&l!==e.unit()), +void 0!==h&&!u&&s){const e=s(h);n.Interval.isEqual(e,h)||(h=e,m=h)}return{symbolChanged:u,intervalChanged:void 0!==h&&!n.Interval.isEqual(e.interval(),h),currencyChanged:p,unitChanged:_,styleChanged:void 0!==c&&c!==e.style(),correctedInterval:m,styleChangeRequiresRestart:void 0!==c&&(0,r.styleChangeRequiresRestart)(c,e.style())}}},34565:(e,t,i)=>{"use strict";i.d(t,{TextWidthCache:()=>s});class s{constructor(e=150){this._actualSize=0,this._usageTick=1,this._oldestTick=1,this._tick2Labels=new Map,this._cache=new Map,this._maxSize=e}reset(){this._actualSize=0,this._cache.clear(),this._usageTick=1,this._oldestTick=1,this._tick2Labels.clear()}measureText(e,t){return this.getMetrics(e,t).width}yMidCorrection(e,t){const i=this.getMetrics(e,t);return"actualBoundingBoxAscent"in i&&"actualBoundingBoxDescent"in i?(i.actualBoundingBoxAscent-i.actualBoundingBoxDescent)/2:0}getMetrics(e,t){const i=this._cache.get(t);if(void 0!==i)return i.metrics;if(this._actualSize===this._maxSize){const e=this._tick2Labels.get(this._oldestTick);this._tick2Labels.delete(this._oldestTick),this._cache.delete(e),this._oldestTick++,this._actualSize--}e.save(),e.textBaseline="middle";const s=e.measureText(t);return e.restore(),0===s.width&&t.length||(this._cache.set(t,{metrics:s,tick:this._usageTick}),this._tick2Labels.set(this._usageTick,t),this._actualSize++,this._usageTick++),s}}},21550:(e,t,i)=>{"use strict";var s=i(57898).Delegate;function r(){this._marksByIndex=new Map,this._marksBySpan=[],this.changed=new s,this.minIndex=void 0,this.maxIndex=void 0}r.prototype.reset=function(){this._resetImpl(),this.changed.fire()},r.prototype._resetImpl=function(){this._marksByIndex=new Map,this._marksBySpan=[],this.minIndex=void 0,this.maxIndex=void 0,this._cache=void 0},r.prototype.merge=function(e){if(0!==e.length){var t=e[0].index,i=e[e.length-1].index;t<=this.minIndex&&i>=this.maxIndex&&this._resetImpl();for(var s=this._marksBySpan,r=new Set,n=0;n=this.maxIndex&&this.maxIndex--,this.maxIndex2;){if(1e3*this._marksByIndex.get(t).time===e)return t;if(1e3*this._marksByIndex.get(i).time===e)return i;var s=Math.round((t+i)/2);1e3*this._marksByIndex.get(s).time>e?i=s:t=s}return t},r.prototype.build=function(e,t){var i=Math.ceil(t/e);if(this._maxbar===i&&this._cache)return this._cache;this._maxbar=i;for(var s=[],r=this._marksBySpan.length;r--;)if(this._marksBySpan[r]){var n=s;s=[];for(var o=n.length,a=0,l=this._marksBySpan[r],c=l.length,h=1/0,d=-1/0,u=0;u=i&&_-d>=i&&(s.push(p),d=_)}for(;ae.index>=i&&e.index<=s))}return{marks:t=t.map((function(e){return[e.span,e.time,e.index]})),version:2}},r.prototype.restoreState=function(e){if(this._marksByIndex=new Map,this._marksBySpan=[],this.maxIndex=void 0,this.minIndex=void 0,e&&e.marks&&e.marks.length)if(2===e.version){var t=e.marks.map((function(e){return{span:e[0],time:e[1],index:e[2]}}));this.merge(t)}else this.merge(e.marks)},e.exports.Tickmarks=r},34951:(e,t,i)=>{"use strict";i.d(t,{TimeAxisView:()=>o});var s=i(87095),r=i(74359);class n{constructor(){this._data=null}setData(e){this._data=e}draw(e,t,i){if(null===this._data||!this._data.visible||0===this._data.text.length)return;const s=this._data;e.font=t.font;const n=Math.round(t.widthCache.measureText(e,s.text));if(n<=0)return;e.save();const o=t.paddingHorizontal,a=n+2*o,l=a/2;let c=s.coordinate,h=Math.floor(c-l)+.5;if(s.alwaysInViewPort){const e=s.width;h<0?(c+=Math.abs(0-h),h=Math.floor(c-l)+.5):h+a>e&&(c-=Math.abs(e-(h+a)),h=Math.floor(c-l)+.5)}const d=h+a,u=Math.ceil(0+t.borderSize+t.offsetSize+t.paddingTop+t.fontSize+t.paddingBottom);e.fillStyle=s.background;const p=Math.round(h*i),_=Math.round(0*i),m=Math.round(d*i),g=Math.round(u*i),f=Math.round(2*i);e.beginPath(),e.moveTo(p,_),e.lineTo(p,g-f),e.arcTo(p,g,p+f,g,f),e.lineTo(m-f,g),e.arcTo(m,g,m,g-f,f),e.lineTo(m,_),e.fill();const v=0+t.borderSize+t.offsetSize+t.paddingTop+t.fontSize/2;e.textAlign="left",e.textBaseline="middle",e.fillStyle=s.color +;const S=t.widthCache.yMidCorrection(e,"Apr0");e.translate((h+o)*i,(v+S)*i),(0,r.drawScaled)(e,i,i,(()=>e.fillText(s.text,0,0))),e.restore()}}class o{constructor(e){this._renderer=new n,this._rendererData={background:"",color:"",coordinate:0,text:"",visible:!1,width:0,alwaysInViewPort:!0},this._invalidated=!0,this._model=e,this._renderer.setData(this._rendererData)}update(){this._invalidated=!0}renderer(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),this._renderer}coordinate(){return this._rendererData.coordinate}_getAlwaysInViewPort(){return!0}_getText(e){const t=this._model.timeScale().indexToUserTime(e);return null!==t?this._model.dateTimeFormatter().format(t):""}_updateImpl(){const e=this._rendererData;if(e.visible=!1,this._model.timeScale().isEmpty()||!this._isVisible())return;const t=this._getIndex();null!==t&&Number.isFinite(t)&&(e.visible=!0,e.width=this._model.timeScale().width(),e.background=this._getBgColor(),e.color=(0,s.colorFromBackground)(e.background),e.coordinate=this._model.timeScale().indexToCoordinate(t),e.alwaysInViewPort=this._getAlwaysInViewPort(),e.text=this._getText(t),this._invalidated=!1)}}},61401:(e,t,i)=>{"use strict";i.d(t,{INVALID_TIME_POINT_INDEX:()=>s,UNPLOTTABLE_TIME_POINT_INDEX:()=>r});const s=-2e6,r=-1e6},16164:(e,t,i)=>{"use strict";i.d(t,{restoreTimeHoursFormatSettingsValue:()=>l,timeHoursFormatProperty:()=>a});var s=i(56840),r=i(59680);const n="time_hours_format";function o(){return s.getValue(n,"24-hours")}const a=(0,r.createPrimitiveProperty)(o());function l(){a.setValue("24-hours"),s.remove(n)}s.onSync.subscribe(null,(()=>a.setValue(o()))),a.subscribe(null,(()=>s.setValue(n,a.value())))},42609:(e,t,i)=>{"use strict";i.r(t),i.d(t,{DAY_SPAN:()=>a,DEFAULT_BAR_SPACING:()=>d,HOUR_SPAN:()=>o,MILLISECOND_SPAN:()=>s,MINUTE_SPAN:()=>n,MONTH_SPAN:()=>c,SECOND_SPAN:()=>r,WEEK_SPAN:()=>l,YEAR_SPAN:()=>h});const s=5,r=10,n=20,o=30,a=40,l=50,c=60,h=70,d=6},92216:(e,t,i)=>{"use strict";i.d(t,{getHourMinuteFormat:()=>r,getHourMinuteSecondFormat:()=>n,getTimeFormatForInterval:()=>o});var s=i(79206);function r(e){return"12-hours"===e?s.twelveHourMinuteFormat:s.hourMinuteFormat}function n(e){return"12-hours"===e?s.twelveHourMinuteSecondFormat:s.hourMinuteSecondFormat}function o(e,t){if(e.isRange())return function(e){return"12-hours"===e?s.twelveHourMinuteNonZeroSecondFormat:s.hourMinuteNonZeroSecondFormat}(t);if(e.isTicks())return s.hourMinuteSecondMillisecFormat;return e.isSeconds()||e.isTicks()?n(t):r(t)}},8775:(e,t,i)=>{"use strict";i.d(t,{trackChartStyleChanged:()=>a,trackDrawingCloned:()=>o,trackDrawingCreated:()=>r,trackDrawingPasted:()=>n});i(50151),i(88732);function s(e,t){0}function r(e){s()}function n(e){s()}function o(e){s()}function a(e){0}},11321:(e,t,i)=>{"use strict";i.d(t,{translatedIntervalString:()=>r});var s=i(94025);function r(e){const t=(0,s.getTranslatedResolutionModel)(e,!0);return null===t?e:t.multiplier+(t.mayOmitShortKind?"":t.shortKind)}},37846:(e,t,i)=>{"use strict";i.d(t,{ApplyLineToolTemplateUndoCommand:()=>r});var s=i(62591) +;class r extends s.UndoCommand{constructor(e,t,i){super(i),this._source=e,this._newState=t,this._oldState=e.properties().state()}redo(){this._source.applyTemplate(this._newState)}undo(){this._source.applyTemplate(this._oldState)}}},74007:(e,t,i)=>{"use strict";i.d(t,{CreateLineToolUndoCommand:()=>c});var s=i(50151),r=i(11542),n=i(36298),o=i(20114),a=i(59656);const l=new n.TranslatedString("create {tool}",r.t(null,void 0,i(81791)));class c extends o.LineToolSynchronizeUndoCommand{constructor({model:e,pane:t,lineTool:i,ownerSource:s,drawOnAllChartsMode:r=0,id:o}){super(e,l.format({tool:new n.TranslatedString(i,a.lineToolsLocalizedNames[i])}),!1),this._lineId=null,this._lineState=null,this._paneIndex=e.panes().indexOf(t),this._lineTool=i,this._ownerSourceId=s.id(),this._lineId=null!=o?o:null,this._drawOnAllChartsMode=r}startCreatingLine(e,t,i,s){var r;const n=this._chartModel.panes()[this._paneIndex],o=this._chartModel.dataSourceForId(this._ownerSourceId),a=this._chartModel.createLineTool(n,e,this._lineTool,t,i,s,o||void 0,null!==(r=this._lineId)&&void 0!==r?r:void 0);return this._lineId=a.id(),!this._chartModel.lineBeingCreated()}continueCreatingLine(e,t,i,s){const r=this._chartModel.continueCreatingLine(e,t,i,s);return r&&this._chartModel.setShouldBeSavedEvenIfHidden(!0),r}line(){return null===this._lineId?null:this._chartModel.dataSourceForId(this._lineId)}drawOnAllCharts(){return 0!==this._drawOnAllChartsMode}_redo(){if(null===this._lineState)return;const e=this._chartModel.restoreSource(!1,this._paneIndex,null,(0,s.ensureNotNull)(this._lineState),null);null!==e&&(this._lineId=e.id(),this._lineState=null,e.share(this._drawOnAllChartsMode))}_undo(){const e=this.line();null!==e&&(this._lineState=e.state(!1),this._chartModel.removeSource(e),this._lineId=null)}}},93562:(e,t,i)=>{"use strict";i.d(t,{ExcludeLineToolsFromGroupUndoCommand:()=>c});var s=i(50151),r=(i(42053),i(11542)),n=i(36298),o=i(1722),a=i(62591);const l=new n.TranslatedString("exclude line tools from group {group}",r.t(null,void 0,i(63391)));class c extends a.UndoCommand{constructor(e,t,i){super(l.format({group:t.name().value()})),this._model=e,this._groupId=t.id,this._groupName=t.name().value(),this._lineToolsIds=i.map((e=>e.id()))}redo(){const e=(0,s.ensureNotNull)(this._model.lineToolsGroupModel().groupForId(this._groupId)),t=this._lineToolsIds.map((e=>this._model.dataSourceForId(e))).filter(o.notNull);e.excludeLineTools(t),0===e.lineTools().length&&this._model.lineToolsGroupModel().removeGroup(e)}undo(){const e=this._lineToolsIds.map((e=>this._model.dataSourceForId(e))),t=this._model.lineToolsGroupModel().groupForId(this._groupId);null!==t?t.addLineTools(e):this._model.lineToolsGroupModel().createGroup(e,this._groupName,this._groupId)}}},20114:(e,t,i)=>{"use strict";i.d(t,{LineToolSynchronizeUndoCommand:()=>r});var s=i(62591);class r extends s.UndoCommand{constructor(e,t,i){super(t,i),this._invalidateViaSync=!1,this._chartModel=e}redo(){ +this._invalidateViaSync?this._chartModel.lineToolsSynchronizer().executeSyncedAction((()=>this._redo())):this._redo()}undo(){this._invalidateViaSync?this._chartModel.lineToolsSynchronizer().executeSyncedAction((()=>this._undo())):this._undo()}}},11235:(e,t,i)=>{"use strict";i.d(t,{MergeDownUndoCommand:()=>a,MergeToTargetPane:()=>l,MergeUpUndoCommand:()=>o});var s=i(50151),r=i(38071);class n extends r.MoveSourceUndoCommand{constructor(e,t,i,s){super(e,t,i),this._restorePane=!1,this._keepZOrder=null!=s&&s,this._initialZOrder=t.zorder()}redo(){const e=this._chartModel.panes().length,t=this._chartModel.panes()[this._targetPaneIndex()],i=(0,s.ensureNotNull)(this._chartModel.dataSourceForId(this._sourceId)),r=(0,s.ensureNotNull)(this._chartModel.paneForSource(i)),n=this._chartModel.children(i,!0);r.bulkActionMacro((()=>{n.forEach((e=>this._chartModel.detachSource(e))),this._restorePane=this._chartModel.detachSource(i)}));const o="overlay"===this._initialPriceScalePosition?this._initialPriceScalePosition:void 0,a=t.findSuitableScale(i,void 0,o),l=0===a.dataSources().length;if(t.bulkActionMacro((()=>{t.addDataSource(i,a,this._keepZOrder),n.forEach((e=>t.addDataSource(e,a,this._keepZOrder)))})),i===this._chartModel.mainSeries()){const e=t.priceScalePosition(a);t.movePriceScale(a,e,0)}if(l){const e=(0,s.ensureNotNull)(i.priceScale());e.restoreState(this._newPriceScaleState(t.isOverlay(i))),e.setHeight(t.height())}this._chartModel.fullUpdate(),e!==this._chartModel.panes().length&&this._chartModel.setShouldBeSavedEvenIfHidden(!0)}undo(){let e;e=this._restorePane?this._chartModel.createPane(this._initialPaneIndex):this._chartModel.panes()[this._initialPaneIndex];const t=(0,s.ensureNotNull)(this._chartModel.dataSourceForId(this._sourceId)),i=(0,s.ensureNotNull)(this._chartModel.paneForSource(t)),r=this._chartModel.children(t,!0);i.bulkActionMacro((()=>{r.forEach((e=>this._chartModel.detachSource(e))),this._chartModel.detachSource(t)}));let n=e.getPriceScaleById(this._initialPriceScaleId);null===n&&(n=e.createPriceScaleAtPosition(this._initialPriceScalePosition,this._initialPriceScaleIndex)),e.bulkActionMacro((()=>{t.setZorder(this._initialZOrder),e.addDataSource(t,n,!0),r.forEach((t=>e.addDataSource(t,n,!1)))}));const o=(0,s.ensureNotNull)(t.priceScale());o.restoreState(this._originalPriceScaleState()),o.setHeight(e.height()),this._chartModel.fullUpdate()}}class o extends n{constructor(e,t,i){super(e,t,i)}_targetPaneIndex(){return this._initialPaneIndex-1}}class a extends n{constructor(e,t,i){super(e,t,i)}_targetPaneIndex(){return this._initialPaneIndex+1}}class l extends n{constructor(e,t,i,s,r){super(e,t,s,r),this._targetPane=i}_targetPaneIndex(){return this._targetPane}}},38071:(e,t,i)=>{"use strict";i.d(t,{MoveSourceUndoCommand:()=>n});var s=i(50151),r=i(62591);class n extends r.UndoCommand{constructor(e,t,i){super(i),this._chartModel=e,this._sourceId=t.id();const r=(0,s.ensureNotNull)(t.priceScale());this._initialPriceScaleId=r.id(),this._initialPriceScaleState=(0,s.ensureNotNull)(t.priceScale()).state();const n=(0, +s.ensureNotNull)(e.paneForSource(t));this._initialPriceScalePosition=n.priceScalePosition(r),this._initialPriceScaleIndex=n.priceScaleIndex(r,this._initialPriceScalePosition),this._initialPaneIndex=e.panes().indexOf(n)}_newPriceScaleState(e){const t={...this._initialPriceScaleState};return delete t.m_isLockScale,delete t.id,delete t.m_topMargin,delete t.m_bottomMargin,t}_originalPriceScaleState(){return this._initialPriceScaleState}}},99778:(e,t,i)=>{"use strict";i.d(t,{MoveToExistingPriceScaleUndoCommand:()=>a,MoveToNewPriceScaleUndoCommand:()=>o});var s=i(50151),r=i(38071);class n extends r.MoveSourceUndoCommand{constructor(e,t,i,s){super(e,t,s),this._sourcePaneRemoved=!1,this._targetPaneIndex=e.panes().indexOf(i)}redo(){const e=this._chartModel.panes()[this._initialPaneIndex],t=this._chartModel.panes()[this._targetPaneIndex],i=e!==t,r=this._targetPriceScale(t),n=(0,s.ensureNotNull)(this._chartModel.dataSourceForId(this._sourceId)),o=this._chartModel.children(n,!0);for(const e of o)i?(this._chartModel.detachSource(e),t.addDataSource(e,r,!1)):t.move(e,r);i?(this._sourcePaneRemoved=this._chartModel.detachSource(n),t.addDataSource(n,r,!1)):t.move(n,r);const a=t.priceScalePosition(r);t.movePriceScale(r,a,this._targetPriceScaleIndex(n)),this._chartModel.fullUpdate()}undo(){this._sourcePaneRemoved&&this._chartModel.createPane(this._initialPaneIndex);const e=this._chartModel.panes()[this._initialPaneIndex],t=e!==this._chartModel.panes()[this._targetPaneIndex],i=(0,s.ensureNotNull)(this._chartModel.dataSourceForId(this._sourceId));let r=e.getPriceScaleById(this._initialPriceScaleId);null===r&&(r=e.createPriceScaleAtPosition(this._initialPriceScalePosition,this._initialPriceScaleIndex));const n=this._chartModel.children(i,!0);for(const i of n)t?(this._chartModel.detachSource(i),e.addDataSource(i,r,!1)):e.move(i,r);t?(this._chartModel.detachSource(i),e.addDataSource(i,r,!1)):e.move(i,r);const o=(0,s.ensureNotNull)(i.priceScale());o.restoreState(this._originalPriceScaleState()),o.setHeight(e.height()),this._chartModel.fullUpdate()}}class o extends n{constructor(e,t,i,s,r){super(e,t,i,r),this._targetPriceScalePosition=s}_targetPriceScale(e){const t=e.createPriceScaleAtPosition(this._targetPriceScalePosition);return t.restoreState(this._newPriceScaleState("overlay"===this._targetPriceScalePosition)),t.setHeight(e.height()),t}_targetPriceScaleIndex(e){return e===this._chartModel.mainSeries()?0:void 0}}class a extends n{constructor(e,t,i,s,r){super(e,t,i,r),this._targetPriceScaleId=s.id()}_targetPriceScale(e){return(0,s.ensureNotNull)(e.getPriceScaleById(this._targetPriceScaleId))}_targetPriceScaleIndex(e){}}},67521:(e,t,i)=>{"use strict";i.d(t,{PriceScaleChangeUndoCommand:()=>h});var s=i(50151),r=i(11542),n=i(36298),o=i(59224),a=i(62591);const l=(0,o.getLogger)("Chart.ChartUndoModel"),c=new n.TranslatedString("scale price",r.t(null,void 0,i(47222)));class h extends a.UndoCommand{constructor(e,t,i,s,r){super(c,!1),this._newPriceScaleState=null,this._model=e,this._paneIndex=e.panes().indexOf(t),this._priceScaleId=i.id(), +this._state=s,this._timestamp=r?performance.now():null}undo(){if(null!==this._newPriceScaleState)return void l.logDebug("PriceScaleChangeUndoCommand.undo: Command is already undone");const[e,t]=this._paneAndScale();this._newPriceScaleState=t.state(),this._model.restorePriceScaleState(e,t,this._state)}redo(){if(null===this._newPriceScaleState)return void l.logDebug("PriceScaleChangeUndoCommand.redo: Command is not undone");const[e,t]=this._paneAndScale();this._model.restorePriceScaleState(e,t,this._newPriceScaleState),this._newPriceScaleState=null}canMerge(e){return e instanceof h&&null!==this._timestamp&&null!==e._timestamp&&null===this._newPriceScaleState&&e._model===this._model&&e._paneIndex===this._paneIndex&&e._priceScaleId===this._priceScaleId&&Math.abs(e._timestamp-this._timestamp)<1e3}merge(e){this._timestamp=e._timestamp}_paneAndScale(){const e=this._model.panes()[this._paneIndex],t=(0,s.ensureNotNull)(e.getPriceScaleById(this._priceScaleId));return[e,t]}}},47513:(e,t,i)=>{"use strict";i.d(t,{RemoveSourcesUndoCommand:()=>m});var s=i(50151),r=i(11542),n=i(36298),o=i(20114),a=i(92249),l=i(59224),c=i(35115),h=i(28853),d=i(93562);class u extends o.LineToolSynchronizeUndoCommand{constructor({chartModel:e,title:t,lineDataSourceIds:i}){super(e,t),this._excludeLineToolsFromGroupUndoCommands=[],this._undoState=[],this._lineDataSourceIds=i}_redo(){const e=this._lineDataSourceIds.map((e=>(0,s.ensureNotNull)(this._chartModel.dataSourceForId(e))));this._groupLineToolsByGroups(e).forEach(((e,t)=>{const i=new d.ExcludeLineToolsFromGroupUndoCommand(this._chartModel,t,e);i.redo(),this._excludeLineToolsFromGroupUndoCommands.push(i)})),e.forEach((e=>{this._undoState.push({state:e.state(!1),paneIndex:this._chartModel.panes().indexOf((0,s.ensureNotNull)(this._chartModel.paneForSource(e))),sharingMode:e.sharingMode().value()}),this._chartModel.removeSource(e)}))}_undo(){var e;for(let t=this._undoState.shift();t;t=this._undoState.shift())null===(e=this._chartModel.restoreSource(!1,t.paneIndex,null,t.state,null))||void 0===e||e.share(t.sharingMode);this._excludeLineToolsFromGroupUndoCommands.forEach((e=>e.undo()))}_groupLineToolsByGroups(e){const t=this._chartModel.lineToolsGroupModel();return e.reduce(((e,i)=>{const s=t.groupForLineTool(i);if(null!==s){const t=e.get(s)||[];t.push(i),e.set(s,t)}return e}),new Map)}}const p=(0,l.getLogger)("Chart.RemoveSourcesUndoCommand"),_=new n.TranslatedString("remove line data sources",r.t(null,void 0,i(66414)));class m extends o.LineToolSynchronizeUndoCommand{constructor(e,t,i){super(e,i),this._removeLineDataSourcesUndoCommand=null,this._initialPriceScaleMode=null;const[r,n]=(0,c.closeSourcesSet)(e,t).reduce(((e,t)=>((0,a.isLineTool)(t)?e[1].push(t.id()):e[0].push(t.id()),e)),[[],[]]);this._sourceIds=r,this._lineDataSourceIds=n,this._sourceStates=[],this._paneIndexes=[],this._priceScalePositionIds=[],this._paneStates=[],this._restorePanes=[];const o=t[0];1===t.length&&(0,h.isStudy)(o)&&(this._initialPriceScaleMode=(0,s.ensureNotNull)(o.priceScale()).mode())}removedIds(){ +return[...this._sourceIds,...this._lineDataSourceIds]}_redo(){this._chartModel.panes().length;const e=this._sourceIds.map((e=>(0,s.ensureNotNull)(this._chartModel.dataSourceForId(e))));this._sourceStates=e.map((e=>(0,s.ensureNotNull)(e.state(!1))));const t=e.map((e=>(0,s.ensureNotNull)(this._chartModel.paneForSource(e))));this._paneIndexes=t.map((e=>this._chartModel.panes().indexOf(e))),this._lineDataSourceIds.length>0&&(this._removeLineDataSourcesUndoCommand=new u({title:_,chartModel:this._chartModel,lineDataSourceIds:this._lineDataSourceIds}),this._removeLineDataSourcesUndoCommand.redo()),this._priceScalePositionIds=e.map(((e,i)=>{const s=e.priceScale();if(null===s)return null;const r=t[i].priceScalePosition(s);return{id:s.id(),position:r,priceScaleIndex:t[i].priceScaleIndex(s,r)}}));const i=new Set;e.forEach(((e,t)=>{i.add(this._paneIndexes[t])})),this._paneStates=e.map(((e,s)=>{const r=this._paneIndexes[s];return i.has(r)?t[s].state(!1,!0):null})),this._restorePanes=e.map((e=>this._chartModel.removeSource(e)))}_undo(){const e=[];for(let t=this._sourceStates.length-1;t>=0;t--){const i=this._chartModel.restoreSource(this._restorePanes[t],this._paneIndexes[t],this._paneStates[t],this._sourceStates[t],this._priceScalePositionIds[t]);i&&e.push(i)}e.some(((t,i)=>t.id()!==this._sourceIds[e.length-i-1]))&&p.logError("Source was restored improperly - source ids does not match"),null!==this._initialPriceScaleMode&&(0,s.ensureNotNull)(e[0].priceScale()).setMode(this._initialPriceScaleMode),this._removeLineDataSourcesUndoCommand&&this._removeLineDataSourcesUndoCommand.undo()}}},4505:(e,t,i)=>{"use strict";i.d(t,{RestoreDefaultsPreferencesUndoCommand:()=>v});var s=i(50151),r=i(11542),n=i(36298),o=i(62591),a=i(12416),l=i(83407),c=i(16164),h=i(98425),d=i(42226),u=i(39875),p=i(78159),_=i(3228),m=i(40493),g=i(11095);const f=new n.TranslatedString("apply all chart properties",r.t(null,void 0,i(64034)));class v extends o.UndoCommand{constructor(e){super(f),this._trading=null,this._oldShowSellBuyButtons=null,this._oldNoConfirmEnabled=null,this._oldShowOnlyRejectionNotifications=null,this._oldShowPricesWithZeroVolume=null,this._oldShowPricesWithSpread=null,this._oldOrderExecutedSoundEnabled=null,this._prevWatermarkPreferences=null,this._prevAlertPreferences=null,this._model=e,this._trading=(0,m.tradingService)(),null!==this._trading&&(this._oldShowSellBuyButtons=this._trading.showSellBuyButtons.value(),this._oldNoConfirmEnabled=this._trading.noConfirmEnabled.value(),this._oldShowOnlyRejectionNotifications=this._trading.showOnlyRejectionNotifications.value(),this._oldShowPricesWithZeroVolume=this._trading.showPricesWith().zeroVolume.value(),this._oldShowPricesWithSpread=this._trading.showPricesWith().spread.value(),this._oldOrderExecutedSoundEnabled=this._trading.orderExecutedSoundParams.enabled.value()),this._defaultsPreferences=(0,a.defaultsPreferencesByWhiteList)(this._model,this._model.mainSeries()),this._oldPreferences=e.preferences(),this._prevDateFormat=l.dateFormatProperty.value(), +this._prevTimeHoursFormat=c.timeHoursFormatProperty.value(),this._prevAddPlusButton=g.addPlusButtonProperty.value(),this._prevShowOpenMarkerStatus=h.showMarketOpenStatusProperty.value(),this._prevCurrencyUnitVisibility=(0,d.currencyUnitVisibilityProperty)().value(),this._prevAutoLogButtonsVisibility=(0,u.autoLogButtonsVisibilityProperty)().value(),this._prevNavigationButtonsVisibility=(0,p.property)().value(),this._prevPaneButtonsVisibility=(0,_.property)().value();const t=this._model.watermarkSource();null!==t&&(this._prevWatermarkPreferences=t.properties().state())}redo(){null!==this._trading&&(this._trading.showSellBuyButtons.setValue(!0),this._trading.noConfirmEnabled.setValue(!1),this._trading.showOnlyRejectionNotifications.setValue(!1),this._trading.showPricesWith().zeroVolume.setValue(!0),this._trading.showPricesWith().spread.setValue(!0),this._trading.orderExecutedSoundParams.enabled.setValue(!1)),this._model.applyPreferences(this._defaultsPreferences),this._model.updateScales(),(0,l.restoreDateFormatSettingsValue)(),(0,c.restoreTimeHoursFormatSettingsValue)(),(0,g.restoreAddPlusButtonSettingsValue)(),(0,h.restoreShowMarketOpenStatusProperty)(),(0,d.restoreCurrencyUnitVisibilitySettingsValue)(),(0,u.restoreAutoLogButtonsVisibilitySettingsValue)(),(0,p.restoreNavigationButtonsVisibilitySettingsValue)(),(0,_.restorePaneButtonsVisibilitySettingsValue)();const e=this._model.watermarkSource();null!==e&&e.restorePropertiesDefaults()}undo(){null!==this._trading&&(this._trading.showSellBuyButtons.setValue((0,s.ensureNotNull)(this._oldShowSellBuyButtons)),this._trading.noConfirmEnabled.setValue((0,s.ensureNotNull)(this._oldNoConfirmEnabled)),this._trading.showOnlyRejectionNotifications.setValue((0,s.ensureNotNull)(this._oldShowOnlyRejectionNotifications)),this._trading.showPricesWith().zeroVolume.setValue((0,s.ensureNotNull)(this._oldShowPricesWithZeroVolume)),this._trading.showPricesWith().spread.setValue((0,s.ensureNotNull)(this._oldShowPricesWithSpread)),this._trading.orderExecutedSoundParams.enabled.setValue((0,s.ensureNotNull)(this._oldOrderExecutedSoundEnabled))),this._model.applyPreferences(this._oldPreferences),this._model.updateScales(),l.dateFormatProperty.setValue(this._prevDateFormat),c.timeHoursFormatProperty.setValue(this._prevTimeHoursFormat),h.showMarketOpenStatusProperty.setValue(this._prevShowOpenMarkerStatus),g.addPlusButtonProperty.setValue(this._prevAddPlusButton),(0,d.currencyUnitVisibilityProperty)().setValue(this._prevCurrencyUnitVisibility),(0,u.autoLogButtonsVisibilityProperty)().setValue(this._prevAutoLogButtonsVisibility),(0,p.property)().setValue(this._prevNavigationButtonsVisibility),(0,_.property)().setValue(this._prevPaneButtonsVisibility);const e=this._model.watermarkSource();null!==e&&null!==this._prevWatermarkPreferences&&e.properties().mergeAndFire(this._prevWatermarkPreferences)}}},87115:(e,t,i)=>{"use strict";i.d(t,{SetPriceScaleCurrencyUndoCommand:()=>o});var s=i(50151),r=i(62591),n=i(42960);class o extends r.UndoCommand{constructor(e,t,i,r){super(r), +this._newSourcesCurrencies=new Map,this._oldSourcesCurrencies=new Map,this._showFade=!1,this._chartWidget=i;const o=i.model().mainSeries();for(const i of e.seriesLikeSources()){if(!i.isVisible()||!i.isActingAsSymbolSource().value())continue;const e=t||(0,n.symbolOriginalCurrency)((0,s.ensureNotNull)(i.symbolInfo()));this._newSourcesCurrencies.set(i.id(),e),this._oldSourcesCurrencies.set(i.id(),i.currency()),this._showFade=this._showFade||i===o&&i.currency()!==e}}redo(){this._applyCurrencies(this._newSourcesCurrencies)}undo(){this._applyCurrencies(this._oldSourcesCurrencies)}_applyCurrencies(e){const t=this._chartWidget.model().model();e.forEach(((e,i)=>{(0,s.ensureNotNull)(t.dataSourceForId(i)).setCurrency(e)})),this._chartWidget.model().selectionMacro((e=>{e.clearSelection()})),this._showFade&&this._chartWidget.screen.show(!0)}}},95367:(e,t,i)=>{"use strict";i.d(t,{SetPriceScaleModeCommand:()=>o});var s=i(46100),r=i(62591),n=i(28558);class o extends r.UndoCommand{constructor(e,t,i,s){super(i),this._newMode=e,this._priceScaleId=t.id(),this._model=s,this._oldMode=t.mode()}redo(){this._applyMode(this._newMode)}undo(){this._applyMode(this._oldMode)}_applyMode(e){const t=this._findPriceScaleById();null!==t&&((0,s.saveDefaultProperties)(!0),t.setMode(e),(0,s.saveDefaultProperties)(!1),this._model&&(this._model.recalculateAllPanes((0,n.viewportChangeEvent)()),this._model.lightUpdate()))}_findPriceScaleById(){const e=this._model.panes();for(let t=0;t{"use strict";i.d(t,{SetPriceScaleSelectionStrategyCommand:()=>a});var s=i(50151),r=i(62591),n=i(49535);class o{constructor(e){this._leftScales=e.leftPriceScales().map((e=>e.id())),this._rightScales=e.rightPriceScales().map((e=>e.id()))}restorePane(e){this._leftScales.reverse().map((t=>(0,s.ensureNotNull)(e.getPriceScaleById(t)))).forEach((t=>e.movePriceScale(t,"left"))),this._rightScales.reverse().map((t=>(0,s.ensureNotNull)(e.getPriceScaleById(t)))).forEach((t=>e.movePriceScale(t,"right")))}}class a extends r.UndoCommand{constructor(e,t,i){super(i),this._chartModel=e,this._targetStrategy=(0,n.createPriceScaleSelectionStrategy)(t),this._initialState=e.panes().map((e=>new o(e)))}redo(){this._chartModel.panes().forEach((e=>e.setPriceScaleSelectionStrategy(this._targetStrategy))),this._chartModel.fullUpdate()}undo(){const e=this._chartModel.panes();for(let t=0;t{"use strict";i.d(t,{SetPriceScaleUnitUndoCommand:()=>o});var s=i(50151),r=i(62591),n=i(42960);class o extends r.UndoCommand{constructor(e,t,i,r){super(r),this._newSourcesUnits=new Map,this._oldSourcesUnits=new Map,this._showFade=!1,this._chartWidget=i;const o=i.model().mainSeries();for(const i of e.seriesLikeSources()){if(!i.isVisible()||!i.isActingAsSymbolSource().value())continue;const e=t||(0,n.symbolOriginalUnit)((0, +s.ensureNotNull)(i.symbolInfo()),this._chartWidget.model().model().unitConversionEnabled());this._newSourcesUnits.set(i.id(),e),this._oldSourcesUnits.set(i.id(),i.unit()),this._showFade=this._showFade||i===o&&i.unit()!==e}}redo(){this._applyUnits(this._newSourcesUnits)}undo(){this._applyUnits(this._oldSourcesUnits)}_applyUnits(e){const t=this._chartWidget.model().model();e.forEach(((e,i)=>{(0,s.ensureNotNull)(t.dataSourceForId(i)).setUnit(e)})),this._chartWidget.model().selectionMacro((e=>{e.clearSelection()})),this._showFade&&this._chartWidget.screen.show(!0)}}},610:(e,t,i)=>{"use strict";i.d(t,{SetScaleRatioPropertiesCommand:()=>o});var s=i(62591),r=i(46100),n=i(28558);class o extends s.UndoCommand{constructor(e,t,i,s){super(i),this._property=e,this._newValue=t,this._model=s,this._priceScale=this._model.mainSeries().priceScale(),this._oldValue=this._property.value(),this._oldMode=this._priceScale.mode()}redo(){this._oldValue=this._property.value(),this._oldMode=this._priceScale.mode(),(0,r.saveDefaultProperties)(!0),this._priceScale.setMode({autoScale:!1,percentage:!1,log:!1}),this._property.setValue(this._newValue),(0,r.saveDefaultProperties)(!1),this._model.recalculateAllPanes((0,n.viewportChangeEvent)()),this._model.lightUpdate()}undo(){(0,r.saveDefaultProperties)(!0),this._property.setValue(this._oldValue),this._priceScale.setMode(this._oldMode),(0,r.saveDefaultProperties)(!1),this._model.recalculateAllPanes((0,n.viewportChangeEvent)()),this._model.lightUpdate()}}},69718:(e,t,i)=>{"use strict";i.d(t,{SetWatchedValueCommand:()=>r});var s=i(62591);class r extends s.UndoCommand{constructor(e,t,i){super(i),this._wv=e,this._newValue=t,this._oldValue=e.value()}redo(){this._wv.setValue(this._newValue)}undo(){this._wv.setValue(this._oldValue)}}},35115:(e,t,i)=>{"use strict";function s(e,t){let i=[];const r=e.children(t,!1);for(let t=0;t{e.children(t,!1).forEach((e=>{i.has(e)||(i.add(e),r(e))}))};return t.forEach(r),t.filter((e=>!i.has(e))).map((t=>s(e,t))).reduce(((e,t)=>e.concat(t)),[])}i.d(t,{closeSourcesSet:()=>r})},51674:(e,t,i)=>{"use strict";i.d(t,{TimeScaleChangeUndoCommand:()=>o});var s=i(59224),r=i(62591);const n=(0,s.getLogger)("Chart.ChartUndoModel");class o extends r.UndoCommand{constructor(e,t,i){super(i,!1),this._newRightOffsetAndBarSpacing=null,this.setCustomFlag("doesnt_affect_save",!0),this._model=e,this._rightOffsetAndBarSpacing=t}undo(){if(null!==this._newRightOffsetAndBarSpacing)return void n.logDebug("TimeScaleChangeUndoCommand.undo: Command is already undone");const e=this._model.timeScale();this._newRightOffsetAndBarSpacing={barSpacing:e.barSpacing(),rightOffset:e.rightOffset()},e.setBarSpacing(this._rightOffsetAndBarSpacing.barSpacing),e.setRightOffset(this._rightOffsetAndBarSpacing.rightOffset),this._model.lightUpdate()}redo(){if(null===this._newRightOffsetAndBarSpacing)return void n.logDebug("TimeScaleChangeUndoCommand.redo: Command is not undone");const e=this._model.timeScale() +;e.setBarSpacing(this._newRightOffsetAndBarSpacing.barSpacing),e.setRightOffset(this._newRightOffsetAndBarSpacing.rightOffset),this._model.lightUpdate(),this._newRightOffsetAndBarSpacing=null}}},62591:(e,t,i)=>{"use strict";i.d(t,{UndoCommand:()=>r});var s=i(36298);class r{constructor(e,t=!0){this._customFlags={},this._text=e||new s.TranslatedString("",""),this._executeOnPush=t}text(){return this._text}executeOnPush(){return this._executeOnPush}customFlag(e){return this._customFlags[e]}setCustomFlag(e,t){this._customFlags[e]=t}canMerge(e){return!1}merge(e){throw new Error("Should be re-implemented in child classes")}}},18687:(e,t,i)=>{"use strict";i.d(t,{createUndoHistory:()=>h});var s=i(50151),r=i(93244),n=i(68452),o=i(69718),a=i(59224),l=i(57898);const c=(0,a.getLogger)("Common.UndoHistory");function h(){const e=[],t=new r.UndoStack,i=new r.UndoStack,a=new l.Delegate;function h(s){if(e.length>0)e[e.length-1].addCommand(s);else{i.clear();const e=t.head(),r=e&&e.text().originalText();e&&e.canMerge(s)?e.merge(s):t.push(s);const n=s.text().originalText();""!==n&&n!==r&&c.logNormal("DO: "+n)}s.executeOnPush()&&s.redo(),e.length||a.fire(d())}function d(){const e=t.head(),s=i.head(),r=void 0===e?void 0:e.text(),n=void 0===s?void 0:s.text();return{enableUndo:!t.isEmpty(),undoCommandCount:t.size(),undoText:void 0!==r?r.translatedText():r,enableRedo:!i.isEmpty(),redoCommandCount:i.size(),redoText:void 0!==n?n.translatedText():n,originalUndoText:void 0!==r?r.originalText():void 0,originalRedoText:void 0!==n?n.originalText():void 0}}return{beginUndoMacro:function(t){const i=new n.UndoMacroCommand(t);return e.push(i),i},clearStack:function(){t.clear(),i.clear(),a.fire(d())},createUndoCheckpoint:function(){return{lastActualCommand:t.isEmpty()?null:t.head()}},endUndoMacro:function(){const t=(0,s.ensureDefined)(e.pop());t.isEmpty()||h(t)},pushUndoCommand:h,redo:function(){if(i.isEmpty())return!1;const e=i.pop();return!!e&&(e.redo(),t.push(e),c.logNormal("REDO: "+e.text().originalText()),a.fire(d()),!0)},redoStack:function(){return i},setWatchedValue:function(e,t,i,s){if(e.value()!==t){const r=new o.SetWatchedValueCommand(e,t,i);r.setCustomFlag("doesnt_affect_save",!!s),h(r),r.redo()}},undo:function(){if(t.isEmpty())return!1;const e=t.pop();return!!e&&(e.undo(),i.push(e),c.logNormal("UNDO: "+e.text().originalText()),a.fire(d()),!0)},undoStack:function(){return t},undoToCheckpoint:function(e){for(;!t.isEmpty()&&e.lastActualCommand!==t.head();)t.pop().undo();i.clear(),a.fire(d())},state:d,onChange:function(){return a}}}},68452:(e,t,i)=>{"use strict";i.d(t,{UndoMacroCommand:()=>r});var s=i(62591);class r extends s.UndoCommand{constructor(e){super(e,!1),this._subcommands=[]}addCommand(e){this._subcommands.push(e)}isEmpty(){return 0===this._subcommands.length}redo(){for(let e=0;e=0;e--)this._subcommands[e].undo()}commands(){return this._subcommands}}},93244:(e,t,i)=>{"use strict";i.d(t,{UndoStack:()=>o});var s=i(62591),r=i(57898) +;const n=(0,i(59224).getLogger)("Common.UndoStack");class o{constructor(){this._commands=[],this._onChange=new r.Delegate}onChange(){return this._onChange}isEmpty(){return 0===this._commands.length}size(){return this._commands.length}clear(){this.isEmpty()||(this._commands.length=0,this._onChange.fire())}push(e){if(!(e instanceof s.UndoCommand))throw new TypeError("argument must be an instance of UndoCommand");this._commands.push(e),this._onChange.fire(e)}pop(){if(this.isEmpty())return void n.logDebug("pop: undo stack is empty");const e=this._commands.pop();return this._onChange.fire(e),e}head(){if(!this.isEmpty())return this._commands[this._commands.length-1]}}},95529:(e,t,i)=>{"use strict";i.d(t,{UnmergeDownUndoCommand:()=>o,UnmergeToNewBottomPane:()=>l,UnmergeUpUndoCommand:()=>a});var s=i(50151),r=i(38071);class n extends r.MoveSourceUndoCommand{constructor(e,t,i){super(e,t,i)}redo(){const e=(0,s.ensureNotNull)(this._chartModel.dataSourceForId(this._sourceId)),t=(0,s.ensureNotNull)(this._chartModel.paneForSource(e)),i=this._chartModel.children(e,!0);t.bulkActionMacro((()=>{i.forEach((e=>this._chartModel.detachSource(e))),this._chartModel.detachSource(e)}));const r=this._chartModel.createPane(this.targetPaneIndex()),n=r.findSuitableScale(e);r.bulkActionMacro((()=>{r.addDataSource(e,n,!1),i.forEach((e=>r.addDataSource(e,n,!1)))}));const o=(0,s.ensureNotNull)(e.priceScale());o.restoreState(this._newPriceScaleState(r.isOverlay(e))),o.setHeight(r.height()),this._chartModel.fullUpdate(),this._chartModel.setShouldBeSavedEvenIfHidden(!0)}undo(){const e=(0,s.ensureNotNull)(this._chartModel.dataSourceForId(this._sourceId)),t=(0,s.ensureNotNull)(this._chartModel.paneForSource(e)),i=this._chartModel.children(e,!0);t.bulkActionMacro((()=>{i.forEach((e=>this._chartModel.detachSource(e)));const t=this._chartModel.detachSource(e);(0,s.assert)(t,"Undo of detaching must remove pane")}));const r=this._chartModel.panes()[this._initialPaneIndex];let n=r.getPriceScaleById(this._initialPriceScaleId);null===n&&(n=r.createPriceScaleAtPosition(this._initialPriceScalePosition,this._initialPriceScaleIndex)),r.bulkActionMacro((()=>{r.addDataSource(e,n,!0),i.forEach((e=>r.addDataSource(e,n,!1)))}));const o=(0,s.ensureNotNull)(e.priceScale());o.restoreState(this._originalPriceScaleState()),o.setHeight(r.height()),this._chartModel.fullUpdate()}}class o extends n{constructor(e,t,i){super(e,t,i)}targetPaneIndex(){return this._initialPaneIndex+1}}class a extends n{constructor(e,t,i){super(e,t,i)}targetPaneIndex(){return this._initialPaneIndex}}class l extends n{constructor(e,t,i){super(e,t,i)}targetPaneIndex(){return this._chartModel.panes().length}}},26512:(e,t,i)=>{"use strict";i.d(t,{sourceNewUnitOnPinningToPriceScale:()=>o,unitConvertibleGroups:()=>n});var s=i(18611),r=i(42960);function n(e,t,i){const s=(0,r.symbolUnitConvertibleGroupsIfExist)(e,!0);if(null!==s)return s;const n=i.unitGroupById(t);return null===n?[]:[n]}function o(e,t,i,r){let o=null;if(i.unitConversionEnabled()&&(0,s.isSymbolSource)(e)){ +const s=i.availableUnits(),a=t.unit(s),l=e.unit(),c=null===l?[]:n(e.symbolInfo(),l,s);null!==a&&null!==a.selectedUnit&&!a.allUnitsAreOriginal&&a.selectedUnit!==l&&(r&&null===l||null!==l&&s.convertible(l,c))&&(o=a.selectedUnit)}return o}},29542:(e,t,i)=>{"use strict";i.d(t,{createVisibilityController:()=>c});var s=i(11542),r=i(32563),n=i(59680),o=i(56840);const a="visibleOnMouseOver";function l(e){return"alwaysOn"===e||"alwaysOff"===e?e:a}function c(e,t){let c,h;function d(){if(!c){c=(0,n.createPrimitiveProperty)();let i=o.getValue(e);void 0===i&&void 0!==t&&(i=o.getValue(t)),c.setValue(l(i)),c.subscribe(c,(t=>{o.setValue(e,l(t.value()))}))}return c}return{property:d,availableValues:function(){return[{id:"visibleOnMouseOver",value:"visibleOnMouseOver",title:s.t(null,void 0,i(89960))},{id:"alwaysOn",value:"alwaysOn",title:s.t(null,void 0,i(71997))},{id:"alwaysOff",value:"alwaysOff",title:s.t(null,void 0,i(9408))}]},actualBehavior:function(){if(!h){h=(0,n.createPrimitiveProperty)();const e=d(),t=()=>{let t=e.value();"alwaysOn"!==t&&"alwaysOff"!==t&&(t=r.mobiletouch?"alwaysOn":"visibleOnMouseOver"),h&&h.setValue(t)};e.subscribe(h,t),t()}return h},restoreDefaultValue:function(){d().setValue(a),o.remove(e)}}}},65632:(e,t,i)=>{"use strict";i.r(t),i.d(t,{restoreWatermarkPropertyDefaults:()=>h,watermarkProperty:()=>c});var s=i(56840),r=i(88640);const n="symbolWatermark",o={visibility:!1,color:"rgba(80, 83, 94, 0.25)"};function a(){const e=s.getJSON(n);return Object.assign({},o,e)}let l=null;function c(){return null===l&&(l=new r.default(a()),s.onSync.subscribe(null,(()=>{null!==l&&l.mergeAndFire(a())})),l.listeners().subscribe(null,(()=>{null!==l&&s.setJSON(n,l.state())}))),l}function h(){null!==l&&l.mergeAndFire(o)}},30255:(e,t,i)=>{"use strict";var s=i(11321).translatedIntervalString,r=i(58557).getTranslatedSymbolDescription,n=i(46501).CHART_FONT_FAMILY,o=i(65632),a=o.watermarkProperty,l=o.restoreWatermarkPropertyDefaults,c=i(74359).drawScaled,h=i(85804).applyDefaultsOverrides,d=i(85804).applyPropertiesOverrides;const u="symbolWatermark";t.Watermark=function(e,t){var i={},o=a();function p(e,t){var s=e.font;return i.hasOwnProperty(s)||(i[s]={}),i[s].hasOwnProperty(t)||(i[s][t]=e.measureText(t).width),i[s][t]}h(o,void 0,!1,u),o.listeners().subscribe(this,(function(){e.updateSource(this)})),this.destroy=function(){o.listeners().unsubscribeAll(this)},this.properties=function(){return o},this.restorePropertiesDefaults=function(){l()},this.applyOverrides=function(e){d(o,void 0,!1,e,u)};var _={renderer:function(i,a){return{draw:function(l,h){c(l,h.pixelRatio,h.pixelRatio,(function(){var c=t.symbolInfo();l.fillStyle=o.color.value();var h,d=c.name;/QUANDL/.test(c.exchange)&&((h=d.split(/\//)).length&&(d=h[h.length-1]));var u={description:c.description,short_description:c.short_description,pro_name:c.pro_name,short_name:c.name,local_description:c.local_description,language:c.language};const _=e.watermarkContentProvider(),m=_?_({symbolInfo:c,interval:t.interval()}):null;for(var g=(m?m.map((e=>({text:e.text,font:`${e.fontSize}px ${n}`, +lineHeight:e.lineHeight,vertOffset:e.vertOffset}))):null)||[{text:d?d+", "+s(t.interval()):"",font:"96px "+n,lineHeight:117,vertOffset:0},{text:r(u)||"",font:"48px "+n,lineHeight:58,vertOffset:5}],f=0,v=0;va?a/S:1,f+=b.lineHeight*b.zoom}}var y=Math.max((i-f)/2,0);for(v=0;v{"use strict";i.d(t,{moveAfterSource:()=>k,moveBeforeSource:()=>D,newLineToolZOrder:()=>w,newStudyZOrder:()=>C,reorderDataSourcesStateZOrder:()=>S});var s=i(92249),r=i(28853),n=i(76544),o=i(53588),a=i(78071);function l(e){return(0,s.isLineTool)(e)&&!e.isSpeciallyZOrderedSource()}function c(e){return(0,r.isStudy)(e)&&!e.isSpeciallyZOrderedSource()}function h(e,t){return e.zorder-t.zorder}function d(e,t){(0,o.isMainSeriesState)(e)?e.zorder=0:e.zorder=t}function u(e,t){e.setZorder(t)}function p(e){return e.zorder()}function _(e){return Math.round(1e3*e)/1e3}function m(e,t){const i=Math.max(e,t),s=Math.min(e,t);return Math.max(0,Math.ceil(i)-Math.floor(s)-1)}function g(e,t,i){let s=0;const r=function(e,t){const i=1e3;return Math.abs(t*i-e*i)/i}(t,e);var n;return r>i?(e=Math.trunc(e),s=Math.floor(r/(i+1))):(n=r/(i+1),s=Math.floor(1e3*n)/1e3),{startZOrder:e,zOrderStep:s}}function f(e,t,i,s){let r=e.length,n=t;for(let t=e.length-1;t>=-1;t--)if(-1===t||s(e[t])){const s=t;let o=x(n);if(r-1===s)s>=0&&i(e[s],o);else{const t=m(r,s);let a=0;for(;0===a;){const e=g(n,o,t);n=e.startZOrder,a=e.zOrderStep,0===a&&(o-=1e4,0===o&&(o-=1e4))}let l=r-1;for(;l>s;){const t=_(n-a);i(e[l],t),n=t,l--}s>=0&&i(e[s],o)}n=o,r=s}}function v(e,t,i,s){let r=-1,n=t;for(let t=0;t<=e.length;t++)if(t===e.length||s(e[t])){const s=t;let o=P(n);if(r+1===s)s<=e.length-1&&i(e[s],o);else{const t=m(r,s);let a=0;for(;0===a;){const e=g(n,o,t);n=e.startZOrder,a=e.zOrderStep,0===a&&(o+=1e4,0===o&&(o+=1e4))}let l=r+1;for(;l<=s-1;){const t=_(n+a);i(e[l],t),n=t,l++}s<=e.length-1&&i(e[s],o)}n=o,r=s}}function S(e){!function(e,t,i,s,r,n){let o=null;const a=[];for(const r of e)t(r)?(a.push(r),o=r):(i(r)||s(r))&&a.push(r);a.sort(n),null!==o&&r(o,0);const l=null===o?-1:a.indexOf(o);-1!==l?(f(a.slice(0,l),0,r,i),v(a.slice(l+1),0,r,i)):v(a,0,r,i)}(e,o.isMainSeriesState,o.isStudyState,o.isLineToolState,d,h)}function y(e,t){const i=Math.floor(e/1e4);let s=t.get(i);return void 0===s&&(s=[],t.set(i,s)),s}function b(e,t,i,s,r,n){let o=-1/0,a=1/0,l=-1/0,c=0;const h=new Map;for(let s=0;sr(e)-r(t)));let p=x(r(u[0]));const m=P(p),f=g(p,m,u.length+1).zOrderStep;return 0!==f?(u.forEach((e=>{const t=_(p+f);s(e,t),p=t})),_(p+f)):_(m+5e3)}function w(e,t){return b(e,l,c,u,p,t)}function C(e){let t=-1e4;for(const i of e)c(i)&&(t=Math.min(t,i.zorder()-1e4));return 0===t?-1e4:t}function P(e){const t=1e4*Math.ceil(e/1e4);return t===e?t+1e4:t}function x(e){const t=1e4*Math.floor(e/1e4);return t===e?t-1e4:t}function T(e,t,i,s,r,n,o){const l=t.length,{newItems:c,movedItemsStartIndex:h}=i>0?(0,a.moveAfter)(e,t,i-1):(0,a.moveBefore)(e,t,0);let d=!1;for(let t=h;tr(e)))?function(e,t,i,s,r,n){let o,a,l=-1,c=-1;0===i?(c=I(e,i+t,s),a=n(e[c])):i+t===e.length?(l=M(e,i-1,s),o=n(e[l])):(l=M(e,i-1,s),o=n(e[l]),c=I(e,i+t,s),a=n(e[c]));if((void 0===o||o<0)&&void 0!==a&&a<=0)f(e.slice(0,c),a,r,s);else if((void 0===a||a>0)&&void 0!==o&&o>=0)v(e.slice(l+1),o,r,s);else{i+t0)&&void 0!==a&&a>=0){c=a;const e=g(c,void 0!==l?l:P(a),t);c=e.startZOrder,p=e.zOrderStep,d=i,u=d+t,h=1}if(0!==p)for(;d!==u;){const t=_(c+h*p);n(e[d],t),c=t,d+=h}else{const t=e.findIndex((e=>r(e)));-1!==t?(f(e.slice(0,t),0,n,s),v(e.slice(t+1),0,n,s)):v(e,0,n,s)}}(c,l,h,r,s,n,o)}function I(e,t,i){for(;t=0&&i(e[t]);)t--;return Math.max(0,t)}function A(e,t,i,s,r,n,o){const a=e.indexOf(i)+1;T(e,t,a,s,r,n,o)}function L(e,t,i,s,r,n,o){const a=e.indexOf(i);T(e,t,a,s,r,n,o)}function k(e,t,i){A(e,t,i,n.isSeries,c,u,p)}function D(e,t,i){L(e,t,i,n.isSeries,c,u,p)}},65106:(e,t,i)=>{"use strict";i.d(t,{getSymbolSearchCompleteOverrideFunction:()=>n,setSymbolSearchCompleteOverrideFunction:()=>r});let s=(e,t)=>{var i;return Promise.resolve({symbol:e,name:null!==(i=null==t?void 0:t.symbol)&&void 0!==i?i:e})};function r(e){s=e}function n(){return s}},60762:(e,t,i)=>{"use strict";i.d(t,{StudyMetaInfoBase:()=>u});var s=i(27147),r=i(50151),n=i(33703);const o=new Set(["CorrelationCoefficient@tv-basicstudies","Correlation - Log@tv-basicstudies-1"]),a=new Set([]),l=new Set(["line"]),c=new Map([["AnchoredVWAP@tv-basicstudies","linetoolanchoredvwap"],["RegressionTrend@tv-basicstudies","linetoolregressiontrend"],["VbPAnchored@tv-basicstudies","linetoolanchoredvp"]]),h=/^([^\$]+)\$\d+$/,d=["bool","color","time","text_area"];class u{static getSourceIdsByInputs(e,t){if(!Array.isArray(e)||!t)return[];const i=[];for(const r of e)if(u.isSourceInput(r)&&(0,s.default)(t[r.id])){const e=t[r.id];e.includes("$")&&i.push(e.split("$")[0]) +}return i}static isSourceInput(e){return Boolean(e.id&&(("source"===e.id||"src"===e.id)&&("text"===e.type||"source"===e.type)||"source"===e.type))}static getSourceInputIds(e){const t=[];for(const i of e.inputs)u.isSourceInput(i)&&t.push(i.id);return t}static setChildStudyMetaInfoPropertiesSourceId(e,t,i){for(const s of e.inputs){if(!u.isSourceInput(s))continue;const e=i.childs().inputs&&i.childs().inputs.childs()[s.id];if(e){const i=e.value(),s=h.exec(i);if(2===(null==s?void 0:s.length)){if("{pid}"===s[1]){const s=i.replace(/^[^\$]+/,t);e.setValue(s)}}}}}static patchSoSInputs(e,t){const i=e=>{const i=h.exec(e);if(2===(null==i?void 0:i.length)){const s=i[1],n=`${(0,r.ensureNotNull)(t(s))}`;return e.replace(/^[^\$]+/,n)}return e};for(const t in e)if(/in_[\d+]/.test(t)||"source"===t){const r=e[t];(0,s.default)(r)?e[t]=i(r):(0,n.isExtendedInput)(r)&&(0,n.isExtendedInputSource)(r)&&(r.v=i(r.v))}}static canBeChild(e){if((0,s.default)(e))return!0;if(!e)return!1;if(e.extra&&!u.isAllowedSourceInputsCount(e.extra.sourceInputsCount)||!0===e.canNotBeChild||!1===e.canBeChild||o.has(e.id))return!1;let t=0;for(const i of e.inputs)u.isSourceInput(i)&&(t+=1);return u.isAllowedSourceInputsCount(t)}static isAllowedSourceInputsCount(e){return 1===e}static canHaveChildren(e){if(e){if(e.isTVScriptStrategy||e.TVScriptSourceCode&&isStrategy(e.TVScriptSourceCode))return!1;if(e.id&&!a.has(e.id)&&Array.isArray(e.plots))for(const t of e.plots)if(l.has(t.type))return!0}return!1}static getChildSourceInputTitles(e,t,i){var s;const r={};if(t.plots&&t.plots.length&&e.options&&e.options.length)for(const n of e.options){const e=n?+n.split("$")[1]:NaN,o=isFinite(e)&&t.plots[e];o&&l.has(o.type)&&(r[n]=t.styles&&t.styles[o.id]&&(null===(s=t.styles[o.id])||void 0===s?void 0:s.title)||o.id,i&&(r[n]=i+": "+r[n]))}return r}static canPlotBeSourceOfChildStudy(e){return l.has(e)}static getStudyPropertyRootName(e){const t=c.get(e.id);if(void 0!==t)return t;let i="study_"+e.id;return e.pine&&e.pine.version&&(i+="_"+e.pine.version.replace(".","_")),i}static getStudyPropertyRootNameById(e){const t=c.get(e);return void 0!==t?t:"study_"+e}_updateInputDisplayDefaults(){this.inputs.filter((e=>void 0===e.display)).forEach((e=>{d.includes(e.type)?e.display=n.InputDisplayFlags.None:e.display=n.InputDisplayFlags.All}))}}},42856:(e,t,i)=>{"use strict";i.d(t,{StudyMetaInfo:()=>a});var s=i(59224).getLogger("Chart.Study.MetaInfo"),r=i(45574).applyOverridesToStudyDefaults,n=i(60762).StudyMetaInfoBase,o={};class a extends n{constructor(e){super(),TradingView.merge(this,{palettes:{},inputs:[],plots:[],graphics:{},defaults:{}}),TradingView.merge(this,e);var t=e.fullId||e.id;TradingView.merge(this,a.parseIdString(t)),this._updateInputDisplayDefaults()}static versionOf(e){var t="_metainfoVersion"in e&&isNumber(e._metainfoVersion)?e._metainfoVersion:0;return t<0&&s.logError("Metainfo format version cannot be negative: "+t),t}static parseIdString(e){var t={};if(-1===e.indexOf("@"))t.shortId=e,t.packageId="tv-basicstudies",t.id=e+"@"+t.packageId,t.version=1;else{var i=e.split("@") +;t.shortId=i[0];var s=i[1].split("-");if(3===s.length)t.packageId=s.slice(0,2).join("-"),t.id=t.shortId+"@"+t.packageId,t.version=s[2];else if(1===s.length&&"decisionbar"===s[0])t.packageId="les-"+s[0],t.id=t.shortId+"@"+t.packageId,t.version=1;else{if(1!==s.length)throw new Error("unexpected study id:"+e);t.packageId="tv-"+s[0],t.id=t.shortId+"@"+t.packageId,t.version=1}}if(t.fullId=t.id+"-"+t.version,"tv-scripting"===t.packageId){var r=t.shortId;if(0===r.indexOf("Script$")||0===r.indexOf("StrategyScript$")){var n=r.indexOf("_");t.productId=n>=0?r.substring(0,n):t.packageId}else t.productId=t.packageId}else t.productId=t.packageId;return t}static getPackageName(e){return(/^[^@]+@([^-]+-[^-]+)/.exec(e||"")||[0,"tv-basicstudies"])[1]}static cutDollarHash(e){var t=e.indexOf("$"),i=e.indexOf("@");return-1===t?e:e.substring(0,t)+(i>=0?e.substring(i):"")}static hasUserIdSuffix(e){return/^USER;[\d\w]+;\d+$/.test(e)}static hasPubSuffix(e){return/^PUB;.+$/.test(e)}static hasStdSuffix(e){return/^STD;.+$/.test(e)}static isStandardPine(e){return/^(Strategy)?Script\$STD;.*@tv-scripting$/.test(e)}static getStudyIdWithLatestVersion(e){const t=a.cutDollarHash(e.id);let i=t;return t.indexOf("@tv-scripting")>=0?i+="-101!":t.endsWith("CP@tv-basicstudies")?i+="-"+Math.min(e.version,207):t.endsWith("CP@tv-chartpatterns")?i+="-"+Math.min(e.version,9):i+="-"+e.version,i}defaultInputs(){for(var e=[],t=0;t0?e[0].id:null}createDefaults(){if(this.defaults){var e=TradingView.clone(this.defaults);e.precision="default";var t=a.getStudyPropertyRootName(this);defaults.create(t,e)}}removeDefaults(){defaults.remove(a.getStudyPropertyRootName(this))}static findStudyMetaInfoByDescription(e,t){if(e){for(var i=0;i{"use strict";window.TradingView=window.TradingView||{},i(2298),i(32563).setClasses(),i(95374),i(56186).install(),i(49483),i(1722),i(42053),i(11417),i(54358),i(56696),i(56840)}, +48324:(e,t,i)=>{"use strict";var s=i(95171),r=i(43370),n=i(50151),o=i(10066),a=i(11542),l=(i(62168),i(14483));const c=(0,o.getChartingLibraryGlobalContext)();JSON.parse(c.urlParams.disabledFeatures).forEach((e=>{l.setEnabled(e,!1)})),JSON.parse(c.urlParams.enabledFeatures).forEach((e=>{l.setEnabled(e,!0)}));i(58005);var h=i(85804),d=(i(89173),i(56840));const u=(0,o.getChartingLibraryGlobalContext)(),p=(0,o.getChartingLibraryOwner)();u.__settingsOverrides=p.settingsOverrides||{};const _=p.settingsAdapter;null!=_?(d.setSettingsAdapter(_),d.sync()):l.enabled("use_localstorage_for_settings")&&d.sync();var m=i(46501);const g=(0,o.getChartingLibraryGlobalContext)();g.urlParams.customFontFamily&&(0,m.setChartFontFamily)(g.urlParams.customFontFamily);var f=i(38881);class v extends f.ChunkLoader{_startLoading(){return Promise.all([i.e(3236),i.e(2666),i.e(4015),i.e(3842),i.e(6),i.e(5649),i.e(8056),i.e(5993),i.e(6752),i.e(8149),i.e(6639),i.e(6036),i.e(6106),i.e(5166),i.e(1033),i.e(4894),i.e(6025),i.e(3939),i.e(6949),i.e(524),i.e(1803),i.e(962),i.e(2544),i.e(2052),i.e(5516)]).then(i.bind(i,2464)).then((e=>e.getRestrictedToolSet()))}}var S=i(69774),y=i(24899);function b(e=[],t=[]){const i=document.createElement("div"),s=document.createElement("div");return i.appendChild(s),i.classList.add(y.container),s.classList.add(y.inner),e.forEach((e=>{i.classList.add(y[e])})),t.forEach((e=>{i.classList.add(y[e])})),i}class w extends f.ChunkLoader{constructor(e,t){super(),this._toolsBootloader=e,this._headerProps=t,this._headerProps.resizerBridge.negotiateHeight(S.HEADER_TOOLBAR_HEIGHT_EXPANDED),this._headerProps.resizerBridge.container.value().appendChild(b())}_startLoading(){return Promise.all([this._toolsBootloader.load(),this._loadHeaderToolbar()]).then((([e,t])=>new t(this._headerProps.resizerBridge.container.value(),{...this._headerProps,tools:e})))}_loadHeaderToolbar(){return Promise.all([i.e(3066),i.e(962),i.e(6918),i.e(3005)]).then(i.bind(i,46618)).then((e=>e.HeaderToolbarRenderer))}}var C=i(14873),P=i(9438);class x extends f.ChunkLoader{constructor(e){super(),this._opts=e,C.isDrawingToolbarVisible.value()&&(this._opts.resizerBridge.negotiateWidth(P.TOOLBAR_WIDTH_EXPANDED),this._opts.resizerBridge.container.value().appendChild(b()))}_startLoading(){return Promise.all([i.e(3175),i.e(2666),i.e(4015),i.e(3842),i.e(5649),i.e(5993),i.e(6752),i.e(6036),i.e(3980),i.e(5166),i.e(1033),i.e(1109),i.e(3939),i.e(3914),i.e(962),i.e(1740),i.e(2544),i.e(1890),i.e(5664),i.e(2846),i.e(2878)]).then(i.bind(i,75038)).then((e=>new e.DrawingToolbarRenderer(this._opts.resizerBridge.container.value(),{...this._opts})))}}var T=i(66501),I=i(32563),M=i(11014),A=i(45345);var L=i(58844),k=i(4741),D=i(3343);function E(e){if("number"==typeof e)return e;switch(e.toLowerCase()){case"ctrl":return D.Modifiers.Control;case"shift":return D.Modifiers.Shift;case"alt":return D.Modifiers.Alt;default:return e.toUpperCase().charCodeAt(0)}}function V(e){let t=0;for(let i=0;i{if(!z)return void this._renameActionHandler(e,t,s,r);const{newValue:n,dialogClose:o}=e,l=(await this._doLoad()).find((e=>e.name===n));o(),void 0!==l?this._hide=await(0,H.showConfirm)({title:a.t(null,void 0,i(56996)),text:a.t(null,void 0,i(30192)),onConfirm:({dialogClose:e})=>{e(),this._doOverwriteExistingLayout(l.id,n,t,s,r)},onCancel:({dialogClose:e})=>{e(),this._showRenameDialog(n,t,s,r)}}):this._renameActionHandler({newValue:n,dialogClose:o},t,s,r)},onClose:()=>this._visibility.setValue(!1)})}_doSaveCurrentLayout(e,t,i,s){const r=this._chartWidgetCollection.metaInfo.name.value();this._chartWidgetCollection.metaInfo.name.setValue(e),this._doSave(t,i,(()=>{this._chartWidgetCollection.metaInfo.name.setValue(r),null==s||s()}))}_doOverwriteExistingLayout(e,t,i,s,r){const n=this._chartWidgetCollection.metaInfo.name.value();this._chartWidgetCollection.metaInfo.id.setValue(e),this._chartWidgetCollection.metaInfo.name.setValue(t),this._doSave(i,s,(()=>{this._chartWidgetCollection.metaInfo.name.setValue(n),null==r||r()}))}}class j extends U{cloneChart(){this._cloneChart().then((()=>this._visibility.setValue(!0)))}show(){(0,O.checkAuthBeforeSaveLoad)((()=>this.cloneChart()),{source:"Clone chart"})}_renameDialogTitle(){return a.t(null,void 0,i(87898))}_renameDialogText(){return a.t(null,void 0,i(24435))+":"}_renameActionHandler({newValue:e,dialogClose:t}){l.enabled("saveload_storage_customization")&&this._doCloneCurrentLayout(e),t()}async _cloneChart(){let e;try{e=await W()}catch(e){return void showErrorDialog({content:a.t(null,void 0,i(56670))})}e&&(this._hide=await this._showRenameDialog(this._getInitialRenameDialogInput()))}_doCloneCurrentLayout(e){const t=this._chartWidgetCollection.metaInfo.name.value();this._chartWidgetCollection.metaInfo.uid.deleteValue(),this._chartWidgetCollection.metaInfo.id.deleteValue(),this._chartWidgetCollection.metaInfo.name.setValue(e),this._doSave(void 0,void 0,(()=>{this._chartWidgetCollection.metaInfo.name.setValue(t)}))}_getInitialRenameDialogInput(){return a.t(null,{context:"ex: AAPL chart copy"},i(16493)).format({title:this._chartWidgetCollection.metaInfo.name.value()})}}class G extends U{show(e,t,i){const s="function"==typeof e?e:void 0;this._saveNewChart(s,t,i).then((()=>this._visibility.setValue(!0)))}_renameDialogTitle(){return a.t(null,void 0,i(10520))}_renameDialogText(){return a.t(null,void 0,i(24435))+":"}_renameActionHandler({newValue:e,dialogClose:t},i,s,r){this._doSaveCurrentLayout(e,i,s,r),t()} +async _saveNewChart(e,t,s){let r;try{r=await W()}catch(e){return void showErrorDialog({content:a.t(null,void 0,i(56670))})}const n=this._chartWidgetCollection.metaInfo.name.value();this._hide=await this._showRenameDialog(n,e,t,s)}}class q extends U{show(){(0,O.checkAuthBeforeSaveLoad)((()=>this._show()),{source:"Rename chart"})}_renameDialogTitle(){return a.t(null,void 0,i(4142))}_renameDialogText(){return a.t(null,void 0,i(24435))+":"}_renameActionHandler({newValue:e,dialogClose:t}){this._doSaveCurrentLayout(e),t()}async _show(){await this._renameChart(),this._visibility.setValue(!0)}async _renameChart(){const e=this._chartWidgetCollection.metaInfo.name.value();this._hide=await this._showRenameDialog(e)}}class ${constructor(e,t){var i;if(this._autosaveTimer=null,this._watchedAutoSaveEnabled=new R.WatchedValue,this._toggleAutoSaveEnabledHandler=this._toggleAutoSaveEnabled.bind(this),this._doSave=(e,t,i,s)=>{const r=this._chartWidgetCollection;void 0!==e&&e();const n=this._chartChangesWatcher.changes();this._chartSaver.saveChartSilently((e=>{var i;i=r.metaInfo.uid.value(),"/chart/"===location.pathname&&(location.href="/chart/"+i),void 0!==t&&t(e)}),(()=>{void 0!==i&&i()}),{autoSave:Boolean(s),changes:n})},this._doLoad=()=>F.backend.getCharts(),this._chartWidgetCollection=e,this._chartSaver=t,this._createController=new G(e,this._doSave,this._doLoad),this._renameController=new q(e,this._doSave,this._doLoad),this._saveAsController=new j(e,this._doSave,this._doLoad),this._chartChangesWatcher=new T.ChartChangesWatcher(e,t,N),e.saveKeysPressed().subscribe(this,this.saveChartOrShowTitleDialog),this._chartChangesWatcher.getOnChange().subscribe(this,this._onStateChanged),l.enabled("saveload_separate_drawings_storage")){const e=!0;e&&this._enableAutoSave(),this._watchedAutoSaveEnabled.setValue(e),this._watchedAutoSaveEnabled.subscribe(this._toggleAutoSaveEnabledHandler),null===(i=this._autoSaveEnabledSetting)||void 0===i||i.getOnChange().subscribe(this,this._autoSaveEnabledSettingHandler)}}autoSaveEnabled(){return this._watchedAutoSaveEnabled}destroy(){var e;l.enabled("saveload_separate_drawings_storage")&&(this._watchedAutoSaveEnabled.unsubscribe(),delete this._watchedAutoSaveEnabled,null===(e=this._autoSaveEnabledSetting)||void 0===e||e.destroy(),delete this._autoSaveEnabledSetting)}getCreateController(){return this._createController}getRenameController(){return this._renameController}getSaveAsController(){return this._saveAsController}cloneChart(){this._saveAsController.cloneChart()}saveChartAs(){this._saveAsController.show()}renameChart(){this._renameController.show()}saveNewChart(e,t,i){this._createController.show(e,t,i)}saveExistentChart(e,t,i){this._doSave(e,t,i)}changes(){return this._chartChangesWatcher.changes()}hasChanges(){return 0!==this._chartChangesWatcher.changes()}saveChartOrShowTitleDialog(e,t,i){const s=window.saver.isSaveInProcess(),r=this._chartChangesWatcher.hasChanges(),n=!!this._chartWidgetCollection.metaInfo.id.value();window.is_authenticated&&(s||!r&&n)||(0,O.checkAuthBeforeSaveLoad)((()=>{ +null!=this._chartWidgetCollection.metaInfo.id.value()?this.saveExistentChart(e,t,i):this.saveNewChart(e,t,i)}),{source:"Save chart",sourceMeta:"Chart"})}saveToJSON(e){return this._chartSaver.saveToJSON(e)}saveChartSilently(e,t,i){this._chartSaver.saveChartSilently(e,t,i)}setAutoSaveEnabled(e){window.is_authenticated&&window.saver.isSaveInProcess()||(0,O.checkAuthBeforeSaveLoad)((()=>{this._watchedAutoSaveEnabled.setValue(e)}),{source:"AutoSave chart"})}saveChartLineTools(e,t,i,s){return this._chartSaver.saveChartLineTools(e,t,i,s)}layoutId(){return this._chartWidgetCollection.metaInfo.uid.value()}_autoSaveEnabledSettingHandler(e){0}_toggleAutoSaveEnabled(e){}_enableAutoSave(){0}_disableAutoSave(){0}_onStateChanged(e){e?this._startAutosave():this._stopAutosave()}_startAutosave(){l.enabled("charts_auto_save")&&null===this._autosaveTimer&&(this._autosaveTimer=setTimeout((()=>{this._autosaveTimer=null,this._chartWidgetCollection.metaInfo.id.value()&&this._doSave(void 0,void 0,void 0,!0)}),6e4))}_stopAutosave(){null!==this._autosaveTimer&&(clearInterval(this._autosaveTimer),this._autosaveTimer=null)}}var Y=i(10638),K=i(51768),Z=i(57898);const X=(0,i(59224).getLogger)("Platform.StudyTemplates"),J=a.t(null,void 0,i(97065));class Q{constructor(e){this._chartWidgetCollection=e.chartWidgetCollection,this._favoriteStudyTemplatesService=e.favoriteStudyTemplatesService,window.loginStateChange.subscribe(null,F.backend.invalidateStudyTemplatesList),this._list=new R.WatchedValue([]),this._onChange=new Z.Delegate,this._list.subscribe((()=>this._onChange.fire()))}findRecordByName(e){return this._list.value().find((t=>t.name===e))||null}showSaveAsDialog(){const e=this._chartWidgetCollection.activeChartWidget.value().model();Promise.all([i.e(2666),i.e(956),i.e(2109),i.e(5145),i.e(855),i.e(6),i.e(2191),i.e(6221),i.e(3502),i.e(6639),i.e(4215),i.e(6884),i.e(3610),i.e(7149),i.e(962),i.e(6408),i.e(5057),i.e(7550),i.e(6631)]).then(i.bind(i,13932)).then((t=>{new t.StudyTemplateSaver({controller:e,onSave:e=>{this._list.setValue(e)}}).show()}))}applyTemplate(e){const t=this.findRecordByName(e);null!==t?window.runOrSignIn((()=>{const e=this._chartWidgetCollection.activeChartWidget.value(),i=i=>{(0,K.trackEvent)("GUI","Load Study Template"),e.model().applyStudyTemplate(JSON.parse(i.content),t.name)};void 0!==t.id?t.is_default?F.backend.getStandardStudyTemplateContentById(t.id,i):F.backend.getStudyTemplateContentById(t.id,i):F.backend.getStudyTemplateContent(t.name).then(i)}),{source:"Study templates apply"}):X.logNormal(`Template ${e} not found in cache`)}deleteStudyTemplate(e,t){const i=this.findRecordByName(e);null!==i?this._removeTemplate(i,t):X.logNormal(`Template ${e} not found in cache`)}list(){return this._list.value()}getOnChange(){return this._onChange}refreshStudyTemplateList(e){F.backend.getStudyTemplatesList().then((t=>{this._list.setValue(t),void 0!==e&&e()}))}invalidate(){F.backend.invalidateStudyTemplatesList()}_removeTemplate(e,t){window.runOrSignIn((()=>{(0,H.showConfirm)({text:J.format({name:e.name}), +onConfirm:({dialogClose:i})=>new Promise((s=>{const r=()=>{this.refreshStudyTemplateList((()=>{const r=this.list();this._list.setValue(r.filter((t=>t!==e))),this._favoriteStudyTemplatesService&&this._favoriteStudyTemplatesService.remove(e.name),s(),i(),null==t||t()}))};F.backend.invalidateStudyTemplatesList(),void 0!==e.id?F.backend.removeStudyTemplateById(e.id,r):F.backend.removeStudyTemplate(e.name).then(r)}))})}),{source:"Study templates delete"})}}var ee=i(35423),te=i(82992),ie=i(83854),se=i(1763);class re{constructor(e,t){this._visibility=new R.WatchedValue(!1),this._dialogPromise=null,this._dialog=null,this._chartWidgetCollection=e,this._options=t}visible(){return this._visibility.readonly()}show(e,t,i){var s,r,n;const o=Array.isArray(e)?e:[],a=Array.isArray(e)?void 0:e;null===this._dialog&&this._requestDialog(null!=o?o:[],t,i,a),null===(s=this._dialog)||void 0===s||s.open(null!=o?o:[],null===(n=null===(r=this._options)||void 0===r?void 0:r.indicatorsPreloader)||void 0===n?void 0:n.getIndicatorPromises(),t,i,a)}hide(){var e;null===(e=this._dialog)||void 0===e||e.hide()}getDialog(){return this._dialog}resetAllPages(){var e;null===(e=this._dialog)||void 0===e||e.resetAllStudies()}_requestDialog(e,t,s,r){if(null===this._dialogPromise){let n;n=Promise.all([i.e(2666),i.e(956),i.e(2109),i.e(5145),i.e(855),i.e(2191),i.e(2587),i.e(6752),i.e(7350),i.e(6494),i.e(962),i.e(6408),i.e(5057),i.e(6456)]).then(i.bind(i,57979)).then((e=>new e.IndicatorsLibraryContainer(this._chartWidgetCollection,this._options))),this._dialogPromise=n.then((i=>{var n,o;this._dialog=i,this._dialog.visible().subscribe((e=>{this._visibility.setValue(e)})),this._dialog.open(e,null===(o=null===(n=this._options)||void 0===n?void 0:n.indicatorsPreloader)||void 0===o?void 0:o.getIndicatorPromises(),t,s,r)}))}return this._dialogPromise}}var ne=i(21097),oe=i(51608),ae=i(30888),le=i(36174),ce=i(63821),he=i(78159),de=i(3228),ue=i(83407),pe=i(16164),_e=i(41249),me=i(38618),ge=i(96429);const fe=/^Etc\/GMT([+-])(\d{1,2}):?(\d\d)?$/,ve=new Map;function Se(e){if(ve.has(e))return ve.get(e);const t=fe.test(e);return ve.set(e,t),t}const ye=new Map;function be(e){if(ye.has(e))return ye.get(e);const t=function(e){const t=e.match(fe);if(!t)return 0;const i="+"===t[1]?-1:1;return 60*(60*parseInt(t[2],10)+parseInt(t[3]||"0",10))*i}(e),i={time:[1924992e3+t],offset:[t]};return ye.set(e,i),i}let we=null;const Ce=new Map;class Pe{constructor(){this._customTimezones=new Map}addTimezones(e){e.forEach((e=>{const{id:t,...i}=e;this._addTimezone(t,i)})),this.updateChartTimezones()}listTimezoneIds(){return[...this._customTimezones.keys()]}listTimezones(){return[...this._customTimezones.entries()].map((([e,t])=>({id:e,...t})))}getTimezoneInfo(e){if(!this.timezoneIsAvailable(e))throw new Error("Provided timezone alias is not within the list of supported timezones.");return(0,n.ensure)(this._customTimezones.get(e))}getAllTimezoneInfo(){return this.listTimezones()}getAliasTimezone(e){return this.getTimezoneInfo(e).alias}timezoneIsAvailable(e){return this._customTimezones.has(e)} +updateChartTimezones(){(0,me.updateAvailableTimezones)(this.getAllTimezoneInfo())}getTimezoneData(e){if(Ce.has(e))return Ce.get(e);let t=null;if(Se(e))t=be(e);else if(this.timezoneIsAvailable(e)){const i=this.getAliasTimezone(e);ge.tzData[i]&&(t=ge.tzData[i]),!t&&Se(i)&&(t=be(i))}return t&&Ce.set(e,t),t}static instance(){return null===we&&(we=new Pe),we}_addTimezone(e,t){try{if((0,n.ensure)(e,"Custom timezone ID"),(0,n.ensure)(t.alias,"Custom timezone alias"),(0,n.ensure)(t.title,"Custom timezone title"),(0,me.timezoneIsAvailable)(e)&&!this.timezoneIsAvailable(e))throw new Error("Custom timezone id already exists.");if(!(0,me.timezoneIsSupported)(t.alias)&&!Se(t.alias))throw new Error("Custom timezone alias is not a supported timezone.");if(e.length<1)throw new Error("Custom timezone id is empty");if(t.title.length<1)throw new Error("Custom timezone title is empty");this._customTimezones.set(e,t)}catch(e){console.warn(`Unable to add custom timezone. ${e}`)}}}(0,_e.setCustomTimezones)(Pe);var xe=i(42226);let Te=null;var Ie=i(36274),Me=i(31940);class Ae{constructor(e){this._document=e,this.isFullscreen=new R.WatchedValue;const t=()=>{const e=["fullscreenElement","webkitFullscreenElement","mozFullscreenElement","mozFullScreenElement","msFullscreenElement"];for(let t=0;t{this.isVisible.setValue(!e[r])},i(),e.addEventListener(t,i,!1);break}}this.destroy=()=>{i&&(e.removeEventListener(t,i,!1),i=null)}}}var ke=i(84015),De=i(49483);function Ee(e,t){let i=0;for(const{min:s,max:r}of t){if(e0&&t.push({min:e,max:s})}return t.sort(((e,t)=>e.min-t.min||e.max-t.max)),t}function Be(e,t){if(e.length!==t.length)return!1;for(let i=e.length;i--;){if(e[i].min!==t[i].min)return!1;if(e[i].max!==t[i].max)return!1}return!0}const Re=l.enabled("no_min_chart_width"),Ne=l.enabled("bypass_chart_height_check");function Oe(e){ +const t=l.enabled("side_toolbar_in_fullscreen_mode"),i=l.enabled("header_in_fullscreen_mode");return"center"===e||"left"===e&&t||"top"===e&&i}var Fe=i(2438),We=i(98310),He=i(16216),ze=(i(26665),i(3162)),Ue=i.n(ze),je=i(241),Ge=i(88348),qe=i(15367),$e=i(68335);const Ye=["LineToolTrendLine","LineToolRay","LineToolInfoLine","LineToolExtended","LineToolRegressionTrend","LineToolRotatedRectangle","LineToolParallelChannel","LineToolFlatBottom","LineToolDisjointAngle","LineToolPitchfork","LineToolSchiffPitchfork","LineToolSchiffPitchfork2","LineToolInsidePitchfork","LineToolVertLine","LineToolCrossLine","LineToolHorzLine","LineToolHorzRay","LineToolTrendAngle"];function Ke(e,t=!1,s=!1){if(!l.enabled("popup_hints"))return;const r=e.getContainer();let o=null,c=null;function h(e,t){if(o)o.show(e,p.bind(null,t));else{const s=Ge.tool.value();Promise.all([i.e(6214),i.e(962),i.e(6166)]).then(i.bind(i,5015)).then((i=>{o=new i.ChartEventHintRenderer(r),s===Ge.tool.value()&&o.show(e,p.bind(null,t))}))}}function u(e){return!Boolean(d.getBool(e))}function p(e){d.setValue(e,!0,{forceFlush:!0}),(0,n.ensureNotNull)(o).destroy(),null!==c&&c(),o=null}Ge.tool.subscribe((function(){const e=Ge.tool.value(),t=De.CheckMobile.any();if(s&&t&&function(e){return Ye.includes(e)}(e))return void async function(e){0}();if(!u("hint.touchPainting"))return;const r=(0,qe.isLineToolDrawWithoutPoints)(e);!(0,qe.isStudyLineToolName)(e)||"LineToolRegressionTrend"===e||r||t?(0,qe.isLineToolName)(e)&&!(0,qe.isLineDrawnWithPressedButton)(e)&&!r&&t?h(a.t(null,void 0,i(67861)),"hint.touchPainting"):o&&o.hide():h(a.t(null,void 0,i(32234)),"hint.touchPainting")})),Ge.createdLineTool.subscribe(null,(function(){const e=Ge.tool.value();"LineToolPath"===e&&u("hint.finishBuildPathByDblClick")?h(a.t(null,void 0,i(5828)),"hint.finishBuildPathByDblClick"):"LineToolPolyline"===e&&u("hint.finishBuildPolylineByDblClick")&&h(a.t(null,void 0,i(63898)),"hint.finishBuildPolylineByDblClick")})),Ge.finishedLineTool.subscribe(null,(function(){if(o){const e=Ge.tool.value();"LineToolPath"===e?p("hint.finishBuildPathByDblClick"):"LineToolPolyline"===e&&p("hint.finishBuildPolylineByDblClick")}})),e.layoutSizesChanged().subscribe((function(){if(!u("hint.startResizingChartInLayout"))return;h(a.t(null,void 0,i(35273)),"hint.startResizingChartInLayout")})),t||De.CheckMobile.any()||!u("hint.startFocusedZoom")||(c=function(e,t){let i=!1;const s=r=>{r?(i&&t(r),e.onZoom().unsubscribe(null,s)):i||(t(r),i=!0)};return e.onZoom().subscribe(null,s),()=>e.onZoom().unsubscribe(null,s)}(e,(function(e){if(!u("hint.startFocusedZoom"))return;if(e)o&&(c=null,p("hint.startFocusedZoom"));else{const e=$e.isMacKeyboard?"⌘":"Ctrl";h(a.t(null,void 0,i(35963)).format({key:e}),"hint.startFocusedZoom")}})))}var Ze=i(2269),Xe=i.n(Ze),Je=i(42856),Qe=i(75117),et=i.n(Qe),tt=(i(24172),i(46544),i(78136)),it=i(88732),st=i(74649),rt=i(97906),nt=i(67980),ot=i(27714),at=i(12481),lt=i(86441),ct=i(34026),ht=i(33013),dt=i(15742),ut=i(18807),pt=i(61345),_t=i(87095),mt=i(88275),gt=i(74359) +;var ft=i(68441),vt=i(34565),St=i(66103),yt=i(70893),bt=i(50946);i(77275);const wt=new Map([["logo-old-style",bt],["tradingview-old-style",yt]]),Ct=l.enabled("adaptive_logo"),Pt=l.enabled("small_no_display"),xt=l.enabled("38914"),Tt="site_branding",It="widget_branding",Mt="widget_referral_branding",At="widget_custom_branding",Lt="widget_custom_no_powered_branding",kt="fundamental_branding",Dt="fundamental_custom_branding",Et="fundamental_custom_no_powered_branding",Vt="library_branding",Bt="library_custom_branding",Rt="library_custom_no_powered_branding",Nt=navigator.userAgent.toLowerCase().indexOf("chrome")>-1&&-1===navigator.userAgent.toLowerCase().indexOf("edge"),Ot=window.urlParams||{},Ft=window.initData||{};Ot.no_referral_id&&enable(Ot.referral_id||"","aggressive");const Wt=a.t(null,void 0,i(26619)),Ht=xt?a.t(null,void 0,i(5607)):a.t(null,void 0,i(68111)),zt=(a.t(null,void 0,i(82128)),a.t(null,void 0,i(88841)),a.t(null,void 0,i(99769)),(0,De.onWidget)(),{brandCircleSize:32,textAsImageWidthCompensation:0,leftOffset:0,bottomOffset:-23,logoLeftOffset:1,maximizedWidthsCompensation:0,logoTextOffset:6});class Ut extends dt.CustomSourceBase{constructor(e,t,i){super(e,t),this._canvasWidth=0,this._paneHeight=0,this._left=13,this._bottom=36,this._layout=Tt,this._needToShow=!0,this._showBranding=!1,this._customLogoSrc="",this._customLogoLink="",this._cubicBezier=new pt.CubicBezier(.4,.01,.22,1),this._openAnimation=null,this._closeAnimation=null,this._powBy=null,this._custom=null,this._destroyed=!1,this._mainSeries=this._model.mainSeries(),this._visible=i,this._showForPro=!t.onWidget();const s=()=>this._model.updateSource(this);this._visible.subscribe(s),this._dark=t.dark().spawn(),this._dark.subscribe(s),this._checkLayout(),this._layout!==At&&this._layout!==Dt||(this._left=8,this._bottom=5);const r=()=>{this._needToShow?this._showBranding=!0:this._showBranding=!1};this._resizeHandlerDelayed=(0,at.default)(r,200),r(),window.addEventListener("resize",this._resizeHandlerDelayed),this._model.isSnapshot()?this._init():(this._mainSeries.dataEvents().symbolResolved().subscribe(this,this._init),null!==this._mainSeries.symbolInfo()&&this._init()),this._renderer={draw:this.draw.bind(this),hitTest:this.hitTest.bind(this)},t.onWidget()||window.loginStateChange.subscribe(this,this._init)}destroy(){window.removeEventListener("resize",this._resizeHandlerDelayed),this._mainSeries.dataEvents().symbolResolved().unsubscribeAll(this),this._powBy&&this._powBy.destroy(),this._model.onWidget()||window.loginStateChange.unsubscribeAll(this),this._visible.release(),this._dark.destroy(),this._destroyed=!0}paneViews(e){if(window.TradingView.printing&&this._layout!==Lt&&this._layout!==Et)return[];if(!this._visible.value())return[];if(this._layout===Tt&&!this._showForPro&&window.user&&window.user.is_pro)return[];const t=l.enabled("move_logo_to_main_pane");let i=!1 +;if(e.maximized().value())i=!0;else if(t)i=this._model.mainPane().collapsed().value()?e===this._model.panes().find((e=>!e.collapsed().value())):e.isMainPane();else if(this._model.lastPane().collapsed().value()){const t=this._model.panes();for(let s=t.length-1;s>=0;--s){const r=t[s];if(!r.collapsed().value()){i=r===e;break}}}else i=e.isLast();return i?[{renderer:this.renderer.bind(this)}]:[]}labelPaneViews(e){return[]}priceAxisViews(e,t){return[]}updateAllViews(){}updateViewsForPane(e){}priceScale(){return null}renderer(e,t){return this._paneHeight=e,this._canvasWidth=t,this._renderer}hasContextMenu(){return!1}onClickOutside(){this._hasAnimation()&&this._startCloseAnimation()}hitTest(e){if(!this._showBranding||l.enabled("logo_without_link"))return null;if(this._powBy&&this._layout!==Lt&&this._layout!==Et&&(this._powBy.hitTest(e)||this._custom&&this._custom.hitTest(e))){const e=!0;return new ut.HitTestResult(ut.HitTarget.Custom,{hideCrosshairLinesOnHover:!0,cursorType:e?St.PaneCursorType.Pointer:St.PaneCursorType.Default,clickHandler:()=>{this._openLink()},tapHandler:()=>{this._hasAnimation()?this._toggleOpenAnimatedOrOpenLink():this._openLink()},mouseEnterHandler:()=>{this._hasAnimation()&&this._startOpenAnimation()},mouseLeaveHandler:()=>{this._hasAnimation()&&this._startCloseAnimation()},mouseDownHandler:()=>{0},mouseUpHandler:()=>{0}})}return null}tvUrl(){var e,t,i;const s="https://"+function(e){return({ar_AE:"ar",de_DE:"de",en:"www",es:"es",ca_ES:"es",fa_IR:"www",fr:"fr",he_IL:"il",id:"id",in:"in",it:"it",ja:"jp",kr:"kr",ms_MY:"my",pl:"pl",br:"br",ru:"ru",sv_SE:"se",th_TH:"th",tr:"tr",uk:"uk",vi_VN:"vn",zh_CN:"cn",zh_TW:"tw"}[e]||"www")+".tradingview.com"}((null!==(t=null===(e=Ft.querySettings)||void 0===e?void 0:e.locale)&&void 0!==t?t:null===(i=Ft.currentLocaleInfo)||void 0===i?void 0:i.language)||"en");let r=new URL(s);if(this._customLogoLink)return this._customLogoLink;if(this._layout===Vt||this._layout===Bt){let e;switch(!0){case l.enabled("charting_library"):e="library";break;case l.enabled("trading_terminal"):e="trading-terminal"}r.searchParams.append("utm_source",window.location.origin),r.searchParams.append("utm_medium","library"),e&&r.searchParams.append("utm_campaign",e)}return r.toString()}draw(e,t){if(!this._showBranding)return;let i=0;Ot.utm=!0,(0,gt.drawScaled)(e,t.pixelRatio,t.pixelRatio,(()=>{if(this._powBy&&this._powBy.show){i=this._powBy.height,e.save();const s=new lt.Point(this._left,this._paneHeight-this._bottom-i);this._powBy.draw(s,e,t,this._canvasWidth),e.restore()}if(this._custom&&this._custom.show){e.save();const s=new lt.Point(this._left,this._paneHeight-this._bottom-i-this._custom.height);this._custom.draw(s,e,t),e.restore()}}))}_init(){this._checkLayout();const e=this._mainSeries.symbolInfo();this._powBy&&this._powBy.destroy(),this._powBy=new Qt(this._layout,(null==e?void 0:e.name)||"",this._model,(()=>this._model.fullUpdate())),this._custom=new ei(this._layout,this._customLogoSrc,(()=>this._model.fullUpdate())),this._openAnimation=null,this._closeAnimation=null, +this._model.lightUpdate()}_checkLayout(){if(l.enabled("widget"))0;else{{const e=JSON.parse(Ot.logo)||{};e.image?(this._customLogoSrc=e.image,this._customLogoLink=e.link,this._needToShow=l.enabled("widget_logo"),l.enabled("link_to_tradingview")?this._layout=Bt:this._layout=Rt):(this._layout=Vt,this._needToShow=l.enabled("widget_logo"))}}}_startOpenAnimation(){null===this._openAnimation&&(null!==this._closeAnimation&&(this._closeAnimation.stop(),this._closeAnimation=null),this._openAnimation=(0,mt.doAnimate)({from:this._currentStateForAnimation(),to:this._openedStateForAnimation(),duration:200,easing:this._cubicBezier.easingFunc,onStep:this._animatedDrawStep.bind(this)}))}_startCloseAnimation(){null===this._closeAnimation&&(null!==this._openAnimation&&(this._openAnimation.stop(),this._openAnimation=null),this._closeAnimation=(0,mt.doAnimate)({from:this._currentStateForAnimation(),to:this._closedStateForAnimation(),duration:200,easing:this._cubicBezier.easingFunc,onStep:this._animatedDrawStep.bind(this)}))}_currentStateForAnimation(){return(0,n.ensureNotNull)(this._powBy).width}_closedStateForAnimation(){return(0,n.ensureNotNull)(this._powBy).minimizedAnimationWidth()}_openedStateForAnimation(){return(0,n.ensureNotNull)(this._powBy).maximizedAnimationWidth()}_animatedDrawStep(e,t){(0,n.ensureNotNull)(this._powBy).animatedDrawStep(e,t),this._model.lightUpdate()}_hasAnimation(){return null!==this._powBy&&this._powBy.hasAnimation()}_openGoPro(){0}_openLink(){if(this._layout===Tt)return this._openGoPro(),!1;l.enabled("widget");return(0,n.ensureNotNull)(window.open(this.tvUrl(),"_blank")).opener=null,!0}_toggleOpenAnimatedOrOpenLink(){null!==this._openAnimation&&this._openAnimation.completed()?this._openLink()||this._startCloseAnimation():this._startOpenAnimation()}}function jt(e){return!Pt||e>480}function Gt(e){return!Ct||e>500}const qt={customBrandingTradingViewText:ht.colorsPalette["color-brand"],customBrandingText:ht.colorsPalette["color-cold-gray-850"],background:ht.colorsPalette["color-cold-gray-900"],shadow:ht.colorsPalette["color-cold-gray-700"],text:ht.colorsPalette["color-white"],staticTextBackground:(0,_t.generateColor)(ht.colorsPalette["color-cold-gray-800"],20),logo:ht.colorsPalette["color-white"]},$t={customBrandingTradingViewText:ht.colorsPalette["color-brand"],customBrandingText:ht.colorsPalette["color-cold-gray-850"],background:ht.colorsPalette["color-white"],shadow:ht.colorsPalette["color-cold-gray-150"],text:ht.colorsPalette["color-cold-gray-900"],staticTextBackground:(0,_t.generateColor)(ht.colorsPalette["color-white"],20),logo:ht.colorsPalette["color-cold-gray-900"]};function Yt(e,t){return new Promise((i=>{const s=e.replace(/fill="#[\da-f]{6}"/gi,`fill="${t}"`),r=new Image;r.onload=()=>{r.onload=null,i(r)},r.src=URL.createObjectURL(new Blob([s],{type:"image/svg+xml"}))}))}let Kt={},Zt={};function Xt(e,t,i,s){const r=Zt,o=[e,t,s&&"tradeWith"].filter(Boolean).join("-"),a=r[o];if(void 0!==a)return a;const[l,c]=function(e,t){ +return t?["logo-trade-with","tradingview-trade-with"]:["logo-old-style","tradingview-old-style"]}(0,s),h=(0,n.ensureDefined)(wt.get(l)),d=(0,n.ensureDefined)(wt.get(c)),u=Yt(h,t),p=Yt(d,t);return Promise.all([u,p]).then((([e,t])=>{const s={logoImage:e,textImage:t};r[o]=s,i(s)})),null}class Jt{constructor(){this._topLeftPoint=null}hitTest(e){const t=this._getHitTestBox();if(t)return(0,ct.pointInBox)(e,t)}_getHitTestBox(){const e=this._topLeftPoint;if(e){const{x:t,y:i}=e;return(0,lt.box)(e,new lt.Point(t+this.width,i+this.height))}}}class Qt extends Jt{constructor(e,t,i,s){super(),this.show=!0,this.hovered=!1,this.active=!1,this._needDisplayImage=!1,this._animatedWidth=zt.brandCircleSize,this._font=`px ${m.CHART_FONT_FAMILY}`,this._txt="TradingView",this._textWidth=0,this._maximizedAnimationTextWidth=0,this._textWidthCache=new vt.TextWidthCache,this._pixelRatio=1,this._onLogoImageReady=e=>{this._requestRepaint()},this._model=i,this._layout=e,this._symbol=t,this._showTradeWithLogo=!1,this._showAnimatedBranding=l.enabled("show_animated_logo")||this._layout===It,this._alwaysMaximized=l.enabled("logo_always_maximized")||!1,this._fontSize=this._showAnimatedBranding||this._layout===Mt?11:14,this._showAnimatedBranding||this._layout!==At&&this._layout!==Dt||(this._fontSize=12),this.width=zt.brandCircleSize,this.height=this._fontSize+2,this._requestRepaint=s,this._init(),this._checkFontLoaded(),this._recalculateMetrics()}destroy(){this._model.properties().childs().paneProperties.childs().background.unsubscribeAll(this),this._model.onChartThemeLoaded().unsubscribeAll(this)}hasAnimation(){return this._showAnimatedBranding&&!this._alwaysMaximized}minimizedAnimationWidth(){return zt.brandCircleSize}maximizedAnimationWidth(){return zt.brandCircleSize+zt.logoTextOffset+this._maximizedAnimationTextWidth}animatedDrawStep(e,t){this._animatedWidth=t}draw(e,t,i,s){const{brandCircleSize:r,logoLeftOffset:n,leftOffset:o,bottomOffset:a}=zt;this._needDisplayImage&&jt(s)&&(e=new lt.Point(e.x+o,e.y-a)),this._topLeftPoint=e,t.translate(e.x,e.y),i.pixelRatio!==this._pixelRatio&&(this._textWidthCache.reset(),this._pixelRatio=i.pixelRatio);const l=this._colors;if(this._showAnimatedBranding){const e=this._getLogoImage(l.logo);this._needDisplayImage&&e&&this._drawLogo(t,e,this._animatedWidth,this._animatedWidth-r,this._animatedWidth>r)}else if(this._layout===At||this._layout===Dt){t.font=this._fontSize+this._font;const e=t.measureText(this._txt).width+2;this.width=e+t.measureText("TradingView").width+2,t.save(),t.globalAlpha=.7,t.fillStyle=this._colors.customBrandingText,t.fillText(this._txt,0,12),t.fillStyle=this._colors.customBrandingTradingViewText,t.fillText("TradingView",e,12),t.restore()}else if(jt(s)&&this._layout===Mt){const e=this._getLogoImage(l.logo),i=this.maximizedAnimationWidth();e&&this._drawLogo(t,e,i,i,!0)}else if(jt(s)){const e=this._getLogoImage(l.logo);if(this._needDisplayImage&&e){t.save(),this._drawBgCircle(t,r/2);const i=new lt.Point(Math.round((r-e.logoImage.width)/2)-1+n,Math.floor((r-e.logoImage.height)/2)+1) +;this._drawLogoImage(t,i,e.logoImage);const o=Gt(s);o&&(t.translate(r+5,Math.round(this._fontSize*("px EuclidCircular"===this._font?.1:0))),this._drawTextStroke(t),this._drawTextFill(t)),t.restore(),this.width=r,o&&(this.width+=this._maximizedAnimationTextWidth)}else{const e=Gt(s);e&&(t.save(),t.translate(Nt?-.5:0,-.5),this._drawTextStroke(t),this._drawTextFill(t),t.restore()),e&&(this.width=this._maximizedAnimationTextWidth)}}else this.width=0}showTradeWithLogo(e){this._showTradeWithLogo=e}_drawTradeWithLogo(e,t,i){0}_drawLogo(e,t,i,s,r){const{brandCircleSize:n,logoLeftOffset:o,logoTextOffset:a}=zt;e.save(),this._drawFillRectWithRoundedCorner(e,-.5,0,i,n,n/2);const l=new lt.Point(Math.round((n-t.logoImage.width)/2)-1+o,Math.floor((n-t.logoImage.height)/2)+1);if(this._drawLogoImage(e,l,t.logoImage),r){const i=new lt.Point(l.x+t.logoImage.width+a,l.y);this._drawImageCropWidth(e,i,t.textImage,s),this.width=t.logoImage.width+Math.min(t.textImage.width,s)}e.restore()}_init(){Zt={},Kt={},this._checkLayout(),this.show&&(this._updateColors(),this.height=this._needDisplayImage?zt.brandCircleSize:this._fontSize+2,this._model.properties().childs().paneProperties.childs().background.subscribe(this,this._updateColors),this._model.onChartThemeLoaded().subscribe(this,this._updateColors))}_checkFontLoaded(){if(!this._showAnimatedBranding&&document.fonts&&document.fonts.check&&document.fonts.load){document.fonts.check(`${this._fontSize}px EuclidCircular`)?this._font="px EuclidCircular":document.fonts.load(`${this._fontSize}px EuclidCircular`,this._txt).then((()=>{this._font="px EuclidCircular",this._recalculateMetrics(),this._requestRepaint()}))}}_recalculateMetrics(){const e=(0,gt.createDisconnectedCanvas)(document,(0,ot.size)({width:0,height:0})),t=(0,gt.getPrescaledContext2D)(e);t.font=this._fontSize+this._font;const i=this._needDisplayImage?Xt(this._model.dark().value()?"dark":"light",this._colors.logo,(()=>this._recalculateMetrics())):null;this._textWidth=i?i.textImage.width+zt.textAsImageWidthCompensation:Math.ceil(t.measureText(this._txt).width)+2+8;let s=this._textWidth;s%2==0&&(s+=1),this._maximizedAnimationTextWidth=s,this._textWidthCache.reset(),this._alwaysMaximized&&(this._animatedWidth=this.maximizedAnimationWidth())}_updateColors(){this._colors=this._model.dark().value()?qt:$t}_getLogoImage(e){return Xt(this._model.dark().value()?"dark":"light",e,this._onLogoImageReady,this._showTradeWithLogo)}_checkLayout(){switch(this._layout){case It:case Mt:case At:case kt:case Dt:case Bt:case Vt:case Tt:this.show=!0;break;case Lt:case Et:case Rt:this.show=!1}switch(this._layout){case Vt:this._needDisplayImage=!0,this._txt=Wt;break;case Bt:this._txt=Ht}}_drawTextStroke(e){e.save(),e.textBaseline="middle",e.textAlign="start",e.font=this._fontSize+this._font,e.strokeStyle=this._colors.staticTextBackground,e.lineWidth=4,e.lineJoin="round",e.strokeText(this._txt,0,zt.brandCircleSize/2+this._textWidthCache.yMidCorrection(e,this._txt)),e.restore()}_drawTextFill(e){e.save(),e.textBaseline="middle",e.textAlign="start", +e.font=this._fontSize+this._font,e.fillStyle=this._colors.text,e.fillText(this._txt,0,zt.brandCircleSize/2+this._textWidthCache.yMidCorrection(e,this._txt)),e.restore()}_drawImageCropWidth(e,t,i,s){e.save(),e.beginPath(),e.rect(t.x,t.y,s,this.height),e.clip(),e.drawImage(i,t.x,t.y),e.restore()}_drawBgCircle(e,t){const i=2*Math.PI;e.save(),e.beginPath(),e.fillStyle=this._colors.shadow,e.arc(t,t,t+1,0,i),e.fill(),e.closePath(),e.restore(),e.save(),e.beginPath(),e.fillStyle=this._colors.background,e.arc(t,t,t,0,i,!1),e.fill(),e.closePath(),e.restore()}_drawFillRectWithRoundedCorner(e,t,i,s,r,n,o){e.save(),(0,ft.drawRoundRect)(e,t-1,i-1,s+2,r+2,n),e.fillStyle=this._backgroundShadowFillStyle(),e.fill(),e.closePath(),e.restore(),e.save(),(0,ft.drawRoundRect)(e,t,i,s,r,null!=o?o:n),e.fillStyle=this._backgroundFillStyle(),e.fill(),e.closePath(),e.restore()}_tradeWithLogoBackgroundColor(){return""}_backgroundShadowFillStyle(){return this._colors.shadow}_backgroundFillStyle(){return this._colors.background}_drawLogoImage(e,t,i){e.drawImage(i,t.x,t.y)}}class ei extends Jt{constructor(e,t,i){super(),this.show=!1,this.width=0,this.height=0,this._ready=!1,this._layout=e,this._src=t,this._onReadyCallback=i,this._checkLayout();const s=new Image;this._img=s,this.show&&(s.addEventListener("load",(()=>{this.width=Math.round(s.width),this.height=Math.round(s.height),this._ready=!0,this._onReadyCallback&&this._onReadyCallback()})),s.crossOrigin="anonymous",s.src=this._src)}draw(e,t,i){this._topLeftPoint=e,this._ready&&(t.translate(e.x,e.y),t.drawImage(this._img,-.5,-.5,this.width,this.height))}_checkLayout(){switch(this._layout){case At:case Lt:case Dt:case Et:case Bt:case Rt:this.show=!0;break;case Tt:case It:case Mt:case kt:case Vt:this.show=!1}}}var ti=i(97304),ii=i(65106);class si{constructor(e,t){this._headerToolbar=e,this._dropdownId=t}applyOptions(e){this._headerToolbar.updateDropdown(this._dropdownId,e)}remove(){this._headerToolbar.removeDropdown(this._dropdownId)}}var ri=i(90194),ni=i(75593);class oi{constructor(e){this._symbolModel=e}getVisible(){return this._symbolModel.visible().value()}setVisible(e){return this._symbolModel.visible().setValue(e),this}getIcon(){return this._symbolModel.icon().value()}setIcon(e){return this._symbolModel.icon().setValue(e),this}getColor(){return this._symbolModel.color().value()}setColor(e){return this._symbolModel.color().setValue(e),this}getTooltip(){return this._symbolModel.tooltip().value()}setTooltip(e){return this._symbolModel.tooltip().setValue(e),this}getDropDownContent(){return this._symbolModel.tooltipContent().value()}setDropDownContent(e){return this._symbolModel.tooltipContent().setValue(e),this}}class ai{symbol(e){return new oi(this._model().getSymbolCustomStatus(e))}hideAll(){this._model().hideAll()}static getInstance(){return null===this._instance&&(this._instance=new ai),this._instance}_model(){return ni.CustomStatusModel.getInstance()}}ai._instance=null;var li=i(39347),ci=i(16838);var hi,di=i(98731),ui=i(71026),pi=i(78325),_i=i(37292);(0,I.setClasses)();const mi=(0, +o.getChartingLibraryGlobalContext)(),gi=(0,o.getChartingLibraryOwner)(),fi=new class{constructor(e,t){this._updateDocumentHeight=e=>{"visual"===this._viewportType&&this._window.document.documentElement.style.setProperty("height",`${e}px`,"important")},this._window=e,this._fullscreenApi=new Ae(e.document),this._viewportType=De.CheckMobile.iOS()&&!(0,ke.isOnMobileAppPage)("any")&&this._window.visualViewport?"visual":"quirks","visual"===this._viewportType?this._viewport=(0,n.ensure)(this._window.visualViewport):this._viewport=this._window;const i=this._layoutSizeSensor=this._window.document.createElement("div");i.id="layout-size-sensor",i.style.position="fixed",i.style.top="0",i.style.left="0",i.style.right="0",i.style.bottom="0",i.style.pointerEvents="none",i.style.visibility="hidden",this._initFullscreen()}allocate(){this.free();const e=this._window.document,t=e.createElement("div");t.classList.add("js-rootresizer__contents"),t.style.position="relative",t.style.width="100%",t.style.height="100%",e.body.insertAdjacentElement("afterbegin",t),e.body.insertAdjacentElement("afterbegin",this._layoutSizeSensor),this._visibilityApi=new Le(this._window.document);const i={alive:new R.WatchedValue(!0),fullscreenable:new R.WatchedValue(!0),container:new R.WatchedValue(t),width:new R.WatchedValue,height:new R.WatchedValue,availWidth:new R.WatchedValue,availHeight:new R.WatchedValue,visible:this._visibilityApi.isVisible,fullscreen:this._fullscreenApi.isFullscreen,remove:()=>{i.alive.setValue(!1)},attach:()=>{i.alive.setValue(!1),this._window.close()},requestFullscreen:()=>{this._requestFullscreen()},exitFullscreen:()=>{this._exitFullscreen()}};return i.alive.subscribe((e=>{e||i!==this._area||this.free()})),this._area=i,this._resizeHandler=()=>{const e=this._width(i)||800,t=this._height(i)||600;i.availHeight.setValue(t),i.availWidth.setValue(e),i.height.setValue(t),i.width.setValue(e)},this._area.height.subscribe(this._updateDocumentHeight,{callWithLast:!0}),this._resizeHandler(),this._viewport.addEventListener("resize",this._resizeHandler),new Me.ResizerDetacherState(i).bridge()}free(){if(this._resizeHandler&&(this._viewport.removeEventListener("resize",this._resizeHandler),this._resizeHandler=void 0),this._visibilityApi&&(this._visibilityApi.destroy(),this._visibilityApi=void 0),this._area){const e=this._area;this._area=void 0,e.height.unsubscribe(this._updateDocumentHeight),e.alive.setValue(!1);const t=e.container.value(),i=null==t?void 0:t.parentElement;i&&(i.removeChild(t),i.removeChild(this._layoutSizeSensor))}}_height(e){if("visual"===this._viewportType)return this._layoutSizeSensor.clientHeight;return e.container.value().clientHeight}_width(e){return e.container.value().clientWidth}_requestFullscreen(){this._fullscreenApi.enter()}_exitFullscreen(){this._fullscreenApi.exit()}_initFullscreen(){this._fullscreenApi.isFullscreen.subscribe((e=>{this._resizeHandler&&this._resizeHandler()}))}}(window),vi=new class{constructor(e){this._processVisibility=e=>{const t=e.container.value() +;return this.affectsLayout(e.name)?(t&&t.classList.toggle("js-hidden",!1),!0):(t&&t.classList.toggle("js-hidden",!0),!1)},this._setWidth=(e,t,i)=>{let s=i;this._fullscreenArea!==e.name&&(e.availWidth.setValue(i),e.canNegotiate.width&&(s=Ee(i,e.negotiations.width))),t||(s=0);const r=e.container.value();return r&&t&&(r.style.width=s+"px"),e.width.setValue(s),s},this._setHeight=(e,t,i)=>{let s=i;this._fullscreenArea!==e.name&&(e.availHeight.setValue(i),e.canNegotiate.height&&(s=Ee(i,e.negotiations.height))),t||(s=0);const r=e.container.value();return r&&t&&(r.style.height=s+"px"),e.height.setValue(s),s};const t=e.container.value();if(!t)throw new Error("bridge.container.value() must be an element");this._container=t,this._availableAreas=["left","tradingpanel","right","top","bottom","center","topleft","extratop"],this._areas={},this._bridge=e,this._width=e.width,this._height=e.height,this._width.subscribe((()=>this.recalculate())),this._height.subscribe((()=>this.recalculate())),this._bridge.visible.subscribe((()=>this._updateVisibility())),this._bridge.fullscreen.subscribe((()=>this._onParentFullscreenChange())),this.recalculate()}allocate(e){const t=e&&e.areaName;if(-1===this._availableAreas.indexOf(t))throw new Error("unknown options.areaName");this.free(t);const i=this._createDOM(t),s={name:t,canNegotiate:{width:"left"===t||"right"===t||"tradingpanel"===t||"topleft"===t,height:"top"===t||"bottom"===t||"topleft"===t||"extratop"===t},negotiations:{width:[],height:[]},remove:()=>{for(const e in this._areas)this._areas[e]===s&&this.free(e)},negotiateWidth:e=>{if(!s.canNegotiate.width)return;const t=Ve(e);Be(s.negotiations.width,t)||(s.negotiations.width=t,this.recalculate())},negotiateHeight:e=>{if(!s.canNegotiate.height)return;const t=Ve(e);Be(s.negotiations.height,t)||(s.negotiations.height=t,this.recalculate())},requestFullscreen:()=>{this._fullscreenArea||("right"!==t&&"center"!==t||(this._fullscreenArea=t),"center"===t&&this._bridge.requestFullscreen(),this._updateFullscreen())},exitFullscreen:()=>{t===this._fullscreenArea&&(this._fullscreenArea=void 0,"center"===t&&this._bridge.exitFullscreen(),this._updateFullscreen())},width:new R.WatchedValue,height:new R.WatchedValue,availWidth:new R.WatchedValue,availHeight:new R.WatchedValue,alive:new R.WatchedValue(!0),container:new R.WatchedValue(i),visible:new R.WatchedValue(!0),fullscreen:new R.WatchedValue(!1),fullscreenable:new R.WatchedValue("right"===t||"center"===t),rdState:new Me.ResizerDetacherState};return s.rdState.pushOwner(s),this._areas[t]=s,s.rdState.owner.subscribe((e=>{const i=s.container.value();if(e!==s)i&&(i.innerHTML="",i.parentElement&&i.parentElement.removeChild(i));else{let e=null;for(let i=this._availableAreas.indexOf(t);i--;){const t=this._availableAreas[i];if(this.affectsLayout(t)){e=this._areas[t].container.value();break}}i&&(e&&i.parentElement?i.insertAdjacentElement("afterend",e):this._container.appendChild(i))}this.recalculate()}),{callWithLast:!0}),s.rdState.bridge()}free(e){const t=this._areas[e];if(!t)return;this._areas[e]=void 0 +;const i=t.container.value();i&&i.parentElement&&i.parentElement.removeChild(i),t.alive.setValue(!1)}recalculate(){const e={};this._recalcSingleRunToken=e;const t=this._areas.topleft,i=this._areas.left,s=this._areas.tradingpanel,r=this._areas.right,n=this._areas.top,o=this._areas.bottom,a=this._areas.center,l=this._areas.extratop,c=this._width.value(),h=this._height.value();let d=0,u=0,p=0,_=0,m=0,g=0,f=0,v=0;if(e===this._recalcSingleRunToken&&l){const e=this._processVisibility(l);v=this._setHeight(l,e,h),this._setWidth(l,e,c)}if(e===this._recalcSingleRunToken&&t){const e=this._processVisibility(t);f=this._setHeight(t,e,h),g=this._setWidth(t,e,c);const i=t.container.value();e&&i&&(i.style.top=v+"px")}let S=0;if(e===this._recalcSingleRunToken&&n){const e=this._processVisibility(n),t=n.container.value();e&&t&&(t.style.left=g+"px",t.style.top=v+"px");const i=c-g;this._setWidth(n,e,i),d=this._setHeight(n,e,h),d&&(S=1)}if(e===this._recalcSingleRunToken&&i){const e=this._processVisibility(i),t=Math.max(f,d);p=this._setWidth(i,e,c),p&&(p+=4),p&&1===S&&(S=4);const s=i.container.value();e&&s&&(s.style.top=t+v+S+"px"),this._setHeight(i,e,h-t-v)}if(e===this._recalcSingleRunToken&&s){const e=this._processVisibility(s);let t=c-p;Re||(t-=300),m=this._setWidth(s,e,t),m&&1===S&&(S=4),this._setHeight(s,e,h-v-d-S)}if(e===this._recalcSingleRunToken&&r){const e=this._processVisibility(r);let t=c-p-m;Re||(t-=300),_=this._setWidth(r,e,t),_&&1===S&&(S=4),this._setHeight(r,e,h-v-d-S);const i=r.container.value();e&&i&&(i.style.top=d+v+S+"px")}const y=m+_;let b=0,w=c-p-m-_-(y?4:0);const C=Boolean(m||!y);if(!_&&m&&(w+=4),e===this._recalcSingleRunToken&&o){const e=this._processVisibility(o),t=o.container.value();e&&t&&(t.style.left=p+"px",t.classList.toggle("no-border-top-left-radius",!p),t.classList.toggle("no-border-top-right-radius",C)),this._setWidth(o,e,w);const i=h-v;b=Math.min(300,i-0),u=this._setHeight(o,e,i)+4}const P=Boolean(d&&(p||y));if(this._container.classList.toggle("layout-with-border-radius",P),e===this._recalcSingleRunToken&&a){const e=this._processVisibility(a),t=a.container.value();e&&t&&(t.style.left=p+"px",t.style.top=d+v+S+"px",t.classList.toggle("no-border-bottom-left-radius",!u||!p),t.classList.toggle("no-border-bottom-right-radius",C||!u),t.classList.toggle("no-border-top-left-radius",Boolean(!p&&y)),t.classList.toggle("no-border-top-right-radius",C)),this._setWidth(a,e,w);const i=h-d-u-v-S;this._setHeight(a,e,Math.max(i,b))}if(e===this._recalcSingleRunToken&&s&&this.affectsLayout("tradingpanel")){const e=s.container.value();e&&(e.style.right=m&&_?`${_+4}px`:`${_}px`,e.style.top=v+d+S+"px",e.style.borderTopRightRadius=P&&_?"4px":"0px")}e===this._recalcSingleRunToken&&this._updateVisibility()}affectsLayout(e){const t=this._areas[e];if(!t)return!1;if(t.rdState.owner.value()!==t)return!1;if(this._fullscreenArea&&this._fullscreenArea!==e)return Oe(e);if(this._width.value()<=567||this._height.value()<=445&&!Ne){if(!["center","top","left","topleft","extratop"].includes(e))return!1}return!0}_updateVisibility(){ +const e=this._bridge.visible.value();for(let t=0;t{mi.ChartApiInstance.start()})),"function"==typeof wi){const e=wi(st);e&&e.then?e.then((e=>{if(!Array.isArray(e))return console.warn("custom_indicators_getter should be a function that returns a Promise object which result is an array of custom indicators"),void Ci.resolve();const t=mi.JSServer;t.studyLibrary.push.apply(t.studyLibrary,e),Ci.resolve(),console.log("{0} custom indicators loaded.".format(e.length))})).catch((e=>{console.warn("Error loading custom indicators "+e),Ci.resolve()})):(console.warn("custom_indicators_getter should be a function that returns a Promise object"),Ci.resolve())}else Ci.resolve();mi.widgetReady=e=>{N.subscribe("onChartReady",e,null)};const ki=null===(hi=yi.theme)||void 0===hi?void 0:hi.toLowerCase();function Di(e){mi.__defaultsOverrides=mi.__defaultsOverrides||{},(0,ae.deepExtend)(mi.__defaultsOverrides,e),void 0!==TradingView.defaultProperties&&void 0!==TradingView.defaultProperties.chartproperties&&((0,h.applyDefaultsOverrides)(TradingView.defaultProperties.chartproperties),(0,h.applyDefaultOverridesToLinetools)())}!function(e){if(!e)return;M.themes[e]&&(0,A.setTheme)(e)}(ki),mi.applyStudiesOverrides=e=>{var t,i +;e&&(mi.chartWidgetCollection?null===(i=(t=mi.chartWidgetCollection).applyStudiesOverrides)||void 0===i||i.call(t,e):Je.StudyMetaInfo.mergeDefaultsOverrides(e))},mi.applyOverrides=e=>{Di(e),mi.chartWidgetCollection&&mi.chartWidgetCollection.applyOverrides(e)},mi.doWhenApiIsReady=e=>{mi.tradingViewApi?e():Pi.promise.then(e)},mi.applyTradingCustomization=e=>{for(const t in e.order)TradingView.defaultProperties.linetoolorder[t]=e.order[t];for(const t in e.position)TradingView.defaultProperties.linetoolposition[t]=e.position[t]},mi.changeTheme=(e,t)=>{const i=M.themes[e.toLowerCase()];return i?mi.tradingViewApi.themes().setStdTheme(i.name,!0,t&&t.disableUndo):Promise.resolve()},mi.getTheme=()=>mi.tradingViewApi.themes().getCurrentThemeName(),mi.is_authenticated=!1;JSON.parse(mi.urlParams.brokerConfig);a.t(null,void 0,i(65911)),a.t(null,void 0,i(68111)),a.t(null,void 0,i(5607));let Ei=null;const Vi=(0,oe.createDeferredPromise)();let Bi;const Ri=()=>{if(l.setEnabled("charting_library_export_chart_data",!mi.configurationData.is_tradingview_data),l.setEnabled("charting_library_debug_mode","true"===yi.debug),l.setEnabled("chart_property_page_trading",!1),l.enabled("remove_library_container_border")){const e=document.querySelector("#library-container");null!==e&&(e.style.border="0px",e.style.padding="1px")}l.enabled("no_min_chart_width")&&(document.body.style.minWidth="0px"),null!=yi.studiesOverrides&&Je.StudyMetaInfo.mergeDefaultsOverrides(JSON.parse(yi.studiesOverrides)),(0,n.assert)(void 0===TradingView.defaultProperties,"Default properties are inited before applying overrides"),Di(JSON.parse(yi.overrides));const e=yi.numeric_formatting?JSON.parse(yi.numeric_formatting):void 0;e&&"string"==typeof e.decimal_sign&&(ie.formatterOptions.decimalSign=e.decimal_sign[0]),mi.ChartApiInstance=new(Xe())(gi.datafeed);const t=gi.customFormatters;t&&(t.timeFormatter&&(se.customFormatters.timeFormatter=t.timeFormatter),t.dateFormatter&&(se.customFormatters.dateFormatter=t.dateFormatter),t.tickMarkFormatter&&(se.customFormatters.tickMarkFormatter=t.tickMarkFormatter),t.priceFormatterFactory&&(se.customFormatters.priceFormatterFactory=t.priceFormatterFactory),t.studyFormatterFactory&&(se.customFormatters.studyFormatterFactory=t.studyFormatterFactory)),gi.customTimezones&&Pe.instance().addTimezones(gi.customTimezones),mi.ChartApiInstance.setStudiesAccessController(mi.ChartApiInstance.createStudiesAccessController(yi.studiesAccess));const s=yi.chartContent?JSON.parse(yi.chartContent).json:void 0,o=yi.chartContentExtendedData?JSON.parse(yi.chartContentExtendedData):s?s.extendedData:void 0,c=yi.interval||"D",h=function(e){const t=/(\d+)(\w+)/;return e.map((e=>{const s=(0,n.ensureNotNull)(t.exec(e.text)),r=s[2].toLowerCase(),o=parseInt(s[1]),l="y"===r?12*o+"M":o+r,c=Ie.Interval.parse(e.resolution);return{text:e.title||o+a.t(r,{context:"dates",count:o},i(673)),description:e.description||"",value:{value:l.toUpperCase(),type:"period-back"},targetResolution:c.value(),requiresIntraday:c.isIntraday()}}))}(JSON.parse(yi.timeFrames)),u={ +resizerBridge:Li,padding:l.enabled("border_around_the_chart")?2:0,content:s,widgetOptions:{addToWatchlistEnabled:!1,hideIdeas:!0,addVolume:(0,n.ensureDefined)(mi.ChartApiInstance.studiesAccessController).isToolEnabled("Volume"),muteSessionErrors:!0,timezone:yi.timezone,defSymbol:s?"":yi.symbol,defInterval:s?"":c,compareSymbols:yi.compareSymbols&&JSON.parse(yi.compareSymbols),defTimeframe:(p=gi.timeframe,p?"string"==typeof p?p:{...p,type:"time-range"}:p),paneContextMenuEnabled:l.enabled("pane_context_menu"),paneContextMenu:{mainSeriesTrade:Si},priceScaleContextMenuEnabled:l.enabled("scales_context_menu"),currencyConversionEnabled:l.enabled("pricescale_currency"),unitConversionEnabled:l.enabled("pricescale_unit"),legendWidgetEnabled:l.enabled("legend_widget"),legendWidget:{contextMenu:{settings:l.enabled("show_chart_property_page"),showOpenMarketStatus:l.enabled("display_market_status")}},sourceStatusesWidget:{errorSolution:!1},marketStatusWidgetEnabled:l.enabled("display_market_status"),chartWarningWidget:{subscriptionFullInfo:!1},timeScaleWidget:{contextMenuEnabled:l.enabled("scales_context_menu"),timezoneMenuEnabled:l.enabled("timezone_menu"),priceAxisLabelsOptions:{showLabels:l.enabled("main_series_scale_menu")}},timeScale:{preserveBarSpacing:!1,lockVisibleTimeRangeOnResize:l.enabled("lock_visible_time_range_on_resize"),rightBarStaysOnScroll:l.enabled("right_bar_stays_on_scroll"),minBarSpacing:yi.time_scale&&JSON.parse(yi.time_scale).min_bar_spacing},goToDateEnabled:l.enabled("go_to_date"),crossHair:{menuEnabled:l.enabled("chart_crosshair_menu")},handleScale:{mouseWheel:l.enabled("mouse_wheel_scale"),pinch:l.enabled("pinch_scale"),axisPressedMouseMove:{time:l.enabled("axis_pressed_mouse_move_scale"),price:l.enabled("axis_pressed_mouse_move_scale")}},handleScroll:{mouseWheel:l.enabled("mouse_wheel_scroll"),pressedMouseMove:l.enabled("pressed_mouse_move_scroll"),horzTouchDrag:l.enabled("horz_touch_drag_scroll"),vertTouchDrag:l.enabled("vert_touch_drag_scroll")},shiftVisibleRangeOnNewBar:l.enabled("shift_visible_range_on_new_bar"),croppedTickMarks:l.enabled("cropped_tick_marks"),countdownEnabled:l.enabled("countdown"),indicatorsDialogShortcutEnabled:l.enabled("insert_indicator_dialog_shortcut")},seriesControlBarEnabled:l.enabled("timeframes_toolbar"),seriesControlBar:{timeFramesWidgetEnabled:!0,timeFramesWidget:{goToDateEnabled:l.enabled("go_to_date"),availableTimeFrames:(e,t)=>{if(!e)return[];if(t!==it.STATUS_DELAYED&&t!==it.STATUS_DELAYED_STREAMING&&t!==it.STATUS_EOD&&t!==it.STATUS_READY)return[];return h.filter((t=>!(t.requiresIntraday&&!e.has_intraday)&&!(e.supported_resolutions&&!e.supported_resolutions.includes(t.targetResolution))))}},timeWidgetEnabled:!0,timeWidget:{timezoneMenuEnabled:l.enabled("timezone_menu")},adjustForDividendsButtonEnabled:!1,sessionIdButtonEnabled:l.enabled("pre_post_market_sessions"),backAdjustmentButtonEnabled:!1,settlementAsCloseButtonEnabled:!1,percentageScaleButtonEnabled:!0,logScaleButtonEnabled:!0,autoScaleButtonEnabled:!0,fullscreenButtonEnabled:!0,mobileChangeLayoutEnabled:!1}, +globalEvents:!0,snapshotUrl:yi.snapshotUrl,mobileForceChartMaximizeEnabled:!1,saveChartEnabled:l.enabled("save_shortcut")};var p;xi&&((0,je.createFavoriteDrawingToolbar)(),u.widgetOptions.isDrawingToolbarVisible=C.isDrawingToolbarVisible),o&&(u.metaInfo={id:o.uid,name:o.name,description:o.description,uid:o.uid,username:""}),gi.additionalSymbolInfoFields&&(0,ti.setAdditionalSymbolInfoFields)(gi.additionalSymbolInfoFields);const _=gi.symbolSearchComplete;_&&(0,ii.setSymbolSearchCompleteOverrideFunction)(_);const m=mi.chartWidgetCollection=new(Ue())(u);let g=!1;m.onAboutToBeDestroyed.subscribe(null,(()=>{g=!0}),!0),function(e){e.addCustomSource("branding",((t,i)=>{const s=(0,rt.combine)(((e,t)=>{const s=null!=e?e:t;return null!==s&&s.hasModel()&&s.model().model()===i}),e.maximizedChartWidget().weakReference(),e.leftBottomChartWidget().weakReference());return new Ut(t,i,s.ownership())}),nt.CustomSourceLayer.Topmost)}(m),mi.studyMarket=new re(m),He.registerService(We.CHART_WIDGET_COLLECTION_SERVICE,m),m.activeChartWidget.subscribe((e=>{N.emit("activeChartChanged",m.getAll().indexOf(e))})),mi.saver=new B.ChartSaver(m);const f=new $(m,mi.saver);m.setSaveChartService(f);const S=new Y.LoadChartService(m);mi.chartWidget=m.activeChartWidget.value(),mi.pro=new TradingView.Pro;const y=function(e){if(!Mi)return null;const t=new T.ChartChangesWatcher(e.chartWidgetCollection,mi.saver,N),s=JSON.parse(yi.favorites);let r,n;s.intervals=s.intervals.map((e=>{let t=""+e;return t.match(/1[DWMYdwmy]/)&&(t=t.slice(1)),t})),l.enabled("study_templates")&&(r=new ee.FavoriteStudyTemplateService(ne.TVXWindowEvents,d),Bi=new Q({chartWidgetCollection:e.chartWidgetCollection,favoriteStudyTemplatesService:r}));const o=yi.header_widget_buttons_mode;"fullsize"===o&&(n=["full"]);"compact"===o&&(n=["small"]);const a=(0,di.shouldShowQuickSearchOnLib)()?function(){const e=e=>Promise.all([i.e(3951),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(2587),i.e(2639),i.e(3502),i.e(6752),i.e(8149),i.e(9842),i.e(6639),i.e(7807),i.e(3353),i.e(9916),i.e(6985),i.e(9403),i.e(962),i.e(1740),i.e(6408),i.e(2544),i.e(5057),i.e(750),i.e(1890),i.e(2846),i.e(9754)]).then(i.bind(i,72539)).then((t=>{const i=new(0,t.GlobalSearchDialogRenderer);return null!==Te&&Te.hide(),i.show(e),Te=i,i}));return(0,k.createGroup)({desc:"GlobalSearch"}).add({desc:"Open",hotkey:k.Modifiers.Mod+75,handler:()=>e()}),e}():void 0;return new w(new v,{chartSaver:mi.saver,chartApiInstance:mi.ChartApiInstance,chartWidgetCollection:e.chartWidgetCollection,defaultFavoriteStyles:s.chartTypes,defaultFavoriteIntervals:s.intervals,resizerBridge:Mi,studyMarket:mi.studyMarket,studyTemplates:Bi,favoriteStudyTemplatesService:r,allowedModes:n,saveChartService:e.saveChartService,loadChartService:e.loadChartService,chartChangesWatcher:t,onClick:Hi,snapshotUrl:e.snapshotUrl,openGlobalSearch:a})}({chartWidgetCollection:m,saveChartService:f,loadChartService:S,snapshotUrl:yi.snapshotUrl});null!==y?y.load().then((e=>{Ei=e.getComponent(),Vi.resolve() +})):(Vi.promise.catch((()=>{})),Vi.reject("header widget is not loaded"));const b=function(e){if(Ai){const t=yi.toolbarbg&&/^[0-9a-f]+$/i.test(yi.toolbarbg)?String(yi.toolbarbg):void 0;if(t){const e=document.createElement("style");e.textContent="body,.chart-controls-bar,#footer-chart-panel{background-color:#"+t+" !important}",document.head.appendChild(e)}return new x({bgColor:t,chartWidgetCollection:e,drawingsAccess:yi.drawingsAccess?JSON.parse(yi.drawingsAccess):void 0,resizerBridge:Ai,onClick:Hi})}return null}(m),P=null;mi.tradingViewApi=new(et())({chartWidgetCollection:m,chartApiInstance:mi.ChartApiInstance,saveChartService:f,loadChartService:S,studyMarket:null});if(te.linking.bindToChartWidgetCollection(m),isNaN(yi.studyCountLimit)||(TradingView.STUDY_COUNT_LIMIT=Math.max(2,+(0,n.ensureDefined)(yi.studyCountLimit))),!isNaN(yi.ssreqdelay)){const e=Math.max(0,+(0,n.ensureDefined)(yi.ssreqdelay));(0,tt.setSearchRequestDelay)(e)}mi.ChartApiInstance.connect(),(async()=>{const{default:e}=await 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.t.bind(i,26916,23));g||(mi.lineToolPropertiesToolbar=new e(m))})();const I=document.querySelector(".tv-content");null!==I&&I.addEventListener("contextmenu",(e=>{e.target instanceof Element&&"input"!==e.target.tagName.toLowerCase()&&"textarea"!==e.target.tagName.toLowerCase()&&e.preventDefault()})),Pi.resolve(),m.undoHistory.undoStack().onChange().subscribe(null,(0,r.default)((e=>{e&&!e.customFlag("doesnt_affect_save")&&N.emit("onAutoSaveNeeded")}),1e3*(Number(yi.autoSaveDelay)||5),{leading:!1,trailing:!0}));let A=!1;function L(){b&&b.load(bi.signal),P&&P.load(bi.signal).then((e=>{mi.footerWidget=e.getComponent()}))}mi.chartWidget.withModel(null,(()=>{mi.ChartApiInstance.on("realtime_tick",(e=>{N.emit("onTick",e)}));if(!M.savedThemeName()&&ki){const e=M.getStdTheme(ki);e&&e.content&&void 0===s&&m.applyTheme({theme:e.content,onlyActiveChart:!1,restoreNonThemeDefaults:!1,themeName:ki,standardTheme:!0,syncState:!0,noUndo:!0}).then((()=>mi.applyOverrides(mi.__defaultsOverrides)))}if(l.enabled("charting_library_debug_mode")&&N.subscribeToAll(((...e)=>{console.log('Event "{0}", arguments: {1}'.format(e[0],JSON.stringify(e.slice(1))))})),A)return;A=!0,Ke(m),function(e,t){const s=a.t(null,void 0,i(78104)).format({emoji:"👍"}),r=a.t(null,void 0,i(12011)).format({emoji:"👍"}),o=a.t(null,void 0,i(79393)).format({emoji:"👍"});N.on("onServerScreenshotCopiedToClipboard",(()=>h(s)),null),N.on("onClientScreenshotCopiedToClipboard",(()=>h(r)),null),N.on("onServerScreenshotEmbedCodeCopiedToClipboard",(()=>h(o)),null);let l=null;const c=e.getContainer();function h(e){l?l.show(e):Promise.all([i.e(2109),i.e(3896),i.e(962),i.e(92)]).then(i.bind(i,89168)).then((i=>{l||(l=new i.ChartScreenshotHintRenderer((0,n.ensureNotNull)(c),{bottomPadding:t.seriesControlBarEnabled}),l.show(e))}))}}(m,{ +seriesControlBarEnabled:l.enabled("timeframes_toolbar")});ri.WatermarkApi.getInstance().setWidgetCollection(mi.chartWidgetCollection)})),m.getAll().some((e=>e.isInitialized()))?L():function(e,t){const i=e.getAll(),s=()=>{t(),i.forEach((e=>{e.chartWidgetInitialized().unsubscribe(null,s)}))};i.forEach((e=>{e.chartWidgetInitialized().subscribe(null,s,!0)}))}(m,L),N.subscribe("chart_load_requested",(e=>{mi.tradingViewApi.loadChart({json:JSON.parse(e.content),extendedData:e})}),null)};window.addEventListener("unload",(()=>{bi.abort(),mi.widgetbar&&(mi.widgetbar.destroy(),mi.widgetbar=null),mi.chartWidgetCollection&&(mi.chartWidgetCollection.destroy(),mi.chartWidgetCollection=null),mi.ChartApiInstance&&mi.ChartApiInstance.disconnect(),(0,Fe.destroyQuoteSessions)(),mi.ChartApiInstance&&(mi.ChartApiInstance.destroy(),mi.ChartApiInstance=null)})),l.enabled("saveload_storage_customization")&&(gi.saveLoadAdapter?L.setCustomAdapter(gi.saveLoadAdapter):mi.urlParams.chartsStorageUrl&&mi.urlParams.clientId?L.initialize(mi.urlParams.clientId,mi.urlParams.userId,mi.urlParams.chartsStorageUrl,mi.urlParams.chartsStorageVer||"1.0"):(l.setEnabled("saveload_storage_customization",!1),l.setEnabled("header_saveload",!1)));const Ni=(0,oe.createDeferredPromise)();function Oi(){Ni.resolve()}gi.loadLastChart&&l.enabled("saveload_storage_customization")?L.getCharts().then((e=>{if(0===e.length)return void Oi();const t=e.sort(((e,t)=>t.modified_iso-e.modified_iso))[0];L.getChartContent(t).then((e=>{const t=e,i=JSON.parse(t.content);i.extendedData=e,yi.chartContent=JSON.stringify({json:i}),Oi()})).catch(Oi)})).catch(Oi):Oi();const Fi=(0,_i.loadLineToolsSynchronizer)(),Wi=(0,oe.createDeferredPromise)();function Hi(){const e=TradingView.bottomWidgetBar;e&&e.turnOffMaximize()}Promise.all([Wi.promise,Ni.promise,mi.loadedCustomCss,Fi]).then((()=>{const e=document.querySelector(".loading-indicator");if(e&&(e.style.display="none"),setTimeout(Ri,0),l.enabled("14851")&&Math.random()<=.02){t=window,i=document,s="script",r="ga",t.GoogleAnalyticsObject=r,t.ga=t.ga||function(){(t.ga.q=t.ga.q||[]).push(arguments)},t.ga.l=Number(new Date),o=i.createElement(s),a=i.getElementsByTagName(s)[0],o.async=1,o.src="//www.google-analytics.com/analytics.js",a.parentNode.insertBefore(o,a);const e=(0,n.ensureNotNull)(document.URL.match(new RegExp("(:?.*://)([^/]+)/.*")))[2];mi.ga("create","UA-112911840-1","auto"),mi.ga("set","anonymizeIp",!0),mi.ga("set",{hostname:e,page:e,referrer:e}),mi.ga("send","pageview")}var t,i,s,r,o,a})),(()=>{let e=!0;gi.datafeed.onReady((t=>{e&&console.warn("`onReady` should return result asynchronously. Use `setTimeout` with 0 interval to execute the callback function."),mi.configurationData=t,Wi.resolve()})),e=!1})(),mi.createShortcutAction=(()=>{const e=k.createGroup({desc:"API"});return(t,i)=>{var s;e.add({hotkey:(s=t,"number"==typeof s?s:"string"==typeof s?V(s.split("+")):Array.isArray(s)?V(s):0),handler:i})}})(),mi.initializationFinished=()=>{mi.chartWidgetCollection.undoHistory.clearStack()},mi.headerReady=()=>Vi.promise,mi.createButton=e=>{ +if(null===Ei)throw new Error("Cannot create button: header widget is not ready or is not loaded - use `headerReady` to wait until header is ready");return(e=e||{}).align=e.align||"left",e.useTradingViewStyle=e.useTradingViewStyle||!1,Ei.addButton((0,le.randomHash)(),e)},mi.createDropdown=e=>{if(void 0===e)throw new Error("Cannot create dropdown without any parameters. Please refer to the documentation");void 0===e.align&&(e.align="left");const t=(0,le.randomHash)();return Ei?(Ei.addDropdown(t,e),Promise.resolve(new si(Ei,t))):Vi.promise.then((()=>((0,n.ensureNotNull)(Ei).addDropdown(t,e),new si((0,n.ensureNotNull)(Ei),t))))},mi.getAllFeatures=()=>{const e=l.getAllFeatures();return Object.keys(e).forEach((t=>{isNaN(parseFloat(t))||delete e[t]})),e},mi.getNavigationButtonsVisibility=(0,s.default)((()=>(0,ce.convertPropertyToWatchedValue)((0,he.property)()))),mi.getPaneButtonsVisibility=(0,s.default)((()=>(0,ce.convertPropertyToWatchedValue)((0,de.property)()))),mi.getDateFormat=(0,s.default)((()=>(0,ce.convertPropertyToWatchedValue)(ue.dateFormatProperty))),mi.getTimeHoursFormat=(0,s.default)((()=>(0,ce.convertPropertyToWatchedValue)(pe.timeHoursFormatProperty))),mi.getCurrencyAndUnitVisibility=(0,s.default)((()=>(0,ce.convertPropertyToWatchedValue)((0,xe.currencyUnitVisibilityProperty)()))),mi.customSymbolStatus=()=>ai.getInstance();const zi=yi.locale||"en",Ui=ui.AriaChartDescription.getInstance();Ui.createElement(document),Ui.setLocale(zi),mi.customChartDescriptionFunction&&Ui.setCustomProvider(mi.customChartDescriptionFunction);const ji=pi.AriaCrosshairPriceDescription.getInstance();ji.createElement(document),ji.setLocale(zi),function(){const e=l.enabled("accessible_keyboard_shortcuts")?(0,D.humanReadableHash)(9):`${(0,D.humanReadableModifiers)(D.Modifiers.Alt,!1)} + ${(0,D.humanReadableHash)(90)}`,t=`${(0,D.humanReadableModifiers)(D.Modifiers.Mod,!1)} + ${(0,D.humanReadableHash)(75)}`,s=a.t(null,void 0,i(48890)),r=[a.t(null,{replace:{shortcut:e}},i(29787)),a.t(null,{replace:{shortcut:t}},i(4868)),a.t(null,void 0,i(71705)),a.t(null,void 0,i(35696)),a.t(null,void 0,i(21585)),a.t(null,void 0,i(14702))],n=document.createElement("p");n.innerText=s;const o=document.createElement("ul");r.forEach((e=>{const t=document.createElement("li");t.innerText=e,o.appendChild(t)}));const c=document.createElement("div");c.setAttribute("role","contentinfo"),c.setAttribute("aria-hidden","false"),c.style.fontSize="0",c.appendChild(n),c.appendChild(o),document.body.insertBefore(c,document.body.firstChild)}(),new li.Action({actionId:"UnknownAction",options:{label:"",onExecute:()=>{window.dispatchEvent(new CustomEvent("keyboard-navigation-activation",{bubbles:!0}));const[e]=Array.from(document.querySelectorAll('button:not([disabled]):not([aria-disabled]):not([tabindex="-1"]), input:not([disabled]):not([aria-disabled]):not([tabindex="-1"]), [tabindex]:not([disabled]):not([aria-disabled]):not([tabindex="-1"])')).filter((0,ci.createScopedVisibleElementFilter)(document.documentElement)).sort(ci.navigationOrderComparator);void 0!==e&&e.focus()}, +hotkeyHash:l.enabled("accessible_keyboard_shortcuts")?9:k.Modifiers.Alt+90,hotkeyGroup:(0,k.createGroup)({desc:"Global shortcuts"}),disabled:!ci.PLATFORM_ACCESSIBILITY_ENABLED}})},10066:(e,t,i)=>{"use strict";function s(){return window}function r(){const e=s();return e.parent[e.urlParams.uid]}i.d(t,{getChartingLibraryGlobalContext:()=>s,getChartingLibraryOwner:()=>r})},54358:(e,t,i)=>{e=i.nmd(e),TradingView.cleanButAmpersand=function(e,t){var i=t?["&"]:["&"];return TradingView.clean(e,t,i)},TradingView.strip_tags=function(e){return e&&e.replace?e.replace(/(<([^>]+)>)/gi,""):e},TradingView.encodeSpread=function(e){return encodeURIComponent(e)},TradingView.clean=function(e,t,i){var s=[["&","&"],["<","<"],[">",">"],['"',"""],["'","'"],["'","'"]],r=e;if(!e||!e.replace)return r;for(var n=0;n{"use strict";i.r(t);var s=i(21097),r=i(51768),n=i(76422),o=i(38780);function a(e,t=!1){"loading"!==document.readyState?t?setTimeout((()=>e()),1):e():document.addEventListener("DOMContentLoaded",(()=>e()))}new Promise((e=>{a(e)}));function l(e,t="x"){let i=!1;return"x"!==t&&"both"!==t||(i=i||e.offsetWidth(t.nodeType===Node.TEXT_NODE&&e.push(t.textContent||""),e)),[]).join("").trim()),i}function u(e,t){let i=!1;const s=e.children;for(let e=0;e{document.addEventListener("mouseenter",(e=>{const t=e.target;if(t instanceof HTMLElement&&t.matches(".apply-overflow-tooltip")){const e=h(t);if(t.matches(".apply-overflow-tooltip--check-children-recursively")){if(!c(t,e))return}else if(t.matches(".apply-overflow-tooltip--check-children")){if(!u(t,e))return}else if(!l(t,e))return;(0,o.showOnElement)(t,{text:d(t)});const i=()=>{(0,o.hide)(),["mouseleave","mousedown"].forEach((e=>t.removeEventListener(e,i)))};["mouseleave","mousedown"].forEach((e=>t.addEventListener(e,i)))}}),!0),document.addEventListener("focus",(e=>{const t=e.target;if(t instanceof HTMLElement&&(t.matches(".apply-overflow-tooltip-focus")||t.querySelector(".apply-overflow-tooltip-focus"))){const e=t.matches(".apply-overflow-tooltip")?t:t.querySelector(".apply-overflow-tooltip"),i=h(e) +;if(e.matches(".apply-overflow-tooltip--check-children-recursively")){if(!c(e,i))return}else if(e.matches(".apply-overflow-tooltip--check-children")){if(!u(e,i))return}else if(!l(e,i))return;(0,o.showOnElement)(t,{text:d(e)});const s=()=>{(0,o.hide)(),t.removeEventListener("blur",s)};t.addEventListener("blur",s)}}),!0)}));var p=i(57898),_=i(11417);var m=i(30888);let g;function f(e){const t=window.user.available_offers||{};window.TVSettings&&window.TVSettings.sync(window.user.settings),window.is_authenticated?(e||(initOfferLoginStateChangeButton(),onGoPro()&&window.location.reload()),!1===window.user.profile_data_filled&&((0,r.trackEvent)("Conversion","First login"),delete window.user.profile_data_filled)):(Object.keys(t).forEach((e=>{const i=e;t[i].available_for_anons||delete t[i]})),window.user={username:"Guest",following:"0",followers:"0",ignore_list:[],available_offers:t},_.TVLocalStorage.removeItem("trial_availiable"))}g=window.loginStateChange?window.loginStateChange:window.loginStateChange=new p.Delegate,g.subscribe(null,f),s.TVXWindowEvents.on("loginStateChange",(e=>{const t=JSON.parse(e);window.user=t.user,window.is_authenticated=!!t.is_authenticated,g.fire()})),s.TVXWindowEvents.on("signOut",(()=>{!function(){if(window.initData.lfs){const e=document.getElementsByClassName("js-admin-warning")[0];document.body.removeChild(e)}let e=!0;[/^\/chart\//,/^\/share-your-love\//].forEach((t=>{t.test(window.location.pathname)&&(e=!1)})),e&&window.location.reload()}()})),(()=>{const e="user-obj-changed",t={};window.crossTabSyncUserAttr=t=>{const i={};t instanceof Array?t.forEach((e=>{i[e]=window.user[e]})):i[t]=window.user[t],s.TVXWindowEvents.emit(e,JSON.stringify(i))},s.TVXWindowEvents.on(e,(e=>{const i=JSON.parse(e);let s;for(s in i)if(i.hasOwnProperty(s)){window.user[s]=i[s];(t[s]||[]).forEach((e=>{e.fire(i[s])}))}}))})(),window.TradingView.changeLoginState=e=>{window.is_authenticated=!!e,s.TVXWindowEvents.emit("loginStateChange",JSON.stringify({is_authenticated:window.is_authenticated,user:window.user})),g.fire(),window.is_authenticated&&n.emit("GLOBAL_EVENT_SIGN_IN_SUCCESS")},window.loginUser=function(e){window.user=(0,m.deepExtend)({},e),window.TradingView.changeLoginState(!0)},window.loginRequiredDelegate=new p.Delegate,window.runOrSignIn=(e,t)=>{t||(t={}),e()},window.onLoginStateChange=f,window.TradingView.setTrialAvailiable=e=>{_.TVLocalStorage.setItem("trial_availiable",e?"1":"0")},window.TradingView.notificationsChanged=new p.Delegate},87095:(e,t,i)=>{"use strict";i.r(t),i.d(t,{alphaToTransparency:()=>o,applyAlpha:()=>n,applyTransparency:()=>l,colorFromBackground:()=>u,colorToInteger:()=>f,generateColor:()=>r,getLuminance:()=>h,gradientColorAtPercent:()=>p,isColorDark:()=>_,isHexColor:()=>d,resetTransparency:()=>c,rgbaFromInteger:()=>m,rgbaToInteger:()=>g,transparencyToAlpha:()=>a});var s=i(24377);function r(e,t,i){if(t=t||0,!d(e))return i?(0,s.rgbaToString)((0,s.rgba)((0,s.parseRgb)(e),(0,s.normalizeAlphaComponent)(a(t)))):e;const[r,n,o]=(0,s.parseRgb)(e),l=(0,s.normalizeAlphaComponent)(a(t));return(0, +s.rgbaToString)([r,n,o,l])}function n(e,t){return r(e,o(t),!0)}function o(e){return 100*(1-e)}function a(e){if(e<0||e>100)throw new Error("invalid transparency");return 1-e/100}function l(e,t){if("transparent"===e)return e;const i=(0,s.parseRgba)(e),r=i[3];return(0,s.rgbaToString)((0,s.rgba)(i[0],i[1],i[2],a(t)*r))}function c(e){return"transparent"===e?e:d(e)?e.slice(0,7):(0,s.rgbaToString)((0,s.rgba)((0,s.parseRgb)(e),(0,s.normalizeAlphaComponent)(1)))}function h(e){const t=(0,s.parseRgb)(e).map((e=>(e/=255)<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4)));return Number((.2126*t[0]+.7152*t[1]+.0722*t[2]).toFixed(3))}function d(e){return 0===e.indexOf("#")}function u(e){return"black"===(0,s.rgbToBlackWhiteString)((0,s.parseRgb)(e),150)?"#ffffff":"#000000"}function p(e,t,i){const[r,n,o,a]=(0,s.parseRgba)(e),[l,c,h,d]=(0,s.parseRgba)(t),u=(0,s.rgba)(Math.round(r+i*(l-r)),Math.round(n+i*(c-n)),Math.round(o+i*(h-o)),a+i*(d-a));return(0,s.rgbaToString)(u)}function _(e){return h(c(e))<.5}function m(e){const t=(e=Math.round(e))%256;e-=t;const i=(e/=256)%256;e-=i;const s=(e/=256)%256;e-=s;return`rgba(${t},${i},${s},${(e/=256)/255})`}function g(e){const t=Math.round(255*e[3]);return e[0]+256*e[1]+65536*e[2]+16777216*t}function f(e){const t=(0,s.tryParseRgba)(e);return null===t?0:g(t)}},88275:(e,t,i)=>{"use strict";function s(e,t,i){return e*(1-i)+t*i}i.d(t,{doAnimate:()=>o,lerp:()=>s});const r={from:0,duration:250,easing:i(61345).easingFunc.easeOutCubic};class n{constructor(e){this._doing=!0,this._completed=!1,this._options={...r,...e};const t=performance.now();window.requestAnimationFrame((e=>{this._animation(t,this._options.from,e)}))}stop(){this._doing=!1}completed(){return this._completed}_animation(e,t,i){if(!this._doing)return void this._finishAnimation();const r=(i=!i||i<1e12?performance.now():i)-e,n=r>=this._options.duration||t===this._options.to,o=s(this._options.from,this._options.to,this._options.easing(r/this._options.duration)),a=n?this._options.to:o,l=a-t;this._options.onStep(l,a),n?this._finishAnimation():window.requestAnimationFrame((t=>{this._animation(e,a,t)}))}_finishAnimation(){this._options.onComplete&&this._options.onComplete(),this._completed=!0}}function o(e){return new n(e)}},69798:(e,t,i)=>{"use strict";i.d(t,{fetch:()=>s});(0,i(59224).getLogger)("Fetch");function s(e,t,i={}){return window.fetch(e,t)}},59224:(e,t,i)=>{"use strict";i.r(t),i.d(t,{LOGLEVEL:()=>s.LOGLEVEL,getLogHistory:()=>s.getLogHistory,getLogLevel:()=>s.getLogLevel,getLogger:()=>s.getLogger,getRawLogHistory:()=>s.getRawLogHistory,isHighRateEnabled:()=>s.isHighRateEnabled,loggingOff:()=>s.loggingOff,loggingOn:()=>s.loggingOn,serializeLogHistoryEntry:()=>s.serializeLogHistoryEntry,setLogLevel:()=>s.setLogLevel});var s=i(44441)},29764:(e,t,i)=>{"use strict";function s(e,t,i,s){return`${s?s+" ":""}${i?i+" ":""}${e}px ${t}`}i.d(t,{makeFont:()=>s,parseFont:()=>n});const r=/(bold )?(italic )?(\d+)(px|pt) (.*)$/;function n(e){const t=r.exec(e);return null===t?null:{family:t[5],size:parseInt(t[3])*("pt"===t[4]?.75:1),bold:Boolean(t[1]), +italic:Boolean(t[2])}}},2298:()=>{"use strict";(()=>{if(window.matchMedia("").addEventListener)return;const e=window.matchMedia;window.matchMedia=(...t)=>{const i=e(...t);return i.addEventListener=(e,t)=>i.addListener(t),i.removeEventListener=(e,t)=>i.removeListener(t),i}})()},2663:(e,t,i)=>{"use strict";i.d(t,{visitObject:()=>n});var s=i(1722);function r(e,t,i){return(0,s.isArray)(e)?function(e,t,i){return e.map((e=>{const s=r(e,t,i),n=t(s);return void 0!==n?n:s}))}(e,t,i):(0,s.isObject)(e)&&((0,s.isHashObject)(e)||i&&i.visitInstances)?function(e,t,i){const s={};return Object.keys(e).forEach((n=>{const o=r(e[n],t,i),a=t(o);s[n]=void 0!==a?a:o})),s}(e,t,i):e}function n(e,t,i){const s=r(e,t,i),n=t(s);return void 0!==n?n:s}},12812:(e,t,i)=>{"use strict";i.d(t,{getPersistentLogger:()=>r});let s=null;function r(){return s}},52157:(e,t,i)=>{"use strict";function s(e){return e.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}i.d(t,{regExpEscape:()=>s})},54282:(e,t,i)=>{"use strict";i.d(t,{rgbaFromIntegerCached:()=>o});var s=i(48874),r=i(87095),n=i(42449);function o(e=1e3){const t=s.default.Cache;s.default.Cache=n.CircularCacheBuffer.bind(n.CircularCacheBuffer,e);const i=(0,s.default)(r.rgbaFromInteger);return s.default.Cache=t,i}},38223:(e,t,i)=>{"use strict";i.r(t),i.d(t,{detectAutoDirection:()=>g,forceLTRStr:()=>c,forceLTRStrSsr:()=>h,forceRTLStr:()=>d,getLTRScrollLeft:()=>u,getLTRScrollLeftOffset:()=>p,isRtl:()=>r,startWithLTR:()=>l,stripLTRMarks:()=>a});var s=i(64531);const r=()=>"rtl"===window.document.dir,n="‬",o=new RegExp("‎|‪|‫|‬","g");function a(e){return""!==e&&r()&&null!=e?e.replace(o,""):e}function l(e){return""!==e&&r()&&null!=e?"‎"+e:e}function c(e){return""!==e&&r()&&null!=e?"‪"+e+n:e}function h(e){return"‪"+e+n}function d(e){return""!==e&&r()&&null!=e?"‫"+e+n:e}function u(e){return(0,s.getNormalizedScrollLeft)(e,"rtl")}function p(e,t){const i=(0,s.detectScrollType)();if("indeterminate"===i)return 0;switch(i){case"negative":t=e.clientWidth-e.scrollWidth+t;break;case"reverse":t=e.scrollWidth-e.clientWidth-t}return t}const _=/[^\u0000-\u0040\u005B-\u0060\u007B-\u00BF\u00D7\u00F7\u02B9-\u02FF\u2000-\u200E\u2010-\u2029\u202C\u202F-\u2BFF]/,m=/[\u0590-\u07FF\u200F\u202B\u202E\uFB1D-\uFDFD\uFE70-\uFEFC]/;function g(e){const t=_.exec(e);return t?m.test(t[0])?"rtl":"ltr":""}},61345:(e,t,i)=>{"use strict";i.d(t,{CubicBezier:()=>s.CubicBezier,dur:()=>s.dur,easingFunc:()=>s.easingFunc});var s=i(74991)},43960:(e,t,i)=>{"use strict";function s(){return Promise.all([i.e(2666),i.e(956),i.e(6221),i.e(9138),i.e(962),i.e(6408),i.e(2077)]).then(i.bind(i,57163))}i.d(t,{loadChangeIntervalDialog:()=>s})},54270:(e,t,i)=>{"use strict";i.d(t,{showChangeIntervalDialogAsync:()=>n});var s=i(43960);let r=null;function n(e){const t=r=(0,s.loadChangeIntervalDialog)().then((i=>{t===r&&i.showChangeIntervalDialog(e)}));return t}},64358:(e,t,i)=>{"use strict";function s(e){ +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(5993),i.e(2191),i.e(6221),i.e(2639),i.e(4215),i.e(6625),i.e(2486),i.e(2260),i.e(962),i.e(4370),i.e(6408),i.e(2544),i.e(5057),i.e(4403),i.e(4713),i.e(5983),i.e(1859)]).then(i.bind(i,91952)).then((t=>t.showGoToDateDialog(e)))}i.d(t,{showGoToDateDialog:()=>s})},39080:(e,t,i)=>{"use strict";i.d(t,{runOrSigninWithFeature:()=>s});const s=(e,t)=>{e()}},21866:(e,t,i)=>{"use strict";i.d(t,{showTooManyStudiesNotice:()=>n});var s=i(11542),r=i(3615);function n(e){"number"!=typeof e&&(e=TradingView.STUDY_COUNT_LIMIT),(0,r.showWarning)({title:s.t(null,void 0,i(33603)),text:s.t(null,void 0,i(70213)).format({number:e})})}},97304:(e,t,i)=>{"use strict";i.d(t,{getAdditionalSymbolInfoFields:()=>n,setAdditionalSymbolInfoFields:()=>r});let s=[];function r(e){s=e}function n(){return s}},5894:(e,t,i)=>{"use strict";function s(e){Promise.all([i.e(2666),i.e(956),i.e(2109),i.e(5145),i.e(855),i.e(8056),i.e(7807),i.e(8450),i.e(8287),i.e(962),i.e(6408),i.e(5057),i.e(7663),i.e(9374)]).then(i.bind(i,63065)).then((({SymbolInfoDialogImpl:t})=>{t.getInstance().show(e)}))}i.d(t,{showSymbolInfoDialog:()=>s})},26676:(e,t,i)=>{"use strict";i.d(t,{ChartSaverBase:()=>c});var s=i(16230),r=i(66501),n=i(23024),o=i(1722),a=i(57898),l=i(14483);new WeakMap;new TextEncoder;class c{constructor(e){this._prevChartState=null,this._chartSavedDelegate=new a.Delegate,this._chartWidgetCollection=e}async saveChartLineTools(e,t,s,r){if(l.enabled("saveload_separate_drawings_storage")){const o=await(0,n.getChartStorage)(),a=this._chartWidgetCollection.metaInfo.uid.value(),l=i=>o.saveLineToolsAndGroups(i,e,t,s,r);if(!a){this._chartSavedDelegate.subscribe(null,(e=>{if(e){const e=this._chartWidgetCollection.metaInfo.uid.value();l(e)}}),!0);const{SavingLineToolsLibraryError:e}=await i.e(5565).then(i.bind(i,98653));throw new e("Layout ID not yet created.",!0)}return l(a)}return Promise.reject("Line tools storage is not supported")}layoutId(){return this._chartWidgetCollection.metaInfo.uid.value()}_getCommonSavingInfo(e){const t=this._chartWidgetCollection,i=this._chartWidgetCollection.chartsSymbols(),s=i[t.activeChartWidget.value().id()],r={...(n=s,{...n,legs:JSON.stringify(null!==(o=n.legs)&&void 0!==o?o:[])})};var n,o;const a=t.metaInfo;return a.id.value()&&(r.id=a.id.value()),r.name=a.name.value()||"",r.description=a.description.value()||"",r.charts_symbols=function(e){const t={};for(const i of Object.keys(e))t[i]={symbol:e[i].symbol};return JSON.stringify(t)}(i),r.is_realtime=r.is_realtime=e?"0":"1",r}async _saveLineToolsToStorage(){if(!l.enabled("saveload_separate_drawings_storage"))return Promise.resolve();{this.layoutId();0;const e=this._chartWidgetCollection.getAll().map((e=>{var t,i;return null!==(i=null===(t=e.lineToolsSynchronizer())||void 0===t?void 0:t.flushPendingSavings())&&void 0!==i?i:null})).filter(o.notNull);e.length&&await Promise.all(e)}}_invalidateAllLineTools(){this._chartWidgetCollection.getAll().forEach((e=>{var t +;return null===(t=e.lineToolsSynchronizer())||void 0===t?void 0:t.invalidateAll()}))}async _saveChart(e,t,n,o){var a;const c=this._chartWidgetCollection.metaInfo;let h=null!==(a=o.changes)&&void 0!==a?a:r.changedAll;l.enabled("saveload_separate_drawings_storage")&&this._invalidateAllLineTools();let d=!0;if(2&h||l.enabled("saveload_separate_drawings_storage"))try{await this._saveLineToolsToStorage()}catch(e){h|=1;const{SavingLineToolsLibraryError:t}=await i.e(5565).then(i.bind(i,98653));e instanceof t&&e.safe||(d=!1)}if(1&h){const i=e(d);if((0,s.default)(this._prevChartState,i)&&null!==c.id.value())return this._chartSavedDelegate.fire(!0),void t(c,i);0;const r=(e,i)=>(d||this._chartWidgetCollection.getAll().forEach((e=>{var t;return null===(t=e.lineToolsSynchronizer())||void 0===t?void 0:t.markAsValidatedBecauseOfSavingToContent(!0)})),t(e,i));return this._saveChartImpl(i,c,r,n,o,e)}this._chartSavedDelegate.fire(!0),t(c,null)}}},80147:(e,t,i)=>{"use strict";var s=i(50151).assert,r=i(61595).backend,n=i(26676).ChartSaverBase,o=i(57898).Delegate,a=i(14483);i.tf(null,void 0,i(8162)),i.tf(null,void 0,i(17994)),i.tf(null,void 0,i(87375));function l(e,t){e.content=JSON.stringify(t)}t.ChartSaver=class extends n{constructor(e){super(e),this._chartAboutToBeSavedDelegate=new o,this._chartSavedDelegate=new o,this._chartSizeLimitExceededDelegate=new o}chartSizeLimitExceeded(){return this._chartSizeLimitExceededDelegate}chartAboutToBeSaved(){return this._chartAboutToBeSavedDelegate}chartSaved(){return this._chartSavedDelegate}saveToJSON(e){var t=e&&!1===e.includeDrawings||void 0,i=this._getCommonSavingInfo(!1);return l(i,this._getChartWidgetCollectionState(!1,!0,t,void 0,t)),i}_getChartWidgetCollectionState(e,t,i,s,r){return e||(t=!0,s=!1),t?this._chartWidgetCollection.state(!!e,i,s,r):this._chartWidgetCollection.activeChartWidget.value().state(!!e,i,s,r)}publishChart(e){}publishScript(e,t,i){}onPublish(e,t){}_saveChartImpl(e,t,i,s,n,o){var a=i,l=s;if(a=function(s){t.id.value()||(t.id.setValue(s),t.uid.setValue(s)),"function"==typeof i&&i(t,e)},!e.name)return console.warn("Saving chart with empty name is not allowed"),void s();r.saveChart(e.name,e.short_name,e.resolution,e,t).then(a.bind(this)).catch(l.bind(this))}saveChartSilently(e,t,i){i=i||{};var r=function(e){var t=e&&a.enabled("saveload_separate_drawings_storage"),s=this._getChartWidgetCollectionState(!1,void 0,void 0,void 0,t),r=this._getCommonSavingInfo(!1,t);return l(r,s),i.chartName&&(r.name=i.chartName),r.name&&0!==r.name.length||!i.defaultChartName||(r.name=i.defaultChartName),i.autoSave&&(r.autoSave=!0),r}.bind(this);this._isSaveInProcess=!0,this._chartAboutToBeSavedDelegate.fire(),this._saveChart(r,function(t,i){s(!this._chartWidgetCollection.readOnly(),"Trying to save layout in read-only mode"),i&&this._chartWidgetCollection.metaInfo.name.setValue(i.name),this._prevChartState=i,this._chartSavedDelegate.fire(!0),this._isSaveInProcess=!1,e&&e({uid:t.uid.value(),data:i}),this._prevChartState&&delete this._prevChartState.savingToken}.bind(this),function(){ +this._chartSavedDelegate.fire(!1),this._isSaveInProcess=!1,t&&t.apply(null,arguments)}.bind(this),i)}isSaveInProcess(){return this._isSaveInProcess}}},58557:(e,t,i)=>{"use strict";i.d(t,{getTranslatedSymbolDescription:()=>s});i(11542);function s(e){return e.description||""}},53180:(e,t,i)=>{"use strict";function s(e){return e+"…"}i.d(t,{appendEllipsis:()=>s})},45884:(e,t,i)=>{"use strict";function s(e){if(!o(e))throw e}function r(e){return(null==e?void 0:e.aborted)?Promise.reject(n()):new Promise(((t,i)=>{null==e||e.addEventListener("abort",(()=>i(n())),{once:!0})}))}function n(){return new DOMException("Aborted","AbortError")}function o(e){return e instanceof Error&&"AbortError"===e.name}function a(e,t){return Promise.race([r(e),t])}async function l(e,t){let i;try{await a(e,new Promise((e=>{i=setTimeout(e,t)})))}finally{clearTimeout(i)}}i.d(t,{delay:()=>l,isAbortError:()=>o,respectAbort:()=>a,skipAbortError:()=>s})},22767:(e,t,i)=>{"use strict";function s(e){let t;if("object"!=typeof e||null==e||"number"==typeof e.nodeType)t=e;else if(e instanceof Date)t=new Date(e.valueOf());else if(Array.isArray(e)){t=[];let i=0;const r=e.length;for(;is})},30888:(e,t,i)=>{"use strict";function s(e,...t){return e&&"object"==typeof e?(0===t.length||t.forEach((t=>{null!=t&&"object"==typeof t&&Object.keys(t).forEach((i=>{const n=e[i],o=t[i];if(o===e)return;const a=Array.isArray(o);if(o&&(r(o)||a)){let t;t=a?n&&Array.isArray(n)?n:[]:n&&r(n)?n:{},e[i]=s(t,o)}else void 0!==o&&(e[i]=o)}))})),e):e}function r(e){if(!e||"[object Object]"!==Object.prototype.toString.call(e))return!1;const t=Object.getPrototypeOf(e);if(!t)return!0;const i=Object.hasOwnProperty.toString,s=t.hasOwnProperty("constructor")&&t.constructor;return"function"==typeof s&&i.call(s)===i.call(Object)}i.d(t,{deepExtend:()=>s})},51608:(e,t,i)=>{"use strict";function s(){let e,t;return{promise:new Promise(((i,s)=>{e=i,t=s})),reject:t,resolve:e}}i.d(t,{createDeferredPromise:()=>s})},93544:(e,t,i)=>{"use strict";function s(e){if(void 0===e)return"";if(e instanceof Error){let t=e.message;return e.stack&&(t+=" "+e.stack),t}return"string"==typeof e?e.toString():JSON.stringify(e)}i.d(t,{errorToString:()=>s})},68616:(e,t,i)=>{"use strict";i.d(t,{getTwemojiUrl:()=>r});var s=i(18438);function r(e,t){let i="";return s.default.parse(e,(e=>(i=s.default.base+("svg"===t?`svg/${e}.svg`:`72x72/${e}.png`),!1))),i}s.default.base="https://cdnjs.cloudflare.com/ajax/libs/twemoji/13.0.1/"},36174:(e,t,i)=>{"use strict";i.r(t),i.d(t,{guid:()=>r,randomHash:()=>n,randomHashN:()=>o});const s="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";function r(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(e=>{const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))}function n(){return o(12)}function o(e){let t="";for(let i=0;i{"use strict";i.d(t,{parseHtml:()=>r,parseHtmlElement:()=>n});const s=new WeakMap;function r(e,t){let i,r;return i=null==t?document.documentElement:9===t.nodeType?t.documentElement:t,s&&(r=s.get(i)),r||(r=i.ownerDocument.createRange(),r.selectNodeContents(i),s&&s.set(i,r)),r.createContextualFragment(e)}function n(e,t){const i=r(e,t),s=i.firstElementChild;return null!==s&&i.removeChild(s),s}},21861:(e,t,i)=>{"use strict";function s(e){e.preventDefault()}i.d(t,{preventDefault:()=>s,preventDefaultForContextMenu:()=>n});const r=["input:not([type])",'input[type="text"]','input[type="email"]','input[type="password"]','input[type="search"]','input[type="number"]','input[type="url"]',"textarea","a[href]",'*[contenteditable="true"]',"[data-allow-context-menu]"];function n(e){const t=e.target;t&&!t.closest(r.join(", "))&&e.preventDefault()}},94474:(e,t,i)=>{"use strict";i.d(t,{capitalizeFirstLetterInWord:()=>h,htmlEscape:()=>a,removeSpaces:()=>c,removeTags:()=>l});const s=/[<"'&>]/g,r=e=>`&#${e.charCodeAt(0)};`,n={"<":"<",">":">",""":'"',"'":"'","&":"&","<":"<",">":">",""":'"',"'":"'","'":"'","&":"&"},o=Object.assign({},...Object.entries(n).map((([e,t])=>({[t]:e}))));new RegExp(Object.keys(n).join("|"),"g"),new RegExp(Object.keys(o).join("|"),"g");function a(e){return e.replace(s,r)}function l(e=""){return e.replace(/(<([^>]+)>)/gi,"")}function c(e=""){return e.replace(/\s+/g,"")}function h(e=""){return e.replace(/\b\w/g,(e=>e.toUpperCase()))}},15051:(e,t,i)=>{"use strict";function s(e){return e.reduce((function(e,t,i){return~e.indexOf(t)||e.push(t),e}),[])}i.r(t),i.d(t,{uniq:()=>s})},50946:e=>{e.exports=''},70893:e=>{ e.exports=''},1457:e=>{ e.exports=''},55824:e=>{e.exports=''},37924:e=>{e.exports=''},2872:e=>{e.exports=''},7983:e=>{e.exports=''},39267:e=>{e.exports=''},16911:e=>{e.exports=''},6862:e=>{e.exports=''},54190:e=>{e.exports=''},25191:e=>{ e.exports=''},51983:e=>{e.exports=''},93379:e=>{e.exports=''},35149:e=>{e.exports=''},84959:e=>{ diff --git a/charting_library/bundles/runtime.fb41253a64dfb129780b.js b/charting_library/bundles/runtime.b283dc97286bf865cf08.js similarity index 84% rename from charting_library/bundles/runtime.fb41253a64dfb129780b.js rename to charting_library/bundles/runtime.b283dc97286bf865cf08.js index 90efc78a..acbd34c8 100644 --- a/charting_library/bundles/runtime.fb41253a64dfb129780b.js +++ b/charting_library/bundles/runtime.b283dc97286bf865cf08.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:"d32b5098422df02a6688",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:"8582f5ea3328f2cbdfae",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:"6826612f0a41ab0fc35c",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 +(()=>{"use strict";var e,a,d,c,f,t={},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 t[e].call(d.exports,d,d.exports,r),d.loaded=!0,d.exports}r.m=t,r.c=b,e=[],r.O=(a,d,c,f)=>{if(!d){var t=1/0;for(i=0;i=f)&&Object.keys(r.O).every((e=>r.O[e](d[n])))?d.splice(n--,1):(b=!1,f0&&e[i-1][2]>f;i--)e[i]=e[i-1];e[i]=[d,c,f]},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 f=Object.create(null);r.r(f);var t={};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=>t[a]=()=>e[a]));return t.default=()=>e,r.d(f,t),f},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:"af8e7c4b04b18b9156b0",4665:"d7331dbca4a2aa0909e7",4713:"8582f5ea3328f2cbdfae",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:"45bca887c7f2c0d84601",6639:"a1bd5bf1d51c681561a1",6747:"ae7a7ec28d22057d6d0d",6752:"912872ffa56a7243d664",6780:"3b96f58f66e0caa61b15",6884:"07642217627127113fb0",6918:"c8f3265e9286a784038b",6925:"665969c4af4481df0691",6949:"f50051a55eaa8dd5e780",6985:"8d289318ce5fe6dc7763",7051:"cff4509091dbd0706ebe",7078:"cddce4ed266fd9e0629e",7111:"4716f3208dc337521c10",7129:"0bc2d3617dda7143f094",7149:"d450e8145ad7e6fbd67f",7194:"098c1a8da1ddbbda98f6",7260:"6826612f0a41ab0fc35c",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={},f="tradingview:",r.l=(e,a,d,t)=>{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 f=c[e];if(delete c[e],b.parentNode&&b.parentNode.removeChild(b),f&&f.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),f=r.p+c;if(((e,a)=>{for(var d=document.getElementsByTagName("link"),c=0;c{var t=document.createElement("link");t.rel="stylesheet",t.type="text/css",t.onerror=t.onload=d=>{if(t.onerror=t.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,t.parentNode&&t.parentNode.removeChild(t),f(n)}},t.href=a,0!==t.href.indexOf(window.location.origin+"/")&&(t.crossOrigin="anonymous"),d?d.parentNode.insertBefore(t,d.nextSibling):document.head.appendChild(t)})(e,f,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 f=new Promise(((d,f)=>c=e[a]=[d,f]));d.push(c[2]=f);var t=r.p+r.u(a),b=new Error;r.l(t,(d=>{if(r.o(e,a)&&(0!==(c=e[a])&&(e[a]=void 0),c)){var f=d&&("load"===d.type?"missing":d.type),t=d&&d.target&&d.target.src;b.message="Loading chunk "+a+" failed.\n("+f+": "+t+")",b.name="ChunkLoadError",b.type=f,b.request=t,c[1](b)}}),"chunk-"+a,a)}},r.O.j=a=>0===e[a];var a=(a,d)=>{var c,f,[t,b,n]=d,o=0;if(t.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-template-dialog.711ba6ae5b343ace8691.js b/charting_library/bundles/study-template-dialog.45bca887c7f2c0d84601.js similarity index 99% rename from charting_library/bundles/study-template-dialog.711ba6ae5b343ace8691.js rename to charting_library/bundles/study-template-dialog.45bca887c7f2c0d84601.js index cbe70088..264482ea 100644 --- a/charting_library/bundles/study-template-dialog.711ba6ae5b343ace8691.js +++ b/charting_library/bundles/study-template-dialog.45bca887c7f2c0d84601.js @@ -1,6 +1,6 @@ -(self.webpackChunktradingview=self.webpackChunktradingview||[]).push([[6631],{74786:(e,t,a)=>{"use strict";a.d(t,{default:()=>n});const n=function(){}},70048:e=>{e.exports={wrapper:"wrapper-GZajBGIm",input:"input-GZajBGIm",box:"box-GZajBGIm",icon:"icon-GZajBGIm",noOutline:"noOutline-GZajBGIm","intent-danger":"intent-danger-GZajBGIm",check:"check-GZajBGIm",dot:"dot-GZajBGIm"}},69789:e=>{e.exports={checkbox:"checkbox-vyj6oJxw",reverse:"reverse-vyj6oJxw",label:"label-vyj6oJxw",baseline:"baseline-vyj6oJxw"}},83073:e=>{e.exports={"small-height-breakpoint":"screen and (max-height: 360px)",footer:"footer-PhMf7PhQ",submitButton:"submitButton-PhMf7PhQ",buttons:"buttons-PhMf7PhQ"}},70673:(e,t,a)=>{"use strict";a.d(t,{CheckboxInput:()=>c});var n=a(50959),i=a(97754),l=a(90186),s=a(9745),o=a(65890),r=a(70048),m=a.n(r);function c(e){const t=i(m().box,m()[`intent-${e.intent}`],{[m().check]:!Boolean(e.indeterminate),[m().dot]:Boolean(e.indeterminate),[m().noOutline]:-1===e.tabIndex}),a=i(m().wrapper,e.className);return n.createElement("span",{className:a,title:e.title,style:e.style},n.createElement("input",{id:e.id,tabIndex:e.tabIndex,className:m().input,type:"checkbox",name:e.name,checked:e.checked,disabled:e.disabled,value:e.value,autoFocus:e.autoFocus,role:e.role,onChange:function(){e.onChange&&e.onChange(e.value)},ref:e.reference,"aria-required":e["aria-required"],"aria-describedby":e["aria-describedby"],"aria-invalid":e["aria-invalid"],...(0,l.filterDataProps)(e)}),n.createElement("span",{className:t},n.createElement(s.Icon,{icon:o,className:m().icon})))}},15294:(e,t,a)=>{"use strict";a.d(t,{Checkbox:()=>m});var n=a(50959),i=a(97754),l=a(59416),s=a(70673),o=a(69789),r=a.n(o);class m extends n.PureComponent{render(){const{inputClassName:e,labelClassName:t,...a}=this.props,l=i(this.props.className,r().checkbox,{[r().reverse]:Boolean(this.props.labelPositionReverse),[r().baseline]:Boolean(this.props.labelAlignBaseline)}),o=i(r().label,t,{[r().disabled]:this.props.disabled});let m=null;return this.props.label&&(m=n.createElement("span",{className:o,title:this.props.title},this.props.label)),n.createElement("label",{className:l},n.createElement(s.CheckboxInput,{...a,className:e}),m)}}m.defaultProps={value:"on"};(0,l.makeSwitchGroupItem)(m)},59416:(e,t,a)=>{"use strict";a.d(t,{SwitchGroup:()=>s,makeSwitchGroupItem:()=>o});var n=a(50959),i=a(74786);const l=(0,n.createContext)({getName:()=>"",getValues:()=>[],getOnChange:()=>i.default,subscribe:i.default,unsubscribe:i.default});class s extends n.PureComponent{constructor(e){super(e),this._subscriptions=new Set,this._getName=()=>this.props.name,this._getValues=()=>this.props.values,this._getOnChange=()=>this.props.onChange,this._subscribe=e=>{this._subscriptions.add(e)},this._unsubscribe=e=>{this._subscriptions.delete(e)},this.state={switchGroupContext:{getName:this._getName,getValues:this._getValues,getOnChange:this._getOnChange,subscribe:this._subscribe,unsubscribe:this._unsubscribe}}}render(){return n.createElement(l.Provider,{value:this.state.switchGroupContext},this.props.children) +(self.webpackChunktradingview=self.webpackChunktradingview||[]).push([[6631],{74786:(e,t,a)=>{"use strict";a.d(t,{default:()=>n});const n=function(){}},70048:e=>{e.exports={wrapper:"wrapper-GZajBGIm",input:"input-GZajBGIm",box:"box-GZajBGIm",icon:"icon-GZajBGIm",noOutline:"noOutline-GZajBGIm","intent-danger":"intent-danger-GZajBGIm",check:"check-GZajBGIm",dot:"dot-GZajBGIm"}},69789:e=>{e.exports={checkbox:"checkbox-vyj6oJxw",reverse:"reverse-vyj6oJxw",label:"label-vyj6oJxw",baseline:"baseline-vyj6oJxw"}},83073:e=>{e.exports={"small-height-breakpoint":"screen and (max-height: 360px)",footer:"footer-PhMf7PhQ",submitButton:"submitButton-PhMf7PhQ",buttons:"buttons-PhMf7PhQ"}},70673:(e,t,a)=>{"use strict";a.d(t,{CheckboxInput:()=>c});var n=a(50959),i=a(97754),l=a(90186),s=a(9745),o=a(65890),r=a(70048),m=a.n(r);function c(e){const t=i(m().box,m()[`intent-${e.intent}`],{[m().check]:!Boolean(e.indeterminate),[m().dot]:Boolean(e.indeterminate),[m().noOutline]:-1===e.tabIndex}),a=i(m().wrapper,e.className);return n.createElement("span",{className:a,title:e.title,style:e.style},n.createElement("input",{id:e.id,tabIndex:e.tabIndex,className:m().input,type:"checkbox",name:e.name,checked:e.checked,disabled:e.disabled,value:e.value,autoFocus:e.autoFocus,role:e.role,onChange:function(){e.onChange&&e.onChange(e.value)},ref:e.reference,"aria-required":e["aria-required"],"aria-describedby":e["aria-describedby"],"aria-invalid":e["aria-invalid"],...(0,l.filterDataProps)(e)}),n.createElement("span",{className:t},n.createElement(s.Icon,{icon:o,className:m().icon})))}},32389:(e,t,a)=>{"use strict";a.d(t,{Checkbox:()=>m});var n=a(50959),i=a(97754),l=a(59416),s=a(70673),o=a(69789),r=a.n(o);class m extends n.PureComponent{render(){const{inputClassName:e,labelClassName:t,...a}=this.props,l=i(this.props.className,r().checkbox,{[r().reverse]:Boolean(this.props.labelPositionReverse),[r().baseline]:Boolean(this.props.labelAlignBaseline)}),o=i(r().label,t,{[r().disabled]:this.props.disabled});let m=null;return this.props.label&&(m=n.createElement("span",{className:o,title:this.props.title},this.props.label)),n.createElement("label",{className:l},n.createElement(s.CheckboxInput,{...a,className:e}),m)}}m.defaultProps={value:"on"};(0,l.makeSwitchGroupItem)(m)},59416:(e,t,a)=>{"use strict";a.d(t,{SwitchGroup:()=>s,makeSwitchGroupItem:()=>o});var n=a(50959),i=a(74786);const l=(0,n.createContext)({getName:()=>"",getValues:()=>[],getOnChange:()=>i.default,subscribe:i.default,unsubscribe:i.default});class s extends n.PureComponent{constructor(e){super(e),this._subscriptions=new Set,this._getName=()=>this.props.name,this._getValues=()=>this.props.values,this._getOnChange=()=>this.props.onChange,this._subscribe=e=>{this._subscriptions.add(e)},this._unsubscribe=e=>{this._subscriptions.delete(e)},this.state={switchGroupContext:{getName:this._getName,getValues:this._getValues,getOnChange:this._getOnChange,subscribe:this._subscribe,unsubscribe:this._unsubscribe}}}render(){return n.createElement(l.Provider,{value:this.state.switchGroupContext},this.props.children) }componentDidUpdate(e){this._notify(this._getUpdates(this.props.values,e.values))}_notify(e){this._subscriptions.forEach((t=>t(e)))}_getUpdates(e,t){return[...t,...e].filter((a=>t.includes(a)?!e.includes(a):e.includes(a)))}}function o(e){var t;return t=class extends n.PureComponent{constructor(){super(...arguments),this._onChange=e=>{this.context.getOnChange()(e)},this._onUpdate=e=>{e.includes(this.props.value)&&this.forceUpdate()}}componentDidMount(){this.context.subscribe(this._onUpdate)}render(){return n.createElement(e,{...this.props,name:this._getName(),onChange:this._onChange,checked:this._isChecked()})}componentWillUnmount(){this.context.unsubscribe(this._onUpdate)}_getName(){return this.context.getName()}_isChecked(){return this.context.getValues().includes(this.props.value)}},t.contextType=l,t}},50182:(e,t,a)=>{"use strict";a.d(t,{AdaptiveConfirmDialog:()=>d});var n=a(50959),i=a(97754),l=a.n(i),s=a(94720),o=a(50151),r=a(11542),m=a(68335),c=a(35057),u=a(83073);class d extends n.PureComponent{constructor(){super(...arguments),this._dialogRef=n.createRef(),this._handleClose=()=>{const{defaultActionOnClose:e,onSubmit:t,onCancel:a,onClose:n}=this.props;switch(e){case"submit":t();break;case"cancel":a()}n()},this._handleCancel=()=>{this.props.onCancel(),this.props.onClose()},this._handleKeyDown=e=>{const{onSubmit:t,submitButtonDisabled:a,submitOnEnterKey:n}=this.props;13===(0,m.hashFromEvent)(e)&&n&&(e.preventDefault(),a||t())}}render(){const{render:e,onClose:t,onSubmit:a,onCancel:i,footerLeftRenderer:l,submitButtonText:s,submitButtonDisabled:o,defaultActionOnClose:r,submitOnEnterKey:m,...u}=this.props;return n.createElement(c.AdaptivePopupDialog,{...u,ref:this._dialogRef,onKeyDown:this._handleKeyDown,render:this._renderChildren(),onClose:this._handleClose})}focus(){(0,o.ensureNotNull)(this._dialogRef.current).focus()}_renderChildren(){return e=>{const{render:t,footerLeftRenderer:i,additionalButtons:o,submitButtonText:m,submitButtonDisabled:c,onSubmit:d,cancelButtonText:h,showCancelButton:p=!0,submitButtonClassName:b,cancelButtonClassName:v,buttonsWrapperClassName:g}=this.props;return n.createElement(n.Fragment,null,t(e),n.createElement("div",{className:u.footer},i&&i(e.isSmallWidth),n.createElement("div",{className:l()(u.buttons,g)},o,p&&n.createElement(s.Button,{className:v,name:"cancel",appearance:"stroke",onClick:this._handleCancel},null!=h?h:r.t(null,void 0,a(20036))),n.createElement("span",{className:u.submitButton},n.createElement(s.Button,{className:b,disabled:c,name:"submit",onClick:d,"data-name":"submit-button"},null!=m?m:r.t(null,void 0,a(68988)))))))}}}d.defaultProps={defaultActionOnClose:"submit",submitOnEnterKey:!0}},92297:e=>{e.exports={loading:"loading-BPaLXf0z"}},15747:e=>{e.exports={container:"container-CD9TBN7D",withSuggestions:"withSuggestions-CD9TBN7D",title:"title-CD9TBN7D",autocomplete:"autocomplete-CD9TBN7D",saveSymbol:"saveSymbol-CD9TBN7D",saveInterval:"saveInterval-CD9TBN7D",indicators:"indicators-CD9TBN7D",hintLabel:"hintLabel-CD9TBN7D",hintMark:"hintMark-CD9TBN7D", -hidden:"hidden-CD9TBN7D"}},13932:(e,t,a)=>{"use strict";a.r(t),a.d(t,{StudyTemplateSaver:()=>A});var n=a(50151),i=a(11542),l=a(50959),s=a(962),o=(a(42053),a(97754)),r=a(15294),m=a(21788),c=a(9745),u=a(50182),d=a(50655),h=a(26996),p=a(92297);function b(e){const{isLoading:t}=e;return l.createElement("span",{className:t?p.loading:void 0},i.t(null,void 0,a(85520)),t&&l.createElement(h.Loader,{color:"white"}))}class v extends l.PureComponent{constructor(e){super(e),this._dialogRef=l.createRef(),this._manager=null,this._handleSubmit=()=>{this.setState({isLoading:!0}),this.props.onSubmit(this)},this.state={isLoading:!1}}render(){const{isOpened:e,saveDisabled:t,title:a,onClose:n}=this.props;return l.createElement(u.AdaptiveConfirmDialog,{ref:this._dialogRef,onClose:n,onSubmit:this._handleSubmit,onCancel:n,onClickOutside:n,isOpened:e,title:a,dataName:"save-rename-dialog",render:this._renderDialogBody(),defaultActionOnClose:"none",submitButtonText:l.createElement(b,{isLoading:this.state.isLoading}),submitButtonDisabled:t})}focus(){(0,n.ensureNotNull)(this._dialogRef.current).focus()}manager(){return this._manager}submit(){this.props.onSubmit(this)}close(){this.props.onClose()}dropLoading(){this.setState({isLoading:!1})}_renderDialogBody(){return()=>l.createElement(d.SlotContext.Consumer,null,(e=>(this._manager=e,this.props.children)))}}var g=a(33547),S=a(85508),_=a(15747),y=a(49483);const f=i.t(null,void 0,a(50912)),w=i.t(null,void 0,a(40898)),C=i.t(null,void 0,a(33455)),N=i.t(null,void 0,a(63135)),k=[_.hintMark,"apply-common-tooltip"];function x(e){const{title:t,saveSymbolHintText:a,saveIntervalHintText:i,indicatorsText:s,source:u,onClose:d,onSubmit:h}=e,[p,b]=(0,l.useState)(""),[y,x]=(0,l.useState)(!1),[I,T]=(0,l.useState)(!1),[D,E]=(0,l.useState)(!1),L=(0,l.useRef)(null),B=(0,l.useRef)(null);return(0,l.useEffect)((()=>{(0,n.ensureNotNull)(B.current).focus()}),[]),l.createElement(v,{ref:L,isOpened:!0,saveDisabled:!p,title:t,onClose:d,onSubmit:function(e){h({title:p,saveSymbol:y,saveInterval:I},e)}},l.createElement("div",{className:o(_.container,D&&_.withSuggestions)},l.createElement("div",{className:_.title},f),l.createElement("div",{className:_.autocomplete},l.createElement(m.Autocomplete,{maxLength:64,value:p,onChange:b,onBlur:function(){(0,n.ensureNotNull)(L.current).focus()},source:u,allowUserDefinedValues:!0,preventOnFocusOpen:!0,noEmptyText:!0,preventSearchOnEmptyQuery:!0,filter:g.autocompleteFilter,setupHTMLInput:function(e){B.current=e},onSuggestionsOpen:function(){E(!0)},onSuggestionsClose:function(){E(!1)}})),l.createElement("div",{className:_.saveSymbol},l.createElement(r.Checkbox,{label:l.createElement("span",{className:_.hintLabel},C,l.createElement(c.Icon,{icon:S,className:o(k),title:a})),onChange:function(){x(!y),(0,n.ensureNotNull)(L.current).focus()},checked:y})),l.createElement("div",{className:_.saveInterval},l.createElement(r.Checkbox,{label:l.createElement("span",{className:_.hintLabel},N,l.createElement(c.Icon,{icon:S,className:o(k),title:i})),onChange:function(){T(!I),(0, +hidden:"hidden-CD9TBN7D"}},13932:(e,t,a)=>{"use strict";a.r(t),a.d(t,{StudyTemplateSaver:()=>A});var n=a(50151),i=a(11542),l=a(50959),s=a(962),o=(a(42053),a(97754)),r=a(32389),m=a(21788),c=a(9745),u=a(50182),d=a(50655),h=a(26996),p=a(92297);function b(e){const{isLoading:t}=e;return l.createElement("span",{className:t?p.loading:void 0},i.t(null,void 0,a(85520)),t&&l.createElement(h.Loader,{color:"white"}))}class v extends l.PureComponent{constructor(e){super(e),this._dialogRef=l.createRef(),this._manager=null,this._handleSubmit=()=>{this.setState({isLoading:!0}),this.props.onSubmit(this)},this.state={isLoading:!1}}render(){const{isOpened:e,saveDisabled:t,title:a,onClose:n}=this.props;return l.createElement(u.AdaptiveConfirmDialog,{ref:this._dialogRef,onClose:n,onSubmit:this._handleSubmit,onCancel:n,onClickOutside:n,isOpened:e,title:a,dataName:"save-rename-dialog",render:this._renderDialogBody(),defaultActionOnClose:"none",submitButtonText:l.createElement(b,{isLoading:this.state.isLoading}),submitButtonDisabled:t})}focus(){(0,n.ensureNotNull)(this._dialogRef.current).focus()}manager(){return this._manager}submit(){this.props.onSubmit(this)}close(){this.props.onClose()}dropLoading(){this.setState({isLoading:!1})}_renderDialogBody(){return()=>l.createElement(d.SlotContext.Consumer,null,(e=>(this._manager=e,this.props.children)))}}var g=a(33547),S=a(85508),_=a(15747),y=a(49483);const f=i.t(null,void 0,a(50912)),w=i.t(null,void 0,a(40898)),C=i.t(null,void 0,a(33455)),N=i.t(null,void 0,a(63135)),k=[_.hintMark,"apply-common-tooltip"];function x(e){const{title:t,saveSymbolHintText:a,saveIntervalHintText:i,indicatorsText:s,source:u,onClose:d,onSubmit:h}=e,[p,b]=(0,l.useState)(""),[y,x]=(0,l.useState)(!1),[I,T]=(0,l.useState)(!1),[D,E]=(0,l.useState)(!1),L=(0,l.useRef)(null),B=(0,l.useRef)(null);return(0,l.useEffect)((()=>{(0,n.ensureNotNull)(B.current).focus()}),[]),l.createElement(v,{ref:L,isOpened:!0,saveDisabled:!p,title:t,onClose:d,onSubmit:function(e){h({title:p,saveSymbol:y,saveInterval:I},e)}},l.createElement("div",{className:o(_.container,D&&_.withSuggestions)},l.createElement("div",{className:_.title},f),l.createElement("div",{className:_.autocomplete},l.createElement(m.Autocomplete,{maxLength:64,value:p,onChange:b,onBlur:function(){(0,n.ensureNotNull)(L.current).focus()},source:u,allowUserDefinedValues:!0,preventOnFocusOpen:!0,noEmptyText:!0,preventSearchOnEmptyQuery:!0,filter:g.autocompleteFilter,setupHTMLInput:function(e){B.current=e},onSuggestionsOpen:function(){E(!0)},onSuggestionsClose:function(){E(!1)}})),l.createElement("div",{className:_.saveSymbol},l.createElement(r.Checkbox,{label:l.createElement("span",{className:_.hintLabel},C,l.createElement(c.Icon,{icon:S,className:o(k),title:a})),onChange:function(){x(!y),(0,n.ensureNotNull)(L.current).focus()},checked:y})),l.createElement("div",{className:_.saveInterval},l.createElement(r.Checkbox,{label:l.createElement("span",{className:_.hintLabel},N,l.createElement(c.Icon,{icon:S,className:o(k),title:i})),onChange:function(){T(!I),(0, n.ensureNotNull)(L.current).focus()},checked:I})),l.createElement("div",{className:_.title},w),l.createElement("div",{className:o(_.indicators,D&&_.withSuggestions)},s)))}y.CheckMobile.any()&&k.push(_.hidden);var I=a(76422),T=a(52092);class D{constructor(e){this._container=document.createElement("div"),this.close=()=>{this.unmount(),this._onClose&&this._onClose()},this.unmount=()=>{I.unsubscribe(T.CLOSE_POPUPS_AND_DIALOGS_COMMAND,this.unmount,null),s.unmountComponentAtNode(this._container)},this._title=e.title,this._saveSymbolHintText=e.saveSymbolHintText,this._saveIntervalHintText=e.saveIntervalHintText,this._indicatorsText=e.indicatorsText,this._source=e.source,this._onSubmit=e.onSubmit,this._onClose=e.onClose,I.subscribe(T.CLOSE_POPUPS_AND_DIALOGS_COMMAND,this.unmount,null)}mount(){s.render(l.createElement(x,{title:this._title,saveSymbolHintText:this._saveSymbolHintText,saveIntervalHintText:this._saveIntervalHintText,indicatorsText:this._indicatorsText,source:this._source,onClose:this.close,onSubmit:this._onSubmit}),this._container)}destroy(){this.unmount()}show(){this.mount()}}var E=a(61595),L=a(3615),B=a(11321),z=a(39344),M=a(39080);const j=i.t(null,void 0,a(21939)),O=i.t(null,void 0,a(61422)),R=i.t(null,void 0,a(30858)),P=i.t(null,void 0,a(83081));function G(e,t,a){const n=()=>{E.backend.invalidateStudyTemplatesList(),E.backend.getStudyTemplatesList().then(t)};E.backend.saveStudyTemplate(e).then(n)}class A{constructor(e){this._dialog=null,this._onSave=e=>{this._options.onSave(e),this._close()},this._showSaveDialog=async()=>{const e=this._controller.model().mainSeries().symbol(),t=this._controller.model().mainSeries().interval(),a=await this._getActualTemplateList();await this._showTemplateSaveRenameDialog(a,e,t)},this._close=()=>{this._dialog&&(this._dialog.destroy(),this._dialog=null)},this._options=e,this._controller=e.controller}show(){(0,M.runOrSigninWithFeature)(this._showSaveDialog,{feature:"customIndicators",source:"Study templates save as",sourceMeta:"Chart"})}_prepareData(e,t,a){const n=this._controller.model().studyTemplate(t,a);return{name:e,content:JSON.stringify(n),meta_info:(0,z.createStudyTemplateMetaInfo)(this._controller,n.interval)}}_doSave(e,t,a){const{title:n,saveSymbol:i,saveInterval:l}=t;if(!n)return;const s=a.manager()||void 0,o=this._prepareData(n,i,l);if(e.find((e=>e.name===n))){const e=e=>{e?G(o,this._onSave):(a.focus(),a.dropLoading())};(function(e,t){return new Promise((a=>(0,L.showConfirm)({text:P.format({templateName:e}),onConfirm:({dialogClose:e})=>{a(!0),e()},onClose:()=>a(!1)},t)))})(n,s).then(e)}else{G(o,this._onSave)}}_getActualTemplateList(){return E.backend.invalidateStudyTemplatesList(),E.backend.getStudyTemplatesList()}_showTemplateSaveRenameDialog(e,t,a){const n=(0,z.createStudyTemplateMetaInfo)(this._controller);(this._dialog=new D({source:e.map((e=>e.name)),title:j,saveSymbolHintText:O.format({symbol:t}),saveIntervalHintText:R.format({interval:(0,B.translatedIntervalString)(a)}),indicatorsText:(0,z.descriptionString)(n.indicators),onSubmit:(t,a)=>this._doSave(e,t,a), onClose:this._close})).show()}}},39344:(e,t,a)=>{"use strict";a.d(t,{createStudyTemplateMetaInfo:()=>l,descriptionString:()=>s});var n=a(28853),i=a(37591);function l(e,t){return{indicators:e.orderedDataSources(!0).filter((e=>(0,n.isStudy)(e)&&!0)).map((e=>({id:e.metaInfo().id,description:e.title(i.TitleDisplayTarget.StatusLine,!0,void 0,!0)}))),interval:t}}function s(e){const t=new Map;return e.forEach((e=>{const[a,n]=t.get(e.id)||[e.description,0];t.set(e.id,[a,n+1])})),Array.from(t.values()).map((([e,t])=>`${e}${t>1?` x ${t}`:""}`)).join(", ")}},33547:(e,t,a)=>{"use strict";function n(e,t){return Boolean(""===e||e&&-1!==t.toLowerCase().indexOf(e.toLowerCase()))}a.d(t,{autocompleteFilter:()=>n})},65890:e=>{e.exports=''},85508:e=>{e.exports=''},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:["關閉選單"]}},21939:e=>{e.exports={ar:["حفظ قالب المؤشر"],ca_ES:"Save Indicator Template",cs:"Save Indicator Template",de:["Indikatorvorlage speichern"],el:"Save Indicator Template",en:"Save Indicator Template",es:["Guardar plantilla de indicadores"],fa:"Save Indicator Template",fr:["Sauver le modèle d'indicateur"],he_IL:["שמור תבנית אינדיקטור"],hu_HU:"Save Indicator Template",id_ID:["Simpan Template Indikator"],it:["Salva modello indicatore"],ja:["インジケーターテンプレートを保存"],ko:["인디케이터 템플릿 세이브"],ms_MY:["Simpan Templat Penunjuk"],nl_NL:"Save Indicator Template",pl:["Zapisz szablon wskaźnika"],pt:["Salvar Conjunto de Indicadores"],ro:"Save Indicator Template",ru:["Сохранить шаблон индикаторов"],sv:["Spara indikatormall"],th:["บันทึกรูปแบบอินดิเคเตอร์"],tr:["Gösterge Şablonu Kaydet"],vi:["Lưu mẫu chỉ báo"],zh:["保存指标模板"],zh_TW:["儲存指標範本為"]}},40898:e=>{e.exports={ar:["المؤشرات المحفوظة"],ca_ES:"Saved indicators",cs:"Saved indicators",de:["Gespeicherte Indikatoren"],el:"Saved indicators",en:"Saved indicators",es:["Indicadores guardados"],fa:"Saved indicators",fr:["Indicateurs sauvegardés"],he_IL:["אינדיקטורים שמורים"],hu_HU:"Saved indicators",id_ID:["Indikator tersimpan"],it:["Indicatori salvati"],ja:["保存されたインジケーター"],ko:["세이브된 인디케이터"],ms_MY:["Petunjuk yang disimpan"],nl_NL:"Saved indicators",pl:["Zapisane wskaźniki"],pt:["Indicadores salvos"],ro:"Saved indicators", ru:["Сохранённые индикаторы"],sv:["Sparade indikatorer"],th:["อินดิเคเตอร์ที่เซฟไว้"],tr:["Kaydedilmiş göstergeler"],vi:["Chỉ báo đã được lưu"],zh:["已存指标"],zh_TW:["已存指標"]}},30858:e=>{e.exports={ar:["سيؤدي تحديد هذا الخيار إلى تعيين الفاصل الزمني‎{interval} ‎ على الرسم البياني عند تطبيق هذا القالب"],ca_ES:"Selecting this option will set the {interval} interval on the chart when this template is applied",cs:"Selecting this option will set the {interval} interval on the chart when this template is applied",de:["Durch Auswahl dieser Option wird das {interval}-Intervall im Chart festgelegt, wenn diese Vorlage angewendet wird"],el:"Selecting this option will set the {interval} interval on the chart when this template is applied",en:"Selecting this option will set the {interval} interval on the chart when this template is applied",es:["Al seleccionar esta opción se establecerá el intervalo {interval} en el gráfico cuando se aplique esta plantilla"],fa:"Selecting this option will set the {interval} interval on the chart when this template is applied",fr:["En sélectionnant cette option, l'intervalle {interval} sera placé sur le graphique lorsque ce modèle est appliqué"],he_IL:["בחירת אפשרות זו תגדיר את האינטרוול ‎{interval}‎ בגרף כאשר מיושמת תבנית זו"],hu_HU:"Selecting this option will set the {interval} interval on the chart when this template is applied",id_ID:["Memilih opsi ini akan mengatur interval {interval} pada chart saat template ini diterapkan"],it:["Selezionando questa opzione, il modello viene applicato cambiando il timeframe in {interval}"],ja:["この項目を選択すると、テンプレートが適用された時にチャートの時間足が{interval}に設定されます"],ko:["이 옵션을 고르면 이 템플릿이 적용될 때 차트에 {interval} 을 세팅하게 됩니다."],ms_MY:["Memilih pilihan ini akan menetapkan selang masa {interval} pada carta apabila templat ini digunakan"],nl_NL:"Selecting this option will set the {interval} interval on the chart when this template is applied",pl:["Wybór tej opcji spowoduje ustawienie na wykresie interwału {interval} po zastosowaniu tego szablonu"],pt:["Selecionar esta opção definirá o intervalo {interval} no gráfico quando este modelo for aplicado"],ro:"Selecting this option will set the {interval} interval on the chart when this template is applied",ru:["Включите, чтобы установить на графике интервал {interval}, когда этот шаблон применён"],sv:["Om du väljer detta alternativ ställer du in intervallet {interval} i diagrammet när den här mallen används"],th:["การเลือกตัวเลือกนี้จะเป็นการกำหนดช่วงเวลา {interval} บนชาร์ต เมื่อเทมเพลตนี้ถูกใช้งาน"],tr:["Bu seçeneğin belirlenmesi ile, bu taslak uygulandığında grafikte {interval} aralığı ayarlanır"],vi:["Chọn tùy chọn này sẽ đặt khoảng thời gian {interval} trên biểu đồ khi mẫu này được áp dụng"],zh:["套用此模板时,选择此选项将在图表上设置{interval}周期"],zh_TW:["套用此模板時,選擇此選項將在圖表上設置{interval}周期"]}},61422:e=>{e.exports={ar:["سيؤدي تحديد هذا الخيار إلى تعيين الرمز ‎{symbol}‎ على الرسم البياني عند تطبيق هذا القالب"],ca_ES:"Selecting this option will set the {symbol} symbol on the chart when this template is applied", diff --git a/charting_library/charting_library.cjs.js b/charting_library/charting_library.cjs.js index 9401aaf0..9d5972d4 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.000 (internal id 0d3d8bbd @ 2024-01-17T14:12:04.769Z)"}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.000 (internal id 0d3d8bbd @ 2024-01-17T14:12:04.769Z)"))),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()}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()}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)}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.fb41253a64dfb129780b.js","bundles/__LANG__.4716.e4ac74dfc9ec5374b00c.js","bundles/6150.bda60280b05cea478076.css","bundles/5142.2c34c8656148cc5203b7.js","bundles/library.b0e1bc71bddeb9026291.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(`