12 lines
34 KiB
JavaScript
12 lines
34 KiB
JavaScript
(self.webpackChunktradingview=self.webpackChunktradingview||[]).push([[3005],{97754:(e,t)=>{var r;!function(){"use strict";var n={}.hasOwnProperty;function s(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var i=typeof r;if("string"===i||"number"===i)e.push(r);else if(Array.isArray(r)&&r.length){var a=s.apply(null,r);a&&e.push(a)}else if("object"===i)for(var o in r)n.call(r,o)&&r[o]&&e.push(o)}}return e.join(" ")}e.exports?(s.default=s,e.exports=s):void 0===(r=function(){return s}.apply(t,[]))||(e.exports=r)}()},46913:e=>{e.exports={wrap:"wrap-wXGVFOC9",wrapWithArrowsOuting:"wrapWithArrowsOuting-wXGVFOC9",wrapOverflow:"wrapOverflow-wXGVFOC9",scrollWrap:"scrollWrap-wXGVFOC9",noScrollBar:"noScrollBar-wXGVFOC9",icon:"icon-wXGVFOC9",scrollLeft:"scrollLeft-wXGVFOC9",scrollRight:"scrollRight-wXGVFOC9",isVisible:"isVisible-wXGVFOC9",iconWrap:"iconWrap-wXGVFOC9",fadeLeft:"fadeLeft-wXGVFOC9",fadeRight:"fadeRight-wXGVFOC9"}},39416:(e,t,r)=>{"use strict";r.d(t,{useFunctionalRefObject:()=>i});var n=r(50959),s=r(43010);function i(e){const t=(0,n.useMemo)((()=>function(e){const t=r=>{e(r),t.current=r};return t.current=null,t}((e=>{o.current(e)}))),[]),r=(0,n.useRef)(null),i=t=>{if(null===t)return a(r.current,t),void(r.current=null);r.current!==e&&(r.current=e,a(r.current,t))},o=(0,n.useRef)(i);return o.current=i,(0,s.useIsomorphicLayoutEffect)((()=>{if(null!==t.current)return o.current(t.current),()=>o.current(null)}),[e]),t}function a(e,t){null!==e&&("function"==typeof e?e(t):e.current=t)}},43010:(e,t,r)=>{"use strict";r.d(t,{useIsomorphicLayoutEffect:()=>s});var n=r(50959);function s(e,t){("undefined"==typeof window?n.useEffect:n.useLayoutEffect)(e,t)}},67842:(e,t,r)=>{"use strict";r.d(t,{useResizeObserver:()=>a});var n=r(50959),s=r(43010),i=r(39416);function a(e,t=[]){const{callback:r,ref:a=null}=function(e){return"function"==typeof e?{callback:e}:e}(e),o=(0,n.useRef)(null),l=(0,n.useRef)(r);l.current=r;const c=(0,i.useFunctionalRefObject)(a),u=(0,n.useCallback)((e=>{c(e),null!==o.current&&(o.current.disconnect(),null!==e&&o.current.observe(e))}),[c,o]);return(0,s.useIsomorphicLayoutEffect)((()=>(o.current=new ResizeObserver(((e,t)=>{l.current(e,t)})),c.current&&u(c.current),()=>{o.current?.disconnect()})),[c,...t]),u}},9745:(e,t,r)=>{"use strict";r.d(t,{Icon:()=>s});var n=r(50959);const s=n.forwardRef(((e,t)=>{const{icon:r="",title:s,ariaLabel:i,ariaLabelledby:a,ariaHidden:o,...l}=e,c=!!(s||i||a);return n.createElement("span",{role:"img",...l,ref:t,"aria-label":i,"aria-labelledby":a,"aria-hidden":o||!c,title:s,dangerouslySetInnerHTML:{__html:r}})}))},47201:(e,t,r)=>{"use strict";function n(...e){return t=>{for(const r of e)void 0!==r&&r(t)}}r.d(t,{createSafeMulticastEventHandler:()=>n})},42142:(e,t,r)=>{"use strict";r.d(t,{FragmentMap:()=>s});var n=r(50959);function s(e){if(e.map){return n.Children.toArray(e.children).map(e.map)}return e.children}},45601:(e,t,r)=>{"use strict";r.d(t,{Measure:()=>s});var n=r(67842);function s(e){const{children:t,onResize:r}=e;return t((0,
|
|
n.useResizeObserver)(r||(()=>{}),[null===r]))}},70412:(e,t,r)=>{"use strict";r.d(t,{hoverMouseEventFilter:()=>i,useAccurateHover:()=>a,useHover:()=>s});var n=r(50959);function s(){const[e,t]=(0,n.useState)(!1);return[e,{onMouseOver:function(e){i(e)&&t(!0)},onMouseOut:function(e){i(e)&&t(!1)}}]}function i(e){return!e.currentTarget.contains(e.relatedTarget)}function a(e){const[t,r]=(0,n.useState)(!1);return(0,n.useEffect)((()=>{const t=t=>{if(null===e.current)return;const n=e.current.contains(t.target);r(n)};return document.addEventListener("mouseover",t),()=>document.removeEventListener("mouseover",t)}),[]),t}},6132:(e,t,r)=>{"use strict";var n=r(22134);function s(){}function i(){}i.resetWarningCache=s,e.exports=function(){function e(e,t,r,s,i,a){if(a!==n){var o=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw o.name="Invariant Violation",o}}function t(){return e}e.isRequired=e;var r={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:s};return r.PropTypes=r,r}},19036:(e,t,r)=>{e.exports=r(6132)()},22134:e=>{"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},13818:e=>{e.exports={group:"group-MBOVGQRI",separator:"separator-MBOVGQRI",noLeftDecoration:"noLeftDecoration-MBOVGQRI",noRightDecoration:"noRightDecoration-MBOVGQRI",noMinimalWidth:"noMinimalWidth-MBOVGQRI",separatorWrap:"separatorWrap-MBOVGQRI"}},32169:e=>{e.exports={separator:"separator-xVhBjD5m"}},58312:e=>{e.exports={"css-value-header-toolbar-height":"38px",toolbar:"toolbar-qqNP9X6e",isHidden:"isHidden-qqNP9X6e",overflowWrap:"overflowWrap-qqNP9X6e",customButton:"customButton-qqNP9X6e",hover:"hover-qqNP9X6e",clicked:"clicked-qqNP9X6e"}},87730:e=>{e.exports={wrap:"wrap-_psvpUP2",icon:"icon-_psvpUP2"}},8297:e=>{e.exports={"css-value-header-toolbar-height":"38px",innerWrap:"innerWrap-OhqNVIYA",inner:"inner-OhqNVIYA",fake:"fake-OhqNVIYA",fill:"fill-OhqNVIYA",collapse:"collapse-OhqNVIYA",button:"button-OhqNVIYA",iconButton:"iconButton-OhqNVIYA",hidden:"hidden-OhqNVIYA",content:"content-OhqNVIYA",desktopPublish:"desktopPublish-OhqNVIYA",mobilePublish:"mobilePublish-OhqNVIYA"}},57177:(e,t,r)=>{"use strict";var n;function s(e){e.dispatchEvent(new CustomEvent("roving-tabindex:main-element"))}function i(e){e.dispatchEvent(new CustomEvent("roving-tabindex:secondary-element"))}r.d(t,{becomeMainElement:()=>s,becomeSecondaryElement:()=>i}),function(e){e.MainElement="roving-tabindex:main-element",e.SecondaryElement="roving-tabindex:secondary-element"}(n||(n={}))},42014:(e,t,r)=>{"use strict";r.d(t,{INTERVALS:()=>s});var n=r(11542);const s=[{name:"",label:n.t(null,{context:"interval"},r(79930))},{name:"H",label:n.t(null,{context:"interval"},r(35157))},{name:"D",label:n.t(null,{context:"interval"},r(23970))},{name:"W",label:n.t(null,{context:"interval"},r(7938))},{
|
|
name:"M",label:n.t(null,{context:"interval"},r(18193))}]},6190:(e,t,r)=>{"use strict";r.d(t,{Toolbar:()=>d});var n=r(50959),s=r(50151),i=r(47201),a=r(3343),o=r(19291),l=r(57177),c=r(39416),u=r(7047);const d=(0,n.forwardRef)((function(e,t){const{onKeyDown:r,orientation:d,blurOnEscKeydown:h=!0,blurOnClick:m=!0,...p}=e,v=(0,c.useFunctionalRefObject)(t);return(0,n.useLayoutEffect)((()=>{const e=(0,s.ensureNotNull)(v.current),t=()=>{const t=(0,o.queryTabbableElements)(e).sort(o.navigationOrderComparator);if(0===t.length){const[t]=(0,o.queryFocusableElements)(e).sort(o.navigationOrderComparator);if(void 0===t)return;(0,l.becomeMainElement)(t)}if(t.length>1){const[,...e]=t;for(const t of e)(0,l.becomeSecondaryElement)(t)}};return window.addEventListener("keyboard-navigation-activation",t),()=>window.removeEventListener("keyboard-navigation-activation",t)}),[]),n.createElement("div",{...u.MouseClickAutoBlurHandler.attributes(m),...p,role:"toolbar","aria-orientation":d,ref:v,onKeyDown:(0,i.createSafeMulticastEventHandler)((function(e){if(e.defaultPrevented)return;if(!(document.activeElement instanceof HTMLElement))return;const t=(0,a.hashFromEvent)(e);if(h&&27===t)return e.preventDefault(),void document.activeElement.blur();if("vertical"!==d&&37!==t&&39!==t)return;if("vertical"===d&&38!==t&&40!==t)return;const r=e.currentTarget,n=(0,o.queryFocusableElements)(r).sort(o.navigationOrderComparator);if(0===n.length)return;const s=n.indexOf(document.activeElement);if(-1===s)return;e.preventDefault();const i=()=>{const e=(s+n.length-1)%n.length;(0,l.becomeSecondaryElement)(n[s]),(0,l.becomeMainElement)(n[e]),n[e].focus()},c=()=>{const e=(s+n.length+1)%n.length;(0,l.becomeSecondaryElement)(n[s]),(0,l.becomeMainElement)(n[e]),n[e].focus()};switch((0,o.mapKeyCodeToDirection)(t)){case"inlinePrev":"vertical"!==d&&i();break;case"inlineNext":"vertical"!==d&&c();break;case"blockPrev":"vertical"===d&&i();break;case"blockNext":"vertical"===d&&c()}}),r),"data-tooltip-show-on-focus":"true"})}))},39214:(e,t,r)=>{"use strict";r.r(t),r.d(t,{HeaderToolbarRenderer:()=>Ie});var n=r(50959),s=r(32227),i=r(50151),a=r(97754),o=r.n(a),l=r(85459),c=r.n(l),u=r(20057),d=r(56570),h=r(76422),m=r(19036),p=r(32563),v=r(42142),f=r(32169);function g(e){return n.createElement("div",{className:o()(f.separator,e.className)})}var S=r(13818);function b(e){const{children:t,className:r,noLeftDecoration:s,noRightDecoration:i,noMinimalWidth:o,onClick:l,removeSeparator:c}=e;return n.createElement(n.Fragment,null,!c&&n.createElement("div",{className:S.separatorWrap},n.createElement(g,{className:S.separator})),n.createElement("div",{className:a(r,S.group,{[S.noMinimalWidth]:o,[S.noLeftDecoration]:s,[S.noRightDecoration]:i}),onClick:l},t))}var y=r(45601),C=r(11542),_=r(9745),E=r(87730),w=r(45820);const M={text:C.t(null,void 0,r(48161))};function R(e){return n.createElement("div",{className:E.wrap},n.createElement(_.Icon,{className:E.icon,icon:w}),M.text)}var k=r(61119),I=r(78871),V=r(63273),F=r(61380),O=r(46913);const W={isVisibleScrollbar:!0,shouldMeasure:!0,hideButtonsFrom:1
|
|
};function L(e){return n.createElement("div",{className:a(O.fadeLeft,e.className,{[O.isVisible]:e.isVisible})})}function N(e){return n.createElement("div",{className:a(O.fadeRight,e.className,{[O.isVisible]:e.isVisible})})}function T(e){return n.createElement(A,{...e,className:O.scrollLeft})}function B(e){return n.createElement(A,{...e,className:O.scrollRight})}function A(e){return n.createElement("div",{className:a(e.className,{[O.isVisible]:e.isVisible}),onClick:e.onClick},n.createElement("div",{className:O.iconWrap},n.createElement(_.Icon,{icon:F,className:O.icon})))}const D=function(e=T,t=B,r=L,s=N){var o;return(o=class extends n.PureComponent{constructor(e){super(e),this._scroll=n.createRef(),this._handleScrollLeft=()=>{if(this.props.onScrollButtonClick)return void this.props.onScrollButtonClick("left");const e=this.props.scrollStepSize||this.state.widthWrap-50;this.animateTo(Math.max(0,this.currentPosition()-e))},this._handleScrollRight=()=>{if(this.props.onScrollButtonClick)return void this.props.onScrollButtonClick("right");const e=this.props.scrollStepSize||this.state.widthWrap-50;this.animateTo(Math.min((this.state.widthContent||0)-(this.state.widthWrap||0),this.currentPosition()+e))},this._handleResizeWrap=([e])=>{const t=e.target.getBoundingClientRect();this.props.onMeasureWrap&&this.props.onMeasureWrap(t),this.setState({widthWrap:t.width}),this._checkButtonsVisibility()},this._handleResizeContent=([e])=>{const t=e.target.getBoundingClientRect();this.props.onMeasureContent&&this.props.onMeasureContent(t);const{shouldDecreaseWidthContent:r,buttonsWidthIfDecreasedWidthContent:n}=this.props;r&&n?this.setState({widthContent:t.width+2*n}):this.setState({widthContent:t.width})},this._handleScroll=()=>{const{onScroll:e}=this.props;e&&e(this.currentPosition(),this.isAtLeft(),this.isAtRight()),this._checkButtonsVisibility()},this._checkButtonsVisibility=()=>{const{isVisibleLeftButton:e,isVisibleRightButton:t}=this.state,r=this.isAtLeft(),n=this.isAtRight();r||e?r&&e&&this.setState({isVisibleLeftButton:!1}):this.setState({isVisibleLeftButton:!0}),n||t?n&&t&&this.setState({isVisibleRightButton:!1}):this.setState({isVisibleRightButton:!0})},this.state={widthContent:0,widthWrap:0,isVisibleRightButton:!1,isVisibleLeftButton:!1}}componentDidMount(){this._checkButtonsVisibility()}componentDidUpdate(e,t){t.widthWrap===this.state.widthWrap&&t.widthContent===this.state.widthContent||this._handleScroll()}currentPosition(){return this._scroll.current?(0,V.isRtl)()?(0,V.getLTRScrollLeft)(this._scroll.current):this._scroll.current.scrollLeft:0}isAtLeft(){return!this._isOverflowed()||this.currentPosition()<=(0,i.ensureDefined)(this.props.hideButtonsFrom)}isAtRight(){return!this._isOverflowed()||this.currentPosition()+this.state.widthWrap>=this.state.widthContent-(0,i.ensureDefined)(this.props.hideButtonsFrom)}animateTo(e,t=I.dur){const r=this._scroll.current;r&&((0,V.isRtl)()&&(e=(0,V.getLTRScrollLeftOffset)(r,e)),t<=0?r.scrollLeft=Math.round(e):(0,k.doAnimate)({onStep(e,t){r.scrollLeft=Math.round(t)},from:r.scrollLeft,
|
|
to:Math.round(e),easing:I.easingFunc.easeInOutCubic,duration:t}))}render(){const{children:i,isVisibleScrollbar:o,isVisibleFade:l,isVisibleButtons:c,shouldMeasure:u,shouldDecreaseWidthContent:d,buttonsWidthIfDecreasedWidthContent:h,onMouseOver:m,onMouseOut:p,scrollWrapClassName:v,fadeClassName:f}=this.props,{isVisibleRightButton:g,isVisibleLeftButton:S}=this.state,b=d&&h;return n.createElement(y.Measure,{onResize:u?this._handleResizeWrap:null},(d=>n.createElement("div",{className:O.wrapOverflow,onMouseOver:m,onMouseOut:p,ref:d},n.createElement("div",{className:a(O.wrap,b?O.wrapWithArrowsOuting:"")},n.createElement("div",{className:a(O.scrollWrap,v,{[O.noScrollBar]:!o}),onScroll:this._handleScroll,ref:this._scroll},n.createElement(y.Measure,{onResize:u?this._handleResizeContent:null},i)),l&&n.createElement(r,{isVisible:S,className:f}),l&&n.createElement(s,{isVisible:g,className:f}),c&&n.createElement(e,{onClick:this._handleScrollLeft,isVisible:S}),c&&n.createElement(t,{onClick:this._handleScrollRight,isVisible:g})))))}_isOverflowed(){const{widthContent:e,widthWrap:t}=this.state;return e>t}}).defaultProps=W,o}(T,B,L,N);var x,P=r(14729);!function(e){e.SymbolSearch="header-toolbar-symbol-search",e.Intervals="header-toolbar-intervals",e.ChartStyles="header-toolbar-chart-styles",e.Compare="header-toolbar-compare",e.Indicators="header-toolbar-indicators",e.StudyTemplates="header-toolbar-study-templates",e.Dropdown="header-toolbar-dropdown",e.Alerts="header-toolbar-alerts",e.Layouts="header-toolbar-layouts",e.SaveLoad="header-toolbar-save-load",e.UndoRedo="header-toolbar-undo-redo",e.Properties="header-toolbar-properties",e.QuickSearch="header-toolbar-quick-search",e.PublishDesktop="header-toolbar-publish-desktop",e.PublishMobile="header-toolbar-publish-mobile",e.Fullscreen="header-toolbar-fullscreen",e.Screenshot="header-toolbar-screenshot",e.Replay="header-toolbar-replay",e.Financials="header-toolbar-financials"}(x||(x={}));var H=r(70412),q=r(77151),z=r(6190),G=r(8297);const X=(0,q.registryContextType)(),U=d.enabled("widget");class Q extends n.PureComponent{constructor(e,t){super(e,t),this._handleMouseOver=e=>{(0,H.hoverMouseEventFilter)(e)&&this.setState({isHovered:!0})},this._handleMouseOut=e=>{(0,H.hoverMouseEventFilter)(e)&&this.setState({isHovered:!1})},this._handleInnerResize=([e])=>{const t=e.contentRect.width,{onWidthChange:r}=this.props;r&&r(t)},this._handleMeasureAvailableSpace=e=>{const{onAvailableSpaceChange:t}=this.props;t&&t(e.width)},this._processCustoms=e=>{const{isFake:t,displayMode:r}=this.props,{tools:s}=this.context;return e.map((e=>n.createElement(b,{key:e.id},(e=>{switch(e.type){case"Button":return n.createElement(s.Custom,{...e.params,isFake:t});case"TradingViewStyledButton":return n.createElement(s.CustomTradingViewStyledButton,{...e.params,className:G.button,displayMode:r});case"Dropdown":return n.createElement(s.Dropdown,{displayMode:r,params:e.params});default:return null}})(e))))},this._fixLastGroup=(e,t,r)=>{if(t===r.length-1&&n.isValidElement(e)&&e.type===b){
|
|
const t=void 0!==this.context.tools.Publish&&!this.props.readOnly;return n.cloneElement(e,{noRightDecoration:t})}return e},(0,q.validateRegistry)(t,{tools:m.any.isRequired}),this.state={isHovered:!1}}render(){const{tools:e}=this.context,{features:t,displayMode:r,chartSaver:s,studyMarket:i,readOnly:o,saveLoadSyncEmitter:l,leftCustomElements:c,rightCustomElements:u,showScrollbarWhen:h,isFake:m=!1}=this.props,{isHovered:f}=this.state,g=this._processCustoms(c),S=this._processCustoms(u),C=h.includes(r);return n.createElement(z.Toolbar,{className:a(G.inner,{[G.fake]:m}),onContextMenu:P.preventDefaultForContextMenu,"data-is-fake-main-panel":m,"aria-hidden":m},n.createElement(D,{isVisibleFade:p.mobiletouch&&C,isVisibleButtons:!p.mobiletouch&&C&&f,isVisibleScrollbar:!1,shouldMeasure:!m,onMouseOver:this._handleMouseOver,onMouseOut:this._handleMouseOut,onMeasureWrap:this._handleMeasureAvailableSpace},(c=>n.createElement("div",{className:G.content,ref:c,role:"none"},n.createElement(y.Measure,{onResize:m?this._handleInnerResize:null},(c=>n.createElement("div",{className:G.innerWrap,ref:c},n.createElement(v.FragmentMap,{map:this._fixLastGroup},!o&&n.Children.toArray([(e.SymbolSearch||!U&&e.Compare)&&n.createElement(b,{key:"symbol"},e.SymbolSearch&&n.createElement(e.SymbolSearch,{id:m?void 0:x.SymbolSearch,isActionsVisible:t.allowSymbolSearchSpread}),e.Compare&&n.createElement(e.Compare,{id:m?void 0:x.Compare,className:G.button,displayMode:r})),e.DateRange&&n.createElement(b,{key:"range"},n.createElement(e.DateRange,null)),e.Intervals&&n.createElement(b,{key:"intervals"},n.createElement(e.Intervals,{id:m?void 0:x.Intervals,isShownQuicks:t.allowFavoriting,isFavoritingAllowed:t.allowFavoriting,displayMode:r,isFake:m})),e.Bars&&n.createElement(b,{key:"styles"},n.createElement(e.Bars,{id:m?void 0:x.ChartStyles,isShownQuicks:t.allowFavoriting,isFavoritingAllowed:t.allowFavoriting,displayMode:r,isFake:m})),U&&e.Compare&&!e.SymbolSearch&&n.createElement(b,{key:"compare"},n.createElement(e.Compare,{id:m?void 0:x.Compare,className:G.button,displayMode:r})),e.Indicators&&n.createElement(b,{key:"indicators"},n.createElement(e.Indicators,{id:m?void 0:x.Indicators,className:G.button,studyMarket:i,displayMode:r}),e.Templates&&n.createElement(e.Templates,{id:m?void 0:x.StudyTemplates,isShownQuicks:t.allowFavoriting,isFavoritingAllowed:t.allowFavoriting,displayMode:r})),e.Alert&&n.createElement(b,{key:"alert"},n.createElement(e.Alert,{id:m?void 0:x.Alerts,className:G.button,displayMode:r}),e.Replay&&n.createElement(e.Replay,{id:m?void 0:x.Replay,className:G.button,displayMode:r})),e.AlertReferral&&!d.enabled("hide_alert_referral_tool")&&n.createElement(b,{key:"alert-referral"},n.createElement(e.AlertReferral,{className:G.button,displayMode:r})),e.ScalePercentage&&n.createElement(b,{key:"percentage"},n.createElement(e.ScalePercentage,null)),e.ScaleLogarithm&&n.createElement(b,{key:"logarithm"},n.createElement(e.ScaleLogarithm,null)),...g]),function(e){
|
|
const t=e.findIndex((e=>n.isValidElement(e)&&!!e.key&&-1!==e.key.toString().indexOf("view-only-badge")));return[t].filter((e=>e>=0)).forEach((t=>{e=n.Children.map(e,((e,r)=>{if(n.isValidElement(e)){switch([t-1,t,t+1].indexOf(r)){case 0:const t={noRightDecoration:!0};e=n.cloneElement(e,t);break;case 1:const r={noLeftDecoration:!0,noRightDecoration:!0};e=n.cloneElement(e,r);break;case 2:const s={noLeftDecoration:!0};e=n.cloneElement(e,s)}}return e}))})),e}(n.Children.toArray([o&&n.createElement(b,{key:"view-only-badge",removeSeparator:!0},n.createElement(R,null)),!o&&e.UndoRedo&&n.createElement(b,{key:"undo-redo"},n.createElement(e.UndoRedo,{id:m?void 0:x.UndoRedo})),n.createElement(b,{removeSeparator:!0,key:"gap-1",className:a(G.fill,m&&G.collapse)}),(e.Layout||e.SaveLoad)&&n.createElement(b,{key:"layout",removeSeparator:!0},!o&&e.Layout&&n.createElement(e.Layout,{id:m?void 0:x.Layouts}),e.SaveLoad&&n.createElement(e.SaveLoad,{id:m?void 0:x.SaveLoad,chartSaver:s,isReadOnly:o,displayMode:r,isFake:m,stateSyncEmitter:l})),e.SaveLoadReferral&&n.createElement(b,{key:"save-load-referral"},n.createElement(e.SaveLoadReferral,{isReadOnly:o,displayMode:r})),t.showLaunchInPopupButton&&e.OpenPopup&&!d.enabled("hide_open_popup_button")&&n.createElement(b,{key:"popup"},n.createElement(e.OpenPopup,null)),!o&&(e.Properties||e.Fullscreen||!U&&e.Screenshot)&&n.createElement(b,{key:"properties"},!o&&e.QuickSearch&&n.createElement(e.QuickSearch,{id:m?void 0:x.QuickSearch,className:G.iconButton}),!o&&e.Properties&&n.createElement(e.Properties,{id:m?void 0:x.Properties,className:G.iconButton}),n.createElement(n.Fragment,null,!o&&e.Fullscreen&&n.createElement(b,{key:"fullscreen",onClick:this._trackFullscreenButtonClick,removeSeparator:!0},n.createElement(e.Fullscreen,{id:m?void 0:x.Fullscreen})),!U&&e.Screenshot&&n.createElement(e.Screenshot,{id:m?void 0:x.Screenshot,className:G.iconButton}))),U&&!o&&e.Fullscreen&&n.createElement(b,{key:"fullscreen",onClick:this._trackFullscreenButtonClick,removeSeparator:!0},n.createElement(e.Fullscreen,{id:m?void 0:x.Fullscreen})),U&&e.Screenshot&&n.createElement(b,{key:"screenshot",removeSeparator:!0},n.createElement(e.Screenshot,{id:m?void 0:x.Screenshot,className:G.iconButton})),!o&&e.Publish&&!d.enabled("hide_publish_button")&&n.createElement(b,{key:"publish",className:G.mobilePublish,removeSeparator:!0},n.createElement(e.Publish,{id:m?void 0:x.PublishMobile})),...S]))))))))),e.Publish&&!o&&!m&&!d.enabled("hide_publish_button")&&n.createElement(e.Publish,{id:x.PublishDesktop,className:G.desktopPublish}))}_trackFullscreenButtonClick(){0}}var Y;Q.contextType=X,function(e){e[e.Left=0]="Left",e[e.Self=1]="Self",e[e.Right=2]="Right"}(Y||(Y={}));var j=r(64147),K=r(59063);class J extends K.CommonJsonStoreService{constructor(e,t,r=[]){super(e,t,"FAVORITE_CHART_STYLES_CHANGED","StyleWidget.quicks",r)}}var $=r(10074),Z=r(97144);class ee extends K.AbstractJsonStoreService{constructor(e,t,r){super(e,t,"FAVORITE_INTERVALS_CHANGED","IntervalWidget.quicks",r)}_serialize(e){return(0,
|
|
Z.uniq)(e.map($.normalizeIntervalString))}_deserialize(e){return(0,Z.uniq)((0,$.convertResolutionsFromSettings)(e).filter($.isResolutionMultiplierValid).map($.normalizeIntervalString))}}var te=r(82992),re=r(52033),ne=r(56840),se=r(21097);class ie extends K.AbstractJsonStoreService{constructor(e,t,r=[]){super(e,t,"CUSTOM_INTERVALS_CHANGED","IntervalWidget.intervals",r)}set(e,t){const r=()=>{super.set(e,t)};e.length,this.get().length,r()}_serialize(e){return(0,Z.uniq)(e.map($.normalizeIntervalString))}_deserialize(e){return(0,Z.uniq)([...(0,$.convertResolutionsFromSettings)(e).filter($.isResolutionMultiplierValid).map($.normalizeIntervalString)])}}const ae=new ie(se.TVXWindowEvents,ne);var oe=r(42014);class le{constructor(e){this._customIntervalsService=ae,this._supportedIntervalsMayChange=new re.Delegate,this._fireSupportedIntervalsMayChange=()=>{this._supportedIntervalsMayChange.fire()},this._resolutionGetter=()=>[],this._resolutionGetter=e,te.linking.supportedResolutions.subscribe(this._fireSupportedIntervalsMayChange),te.linking.range.subscribe(this._fireSupportedIntervalsMayChange),te.linking.seconds.subscribe(this._fireSupportedIntervalsMayChange),te.linking.ticks.subscribe(this._fireSupportedIntervalsMayChange),te.linking.intraday.subscribe(this._fireSupportedIntervalsMayChange),te.linking.dataFrequencyResolution.subscribe(this._fireSupportedIntervalsMayChange)}destroy(){te.linking.supportedResolutions.unsubscribe(this._fireSupportedIntervalsMayChange),te.linking.range.unsubscribe(this._fireSupportedIntervalsMayChange),te.linking.seconds.unsubscribe(this._fireSupportedIntervalsMayChange),te.linking.ticks.unsubscribe(this._fireSupportedIntervalsMayChange),te.linking.intraday.unsubscribe(this._fireSupportedIntervalsMayChange),te.linking.dataFrequencyResolution.unsubscribe(this._fireSupportedIntervalsMayChange)}getDefaultIntervals(){return this._resolutionGetter?this._resolutionGetter().map($.normalizeIntervalString):[]}getCustomIntervals(){return this._customIntervalsService.get()}add(e,t,r){if(!this.isValidInterval(e,t))return null;const n=(0,$.normalizeIntervalString)(`${e}${t}`),s=this.getCustomIntervals();return this._isIntervalDefault(n)||s.includes(n)?null:(this._customIntervalsService.set((0,$.sortResolutions)([...s,n])),n)}remove(e){this._customIntervalsService.set(this.getCustomIntervals().filter((t=>t!==e)))}isValidInterval(e,t){return(0,$.isResolutionMultiplierValid)(`${e}${t}`)}isSupportedInterval(e){return(0,$.isAvailable)(e)}supportedIntervalsMayChange(){return this._supportedIntervalsMayChange}getOnChange(){return this._customIntervalsService.getOnChange()}getPossibleIntervals(){return oe.INTERVALS}getResolutionUtils(){return{getMaxResolutionValue:$.getMaxResolutionValue,getTranslatedResolutionModel:$.getTranslatedResolutionModel,mergeResolutions:$.mergeResolutions,sortResolutions:$.sortResolutions}}_isIntervalDefault(e){return this.getDefaultIntervals().includes(e)}}var ce=r(72894);function ue(e){return e.replace(/(@[^-]+-[^-]+).*$/,"$1")}const de={};let he=null;class me{constructor(e=ne){
|
|
this._favorites=[],this._favoritesChanged=new re.Delegate,this._settings=e,se.TVXWindowEvents.on("StudyFavoritesChanged",(e=>{const t=JSON.parse(e);this._loadFromState(t.favorites||[])})),this._settings.onSync.subscribe(this,this._loadFavs),this._loadFavs()}isFav(e){const t=this.favId(e);return-1!==this._findFavIndex(t)}toggleFavorite(e){this.isFav(e)?this.removeFavorite(e):this.addFavorite(e)}addFavorite(e){const t=this.favId(e);this._favorites.push(ve(t)),this._favoritesChanged.fire(t),this._saveFavs()}removeFavorite(e){const t=this.favId(e),r=this._findFavIndex(t);-1!==r&&(this._favorites.splice(r,1),this._favoritesChanged.fire(t)),this._saveFavs()}favId(e){return ue(e)}favorites(){return this._favorites}favoritePineIds(){return this._favorites.filter((e=>"pine"===e.type)).map((e=>e.pineId))}favoritesChanged(){return this._favoritesChanged}static getInstance(){return null===he&&(he=new me),he}static create(e){return new me(e)}_loadFavs(){const e=this._settings.getJSON("studyMarket.favorites",[]);this._loadFromState(e)}_saveFavs(){const e=this._stateToSave();this._settings.setJSON("studyMarket.favorites",e,{forceFlush:!0}),se.TVXWindowEvents.emit("StudyFavoritesChanged",JSON.stringify({favorites:e}))}_stateToSave(){return this._favorites.map(pe)}_loadFromState(e){this._favorites=e.map((e=>ve(function(e){return e in de?de[e]:e}(e)))),this._favoritesChanged.fire()}_findFavIndex(e){return this._favorites.findIndex((t=>e===pe(t)))}}function pe(e){return"java"===e.type?e.studyId:e.pineId}function ve(e){return isPineIdString(e)?{type:"pine",pineId:e}:{type:"java",studyId:e}}var fe=r(85049);const ge={[fe.ResolutionKind.Ticks]:!1,[fe.ResolutionKind.Seconds]:!1,[fe.ResolutionKind.Minutes]:!1,[fe.SpecialResolutionKind.Hours]:!1,[fe.ResolutionKind.Days]:!1,[fe.ResolutionKind.Range]:!1};class Se extends K.CommonJsonStoreService{constructor(e,t,r=ge){super(e,t,"INTERVALS_MENU_VIEW_STATE_CHANGED","IntervalWidget.menu.viewState",r)}isAllowed(e){return Object.keys(ge).includes(e)}}const be={Area:3,"HLC area":16,Bars:0,Candles:1,"Heiken Ashi":8,"Hollow Candles":9,Line:2,Renko:4,Kagi:5,"Point & figure":6,"Line Break":7,Baseline:10,LineWithMarkers:14,Stepline:15,Columns:13,"High-low":12},ye=["1","30","60"];function Ce(e=[]){let t=e.map((e=>be[e]))||[1,4,5,6];return d.enabled("widget")&&(t=[0,1,3]),t}function _e(e=[]){return(0,$.mergeResolutions)(e,d.enabled("star_some_intervals_by_default")?ye:[])}new ee(se.TVXWindowEvents,ne,_e()),new J(se.TVXWindowEvents,ne,Ce());const Ee={tools:m.any.isRequired,isFundamental:m.any,chartApiInstance:m.any,availableTimeFrames:m.any,chartWidgetCollection:m.any,windowMessageService:m.any,favoriteChartStylesService:m.any,favoriteIntervalsService:m.any,intervalService:m.any,recentStudyTemplatesService:m.any,studyTemplates:m.any,chartChangesWatcher:m.any,saveChartService:m.any,sharingChartService:m.any,loadChartService:m.any,chartWidget:m.any,favoriteScriptsModel:m.any,intervalsMenuViewStateService:m.any,templatesMenuViewStateService:m.any,openGlobalSearch:m.any,snapshotUrl:m.any}
|
|
;var we=r(49481),Me=r(58312);const Re=[];class ke extends n.PureComponent{constructor(e){super(e),this._saveLoadSyncEmitter=new(c()),this._handleFullWidthChange=e=>{this._fullWidth=e,this.setState({measureValid:!1})},this._handleFavoritesWidthChange=e=>{this._favoritesWidth=e,this.setState({measureValid:!1})},this._handleCollapseWidthChange=e=>{this._collapseWidth=e,this.setState({measureValid:!1})},this._handleMeasure=e=>{this.setState({availableWidth:e,measureValid:!1})};const{tools:t,windowMessageService:r,chartWidgetCollection:n,chartApiInstance:s,availableTimeFrames:a,isFundamental:o,favoriteIntervalsService:l,favoriteChartStylesService:h,recentStudyTemplatesService:m,studyTemplates:p,saveChartService:v,sharingChartService:f,loadChartService:g,snapshotUrl:S,openGlobalSearch:b}=e;this._showScrollbarWhen=(0,i.ensureDefined)(e.allowedModes).slice(-1),this._panelWidthChangeHandlers={full:this._handleFullWidthChange,medium:this._handleFavoritesWidthChange,small:this._handleCollapseWidthChange};const{chartChangesWatcher:y}=e;this._chartChangesWatcher=y;const C=Ce(this.props.defaultFavoriteStyles);this._favoriteChartStylesService=h||new J(se.TVXWindowEvents,ne,C);const _=_e(this.props.defaultFavoriteIntervals);this._favoriteIntervalsService=l||new ee(se.TVXWindowEvents,ne,_),this._intervalsMenuViewStateService=new Se(se.TVXWindowEvents,ne),this._intervalService=new le(s.defaultResolutions),this._registry={tools:t,isFundamental:o,chartWidgetCollection:n,windowMessageService:r,chartApiInstance:s,availableTimeFrames:a,recentStudyTemplatesService:m,studyTemplates:p,saveChartService:v,sharingChartService:f,loadChartService:g,intervalsMenuViewStateService:this._intervalsMenuViewStateService,favoriteChartStylesService:this._favoriteChartStylesService,favoriteIntervalsService:this._favoriteIntervalsService,intervalService:this._intervalService,chartChangesWatcher:this._chartChangesWatcher,chartWidget:n.activeChartWidget.value(),favoriteScriptsModel:me.getInstance(),templatesMenuViewStateService:this._templatesMenuVuewStateService,snapshotUrl:S,openGlobalSearch:b},this.state={isVisible:!0,availableWidth:0,displayMode:"full",measureValid:!1,leftCustomElements:[],rightCustomElements:[]},this._readOnly=n.readOnly(),this._features={allowFavoriting:d.enabled("items_favoriting"),showIdeasButton:Boolean(this.props.ideas),showLaunchInPopupButton:Boolean(this.props.popupButton),allowSymbolSearchSpread:d.enabled("header_symbol_search")&&d.enabled("show_spread_operators"),allowToolbarHiding:d.enabled("collapsible_header")},this._setDisplayMode=(0,u.default)(this._setDisplayMode,100),this._negotiateResizer()}componentDidUpdate(e,t){const{isVisible:r,measureValid:n}=this.state;r!==t.isVisible&&(h.emit("toggle_header",r),this._negotiateResizer()),n||this._setDisplayMode()}render(){const{resizerBridge:e,allowedModes:t,...r}=this.props,{displayMode:s,isVisible:o,leftCustomElements:l,rightCustomElements:c}=this.state,u={features:this._features,readOnly:this._readOnly,isFake:!1,saveLoadSyncEmitter:this._saveLoadSyncEmitter,leftCustomElements:l,
|
|
rightCustomElements:c,...r},d={...u,isFake:!0,showScrollbarWhen:Re},h=(0,i.ensureDefined)(t),m=this.props.tools.PublishButtonManager||n.Fragment;return n.createElement(q.RegistryProvider,{value:this._registry,validation:Ee},n.createElement(m,null,n.createElement("div",{className:a(Me.toolbar,{[Me.isHidden]:!o}),onClick:this.props.onClick},n.createElement("div",{className:Me.overflowWrap},h.map((e=>n.createElement(Q,{key:e,displayMode:e,onWidthChange:this._panelWidthChangeHandlers[e],...d}))),n.createElement(Q,{key:"live",showScrollbarWhen:this._showScrollbarWhen,displayMode:s,onAvailableSpaceChange:this._handleMeasure,...u})))))}addButton(e,t){if(!t.useTradingViewStyle)return this._addCustomHTMLButton(e,t.align);this._addCustomTradingViewStyledButton(e,t)}addDropdown(e,t){const{leftCustomElements:r,rightCustomElements:n}=this.state,s={type:"Dropdown",id:e,params:t};"left"===t.align?this.setState({leftCustomElements:[...r,s]}):this.setState({rightCustomElements:[...n,s]})}updateDropdown(e,t){const r=t=>"Dropdown"===t.type&&t.id===e,n=this.state.leftCustomElements.find(r)||this.state.rightCustomElements.find(r);void 0!==n&&(n.params={...n.params,...t},this.setState({leftCustomElements:this.state.leftCustomElements.slice(),rightCustomElements:this.state.rightCustomElements.slice()}))}removeDropdown(e){const t=t=>"Dropdown"===t.type&&t.id!==e,r=this.state.leftCustomElements.filter(t),n=this.state.rightCustomElements.filter(t);this.setState({leftCustomElements:r,rightCustomElements:n})}_negotiateResizer(){this.props.resizerBridge.negotiateHeight(this.state.isVisible?ce.HEADER_TOOLBAR_HEIGHT_EXPANDED:ce.HEADER_TOOLBAR_HEIGHT_COLLAPSED)}_setDisplayMode(){const{availableWidth:e}=this.state,{allowedModes:t}=this.props,r={full:this._fullWidth,medium:this._favoritesWidth,small:this._collapseWidth},n=(0,i.ensureDefined)(t);let s=n.map((e=>r[e])).findIndex((t=>e>=t));-1===s&&(s=n.length-1);const a=n[s];this.setState({measureValid:!0,displayMode:a})}_addCustomHTMLButton(e,t="left"){const r=new j.WatchedValue(0),n=(0,we.parseHtmlElement)(`<div class="apply-common-tooltip ${Me.customButton}">`),s={type:"Button",id:e,params:{key:Number(new Date),element:n,width:r}};return this._addCustomElementToState(t,s),n}_addCustomTradingViewStyledButton(e,t){const r={type:"TradingViewStyledButton",id:e,params:{key:Number(new Date),text:t.text,title:t.title,onClick:t.onClick}};this._addCustomElementToState(t.align,r)}_addCustomElementToState(e,t){const{leftCustomElements:r,rightCustomElements:n}=this.state;"left"===e?this.setState({leftCustomElements:[...r,t]}):this.setState({rightCustomElements:[...n,t]})}}ke.defaultProps={allowedModes:["full","medium"]};class Ie{constructor(e,t){this._component=null,this._handleRef=e=>{this._component=e},this._container=e,s.render(n.createElement(ke,{...t,ref:this._handleRef}),this._container)}destroy(){s.unmountComponentAtNode(this._container)}getComponent(){return(0,i.ensureNotNull)(this._component)}}},77151:(e,t,r)=>{"use strict";r.d(t,{RegistryProvider:()=>l,registryContextType:()=>c,validateRegistry:()=>o
|
|
});var n=r(50959),s=r(19036),i=r.n(s);const a=n.createContext({});function o(e,t){i().checkPropTypes(t,e,"context","RegistryContext")}function l(e){const{validation:t,value:r}=e;return o(r,t),n.createElement(a.Provider,{value:r},e.children)}function c(){return a}},61380:e=>{e.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 10" width="20" height="10"><path fill="none" stroke="currentColor" stroke-width="1.5" d="M2 1l8 8 8-8"/></svg>'},45820:e=>{e.exports='<svg xmlns="http://www.w3.org/2000/svg" width="28" height="28"><path fill="currentColor" fill-rule="evenodd" d="M4.56 14a10.05 10.05 0 00.52.91c.41.69 1.04 1.6 1.85 2.5C8.58 19.25 10.95 21 14 21c3.05 0 5.42-1.76 7.07-3.58A17.18 17.18 0 0023.44 14a9.47 9.47 0 00-.52-.91c-.41-.69-1.04-1.6-1.85-2.5C19.42 8.75 17.05 7 14 7c-3.05 0-5.42 1.76-7.07 3.58A17.18 17.18 0 004.56 14zM24 14l.45-.21-.01-.03a7.03 7.03 0 00-.16-.32c-.11-.2-.28-.51-.5-.87-.44-.72-1.1-1.69-1.97-2.65C20.08 7.99 17.45 6 14 6c-3.45 0-6.08 2-7.8 3.92a18.18 18.18 0 00-2.64 3.84v.02h-.01L4 14l-.45-.21-.1.21.1.21L4 14l-.45.21.01.03a5.85 5.85 0 00.16.32c.11.2.28.51.5.87.44.72 1.1 1.69 1.97 2.65C7.92 20.01 10.55 22 14 22c3.45 0 6.08-2 7.8-3.92a18.18 18.18 0 002.64-3.84v-.02h.01L24 14zm0 0l.45.21.1-.21-.1-.21L24 14zm-10-3a3 3 0 100 6 3 3 0 000-6zm-4 3a4 4 0 118 0 4 4 0 01-8 0z"/></svg>'}}]); |