Release v28.3.0 (from b985f2be)

This commit is contained in:
jenkins
2024-10-24 17:22:15 +00:00
parent 89a64671f4
commit a7303f87aa
908 changed files with 378 additions and 307 deletions

View File

@@ -4,6 +4,26 @@
<!-- markdownlint-disable no-emphasis-as-header -->
<!-- markdownlint-disable no-inline-html -->
<!-- markdownlint-disable code-block-style -->
## Version 28.3.0
*Date: Thu Oct 24 2024*
**New Features**
- **Symbol name in the Watchlist and Details widgets.** Now, the [`DatafeedQuoteValues.short_name`](https://www.tradingview.com/charting-library-docs/latest/api/interfaces/Datafeed.DatafeedQuoteValues#short_name) value is displayed as a symbol's short name in the [Watchlist](https://www.tradingview.com/charting-library-docs/latest/trading_terminal/Watch-List) and [Details](https://www.tradingview.com/charting-library-docs/latest/trading_terminal#details).
You can disable the [`prefer_quote_short_name`](https://www.tradingview.com/charting-library-docs/latest/customization/Featuresets#prefer_quote_short_name) featureset to revert to the old behavior. In this case, the [`ticker`](https://www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.LibrarySymbolInfo#ticker) value will be used instead. `Trading Platform Only`
**Improvements**
- **Added new time zone Azores (UTC).**
**Bug Fixes**
- **Anchored Note in multi-layout.** Fixed an issue where plotting a saved Anchored Note in multi-layout would raise an error. `Trading Platform Only`
- **Fixed symbol logo persistence in legend.** Resolved an issue where a failed image load (e.g., a 404 error) for a symbol logo would cause the previous logo to persist in the legend. Now, the legend correctly updates to reflect the absence of a logo when loading fails. See the [Symbol logos](https://www.tradingview.com/charting-library-docs/latest/ui_elements/Legend#symbol-logos) section of the Legend documentation for more details on the feature.
- **Fixed ordering of symbol logos.** Fixed an issue where symbol logos with two URLs defined in [`logo_urls`](https://www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.LibrarySymbolInfo#logo_urls) were displayed in an inconsistent order. The order has been corrected on the chart legend and within the Account Manager table.
## Version 28.2.0
*Date: Tue Oct 01 2024*
@@ -12,13 +32,13 @@
- **Added `Rank Correlation Index` indicator.**
- **Support building seconds bars from ticks.** Trading Platform now supports building seconds bars from ticks for symbols configured to support it. Compatible symbols must set the [`build_seconds_from_ticks`](https://www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.LibrarySymbolInfo#build_seconds_from_ticks) flag to `true`. Additionally, [`has_seconds`](https://www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.LibrarySymbolInfo#has_seconds) and [`has_ticks`](https://www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.LibrarySymbolInfo#has_ticks) must be `true`, and [`seconds_multipliers`](https://www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.LibrarySymbolInfo#seconds_multipliers) must be an empty array or only contain multipliers that the datafeed provides itself. `Trading Platform Only`
- **Sped up sorting animation in the Account Manager.** Raised by [#8760](https://github.com/tradingview/charting_library/issues/8760) `Trading Platform Only`
**Improvements**
- **Added an option to customize the default Volume MA calculation in the Volume indicator.** By default, the Volume MA, optionally plotted in the Volume indicator, used the SMA calculation. We have now introduced two additional options: EMA and WMA.
- **Added new event to `SubscribeEventsMap`.** The [`timeframe_interval`](https://www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.SubscribeEventsMap#timeframe_interval) event is triggered when the one of the bottom left intervals is selected or the [`setTimeFrame`](https://www.tradingview.com/charting-library-docs/latest/api/interfaces/Charting_Library.IChartWidgetApi#settimeframe) API is used.
- **Added a symbol change to MACD indicator.** It is now possible to change the targeted symbol when plotting MACD indicator without using the main series.
- **Sped up sorting animation in the Account Manager.** Raised by [#8760](https://github.com/tradingview/charting_library/issues/8760) `Trading Platform Only`
## Version 28.1.0

View File

@@ -3,7 +3,7 @@
desktop:"desktop-IxKZEhmO",allSelectedIcon:"allSelectedIcon-IxKZEhmO",selected:"selected-IxKZEhmO",focused:"focused-IxKZEhmO",titleWithoutDesc:"titleWithoutDesc-IxKZEhmO",textBlock:"textBlock-IxKZEhmO",bordered:"bordered-IxKZEhmO"}},9854:e=>{e.exports={container:"container-dfKL9A7t",contentList:"contentList-dfKL9A7t",contentListDesktop:"contentListDesktop-dfKL9A7t",searchSourceItemsContainer:"searchSourceItemsContainer-dfKL9A7t",oneColumn:"oneColumn-dfKL9A7t",searchSourceItemsContainerDesktop:"searchSourceItemsContainerDesktop-dfKL9A7t",groupTitleDesktop:"groupTitleDesktop-dfKL9A7t",column:"column-dfKL9A7t",emptyText:"emptyText-dfKL9A7t",emptyIcon:"emptyIcon-dfKL9A7t",noResultsDesktop:"noResultsDesktop-dfKL9A7t"}},16872:e=>{e.exports={wrap:"wrap-gjrLBBL3",item:"item-gjrLBBL3",small:"small-gjrLBBL3",newStyles:"newStyles-gjrLBBL3",mobile:"mobile-gjrLBBL3",text:"text-gjrLBBL3",exchange:"exchange-gjrLBBL3",filterItem:"filterItem-gjrLBBL3",brokerWrap:"brokerWrap-gjrLBBL3"}},90349:e=>{e.exports={wrap:"wrap-dlewR1s1",watchlist:"watchlist-dlewR1s1",noFeed:"noFeed-dlewR1s1",newStyles:"newStyles-dlewR1s1",scrollContainer:"scrollContainer-dlewR1s1",listContainer:"listContainer-dlewR1s1",multiLineItemsContainer:"multiLineItemsContainer-dlewR1s1",withSpinner:"withSpinner-dlewR1s1",spinnerContainer:"spinnerContainer-dlewR1s1",largeSpinner:"largeSpinner-dlewR1s1"}},43376:e=>{e.exports={search:"search-ZXzPWcCf",upperCase:"upperCase-ZXzPWcCf",bubblesContainer:"bubblesContainer-ZXzPWcCf",mobile:"mobile-ZXzPWcCf",bubbles:"bubbles-ZXzPWcCf",withFilters:"withFilters-ZXzPWcCf",spinnerWrap:"spinnerWrap-ZXzPWcCf",emptyText:"emptyText-ZXzPWcCf",emptyIcon:"emptyIcon-ZXzPWcCf",noResultsDesktop:"noResultsDesktop-ZXzPWcCf",brokerButtonWrap:"brokerButtonWrap-ZXzPWcCf"}},54464:e=>{e.exports={flagWrap:"flagWrap-QKnxaZOG",icon:"icon-QKnxaZOG",caret:"caret-QKnxaZOG",title:"title-QKnxaZOG",button:"button-QKnxaZOG",withFlag:"withFlag-QKnxaZOG",buttonContent:"buttonContent-QKnxaZOG"}},26664:e=>{e.exports={dialog:"dialog-u2dP3kv1",tabletDialog:"tabletDialog-u2dP3kv1",desktopDialog:"desktopDialog-u2dP3kv1",backButton:"backButton-u2dP3kv1"}},99113:e=>{e.exports={childrenWrapper:"childrenWrapper-_RhDhmVQ",container:"container-_RhDhmVQ"}},32248:e=>{e.exports={highlighted:"highlighted-cwp8YRo6"}},18429:(e,t,r)=>{"use strict";r.d(t,{SEPARATOR_PREFIX:()=>o,isSeparatorItem:()=>n});const o="###";function n(e){return e.startsWith(o)}},48199:(e,t,r)=>{"use strict";r.d(t,{BackButton:()=>f});var o,n=r(50959),l=r(64388),a=r(95694),s=r(49498),i=r(60176),c=r(35369),u=r(58478),d=r(73063),m=r(14127),p=r(18073),h=r(99243),g=r(42576);function v(e="large",t="1.2"){switch(e){case"large":return"1.2"===t?a:d;case"medium":return"1.2"===t?s:m;case"small":return"1.2"===t?i:p;case"xsmall":return"1.2"===t?c:h;case"xxsmall":return"1.2"===t?u:g;default:return s}}!function(e){e.Thin="1.2",e.Medium="1.5"}(o||(o={}));const f=n.forwardRef(((e,t)=>{const{"aria-label":r,flipIconOnRtl:o,...a}=e;return n.createElement(l.NavButton,{...a,"aria-label":r,ref:t,icon:v(e.size,e.iconStrokeWidth),
flipIconOnRtl:o})}))},27011:(e,t,r)=>{"use strict";function o(e,t){return t||null==e||("string"==typeof e||Array.isArray(e))&&0===e.length}r.d(t,{isIconOnly:()=>o})},14543:(e,t,r)=>{"use strict";r.d(t,{LightButton:()=>o.LightButton});r(9038);var o=r(15893);r(50959),r(21593),r(66860),r(29075),r(62978);r(78572)},9038:(e,t,r)=>{"use strict";r.d(t,{useLightButtonClasses:()=>c});var o=r(50959),n=r(97754),l=r(17946),a=r(27011),s=r(86332);const i=o.createContext({isInButtonGroup:!1,isGroupPrimary:!1}),c=(e,t,r)=>{const c=(0,o.useContext)(l.CustomBehaviourContext),{className:u,isSelected:d,children:m,showCaret:p,forceDirection:h,iconOnly:g,color:v="gray",variant:f="primary",size:y="medium",enableActiveStateStyles:S=c.enableActiveStateStyles,typography:b,isLink:x=!1,textWrap:w,isPills:k,isActive:C,startSlot:E,endSlot:I}=t,L=e[`typography-${((e,t,r)=>{if(r){const e=r.replace(/^\D+/g,"");return t?`semibold${e}`:r}switch(e){case"xsmall":return t?"semibold14px":"regular14px";case"small":case"medium":return t?"semibold16px":"regular16px";default:return""}})(y,d||k,b||void 0)}`],R=(0,o.useContext)(s.ControlGroupContext),{isInButtonGroup:_,isGroupPrimary:T}=(0,o.useContext)(i);return n(u,e.lightButton,x&&e.link,C&&e.active,d&&e.selected,(0,a.isIconOnly)(m,g)&&e.noContent,!!E&&e.withStartSlot,(p||!!I)&&e.withEndSlot,r&&e.withGrouped,h&&e[h],e[T?"primary":f],e[T?"gray":v],e[y],L,!S&&e.disableActiveStateStyles,R.isGrouped&&e.grouped,w&&e.wrap,_&&e.disableActiveOnTouch,k&&e.pills)}},66860:(e,t,r)=>{"use strict";r.d(t,{LightButtonContent:()=>d});var o=r(50959),n=r(97754),l=r(34094),a=r(27011),s=r(9745),i=r(2948),c=r(29075),u=r.n(c);function d(e){const{showCaret:t,iconOnly:r,ellipsis:c=!0,textWrap:d,tooltipText:m,children:p,endSlot:h,startSlot:g,isActiveCaret:v}=e;[h,t].filter((e=>!!e));return o.createElement(o.Fragment,null,g&&o.createElement("span",{className:n(u().slot,u().startSlot)},g),!(0,a.isIconOnly)(p,r)&&o.createElement("span",{className:n(u().content,!d&&u().nowrap,"apply-overflow-tooltip","apply-overflow-tooltip--check-children-recursively","apply-overflow-tooltip--allow-text"),"data-overflow-tooltip-text":null!=m?m:(0,l.getTextForTooltip)(p)},d||c?o.createElement(o.Fragment,null,o.createElement("span",{className:n(!d&&c&&u().ellipsisContainer,d&&u().textWrapContainer,d&&c&&u().textWrapWithEllipsis)},p),o.createElement("span",{className:u().visuallyHidden,"aria-hidden":!0},p)):o.createElement(o.Fragment,null,p,o.createElement("span",{className:u().visuallyHidden,"aria-hidden":!0},p))),h&&o.createElement("span",{className:n(u().slot,u().endSlot)},h),t&&(e=>o.createElement(s.Icon,{className:n(u().caret,e&&u().activeCaret),icon:i}))(v))}},15893:(e,t,r)=>{"use strict";r.d(t,{LightButton:()=>d});var o=r(50959),n=r(86332),l=r(9038),a=r(66860),s=r(29075),i=r.n(s),c=r(62978),u=r.n(c);function d(e){
const{isGrouped:t}=o.useContext(n.ControlGroupContext),{reference:r,className:s,isSelected:c,children:d,iconOnly:m,ellipsis:p,showCaret:h,forceDirection:g,endSlot:v,startSlot:f,color:y,variant:S,size:b,enableActiveStateStyles:x,typography:w,textWrap:k=!1,maxLines:C,style:E={},isPills:I,isActive:L,tooltipText:R,role:_,...T}=e,N=k?null!=C?C:2:1,B=N>0?{...E,"--ui-lib-light-button-content-max-lines":N}:E;return o.createElement("button",{...T,className:(0,l.useLightButtonClasses)({...u(),...i()},{className:s,isSelected:c,children:d,iconOnly:m,showCaret:h,forceDirection:g,endSlot:v,startSlot:f,color:y,variant:S,size:b,enableActiveStateStyles:x,typography:w,textWrap:k,isPills:I,isActive:L},t),ref:r,style:B,role:_},o.createElement(a.LightButtonContent,{showCaret:h,isActiveCaret:h&&(I||L||c),iconOnly:m,ellipsis:p,textWrap:k,tooltipText:R,endSlot:v,startSlot:f},d))}},34094:(e,t,r)=>{"use strict";r.d(t,{getTextForTooltip:()=>a});var o=r(50959);const n=e=>(0,o.isValidElement)(e)&&Boolean(e.props.children),l=e=>null==e||"boolean"==typeof e||"{}"===JSON.stringify(e)?"":e.toString()+" ",a=e=>Array.isArray(e)||(0,o.isValidElement)(e)?o.Children.toArray(e).reduce(((e,t)=>{let r="";return r=(0,o.isValidElement)(t)&&n(t)?a(t.props.children):(0,o.isValidElement)(t)&&!n(t)?"":l(t),e.concat(r)}),"").trim():l(e)},3685:(e,t,r)=>{"use strict";function o(){var e,t,r;return null!==(r=null===(t=null===(e=window.configurationData)||void 0===e?void 0:e.exchanges)||void 0===t?void 0:t.map((e=>({...e,country:"",providerId:"",flag:""}))))&&void 0!==r?r:[]}r.d(t,{getExchanges:()=>o})},36279:(e,t,r)=>{"use strict";var o;r.d(t,{LogoSize:()=>o,getLogoUrlResolver:()=>a}),function(e){e[e.Medium=0]="Medium",e[e.Large=1]="Large"}(o||(o={}));class n{getSymbolLogoUrl(e){return e}getCountryFlagUrl(){return""}getCryptoLogoUrl(e){return e}getProviderLogoUrl(e){return e}getSourceLogoUrl(e){return e}getBlockchainContractLogoUrl(e){return e}}let l;function a(){return l||(l=new n),l}},69654:(e,t,r)=>{"use strict";r.d(t,{DialogSearch:()=>d});var o=r(50959),n=r(97754),l=r.n(n),a=r(11542),s=r(9745),i=r(69859),c=r(54313),u=r(59086);function d(e){const{children:t,isMobile:n,renderInput:d,onCancel:p,containerClassName:h,inputContainerClassName:g,iconClassName:v,cancelTitle:f=a.t(null,void 0,r(4543)),...y}=e;return o.createElement("div",{className:l()(u.container,n&&u.mobile,h)},o.createElement("div",{className:l()(u.inputContainer,n&&u.mobile,g,p&&u.withCancel)},d||o.createElement(m,{isMobile:n,...y})),t,o.createElement(s.Icon,{className:l()(u.icon,n&&u.mobile,v),icon:n?c:i}),p&&(!n||""!==y.value)&&o.createElement("div",{className:l()(u.cancel,n&&u.mobile),onClick:p},f))}function m(e){const{className:t,reference:r,isMobile:n,value:a,onChange:s,onFocus:i,onBlur:c,onKeyDown:d,onSelect:m,placeholder:p,activeDescendant:h,...g}=e;return o.createElement("input",{...g,ref:r,type:"text",className:l()(t,u.input,n&&u.mobile),autoComplete:"off","data-role":"search",placeholder:p,value:a,onChange:s,onFocus:i,onBlur:c,onSelect:m,onKeyDown:d,"aria-activedescendant":h})}},
96967:(e,t,r)=>{"use strict";r.d(t,{SymbolSearchDialogContentItem:()=>M});var o=r(50959),n=r(97754),l=r.n(n),a=(r(11542),r(50151)),s=r(9745),i=r(56570),c=r(24637),u=r(19785),d=r(84524),m=r(24633),p=r(77975),h=r(45345),g=r(32563),v=r(49406),f=r(618),y=r(36279),S=r(59695),b=r(58492),x=r(39330),w=r(19938),k=r(43010),C=r(23348);function E(e){const{className:t,placeholderLetter:r,url1:n,url2:a,size:s="xxxsmall"}=e,i=(0,o.useRef)(null),c=(0,o.useRef)(null),u=(0,o.useRef)(null),d=(0,o.useRef)(null),m=(0,o.useRef)(null),p=(0,o.useRef)(null);return(0,k.useIsomorphicLayoutEffect)((()=>{const e=void 0===n?[]:void 0===a?[n]:[n,a],t=p.current=(r=e,Promise.all(r.map((e=>(0,w.getImage)(`symbol_logo_${e}`,e,L).then((e=>e.cloneNode()))))));var r;t.then((e=>{var r,o,n,l,a,s,h,g,v;if(t===p.current)switch(e.length){case 0:null===(r=u.current)||void 0===r||r.classList.add(C.hidden),null===(o=c.current)||void 0===o||o.classList.add(S.hiddenCircleLogoClass),null===(n=i.current)||void 0===n||n.classList.remove(S.hiddenCircleLogoClass);break;case 1:I(c.current,e[0]),null===(l=u.current)||void 0===l||l.classList.add(C.hidden),null===(a=c.current)||void 0===a||a.classList.remove(S.hiddenCircleLogoClass),null===(s=i.current)||void 0===s||s.classList.add(S.hiddenCircleLogoClass);break;case 2:I(d.current,e[0]),I(m.current,e[1]),null===(h=u.current)||void 0===h||h.classList.remove(C.hidden),null===(g=c.current)||void 0===g||g.classList.add(S.hiddenCircleLogoClass),null===(v=i.current)||void 0===v||v.classList.add(S.hiddenCircleLogoClass)}}))}),[n,a]),o.createElement("span",{className:l()(t,C.container)},o.createElement("span",{ref:u,className:l()(C.pairContainer,C.hidden)},o.createElement("span",{className:(0,x.getBlockStyleClasses)(s)},o.createElement("span",{ref:m,className:l()(C.logo,(0,x.getLogoStyleClasses)(s))}),o.createElement("span",{ref:d,className:l()(C.logo,(0,x.getLogoStyleClasses)(s))}))),o.createElement("span",{ref:c,className:l()(C.logo,S.hiddenCircleLogoClass,(0,b.getStyleClasses)(s))}),o.createElement("span",{ref:i,className:l()(C.logo,(0,b.getStyleClasses)(s))},o.createElement(S.CircleLogo,{size:s,placeholderLetter:r})))}function I(e,t){e&&(e.innerHTML="",e.appendChild(t))}function L(e){e.crossOrigin="",e.decoding="async"}var R=r(75471);function _(e){const{logoId:t,baseCurrencyLogoId:r,currencyLogoId:n,placeholder:a,className:s,size:i="xsmall"}=e,c=(0,o.useMemo)((()=>{const e={logoid:t,"currency-logoid":n,"base-currency-logoid":r};return(0,f.removeUsdFromCryptoPairLogos)((0,f.resolveLogoUrls)(e,y.LogoSize.Medium))}),[t,n,r]);return o.createElement(E,{key:i,className:l()(R.logo,s),url1:c[0],url2:c[1],placeholderLetter:a,size:i})}var T=r(29562),N=r(69533),B=r(35881);function M(e){var t,r
96967:(e,t,r)=>{"use strict";r.d(t,{SymbolSearchDialogContentItem:()=>M});var o=r(50959),n=r(97754),l=r.n(n),a=(r(11542),r(50151)),s=r(9745),i=r(56570),c=r(24637),u=r(19785),d=r(84524),m=r(24633),p=r(77975),h=r(45345),g=r(32563),v=r(49406),f=r(618),y=r(36279),S=r(59695),b=r(58492),x=r(39330),w=r(19938),k=r(43010),C=r(23348);function E(e){const{className:t,placeholderLetter:r,url1:n,url2:a,size:s="xxxsmall"}=e,i=(0,o.useRef)(null),c=(0,o.useRef)(null),u=(0,o.useRef)(null),d=(0,o.useRef)(null),m=(0,o.useRef)(null),p=(0,o.useRef)(null);return(0,k.useIsomorphicLayoutEffect)((()=>{const e=void 0===n?[]:void 0===a?[n]:[n,a],t=p.current=(r=e,Promise.all(r.map((e=>(0,w.getImage)(`symbol_logo_${e}`,e,L).then((e=>e.cloneNode()))))));var r;t.catch((()=>[])).then((e=>{var r,o,n,l,a,s,h,g,v;if(t===p.current)switch(e.length){case 0:null===(r=u.current)||void 0===r||r.classList.add(C.hidden),null===(o=c.current)||void 0===o||o.classList.add(S.hiddenCircleLogoClass),null===(n=i.current)||void 0===n||n.classList.remove(S.hiddenCircleLogoClass);break;case 1:I(c.current,e[0]),null===(l=u.current)||void 0===l||l.classList.add(C.hidden),null===(a=c.current)||void 0===a||a.classList.remove(S.hiddenCircleLogoClass),null===(s=i.current)||void 0===s||s.classList.add(S.hiddenCircleLogoClass);break;case 2:I(d.current,e[0]),I(m.current,e[1]),null===(h=u.current)||void 0===h||h.classList.remove(C.hidden),null===(g=c.current)||void 0===g||g.classList.add(S.hiddenCircleLogoClass),null===(v=i.current)||void 0===v||v.classList.add(S.hiddenCircleLogoClass)}}))}),[n,a]),o.createElement("span",{className:l()(t,C.container)},o.createElement("span",{ref:u,className:l()(C.pairContainer,C.hidden)},o.createElement("span",{className:(0,x.getBlockStyleClasses)(s)},o.createElement("span",{ref:m,className:l()(C.logo,(0,x.getLogoStyleClasses)(s))}),o.createElement("span",{ref:d,className:l()(C.logo,(0,x.getLogoStyleClasses)(s))}))),o.createElement("span",{ref:c,className:l()(C.logo,S.hiddenCircleLogoClass,(0,b.getStyleClasses)(s))}),o.createElement("span",{ref:i,className:l()(C.logo,(0,b.getStyleClasses)(s))},o.createElement(S.CircleLogo,{size:s,placeholderLetter:r})))}function I(e,t){e&&(e.innerHTML="",e.appendChild(t))}function L(e){e.crossOrigin="",e.decoding="async"}var R=r(75471);function _(e){const{logoId:t,baseCurrencyLogoId:r,currencyLogoId:n,placeholder:a,className:s,size:i="xsmall"}=e,c=(0,o.useMemo)((()=>{const e={logoid:t,"currency-logoid":n,"base-currency-logoid":r};return(0,f.removeUsdFromCryptoPairLogos)((0,f.resolveLogoUrls)(e,y.LogoSize.Medium))}),[t,n,r]);return o.createElement(E,{key:i,className:l()(R.logo,s),url1:c[0],url2:c[1],placeholderLetter:a,size:i})}var T=r(29562),N=r(69533),B=r(35881);function M(e){var t,r
;const{dangerousTitleHTML:n,title:f,dangerousDescriptionHTML:y,description:S,searchToken:b,exchangeName:x,marketType:w,onClick:k,isSelected:C,isEod:E=!1,isActive:I=!1,isOffset:L=!1,invalid:R=!1,isHighlighted:M=!1,hideExchange:D=!1,hideMarkedListFlag:O=!1,onExpandClick:F,isExpanded:P,hoverComponent:A,country:V,providerId:U,source:Q,source2:W,type:K,flag:z,itemRef:Z,onMouseOut:H,onMouseOver:q,className:$,actions:j,reference:G,fullSymbolName:Y,logoId:X,currencyLogoId:J,baseCurrencyLogoId:ee,shortName:te,hideLogo:re=!1,exchangeTooltip:oe,hideMarketType:ne,isPrimary:le}=e,{isSmallWidth:ae,isMobile:se}=(0,a.ensureNotNull)((0,o.useContext)(d.SymbolSearchItemsDialogContext)),ie=Boolean(A),ce=!R&&!D&&(se||!ie),ue=(0,p.useWatchedValueReadonly)({watchedValue:h.watchedTheme})===m.StdTheme.Dark?B.dark:B.light,de=A,me=i.enabled("show_symbol_logos"),pe=i.enabled("show_exchange_logos"),he=me||!1,ge=null!==(t=null==W?void 0:W.description)&&void 0!==t?t:Q,ve=null!==(r=null==W?void 0:W.name)&&void 0!==r?r:Q;return o.createElement("div",{className:l()(B.itemRow,ae&&B.multiLine,M&&B.highlighted,M&&ue,C&&B.selected,I&&B.active,R&&B.invalid,!se&&g.mobiletouch&&ie&&B.hover,$),onClick:function(e){if(!k||e.defaultPrevented)return;e.preventDefault(),k(e)},"data-role":e["data-role"]||"list-item","data-active":I,"data-type":w,"data-name":"symbol-search-dialog-content-item",onMouseOut:H,onMouseOver:q,ref:G},o.createElement("div",{ref:Z,className:l()(B.itemInfoCell,B.cell,L&&B.offset)},o.createElement("div",{className:l()(B.actionHandleWrap,!he&&B.fixedWidth)},o.createElement(o.Fragment,null,!1,F&&o.createElement("div",{onClick:function(e){if(!F||e.defaultPrevented)return;e.preventDefault(),F(e)}},o.createElement(s.Icon,{className:l()(B.expandHandle,P&&B.expanded,C&&B.selected),icon:N})),he&&!L&&o.createElement("div",{className:l()(B.logo,Boolean(F)&&B.isExpandable)},o.createElement(_,{key:Y,logoId:X,currencyLogoId:J,baseCurrencyLogoId:ee,placeholder:te?te[0]:void 0})))),o.createElement("div",{className:l()(B.description,he&&L&&B.offset)},f&&o.createElement("div",{className:l()(B.symbolTitle,I&&B.active,R&&B.invalid,!Boolean(y)&&B.noDescription),"data-name":"list-item-title"},"string"==typeof f&&b?o.createElement(c.HighlightedText,{className:B.highlightedText,text:f,queryString:b,rules:(0,u.createRegExpList)(b)}):f,E&&o.createElement("span",{className:B.dataMode},"E")),!f&&n&&o.createElement("div",{className:l()(B.symbolTitle,I&&B.active,R&&B.invalid),"data-name":"list-item-title"},o.createElement("span",{dangerouslySetInnerHTML:{__html:n}}),E&&o.createElement("span",{className:B.dataMode},"E")),ae&&fe())),!ae&&o.createElement("div",{className:l()(B.cell,B.descriptionCell,Boolean(de)&&B.addition)},fe(),de?o.createElement(de,{...e,className:B.actions,onMouseOver:void 0,onMouseOut:void 0}):null),ae&&de?o.createElement(de,{...e,className:B.cell,onMouseOver:void 0,onMouseOut:void 0}):null,ce&&o.createElement("div",{className:l()(B.exchangeCell,B.cell)},o.createElement("div",{className:l()(B.exchangeDescription)},!ne&&o.createElement("div",{
className:l()(B.marketType,I&&B.active)},w),o.createElement("div",{className:B.source},!1,"economic"===K&&ge&&ve?o.createElement("div",{className:l()(B.exchangeName,I&&B.active,"apply-common-tooltip",B.narrow,ne&&B.wide),title:ge},ve):o.createElement("div",{className:l()(B.exchangeName,I&&B.active,oe&&"apply-common-tooltip"),title:oe},x))),pe&&o.createElement("div",{className:B.flag},o.createElement(T.SymbolSearchFlag,{key:pe?`${Y}_exchange`:`${V}_${U}_${null==W?void 0:W.id}_${K}_${z}`,className:B.icon,country:V,providerId:U,sourceId:"economic"===K&&W?W.id:void 0}))),o.createElement("div",{className:l()(B.cell,Boolean(j)&&B.actionsCell)},j));function fe(){if(R)return null;const e=l()(B.symbolDescription,I&&B.active,!g.mobiletouch&&"apply-overflow-tooltip apply-overflow-tooltip--allow-text");return S?o.createElement("div",{className:e},b?o.createElement(c.HighlightedText,{className:B.highlightedText,text:S,queryString:b,rules:(0,u.createRegExpList)(b)}):S):y?o.createElement("div",{"data-overflow-tooltip-text":(0,v.removeTags)(y),className:e,dangerouslySetInnerHTML:{__html:y}}):null}}},29562:(e,t,r)=>{"use strict";r.d(t,{SymbolSearchFlag:()=>v});var o=r(50959),n=r(97754),l=r.n(n),a=r(24633),s=r(36279);const i=r.p+"mock-dark.16b5f3a431f502b03ae3.svg",c=r.p+"mock-light.d201313017eb2c1b989f.svg";function u(e){return e===a.StdTheme.Dark?i:c}var d=r(77975),m=r(45345),p=r(50151);const h=s.LogoSize.Medium;var g=r(35599);function v(e){const{country:t,tooltip:r,providerId:n,sourceId:a,className:i}=e,c=(0,d.useWatchedValueReadonly)({watchedValue:m.watchedTheme}),[v,f]=(0,o.useState)(function({country:e,providerId:t,sourceId:r}){const o=(0,s.getLogoUrlResolver)();return n=>{const l=e=>o.getProviderLogoUrl(e,h),a=[{value:r,resolve:l},{value:e,resolve:e=>o.getCountryFlagUrl(e.toUpperCase(),h)},{value:t,resolve:l}].find((({value:e})=>void 0!==e&&e.length>0));return void 0!==a?a.resolve((0,p.ensureDefined)(a.value)):u(n)}}({country:t,providerId:n,sourceId:a})(c));return o.createElement("img",{className:l()(i,"apply-common-tooltip",g.icon),crossOrigin:"","data-tooltip":r,src:v,onError:function(){f(u(c))}})}},58442:(e,t,r)=>{"use strict";r.d(t,{QualifiedSources:()=>o,qualifyProName:()=>a});var o,n=r(50151),l=r(56570);r(81319);function a(e){return e}!function(e){function t(e){return e.pro_name}function r(e){{const t=l.enabled("pay_attention_to_ticker_not_symbol")?e.ticker:e.name;return(0,n.ensureDefined)(t)}}e.fromQuotesSnapshot=function(e){return"error"===e.status?e.symbolname:e.values.pro_name},e.fromQuotesResponse=function(e){const{values:r,symbolname:o,status:n}=e;return"error"===n&&o?o:t(r)},e.fromQuotes=t,e.fromSymbolSearchResult=function(e,t){{const{ticker:r,symbol:o}=null!=t?t:e;return l.enabled("pay_attention_to_ticker_not_symbol")?(0,n.ensureDefined)(null!=r?r:o):(0,n.ensureDefined)(o)}},e.fromSymbolInfo=r,e.fromSymbolMessage=function(e,t){return"symbol_resolved"===t.method?r(t.params[1]):e}}(o||(o={}))},20882:(e,t,r)=>{"use strict";r.d(t,{createSearchSources:()=>s,filterSearchSources:()=>l,isAllSearchSourcesSelected:()=>n,
splitSearchSourcesByGroup:()=>a});const o=[];function n(e){return""===e.value()}function l(e,t){return e.filter((e=>e.includes(t)))}function a(e){const t=new Map;e.forEach((e=>{t.has(e.group())?t.get(e.group()).push(e):t.set(e.group(),[e])}));for(const e of t.values()){e[0].group()!==ExchangeGroup.NorthAmerica&&e.sort(((e,t)=>e.name().toLowerCase()>t.name().toLowerCase()?1:-1))}return new Map([...t.entries()].sort((([e],[t])=>o.indexOf(e)-o.indexOf(t))))}function s(e,t){return t.map((t=>new e(t)))}},70613:(e,t,r)=>{"use strict";r.d(t,{SymbolSearchDialogBodyContext:()=>o});const o=r(50959).createContext(null)},84524:(e,t,r)=>{"use strict";r.d(t,{SymbolSearchItemsDialogContext:()=>o});const o=r(50959).createContext(null)},73280:(e,t,r)=>{"use strict";r.d(t,{SymbolSearchItemsDialog:()=>Xe});var o,n,l,a=r(50959),s=r(97754),i=r.n(s),c=r(11542),u=r(56570),d=r(44254),m=r(81319);function p(e){const t=function(e){let t,r=0,o=0;for(let n=0;n<e.length;n++){const l=e[n];if("whitespace"!==l.type)switch(r){case 0:if("number"!==l.type||1!=+l.value)return[];r=1;break;case 1:if(1!==r||"divide"!==l.type)return[];r=2,t=n+1;break;case 2:if("openBrace"===l.type)r=3,o=1;else if((0,d.isBinaryOperator)(l.type))return[];break;case 3:"openBrace"===l.type?o++:"closeBrace"===l.type&&(o--,o<=0&&(r=2))}}return e.slice(t)}(e);return t.length?(0,d.factorOutBraces)(t):(0,d.factorOutBraces)((0,d.tokenize)("1/("+h(e)+")"))}function h(e){return e.reduce(((e,t)=>"symbol"===t.type&&d.symbolTokenEscapeRe.test(t.value)?e+`'${t.value}'`:e+t.value),"")}function g(e){const t=function(e){const t=(0,d.tokenize)(e),r=[];return t.forEach((e=>{if("symbol"!==e.type)return;const[t]=(0,d.parseToken)(e);t&&r.push(t)})),r}(e);if(1===t.length)return t[0]}function v(e,t,r){const o=e.value,[n,l]=f(e,r),a=(0,m.getSymbolFullName)(t),s=d.symbolTokenEscapeRe.test(a)?`'${a}'`:a;return[o.substring(0,l)+s+o.substring(l+n.length),l+s.length]}function f(e,t){const{value:r,selectionStart:o}=e,n=(0,d.tokenize)(t?r.toUpperCase():r),l=(0,d.getTokenAtPos)(n,o||0);return[(null==l?void 0:l.value)||"",l?l.offset:r.length,n]}!function(e){e.Init="init",e.Var="var",e.Operator="operator"}(o||(o={})),function(e){e[e.Init=0]="Init",e[e.Div=1]="Div",e[e.Expression=2]="Expression",e[e.BracedExpression=3]="BracedExpression"}(n||(n={})),function(e){e.Stocks="stocks",e.Futures="futures",e.Funds="funds",e.Forex="forex",e.Crypto="bitcoin,crypto",e.Index="index",e.Bond="bond",e.Economic="economic",e.Options="options"}(l||(l={}));const y=["futures","forex","bond","economic","options"];var S=r(84877),b=r(24437),x=r(79418),w=r(9745),k=r(86240),C=r(86781),E=r(84524),I=r(69654),L=r(3343),R=r(19291);function _(e,t,r){return`source-item-${e}-${t}-${r}`}var T=r(20882),N=r(99113);function B(e){const{children:t,className:r}=e;return a.createElement("div",{className:i()(N.container,r)},a.createElement("div",{className:N.childrenWrapper},t))}var M=r(50151),D=r(78036),O=r(24637),F=r(19785),P=r(91540),A=r(78406);function V(e){

View File

@@ -12,7 +12,7 @@ w.defaultPreventedHandler)(this._model.setSourceSelected.bind(this._model)),null
accessibleButtons(){return this._isRowHidden.value()?[]:this._accessibleButtons.filter((e=>!e.classList.contains(V.blockHidden)))}showActions(){null===this._el||this._el.classList.contains(A.withAction)||this._showActions()}hideActions(){null!==this._el&&this._el.classList.contains(A.withAction)&&this._hideActions()}_updateActionsVisibilitiesByMode(){}_updateTitlesVisibilitiesByMode(){}_render(){this._renderTitles(),this._renderActions(),this._renderValues(),this._el=document.createElement("div"),B(this._el,this._loading.value()),this._firstBlockWrapper=document.createElement("div"),this._firstBlockWrapper.classList.add(A.noWrapWrapper),this._firstBlockWrapper.appendChild((0,o.ensureNotNull)(this._titlesWrapperEl)),null!==this._actionsParentEl&&this._firstBlockWrapper.appendChild(this._actionsParentEl),this._el.appendChild(this._firstBlockWrapper),this._el.appendChild((0,o.ensureNotNull)(this._valuesParentEl)),this._parentEl.append(this._el)}_renderTitles(){null===this._titlesWrapperEl&&(this._titlesWrapperEl=document.createElement("div"),this._titlesWrapperEl.classList.add(A.titlesWrapper));for(let e=0;e<this._titlesSpawns.length;e++){const{wrapper:t,title:i}=this._renderTitle(this._titlesSpawns[e]);this._titlesWrapperEl.appendChild(t),this._titleContainers.push(t),this._titleElements.push(i)}}_renderTitle(e){var t;const{class:i,title:s,titleId:l,tooltip:o,onClick:a}=e,n=a,r=null!==(t=s.value())&&void 0!==t?t:"",d=document.createElement("div");d.classList.add(A.titleWrapper,i,"apply-overflow-tooltip",A.withDot),d.dataset.name=l,void 0!==o&&(d.classList.add("apply-common-tooltip"),d.setAttribute("title",o));const u=document.createElement(n?"button":"div");if(u.classList.add(A.title),void 0!==a){d.classList.add(A.withAction);const e=e=>{var t;null===(t=this._selectedSourceHandler)||void 0===t||t.call(this,e),a(),n&&u.blur()};this._mouseEventHandlers.push(new w.MouseEventHandler(d,{mouseClickEvent:e,tapEvent:_.CheckMobile.any()?void 0:e},{ignoreClickAndTapOnDblClickOrDblTap:!0}))}if(n){const e=u;this._makeItemAccessible(e,a,null!=o?o:"")}return r.length>0?u.appendChild(document.createTextNode(r)):(d.classList.add(V.blockHidden),u.classList.add(V.blockHidden)),d.appendChild(u),{wrapper:d,title:u}}_makeItemAccessible(e,t,i){""!==i&&e.setAttribute("aria-label",i),e.type="button",e.classList.add(A.accessible),e.tabIndex=-1;const s=t=>{switch(t.type){case"roving-tabindex:main-element":e.tabIndex=0;break;case"roving-tabindex:secondary-element":e.tabIndex=-1}};e.addEventListener("roving-tabindex:main-element",s),e.addEventListener("roving-tabindex:secondary-element",s),e.addEventListener("keydown",(e=>{const i=(0,u.hashFromEvent)(e);13!==i&&32!==i||(e.preventDefault(),t(e))})),this._accessibleButtons.push(e)}_renderActions(){if(!this._withActions)return;null===this._actionsParentEl&&(this._actionsParentEl=document.createElement("div"),this._actionsParentEl.classList.add(A.buttonsWrapper),this._parentEl.append(this._actionsParentEl),this._actionAdditionalWrapperEl=document.createElement("div"),
this._actionAdditionalWrapperEl.classList.add(A.buttons),this._actionsParentEl.appendChild(this._actionAdditionalWrapperEl));const e=(0,o.ensureNotNull)(this._actionAdditionalWrapperEl);this._model.actions().forEach((t=>{var i,s;const l=void 0===t.disableAccessibility,o={iconSize:v.trackingModeIsAvailable?"large":"small",tag:l?"button":"div",buttonClassName:A.button,wrapIconClassName:A.buttonIcon,hiddenClassName:V.blockHidden,blurOnClick:!!l||void 0},a=(0,y.createActionElement)(t,o);l&&this._makeItemAccessible(a,(e=>{t.action(e)}),null!==(s=null===(i=t.title)||void 0===i?void 0:i.value())&&void 0!==s?s:""),this._actionElements.push(a),e.appendChild(a)}))}_initWrappersIfNotInitialized(){return null===this._valuesParentEl&&(this._valuesParentEl=document.createElement("div"),this._valuesParentEl.classList.add(A.valuesWrapper),this._valuesAdditionalWrapperEl=document.createElement("div"),this._valuesAdditionalWrapperEl.classList.add(A.valuesAdditionalWrapper),this._valuesParentEl.appendChild(this._valuesAdditionalWrapperEl)),(0,o.ensureNotNull)(this._valuesAdditionalWrapperEl)}_isWidthButtonsMode(){return null!==this._el&&(this._el.classList.contains(A.withAction)||this._disabled.value()||this._selected.value()||this._stayInHoveredMode)}_updateTitlesHandler(e,t){const i=(0,o.ensureNotNull)(this._titleContainers[e]),s=(0,o.ensureNotNull)(this._titleElements[e]),l=0===t.length||this._isTitleHiddenByMode(this._titlesSpawns[e]);s.classList.toggle(V.blockHidden,l),i.classList.toggle(V.blockHidden,l),p((0,o.ensureNotNull)(this._titleElements[e]),t)}_isTitleHiddenByMode(e){return!1}_updateStates(e){this._updateDisabledState(),this._updateDisabledOnIntervalState(),this._updateSelectedState(),this._updateLoadingState(),e&&this._clearDisableState()}_updateValuesHTMLElHandler(e,t){p((0,o.ensure)(this._valuesElements[e].value),t),this._updateShowValues()}_updateValueColorHandler(e,t=""){(0,o.ensure)(this._valuesElements[e].value).style.color=t}_updateValueVisibleHandler(e,t){const i=(0,o.ensure)(this._valuesElements[e].value).closest(`.${A.valueItem}`);null!==i&&i.classList.toggle(V.blockHidden,!t),this._updateShowValues()}_updateShowLine(){null!==this._el&&this._el.classList.toggle(V.blockHidden,this._isRowHidden.value())}_createValuesSpawns(){this._valuesSpawnArray=this._values.value().map((e=>({value:e.value.spawn(),color:e.color.spawn(),visible:e.visible.spawn(),title:e.title.spawn()})))}_removeValuesSpawnsSubscriptions(){for(const e of this._valuesSpawnArray)e.value.destroy(),e.color.destroy(),e.visible.destroy(),e.title.destroy();this._valuesSpawnArray=[]}_addValuesSpawnsSubscriptions(){for(let e=0;e<this._valuesSpawnArray.length;e++){const t=this._valuesSpawnArray[e];t.value.subscribe(this._updateValuesHTMLElHandler.bind(this,e)),t.color.subscribe(this._updateValueColorHandler.bind(this,e)),t.visible.subscribe(this._updateValueVisibleHandler.bind(this,e)),t.title.subscribe(this._updateValuesTitleHTMLElHandler.bind(this,e))}}_updateShowValues(){function e(e){if(!e)return
;const t=Array.from(e.children).every((e=>e.classList.contains(V.blockHidden)));e.classList.toggle(V.blockHidden,t)}e(this._valuesAdditionalWrapperEl),e(this._valuesParentEl)}_addStatusesWidget(e,t,i){this._statusesWrapper=document.createElement("div"),this._statusesWrapper.classList.add(A.statusesWrapper),e.classList.add(A.statusesWrapper__statuses),this._statusesWrapper.appendChild(e),(0,o.ensureNotNull)(this._firstBlockWrapper).appendChild(this._statusesWrapper),this._hideInvisibleHover=t.spawn(),this._hideInvisibleHover.subscribe(this._updateInvisibleHoverMode.bind(this),{callWithLast:!0}),this._hideValues=i.spawn(),this._hideValues.subscribe(this._updateHideValuesMode.bind(this),{callWithLast:!0}),this._updateStatusWidgetVisibility(this._disabled.value()),this._resizeObserver=new ResizeObserver(this._handlerRestrictTitleWidth.bind(this)),null!==this._actionsParentEl&&this._resizeObserver.observe(this._actionsParentEl),this._resizeObserver.observe(this._statusesWrapper)}_updateTitleMaxWidth(){if(null===this._firstBlockWrapper)return;const e=this._allButtonsWidth||0,t=(this._lastActionsWrapperWidth||0)+(this._lastStatusesWrapperWidth||0);this._isWidthButtonsMode()?this._firstBlockWrapper.style.maxWidth=`calc(100% - ${Math.max(e,t)}px)`:this._firstBlockWrapper.style.maxWidth=t>0?`calc(100% - ${t}px)`:""}_updateAllButtonsWidth(){this._allButtonsWidth=this._getButtonsCount()*S+1,this._updateTitleMaxWidth()}_updateInvisibleHoverMode(e){null!==this._el&&this._el.classList.toggle(A.invisibleHover,!e)}_updateHideValuesMode(e){null!==this._el&&this._el.classList.toggle(A.hideValues,e)}_showActions(){if(null===this._el||!this._withActions)return;this._el.classList.add(A.withAction);const e=null!==this._valuesParentEl&&null!==this._titlesWrapperEl&&this._valuesParentEl.offsetTop===this._titlesWrapperEl.offsetTop;this._el.classList.toggle(A.withTail,e),this._updateTitleMaxWidth()}_hideActions(){null!==this._el&&this._withActions&&!this._stayInHoveredMode&&(this._el.classList.remove(A.withAction),null!==this._valuesParentEl&&this._valuesParentEl.classList.remove(A.withTail),this._updateTitleMaxWidth())}_handlerRestrictTitleWidth(e){if(null===this._actionsParentEl||null===this._firstBlockWrapper)return;let t=null,i=null;for(const s of e)s.target===this._statusesWrapper&&(t=s.contentRect.width),s.target===this._actionsParentEl&&(i=s.contentRect.width);t===this._lastStatusesWrapperWidth&&i===this._lastActionsWrapperWidth||(null!==t&&(this._lastStatusesWrapperWidth=t),null!==i&&(this._lastActionsWrapperWidth=i),this._updateTitleMaxWidth())}_clearDisableState(){null!==this._el&&(this._el.classList.remove(A.eyeLoading),this._el.classList.remove(A.disabled),this._updateStatusWidgetVisibility(this._disabled.value()),this._updateTitleMaxWidth())}_updateDisabledOnIntervalState(){var e;null===(e=this._el)||void 0===e||e.classList.toggle(A.disabledOnInterval,this._disabledOnInterval.value())}_updateSelectedState(){null!==this._el&&this._withActions&&this._el.classList.toggle(A.selected,this._selected.value())}_updateShowTitles(){
null!==this._titlesWrapperEl&&(this._titlesWrapperEl.classList.toggle(V.blockHidden,this._isTitleHidden.value()),null!==this._actionsParentEl&&this._actionsParentEl.classList.toggle(V.blockHidden,this._isTitleHidden.value()))}_updateValues(){this._removeValuesSpawnsSubscriptions(),this._createValuesSpawns(),null!==this._valuesParentEl&&null!==this._valuesAdditionalWrapperEl&&(this._valuesElements=[],this._valuesAdditionalWrapperEl.innerHTML=""),this._renderValues(),this._addValuesSpawnsSubscriptions(),this._updateShowValues()}_updateActionVisibilities(e){null!==this._actionsParentEl&&this._actionsParentEl.querySelectorAll(`.${A.button}`)[e].classList.toggle(V.blockHidden,!this._actionsSpawnArray[e].visible.value())}_updateActionTitle(e){const t=this._actionsSpawnArray[e].title;if(null===this._actionsParentEl||null===t)return;const i=this._actionsParentEl.querySelectorAll(`.${A.button}`)[e];i.setAttribute("title",t.value()),i.hasAttribute("aria-label")&&i.setAttribute("aria-label",t.value())}_updateCustomTextColor(){const e=this._customTextColor.value()||"";for(const t of this._titleContainers)null!==t&&(t.style.color=e);const t=(0,o.ensureNotNull)(this._valuesParentEl).querySelectorAll(`.${A.valueTitle}`);for(let i=0;i<t.length;i++)t[i].style.color=e;(0,o.ensureNotNull)(this._el).classList.toggle(A.withCustomTextColor,Boolean(e))}_updateStatusWidgetVisibility(e){null!==this._statusesWrapper&&this._statusesWrapper.classList.toggle(V.blockHidden,e)}}var D=i(16230),P=i(97754),z=i.n(P),N=i(39330),R=i(58492),O=i(82708),F=i(19938),U=i(59695);class G{constructor(e,t){this._lastDrawnLogos=[],this._logoWrapper=null,this._pairContainer=null,this._primaryLogo=null,this._secondaryLogo=null,this._logoContainer=null,this._symbolLetterContainer=null,this._updateLogoVisibility=e=>{this._logoWrapper&&this._logoWrapper.classList.toggle(A.hidden,!e)},this._updateSymbolLogo=async e=>{var t,i,s,l,o,a,n,r,d;if(null===this._logoWrapper&&this._renderSymbolLogo(),0!==this._lastDrawnLogos.length&&0!==e.length&&(0,D.default)(this._lastDrawnLogos,e))return;const u=await(h=e,Promise.all(h.map((e=>(0,F.getImage)(`symbol_logo_${e}`,e,K).then((e=>e.cloneNode()))))));var h;switch(u.length){case 0:null===(t=this._pairContainer)||void 0===t||t.classList.add(A.hidden),null===(i=this._logoContainer)||void 0===i||i.classList.add(U.hiddenCircleLogoClass),this._updateSymbolLetter(),null===(s=this._symbolLetterContainer)||void 0===s||s.classList.remove(U.hiddenCircleLogoClass),this._lastDrawnLogos=e;break;case 1:j(this._logoContainer,u[0]),null===(l=this._pairContainer)||void 0===l||l.classList.add(A.hidden),null===(o=this._logoContainer)||void 0===o||o.classList.remove(U.hiddenCircleLogoClass),null===(a=this._symbolLetterContainer)||void 0===a||a.classList.add(U.hiddenCircleLogoClass),this._lastDrawnLogos=e;break;case 2:j(this._primaryLogo,u[0]),j(this._secondaryLogo,u[1]),null===(n=this._pairContainer)||void 0===n||n.classList.remove(A.hidden),null===(r=this._logoContainer)||void 0===r||r.classList.add(U.hiddenCircleLogoClass),
null!==this._titlesWrapperEl&&(this._titlesWrapperEl.classList.toggle(V.blockHidden,this._isTitleHidden.value()),null!==this._actionsParentEl&&this._actionsParentEl.classList.toggle(V.blockHidden,this._isTitleHidden.value()))}_updateValues(){this._removeValuesSpawnsSubscriptions(),this._createValuesSpawns(),null!==this._valuesParentEl&&null!==this._valuesAdditionalWrapperEl&&(this._valuesElements=[],this._valuesAdditionalWrapperEl.innerHTML=""),this._renderValues(),this._addValuesSpawnsSubscriptions(),this._updateShowValues()}_updateActionVisibilities(e){null!==this._actionsParentEl&&this._actionsParentEl.querySelectorAll(`.${A.button}`)[e].classList.toggle(V.blockHidden,!this._actionsSpawnArray[e].visible.value())}_updateActionTitle(e){const t=this._actionsSpawnArray[e].title;if(null===this._actionsParentEl||null===t)return;const i=this._actionsParentEl.querySelectorAll(`.${A.button}`)[e];i.setAttribute("title",t.value()),i.hasAttribute("aria-label")&&i.setAttribute("aria-label",t.value())}_updateCustomTextColor(){const e=this._customTextColor.value()||"";for(const t of this._titleContainers)null!==t&&(t.style.color=e);const t=(0,o.ensureNotNull)(this._valuesParentEl).querySelectorAll(`.${A.valueTitle}`);for(let i=0;i<t.length;i++)t[i].style.color=e;(0,o.ensureNotNull)(this._el).classList.toggle(A.withCustomTextColor,Boolean(e))}_updateStatusWidgetVisibility(e){null!==this._statusesWrapper&&this._statusesWrapper.classList.toggle(V.blockHidden,e)}}var D=i(16230),P=i(97754),z=i.n(P),N=i(39330),R=i(58492),O=i(82708),F=i(19938),U=i(59695);class G{constructor(e,t){this._lastDrawnLogos=[],this._logoWrapper=null,this._pairContainer=null,this._primaryLogo=null,this._secondaryLogo=null,this._logoContainer=null,this._symbolLetterContainer=null,this._updateLogoVisibility=e=>{this._logoWrapper&&this._logoWrapper.classList.toggle(A.hidden,!e)},this._updateSymbolLogo=async e=>{var t,i,s,l,o,a,n,r,d;if(null===this._logoWrapper&&this._renderSymbolLogo(),0!==this._lastDrawnLogos.length&&0!==e.length&&(0,D.default)(this._lastDrawnLogos,e))return;const u=await(h=e,Promise.all(h.map((e=>(0,F.getImage)(`symbol_logo_${e}`,e,K).then((e=>e.cloneNode())))))).catch((()=>[]));var h;switch(u.length){case 0:null===(t=this._pairContainer)||void 0===t||t.classList.add(A.hidden),null===(i=this._logoContainer)||void 0===i||i.classList.add(U.hiddenCircleLogoClass),this._updateSymbolLetter(),null===(s=this._symbolLetterContainer)||void 0===s||s.classList.remove(U.hiddenCircleLogoClass),this._lastDrawnLogos=e;break;case 1:j(this._logoContainer,u[0]),null===(l=this._pairContainer)||void 0===l||l.classList.add(A.hidden),null===(o=this._logoContainer)||void 0===o||o.classList.remove(U.hiddenCircleLogoClass),null===(a=this._symbolLetterContainer)||void 0===a||a.classList.add(U.hiddenCircleLogoClass),this._lastDrawnLogos=e;break;case 2:j(this._primaryLogo,u[0]),j(this._secondaryLogo,u[1]),null===(n=this._pairContainer)||void 0===n||n.classList.remove(A.hidden),null===(r=this._logoContainer)||void 0===r||r.classList.add(U.hiddenCircleLogoClass),
null===(d=this._symbolLetterContainer)||void 0===d||d.classList.add(U.hiddenCircleLogoClass),this._lastDrawnLogos=e}},this._model=e,this._parentElement=t,this._renderSymbolLogo(),this._logoUrls=e.symbolLogoUrls().spawn(),this._logoUrls.subscribe(this._updateSymbolLogo,{callWithLast:!0}),this._isLogoVisible=e.isSymbolLogoVisible().spawn(),this._isLogoVisible.subscribe(this._updateLogoVisibility,{callWithLast:!0})}destroy(){var e;null===(e=this._logoWrapper)||void 0===e||e.remove(),this._logoWrapper=null,this._pairContainer=null,this._primaryLogo=null,this._secondaryLogo=null,this._logoContainer=null,this._symbolLetterContainer=null,this._logoUrls.destroy(),this._isLogoVisible.destroy()}_renderSymbolLogo(){if(!this._logoWrapper){const e=this._logoWrapper=document.createElement("div");e.classList.add(A.logoWrapper);const t=this._pairContainer=e.appendChild(document.createElement("span"));t.classList.add(A.pairContainer,A.hidden);const i=t.appendChild(document.createElement("span"));i.className=(0,N.getBlockStyleClasses)("xxxsmall");(this._secondaryLogo=i.appendChild(document.createElement("span"))).className=z()((0,N.getLogoStyleClasses)("xxxsmall"),A.logo);(this._primaryLogo=i.appendChild(document.createElement("span"))).className=z()((0,N.getLogoStyleClasses)("xxxsmall"),A.logo);(this._logoContainer=e.appendChild(document.createElement("span"))).className=z()((0,R.getStyleClasses)("xxxsmall"),A.logo,U.hiddenCircleLogoClass);(this._symbolLetterContainer=e.appendChild(document.createElement("span"))).className=z()((0,R.getStyleClasses)("xxxsmall"),A.logo),this._updateSymbolLetter()}this._parentElement.insertBefore(this._logoWrapper,this._parentElement.firstChild)}_updateSymbolLetter(){var e;if(this._symbolLetterContainer){const t=(0,O.safeShortName)(null!==(e=this._model.symbol())&&void 0!==e?e:"")[0];p(this._symbolLetterContainer,t)}}}function j(e,t){e&&e.replaceChildren(t)}function K(e){e.crossOrigin="",e.decoding="async"}const $=_.isSafari?"click":"auxclick";class Z extends I{constructor(e,t,i){super(e,t,i),this._wheelClickHandler=null,this._symbolLogoRenderer=null,this._updateSymbolLogoRenderer=e=>{var t;c.enabled("show_symbol_logo_for_compare_studies")&&(null===(t=this._symbolLogoRenderer)||void 0===t||t.destroy(),this._symbolLogoRenderer=e?new G(e,(0,o.ensureNotNull)(this._titleContainers[0])):null)},this._canUpdateRowVisibility=!0,this._globalRowVisibility=this._model.globalVisibility().spawn(),this._globalRowVisibility.subscribe(this._updateShowLine.bind(this),{callWithLast:!0}),this._has5Buttons=this._model.isAbleShowSourceCode().spawn(),this._has5Buttons.subscribe(this._update5ButtonsStyles.bind(this),{callWithLast:!0}),this._updateStates(!this._disabled.value()),i.statusWidgetEl&&this._addStatusesWidget(i.statusWidgetEl,i.hideInvisibleHover,i.hideValues),this._selected.subscribe(this._updateTitleMaxWidth.bind(this)),i.withActions&&(this._wheelClickHandler=this._onWheelClicked.bind(this),null!==this._titlesWrapperEl&&this._titlesWrapperEl.addEventListener($,this._wheelClickHandler))
;const s=e.symbolLogoViewModel().value();this._updateSymbolLogoRenderer(s),e.symbolLogoViewModel().subscribe(this._updateSymbolLogoRenderer)}destroy(){var e;this._model.symbolLogoViewModel().unsubscribe(this._updateSymbolLogoRenderer),null===(e=this._symbolLogoRenderer)||void 0===e||e.destroy(),this._has5Buttons.destroy(),this._globalRowVisibility&&this._globalRowVisibility.destroy(),null!==this._wheelClickHandler&&null!==this._titlesWrapperEl&&this._titlesWrapperEl.removeEventListener($,this._wheelClickHandler),super.destroy()}accessibleButtons(){return this._globalRowVisibility.value()?super.accessibleButtons():[]}_updateActionsVisibilitiesByMode(){const e=this._model.actions(),t=[];let i=[];if(2===this._rowMode||1===this._rowMode)e[0].visible.value()&&t.push(this._actionElements[0]),e[this._actionElements.length-1].visible.value()&&t.push(this._actionElements[this._actionElements.length-1]),i=this._actionElements.slice(1,this._actionElements.length-1);else for(let i=0;i<this._actionElements.length-1;i++)e[i].visible.value()&&t.push(this._actionElements[i]);i.forEach((e=>e.classList.toggle(V.blockHidden,!0))),t.forEach((e=>e.classList.toggle(V.blockHidden,!1)))}_updateShowLine(){if(null===this._el||!this._canUpdateRowVisibility)return;const e=!this._globalRowVisibility.value();e?this._el.classList.toggle(V.blockHidden,e):super._updateShowLine()}_getButtonsCount(){switch(this._rowMode){case 4:return this._has5Buttons.value()?5:4;case 3:return 3;default:return 2}}_render(){super._render();const e=(0,o.ensureNotNull)(this._el);e.classList.add(A.item,A.study),e.dataset.name="legend-source-item",e.dataset.entityId=this._model.getSource().id(),e.setAttribute("role","toolbar")}_createTitlesSpawns(){const e=this._model.titles(),t=this._model.titleActions();this._titlesSpawns=[{...t.title,title:e.title.spawn(),class:A.mainTitle,titleId:"legend-source-title"},{...t.args,title:e.args.spawn(),class:A.descTitle,titleId:"legend-source-description"}]}_renderValues(){const e=this._initWrappersIfNotInitialized(),t=this._values.value();for(const i of t){const t=document.createElement("div");t.classList.add(A.valueItem),t.classList.toggle(V.blockHidden,!i.visible.value());const s=document.createElement("div");s.classList.add(A.valueValue),s.style.color=i.color.value()||"",s.appendChild(document.createTextNode(i.value.value()));const l=i.title.value();void 0!==l&&(s.classList.add("apply-common-tooltip"),s.title=l),t.appendChild(s),this._valuesElements.push({value:s}),e.appendChild(t)}}_updateValuesTitleHTMLElHandler(e,t=""){const i=(0,o.ensure)(this._valuesElements[e].value);i.classList.toggle("apply-common-tooltip",0!==t.length),i.title=t}_update5ButtonsStyles(e){null!==this._el&&(this._el.classList.toggle(A.has5Buttons,e),this._updateAllButtonsWidth())}_onWheelClicked(e){1===e.button&&this._model.onRemoveSource()}}class Q extends I{constructor(e,t,i){super(e,t,i),this._symbolLogoRenderer=null,this._clientHeight=null,this._updateLinkedState=void 0,this._flagged=this._model.flagged().spawn(),
this._flagged.subscribe(this._updateFlaggedState.bind(this)),this._updateStates(),i.statusWidgetEl&&this._addStatusesWidget(i.statusWidgetEl,i.hideInvisibleHover,i.hideValues),this._selected.subscribe(this._updateTitleMaxWidth.bind(this));const s=e.symbolLogoViewModel().value();s&&(this._symbolLogoRenderer=new G(s,(0,o.ensureNotNull)(this._titleContainers[0])))}destroy(){var e,t;super.destroy(),null===(e=this._flagged)||void 0===e||e.destroy(),null===(t=this._symbolLogoRenderer)||void 0===t||t.destroy()}getHeight(){return null===this._el?null:(null===this._clientHeight&&(this._clientHeight=this._el.clientHeight,0===this._clientHeight&&(this._clientHeight=null)),this._clientHeight)}_updateActionsVisibilitiesByMode(){const e=[];let t=[];const i=this._model.actions();if(1===this._rowMode)i[this._actionElements.length-1].visible.value()&&e.push(this._actionElements[this._actionElements.length-1]),t=this._actionElements.slice(0,this._actionElements.length-1);else for(let t=0;t<this._actionElements.length;t++)i[t].visible.value()&&e.push(this._actionElements[t]);t.forEach((e=>e.classList.toggle(V.blockHidden,!0))),e.forEach((e=>e.classList.toggle(V.blockHidden,!1)))}_updateTitlesVisibilitiesByMode(){}_isTitleHiddenByMode(e){const t=e.titleId;return"legend-source-interval"!==t&&"legend-source-provider"!==t&&"legend-source-exchange"!==t?super._isTitleHiddenByMode(e):"legend-source-interval"===t&&this._isMultipleLayout.value()?1===this._titlesMode:3!==this._titlesMode}_hideTitleAndItsContainerIfRequired(e){const t=this._getTitleIndexByDataName(e);if(-1===t)return;const i=this._titlesSpawns[t],s=this._titleContainers[t],l=this._titleElements[t],o=0===i.title.value().length||this._isTitleHiddenByMode(i);null==s||s.classList.toggle(V.blockHidden,o),null==l||l.classList.toggle(V.blockHidden,o)}_getButtonsCount(){return 1===this._rowMode?1:3}_render(){super._render();const e=(0,o.ensureNotNull)(this._el);e.classList.add(A.item,A.series),e.classList.toggle(A.onlyOneButtonCanBeStick,this._model.isOneButtonCanBeStick()),e.dataset.name="legend-series-item",e.setAttribute("role","toolbar")}_updateStates(){super._updateStates(),this._updateFlaggedState()}_renderValues(){const e=this._initWrappersIfNotInitialized(),t=this._values.value();for(const i of t){const t=document.createElement("div");t.classList.add(A.valueItem),t.classList.toggle(V.blockHidden,!i.visible.value()),t.classList.toggle(A.unimportant,i.unimportant.value());const s=document.createElement("div"),l=i.title.value()||"";s.classList.add(A.valueTitle),s.classList.toggle(V.blockHidden,0===l.length),s.appendChild(document.createTextNode(l)),t.appendChild(s);const o=document.createElement("div");o.classList.add(A.valueValue),o.style.color=i.color.value()||"",o.appendChild(document.createTextNode(i.value.value())),t.appendChild(o),this._valuesElements.push({title:s,value:o}),e.appendChild(t)}}_createTitlesSpawns(){const e=this._model.titles(),t=this._model.titleActions();this._titlesSpawns=[{...t.title,title:e.title.spawn(),class:A.mainTitle,titleId:"legend-source-title"},{
@@ -25,7 +25,7 @@ this._collapsedDataSourcesEl.setAttribute("title",this._options.collapsedDataSou
e.focus())}}}_addMainDataSource(e,t){this._renderMainDataSourceEl(),this._mainDataSourceRenderer=new Q(e,(0,o.ensureNotNull)(this._mainDataSourceEl),{withActions:this._options.withActions,customTextColor:this._options.customTextColor,statusWidgetEl:t.getElement(),hideInvisibleHover:t.visibility(),hideValues:t.errorWidgetIsShown,isMultipleLayout:this._options.isMultipleLayout}),this._updateLegendVisibility()}_addDataSource(e,t,i){const s=(0,o.ensureNotNull)(this._dataSourcesAdditionalWrapperEl),l=new Z(e,s,{withActions:this._options.withActions,customTextColor:this._options.customTextColor,statusWidgetEl:t.getElement(),hideInvisibleHover:t.visibility(),hideValues:t.errorWidgetIsShown,isMultipleLayout:this._options.isMultipleLayout}),a=(0,o.ensureNotNull)(l.getElement());if(null!==a){let e=this._dataSourceRenderers[i];void 0!==e?s.insertBefore(a,e.getElement()):(e=this._dataSourceRenderers[i-1],void 0!==e&&s.insertBefore(a,(0,o.ensureNotNull)(e.getElement()).nextSibling))}this._dataSourceRenderers.splice(i,0,l),this._updateLegendVisibility()}_moveDataSource(e,t){const i=this._dataSourceRenderers.indexOf(e);if(-1===i||t===i)return;const s=(0,o.ensureNotNull)(this._dataSourcesAdditionalWrapperEl),l=(0,o.ensureNotNull)(e.getElement());let a=this._dataSourceRenderers[t];void 0!==a?s.insertBefore(l,a.getElement()):(a=this._dataSourceRenderers[t-1],void 0!==a&&s.insertBefore(l,(0,o.ensureNotNull)(a.getElement()).nextSibling)),this._dataSourceRenderers.splice(i,1),this._dataSourceRenderers.splice(t,0,e)}_onKeyboardNavigationActivation(){re._wasKeyboardNavigationActivated=!0,this._togglerOptions.isDataSourcesCollapsed.unsubscribe(this._onIsDataSourcesCollapsedBound),this._togglerOptions.isDataSourcesCollapsed.subscribe(this._onIsDataSourcesCollapsedBound);const e=this._getAllAccessibleButtons(),t=e.filter((e=>e.tabIndex>=0));if(0===t.length){const[t]=e.filter((e=>e.hasAttribute("tabIndex")));if(void 0===t)return;const i=this._getRowRendererByChild(t);if(null===i)return;this._makeRowElementTheMainOne(t,i)}if(t.length>1){const[,...e]=t;for(const t of e)(0,g.becomeSecondaryElement)(t)}}_handleKeyDown(e){if(e.defaultPrevented)return;const t=(0,u.hashFromEvent)(e);if(!ne.includes(t))return;const i=document.activeElement;if(!(i instanceof HTMLButtonElement))return;const s=this._getRowRendererByChild(i);if(null===s)return;if(27===t||9===t)return void(27===t?i.blur():window.dispatchEvent(new CustomEvent("keyboard-navigation-activation",{bubbles:!0})));const l=s.accessibleButtons(),o=l.indexOf(i);if(0===l.length||-1===o)return;const a=t=>{e.preventDefault();const i=this._getRowRenderers(),l=i.indexOf(s);let o,a,n="blockNext"===t?l+1:l-1;for(;n>=0&&n<i.length;){const e=i[n],s=e.accessibleButtons();if(0!==s.length){o=e,a=s;break}n="blockNext"===t?n+1:n-1}o&&a&&this._changeFocusElement(a[0],o)},n=(0,m.mapKeyCodeToDirection)(t);switch(n){case"inlinePrev":e.preventDefault(),this._changeFocusElement(0!==o?l[o-1]:l[l.length-1],s);break;case"inlineNext":e.preventDefault(),this._changeFocusElement(o!==l.length-1?l[o+1]:l[0],s);break
;case"blockPrev":case"blockNext":a(n)}}_subscribeElementToFocusEvents(e,t){this._focusEventAbortController=new AbortController,e.addEventListener("focusin",(()=>{this._focusEventAbortController=new AbortController,e.addEventListener("focusout",(i=>{const s=i.relatedTarget;null!==s&&s instanceof HTMLButtonElement&&t.accessibleButtons().includes(s)||(this._subscribeElementToFocusEvents(e,t),t instanceof oe||t.hideActions())}),{once:!0,signal:this._focusEventAbortController.signal}),this._options.onLegendRowFocused(),t instanceof oe||t.showActions()}),{once:!0,signal:this._focusEventAbortController.signal})}_makeRowElementTheMainOne(e,t){this._subscribeElementToFocusEvents(e,t),(0,g.becomeMainElement)(e)}_changeFocusElement(e,t){document.activeElement&&(0,g.becomeSecondaryElement)(document.activeElement),this._makeRowElementTheMainOne(e,t),e.focus()}_getRowRenderers(){let e=[];return this._mainDataSourceRenderer&&e.push(this._mainDataSourceRenderer),this._dataSourcesEl&&!this._dataSourcesEl.classList.contains(V.blockHidden)&&(this._togglerOptions.isDataSourcesCollapsed.value()&&1!==this._mode&&(e=e.concat(this._dataSourceRenderers)),this._renderToggler&&0!==this._dataSourceRenderers.length&&e.push(this._renderToggler)),e}_getAllAccessibleButtons(){const e=[];return this._getRowRenderers().forEach((t=>{e.push(...t.accessibleButtons())})),e}_getRowRendererByChild(e){var t;return null!==(t=this._getRowRenderers().find((t=>t.accessibleButtons().includes(e))))&&void 0!==t?t:null}}re._wasKeyboardNavigationActivated=!1;var de,ue=i(86129),he=i(99531),ce=i(42752),_e=i(86235),pe=i(58473),ge=i(76460),me=i(19063),ve=i(45126),be=i(63273),we=i(88960),Se=i(19466);function ye(e){return void 0!==e?me.resetTransparency(e):e}function Me(e){return e.hasOwnProperty("touches")}!function(e){e.Small="small",e.Large="large"}(de||(de={}));const Ce=new ve.TranslatedString("show {title}",X.t(null,void 0,i(51382))),fe=new ve.TranslatedString("hide {title}",X.t(null,void 0,i(13017))),Ee=X.t(null,void 0,i(98334)),Ve=X.t(null,void 0,i(27298));class Le{constructor(e,t,i,s,l){this._values=new n.WatchedValue([]),this._actions=[],this._loading=new n.WatchedValue(!1),this._symbolLogoViewModel=new n.WatchedValue(null),this._destroyed=!1,this._moreActionCM=null,this._updateLoadingStatus=()=>{this._loading.setValue(this._source.isLoading())},this._model=e,this._source=t,this._options=i,this._callbacks=s,this._contextMenuOptions=l,this._disabled=new n.WatchedValue(this._getDisabledState()),this._disabledOnInterval=new n.WatchedValue(this._getDisabledOnIntervalState()),this._selected=new n.WatchedValue(!1),this._isTitleHidden=new n.WatchedValue(this._getTitleHiddenValue()),this._isValuesHidden=new n.WatchedValue(this._getValuesHiddenValue()),this._isRowHidden=new n.WatchedValue(this._getRowHiddenValue()),this._isEditable=new n.WatchedValue(this._getIsEditable()),(0,we.combine)((()=>({})),this._isTitleHidden.weakReference(),this._isValuesHidden.weakReference(),this._disabled.weakReference()).subscribe(this._updateRowVisibilities.bind(this)),
this._values.subscribe((()=>{this._isValuesHidden.setValue(this._getValuesHiddenValue())}))}destroy(){var e;null===(e=this._symbolLogoViewModel.value())||void 0===e||e.destroy(),this._destroyed=!0}titles(){return this._titles}titleActions(){return this._titleActions}values(){return this._values.readonly()}actions(){return this._actions}disabled(){return this._disabled.readonly()}disabledOnInterval(){return this._disabledOnInterval.readonly()}selected(){return this._selected.readonly()}loading(){return this._loading.readonly()}isTitleHidden(){return this._isTitleHidden.readonly()}isValuesHidden(){return this._isValuesHidden.readonly()}isRowHidden(){return this._isRowHidden.readonly()}isEditable(){return this._isEditable.readonly()}symbolLogoViewModel(){return this._symbolLogoViewModel}update(){var e,t;this._updateTitles(),this._updateValues(),this._updateStates(),null===(t=null===(e=this.symbolLogoViewModel())||void 0===e?void 0:e.value())||void 0===t||t.update()}onToggleDisabled(){const e=this._source.properties().childs().visible,t=!e.value();this._model.setProperty(e,t,(t?Ce:fe).format({title:new ve.TranslatedString(this._source.name(),this._source.title(Se.TitleDisplayTarget.StatusLine))})),J((t?"Show":"Hide")+" source")}onShowSettings(e){this._source.userEditEnabled()&&(this.setSourceSelected(),this._callbacks.showChartPropertiesForSource(this._source,e),J("Settings for source"))}onShowMoreActions(e){return this._options.readOnlyMode?Promise.resolve(null):(this._callbacks.updateActions(),J("Show source context menu"),this._callbacks.showContextMenuForSources([this._source],this._calcNewPosition(e),{...this._contextMenuOptions,isKeyboardEvent:!Me(e)&&(0,ge.isKeyboardClick)(e)},{origin:"LegendPropertiesContextMenu"}))}setSourceSelected(){this._model.selectionMacro((e=>{e.clearSelection(),e.addSourceToSelection(this._source)}))}_moreActionHandler(e){e.preventDefault(),null!==this._moreActionCM&&this._moreActionCM.isShown()?this._moreActionCM=null:(this.setSourceSelected(),this.onShowMoreActions(e).then((e=>{this._moreActionCM=e})))}_updateStates(){this._disabled.setValue(this._getDisabledState()),this._disabledOnInterval.setValue(this._getDisabledOnIntervalState()),this._selected.setValue(this._model.selection().isSelected(this._source)),this._isEditable.setValue(this._getIsEditable()),this._updateLoadingStatus()}_hasValues(){return this._values.value().length>0}_getEyeTitle(){return this._disabled.value()?Ee:Ve}_getIsEditable(){return this._source.userEditEnabled()}_getDisabledState(){return!this._source.properties().visible.value()}_updateRowVisibilities(){this._isRowHidden.setValue(this._getRowHiddenValue())}_getRowHiddenValue(){return this._options.readOnlyMode&&this._disabled.value()||this._isTitleHidden.value()&&(this._isValuesHidden.value()||this._disabled.value())}_calcNewPosition(e){let t={};if(Me(e)&&e.touches.length>0)t={clientX:e.touches[0].clientX,clientY:e.touches[0].clientY};else if(null!==e.target){const i=e.target.getBoundingClientRect();t={clientX:(0,be.isRtl)()?i.right:i.left,
clientY:i.top+i.height+3}}else{const i=e;t={clientX:i.clientX,clientY:i.clientY}}return t}}var xe=i(618),We=i(36279),Ae=i(12184),ke=i(5201);const Te=c.enabled("show_symbol_logos")&&c.enabled("show_symbol_logo_in_legend"),He=new ke.CircularCacheBuffer(100);class Be{constructor(e,t){this._symbolLogoUrls=new n.WatchedValue([]),this._quoteDataForLogos=null,this._logoDataUpdated=()=>{var e;const t=this.symbol(),i=this._logoData.value();i&&t&&He.set(t,i);const s=He.get(t);this._quoteDataForLogos=(0,r.merge)(null!=s?s:{},null!==(e=this._logoData.value())&&void 0!==e?e:{}),this._symbolLogoUrls.setValue((0,xe.removeUsdFromCryptoPairLogos)((0,xe.resolveLogoUrls)(this._quoteDataForLogos,We.LogoSize.Medium)))},this._logoModel=e,this._isLogoVisible=(0,Ae.createWVFromGetterAndSubscription)((()=>t.showLogo.value()),t.showLogo),this._logoData=this._logoModel.logoData().spawn(),this._logoData.subscribe(this._logoDataUpdated,{callWithLast:!0})}destroy(){this._isLogoVisible.destroy(),this._logoModel.destroy()}isSymbolLogoVisible(){return this._isLogoVisible}symbolLogoUrls(){return this._symbolLogoUrls}symbol(){return this._logoModel.symbol()}update(){this._logoModel.update()}}function Ie(e,t){return Te?new Be(e,t):null}var De=i(26023);const Pe=(0,i(12168).getLogger)("Chart.LegendWidget");function ze(e){const t={};for(const i of["logoid","currency-logoid","base-currency-logoid"])if(i in e){const s=i;t[s]=e[s]}return t}class Ne{constructor(e){this._logoData=new n.WatchedValue(null),this._prevSymbol="",this._source=e,this._source.symbolResolved().subscribe(this,this._onSourceSymbolResolved),this.update()}destroy(){this._source.symbolResolved().unsubscribeAll(this)}symbol(){return this._source.symbol()}logoData(){return this._logoData}update(){const e=this.symbol();this._prevSymbol!==e&&(this._prevSymbol=e,this._onSourceSymbolResolved())}_onQuoteSymbolDataUpdated(e,t){const i=t.values;!this._source.symbolSameAsCurrent(e.values.pro_name)||void 0===i.logoid&&void 0===i["currency-logoid"]&&void 0===i["base-currency-logoid"]||this._logoData.setValue(ze(i))}async _onSourceSymbolChange(){const e=this.symbol();let t=null;try{this._logoData.setValue(null),t=await this._source.quotesProvider().quotesSnapshot(e)}catch(e){Pe.logError(`Quote snapshot error: ${e}`)}finally{this.symbol()===e&&(null===t?this._logoData.setValue(null,!0):this._logoData.setValue(ze(t)))}}_onSourceSymbolResolved(){{const e=this._source.symbolInfo(),t=(null==e?void 0:e.logo_urls)||[];if(1===t.length)return void this._logoData.setValue({logoid:t[0]});if(2===t.length)return void this._logoData.setValue({"currency-logoid":t[0],"base-currency-logoid":t[1]});this._logoData.setValue(null,!0)}}}var Re=i(54336),Oe=i(41674),Fe=i(87258),Ue=i(45534);const Ge=X.t(null,void 0,i(37117)),je=X.t(null,void 0,i(44454)),Ke=X.t(null,void 0,i(13865)),$e=X.t(null,void 0,i(63245)),Ze=X.t(null,void 0,i(29151)),Qe=X.t(null,void 0,i(2569)),Xe=c.enabled("legend_inplace_edit"),qe=c.enabled("show_hide_button_in_legend"),Je=c.enabled("hide_resolution_in_legend");class Ye extends Le{constructor(e,t,i,s,l){
clientY:i.top+i.height+3}}else{const i=e;t={clientX:i.clientX,clientY:i.clientY}}return t}}var xe=i(618),We=i(36279),Ae=i(12184),ke=i(5201);const Te=c.enabled("show_symbol_logos")&&c.enabled("show_symbol_logo_in_legend"),He=new ke.CircularCacheBuffer(100);class Be{constructor(e,t){this._symbolLogoUrls=new n.WatchedValue([]),this._quoteDataForLogos=null,this._logoDataUpdated=()=>{var e;const t=this.symbol(),i=this._logoData.value();i&&t&&He.set(t,i);const s=He.get(t);this._quoteDataForLogos=(0,r.merge)(null!=s?s:{},null!==(e=this._logoData.value())&&void 0!==e?e:{}),this._symbolLogoUrls.setValue((0,xe.removeUsdFromCryptoPairLogos)((0,xe.resolveLogoUrls)(this._quoteDataForLogos,We.LogoSize.Medium)))},this._logoModel=e,this._isLogoVisible=(0,Ae.createWVFromGetterAndSubscription)((()=>t.showLogo.value()),t.showLogo),this._logoData=this._logoModel.logoData().spawn(),this._logoData.subscribe(this._logoDataUpdated,{callWithLast:!0})}destroy(){this._isLogoVisible.destroy(),this._logoModel.destroy()}isSymbolLogoVisible(){return this._isLogoVisible}symbolLogoUrls(){return this._symbolLogoUrls}symbol(){return this._logoModel.symbol()}update(){this._logoModel.update()}}function Ie(e,t){return Te?new Be(e,t):null}var De=i(26023);const Pe=(0,i(12168).getLogger)("Chart.LegendWidget");function ze(e){const t={};for(const i of["logoid","currency-logoid","base-currency-logoid"])if(i in e){const s=i;t[s]=e[s]}return t}class Ne{constructor(e){this._logoData=new n.WatchedValue(null),this._prevSymbol="",this._source=e,this._source.symbolResolved().subscribe(this,this._onSourceSymbolResolved),this.update()}destroy(){this._source.symbolResolved().unsubscribeAll(this)}symbol(){return this._source.symbol()}logoData(){return this._logoData}update(){const e=this.symbol();this._prevSymbol!==e&&(this._prevSymbol=e,this._onSourceSymbolResolved())}_onQuoteSymbolDataUpdated(e,t){const i=t.values;!this._source.symbolSameAsCurrent(e.values.pro_name)||void 0===i.logoid&&void 0===i["currency-logoid"]&&void 0===i["base-currency-logoid"]||this._logoData.setValue(ze(i))}async _onSourceSymbolChange(){const e=this.symbol();let t=null;try{this._logoData.setValue(null),t=await this._source.quotesProvider().quotesSnapshot(e)}catch(e){Pe.logError(`Quote snapshot error: ${e}`)}finally{this.symbol()===e&&(null===t?this._logoData.setValue(null,!0):this._logoData.setValue(ze(t)))}}_onSourceSymbolResolved(){{const e=this._source.symbolInfo(),t=(null==e?void 0:e.logo_urls)||[];if(1===t.length)return void this._logoData.setValue({logoid:t[0]});if(2===t.length)return void this._logoData.setValue({"base-currency-logoid":t[0],"currency-logoid":t[1]});this._logoData.setValue(null,!0)}}}var Re=i(54336),Oe=i(41674),Fe=i(87258),Ue=i(45534);const Ge=X.t(null,void 0,i(37117)),je=X.t(null,void 0,i(44454)),Ke=X.t(null,void 0,i(13865)),$e=X.t(null,void 0,i(63245)),Ze=X.t(null,void 0,i(29151)),Qe=X.t(null,void 0,i(2569)),Xe=c.enabled("legend_inplace_edit"),qe=c.enabled("show_hide_button_in_legend"),Je=c.enabled("hide_resolution_in_legend");class Ye extends Le{constructor(e,t,i,s,l){
super(e,t,i,s,l),this._titles={title:new n.WatchedValue(""),description:new n.WatchedValue(""),interval:new n.WatchedValue(""),provider:new n.WatchedValue(""),exchange:new n.WatchedValue(""),chartStyle:new n.WatchedValue(""),priceSource:new n.WatchedValue("")},this._titleActions={title:void 0,description:void 0,interval:void 0,provider:void 0,exchange:void 0,chartStyle:void 0,priceSource:void 0},this._symbolMarker=null,this._symbolMarkerIcon=null,this._flagged=new n.WatchedValue(null),this._symbolAction=null,this._symbolForMarker=null,this._isOneButtonCanBeStick=!1,this._layoutChartSyncLegendRenderer=null,this._isChartLinked=new n.WatchedValue(!1).readonly().spawn(),this._initializeTitleActions(),this._createActions(),this._updateSymbolMarker();const o=this._model.model().properties().childs().paneProperties.childs().legendProperties.childs();this._symbolLogoViewModel.setValue(Ie(new Ne(t),o)),o.showSeriesTitle.subscribe(this,(()=>{this._isTitleHidden.setValue(this._getTitleHiddenValue())})),this._isPriceSourceHidden=(0,he.createWVFromGetterAndSubscription)((()=>!o.showPriceSource.value()),o.showPriceSource),this._valuesVisibleProperty=(0,he.combineProperty)(((e,t,i,s)=>e||t||i||s),o.showSeriesOHLC.weakReference(),o.showBarChange.weakReference(),o.showVolume.weakReference(),o.showLastDayChange.weakReference()),this._valuesVisibleProperty.subscribe(null,(()=>{this._isValuesHidden.setValue(this._getValuesHiddenValue())})),this.update(),this._source.statusWV().subscribe(this._updateLoadingStatus)}destroy(){super.destroy(),this._model.model().properties().childs().paneProperties.childs().legendProperties.childs().showSeriesTitle.unsubscribeAll(this),this._source.statusWV().unsubscribe(this._updateLoadingStatus),this._valuesVisibleProperty.destroy(),this._isPriceSourceHidden.destroy()}flagged(){return this._flagged}linked(){return this._isChartLinked}onShowSettings(){this._source.userEditEnabled()&&this._callbacks.showGeneralChartProperties(De.TabNames.symbol)}isOneButtonCanBeStick(){return this._isOneButtonCanBeStick}_updateTitles(){const e=(0,o.ensureNotNull)(this._source.statusView()).getSplitTitle();this._titles.title.setValue((0,ue.clean)(e.title,!0)),this._titles.description.setValue((0,ue.clean)(e.description,!0)),Je||this._titles.interval.setValue((0,ue.clean)(e.interval,!0)),this._titles.provider.setValue((0,ue.clean)(e.provider,!0)),this._titles.exchange.setValue((0,ue.clean)(e.exchange,!0)),this._titles.chartStyle.setValue((0,ue.clean)(e.chartStyle,!0)),this._titles.priceSource.setValue((0,ue.clean)(this._isPriceSourceHidden.value()?"":e.priceSource,!0))}_updateValues(){const e=this._source.legendView(),t=this._values.value(),i=e.marketTitle(),s=e.marketTitle().length>0,l=e.items();if(0===t.length||t.length!==l.length+1){const e={value:new n.WatchedValue(""),color:new n.WatchedValue(""),visible:new n.WatchedValue(s),title:new n.WatchedValue(i),unimportant:new n.WatchedValue(!1)},t=l.map((e=>({value:new n.WatchedValue(e.value()),color:new n.WatchedValue(ye(e.color())),visible:new n.WatchedValue(e.visible()),
title:new n.WatchedValue(e.title()),unimportant:new n.WatchedValue(e.unimportant())})));this._values.setValue([e].concat(t))}else{t[0].title.setValue(i),t[0].visible.setValue(s);for(let e=0;e<l.length;e++){const i=l[e];t[e+1].value.setValue(i.value()),t[e+1].color.setValue(ye(i.color())),t[e+1].visible.setValue(i.visible()),t[e+1].title.setValue(i.title())}}}_updateStates(){super._updateStates(),this._updateSymbolMarker()}_getDisabledOnIntervalState(){return!1}_getTitleHiddenValue(){return!this._model.model().properties().childs().paneProperties.childs().legendProperties.childs().showSeriesTitle.value()}_getValuesHiddenValue(){return!this._hasValues()||!this._valuesVisibleProperty.value()}_initializeTitleActions(){if(!Xe)return;const e=()=>{const e=this._model.mainSeries(),t=e.symbol(),i=e.properties().childs().shortName.value();(0,pe.showDialog)({defaultValue:e.isSpread()?t:i||t||""})};c.enabled("disable_legend_inplace_symbol_change")||(this._titleActions.title={onClick:e,tooltip:$e},this._titleActions.description={onClick:e,tooltip:Ze}),this._titleActions.interval={onClick:()=>{(0,_e.showChangeIntervalDialogAsync)({initVal:this._model.mainSeries().interval(),selectOnInit:!0})},tooltip:Qe}}_createActions(){if(qe){const e=(0,ce.convertPropertyToWatchedValue)((0,he.combineProperty)((e=>!e),this._source.properties().childs().visible.weakReference())),t={iconMap:new Map([["large",Oe],["small",Re]]),action:(0,M.wrapHandlerWithPreventEvent)(this.onToggleDisabled.bind(this)),visible:e,className:A.eye,title:new n.WatchedValue(this._getEyeTitle()),dataset:{name:"legend-show-hide-action"}};this._actions.push(t),this._disabled.subscribe((()=>{var e;null===(e=t.title)||void 0===e||e.setValue(this._getEyeTitle())}))}this._actions.push({iconMap:new Map([["large",Ue],["small",Fe]]),action:this._moreActionHandler.bind(this),visible:new n.WatchedValue(!0),title:new n.WatchedValue(Ge),dataset:{name:"legend-more-action"}})}_getMarkerTitle(){return null!==this._symbolMarker?this._symbolMarker.isMarked()?Ke:je:""}_symbolActionHandler(e){(0,M.preventDefault)(e),null!==this._symbolMarker&&(this._updateSymbolMarker(),e instanceof KeyboardEvent&&this._symbolMarker.toggle(e),J("Change flag state"))}_updateSymbolMarker(){this._isOneButtonCanBeStick=!0}}var et=i(72708),tt=i(3615);var it=i(28388),st=i(60074),lt=i(50340),ot=i(94664),at=i(31955),nt=i(83637),rt=i(34882),dt=i(30556),ut=i(91104);(0,at.getLogger)("Chart.LegendWidget");const ht=X.t(null,void 0,i(32514)),ct=X.t(null,void 0,i(87142)),_t=X.t(null,void 0,i(67410)),pt=X.t(null,void 0,i(37117)),gt=(X.t(null,void 0,i(57335)),X.t(null,void 0,i(43206)),X.t(null,void 0,i(74759))),mt=X.t(null,void 0,i(63245)),vt=(c.enabled("study_buttons_in_legend"),c.enabled("show_hide_button_in_legend")),bt=c.enabled("property_pages"),wt=c.enabled("format_button_in_legend"),St=c.enabled("delete_button_in_legend"),yt=c.enabled("legend_inplace_edit");class Mt extends Le{constructor(e,t,i,s,l){super(e,t,i,s,l),this._titles={title:new n.WatchedValue(""),args:new n.WatchedValue("")},this._titleActions={
title:void 0,args:void 0},this._error=new n.WatchedValue(!1),this._isAbleShowSourceCode=new n.WatchedValue(!1),this._isAbleShowSourceCodeInner=new n.WatchedValue(!1).spawn(),this._pineAction=null,this._globalVisibility=new n.WatchedValue(!0),this._updateSymbolLogoModel(),this._initializeTitleActions(),this._createActions();const o=this._model.model().properties().childs().paneProperties.childs().legendProperties.childs(),a=[o.showSeriesTitle,o.showStudyTitles];for(const e of a)e.subscribe(this,(()=>{this._isTitleHidden.setValue(this._getTitleHiddenValue())}));const r=[o.showSeriesOHLC,o.showBarChange,o.showStudyValues,o.showLastDayChange];for(const e of r)e.subscribe(this,(()=>{this._isValuesHidden.setValue(this._getValuesHiddenValue())}));this.update()}destroy(){super.destroy();const e=this._model.model().properties().childs().paneProperties.childs().legendProperties.childs();e.showSeriesTitle.unsubscribeAll(this),e.showStudyTitles.unsubscribeAll(this),e.showSeriesOHLC.unsubscribeAll(this),e.showBarChange.unsubscribeAll(this),e.showStudyValues.unsubscribeAll(this),e.showLastDayChange.unsubscribeAll(this),this._isAbleShowSourceCodeInner.destroy()}error(){return this._error.readonly()}isAbleShowSourceCode(){return this._isAbleShowSourceCode}onRemoveSource(){var e;this._source.isUserDeletable()&&(this._source.hasChildren()?(e=this._model.removeSource.bind(this._model,this._source,!1),(0,tt.showConfirm)({title:X.t(null,void 0,i(81605)),text:X.t(null,void 0,i(77174)),onConfirm:({dialogClose:t})=>{e(),t()}})):this._model.removeSource(this._source,!1),J("Remove sources"))}async onShowSourceCode(){}setGlobalVisibility(e){this._globalVisibility.setValue(e)}globalVisibility(){return this._globalVisibility.readonly()}getFullTitle(){return[this._titles.title,this._titles.args].map((e=>e.value())).join(" ")}getSource(){return this._source}_updateTitles(){const e=(0,o.ensureNotNull)(this._source.statusView()).getSplitTitle();this._titles.title.setValue((0,ue.clean)(e[0],!0));const t=Array.isArray(e[1])?e[1].join(" "):e[1]||"";this._titles.args.setValue((0,ue.clean)(t,!0))}_updateValues(){const e=this._source.legendView();if(null===e)return;if(0===e.items().length)return;const t=this._values.value();if(0===t.length){const t=e.items().map((e=>({value:new n.WatchedValue(e.value()),color:new n.WatchedValue(ye(e.color())),visible:new n.WatchedValue(e.visible()),unimportant:new n.WatchedValue(e.unimportant()),title:new n.WatchedValue(e.title())})));this._values.setValue(t)}else{const i=e.items();for(let e=0;e<i.length;e++){const s=t[e],l=i[e];s.value.setValue(l.value()),s.color.setValue(ye(l.color())),s.visible.setValue(l.visible()),s.title.setValue(l.title())}}}_updateStates(){super._updateStates(),void 0!==this._error&&this._error.setValue(Boolean(this._source.isFailed()))}_getTitleHiddenValue(){const e=this._model.model().properties().childs().paneProperties.childs().legendProperties.childs();return this._isSymbolLikeStudy()?!e.showSeriesTitle.value():!e.showStudyTitles.value()}_getDisabledOnIntervalState(){return!(!(0,

Some files were not shown because too many files have changed in this diff Show More