(self.webpackChunktradingview=self.webpackChunktradingview||[]).push([[9380],{304986:(e,t,n)=>{"use strict";n.d(t,{getThemeFromUserSettings:()=>a,saveThemeInUserSettings:()=>r});var o=n(62802),i=n(278855);function a(){return(0,i.getThemeFromCookie)()||(0,o.getValue)("current_theme.name")||null}function r(e){(0,i.setThemeToCookie)(e),(0,o.setValue)("current_theme.name",e,{forceFlush:!0})}},429874:(e,t,n)=>{"use strict";n.r(t),n.d(t,{DEFAULT_THEME:()=>c.DEFAULT_THEME,extractThemeFromModel:()=>N,getCurrentTheme:()=>h,getStdTheme:()=>f,getStdThemeNames:()=>y,getStdThemedValue:()=>A,getTheme:()=>b,getThemeNames:()=>w,getThemedColor:()=>p,isPublicTheme:()=>u,isStdTheme:()=>M,isStdThemeName:()=>T,isStdThemedDefaultValue:()=>C,isThemeExist:()=>W,loadTheme:()=>g,removeTheme:()=>I,restoreTheme:()=>m,saveTheme:()=>_,savedThemeName:()=>S,syncTheme:()=>v,themes:()=>d.themes,translateStdThemeName:()=>P});var o=n(724377),i=n(42292),a=n(304986);const r=n(787703);var l=n(86746),s=n(331633),c=n(484400),d=n(514811);function u(e){return!e.isPrivate}function h(){return d.themes[s.watchedTheme.value()]||d.themes[c.DEFAULT_THEME]}function p(e){return h().getThemedColor(e)}async function g(e,t){const{themeName:n,standardTheme:o,syncState:a=!0,noUndo:r=!1,applyOverrides:l=!1,onlyActiveChart:s=!1}=t,c=await(o?Promise.resolve(f(n)):b(n)),d=!o;if(void 0!==c.content){const t=!o||s;l&&(void 0!==(u=c.content).chartProperties&&(0,i.applyDefaultsOverrides)(u.chartProperties),void 0!==u.mainSourceProperties&&(0,i.applyDefaultsOverrides)(u.mainSourceProperties,void 0,!0,"mainSeriesProperties")),await e.applyTheme({theme:c.content,onlyActiveChart:t,restoreNonThemeDefaults:d,themeName:n,standardTheme:o,syncState:a,noUndo:r})}var u;return c}function m(){(0,s.setTheme)((0,a.getThemeFromUserSettings)()||c.DEFAULT_THEME)}function S(){return(0,a.getThemeFromUserSettings)()}function v(){(0,a.saveThemeInUserSettings)(h().name)}function b(e){return r.loadTheme(e)}function w(){return r.loadThemes()}function y(){return l.getStdThemeNames()}function T(e){return y().includes(e)}function f(e){return l.getStdChartTheme(e)||{content:void 0}}function A(e,t){const n=t||h().name,o=l.getStdChartTheme(n),i=0!==e.length&&e.split(".");return o&&o.content&&i?i.reduce(((e,t)=>e[t]),o.content):null}function C(e,t,n){const i=A(e,n);return null!==i&&(0,o.areEqualRgba)((0,o.parseRgba)(i),(0,o.parseRgba)(String(t)))}function _(e,t){return r.saveTheme(e,t)}function I(e){return r.removeTheme(e)}function W(e){return r.isThemeExist(e)}function P(e){return l.translateThemeName(e)}function M(e){return l.isStdTheme(e)}function N(e){return{content:{chartProperties:{paneProperties:e.model().properties().childs().paneProperties.state(),scalesProperties:e.model().properties().childs().scalesProperties.state()},sessions:e.model().sessions().properties().state(),mainSourceProperties:e.model().mainSeries().properties().state(),version:e.model().version()}}}},72368:(e,t,n)=>{"use strict";n.d(t,{canShowNewSymbolSearch:()=>s,getCurrentLocaleInfoCountry:()=>c,isMobile:()=>r,isPlatformMobile:()=>l}) ;var o=n(314802),i=n(244842),a=n(638456);function r(){const e=window.matchMedia("(min-width: 602px) and (min-height: 445px)").matches;return a.CheckMobile.any()&&!e}function l(){return!(0,o.isOnMobileAppPage)("any")&&r()}function s(){return!i.enabled("widget")&&!(0,o.isOnMobileAppPage)("any")}function c(){var e,t;return null===(t=null===(e=window.initData)||void 0===e?void 0:e.currentLocaleInfo)||void 0===t?void 0:t.flag.toUpperCase()}},515828:(e,t,n)=>{"use strict";n.d(t,{MINDS_GROUP_PATH_PATTERN:()=>o,createMindsPath:()=>i});const o="/minds/groups/:symbol/";function i(e,t,n){let i=o.replace(":symbol",encodeURIComponent(e));if(!t)return i;const a=new URLSearchParams;return a.set("mind",t),n&&a.set("editable","true"),i+=`?${a.toString()}`,i}},951713:(e,t,n)=>{"use strict";n.d(t,{getHideOptions:()=>d,getSavedHideMode:()=>h,toggleHideMode:()=>u});var o=n(650151),i=n(444372),a=n(62802),r=n(439016),l=n(885482),s=n(597101);let c=null;function d(){if(null!==c)return c;const e=(0,r.tradingService)();return c=new Map([["drawings",{label:i.t(null,void 0,n(413277)),dataName:"hide-drawing-tools",tooltip:{active:i.t(null,void 0,n(998116)),inactive:i.t(null,void 0,n(895551))},getBoxedValue:()=>(0,l.hideAllDrawings)(),trackLabel:"hide drawings"}],["indicators",{label:i.t(null,void 0,n(44177)),dataName:"hide-indicators",tooltip:{active:i.t(null,void 0,n(249982)),inactive:i.t(null,void 0,n(986306))},getBoxedValue:()=>(0,l.hideAllIndicators)(),trackLabel:"hide indicators"}],["positions",{label:i.t(null,void 0,n(190540)),dataName:"hide-positions-and-orders",tooltip:{active:i.t(null,void 0,n(262632)),inactive:i.t(null,void 0,n(770803))},getBoxedValue:()=>(0,o.ensureNotNull)(e).showTradedSources,inverted:!0,trackLabel:"hide positions"}],["all",{label:i.t(null,void 0,n(133911)),dataName:"hide-all",tooltip:{active:e?i.t(null,void 0,n(538293)):i.t(null,void 0,n(839046)),inactive:e?i.t(null,void 0,n(67927)):i.t(null,void 0,n(44312))},trackLabel:"hide all"}]]),e||c.delete("positions"),c}function u(e){e?a.setValue("ChartToolsHideMode",e):e=h();const t=p();let n=!t;return"all"===e?(g(((e,t,o)=>{e.setValue(o?!n:n)})),s.hideStateChange.fire({hideMode:e,isActive:n}),n):(g(((o,i,a)=>{if(i===e){const e=t?!a:!o.value();o.setValue(e),n=a?!e:e}else o.setValue(Boolean(a))})),s.hideStateChange.fire({hideMode:e,isActive:n}),n)}function h(){const e=a.getValue("ChartToolsHideMode","drawings");return d().has(e)?e:"drawings"}function p(){let e=!0;return g(((t,n,o)=>{const i=t.value();e=e&&(o?!i:i)})),e}function g(e){d().forEach(((t,n)=>{var o;const i=null===(o=t.getBoxedValue)||void 0===o?void 0:o.call(t);i&&e(i,n,t.inverted)}))}},306388:(e,t,n)=>{"use strict";n.d(t,{initSymbolListService:()=>r});var o=n(564894),i=n(83871),a=n(244842);function r(){ return Promise.all([Promise.all([n.e(67681),n.e(1893),n.e(42381),n.e(38697),n.e(86282),n.e(47821),n.e(29218),n.e(64820),n.e(81271),n.e(90624),n.e(95348),n.e(26317),n.e(90385),n.e(33974),n.e(29594),n.e(8010),n.e(34654),n.e(62526),n.e(46576),n.e(5069),n.e(37714),n.e(1026)]).then(n.bind(n,999614)),Promise.all([n.e(67681),n.e(1893),n.e(42381),n.e(38697),n.e(86282),n.e(47821),n.e(29218),n.e(64820),n.e(81271),n.e(90624),n.e(95348),n.e(26317),n.e(90385),n.e(33974),n.e(29594),n.e(8010),n.e(34654),n.e(62526),n.e(46576),n.e(5069),n.e(37714),n.e(1026)]).then(n.bind(n,38506)),Promise.all([n.e(67681),n.e(1893),n.e(42381),n.e(38697),n.e(86282),n.e(47821),n.e(29218),n.e(64820),n.e(81271),n.e(90624),n.e(95348),n.e(26317),n.e(90385),n.e(33974),n.e(29594),n.e(8010),n.e(34654),n.e(62526),n.e(46576),n.e(5069),n.e(37714),n.e(1026)]).then(n.bind(n,850935)),Promise.all([n.e(67681),n.e(1893),n.e(42381),n.e(38697),n.e(86282),n.e(47821),n.e(29218),n.e(64820),n.e(81271),n.e(90624),n.e(95348),n.e(26317),n.e(90385),n.e(33974),n.e(29594),n.e(8010),n.e(34654),n.e(62526),n.e(46576),n.e(5069),n.e(37714),n.e(1026)]).then(n.bind(n,244692)),a.enabled("widget")?null:Promise.all([n.e(67681),n.e(1893),n.e(42381),n.e(38697),n.e(86282),n.e(47821),n.e(29218),n.e(64820),n.e(81271),n.e(90624),n.e(95348),n.e(26317),n.e(90385),n.e(33974),n.e(29594),n.e(8010),n.e(34654),n.e(62526),n.e(46576),n.e(5069),n.e(37714),n.e(1026)]).then(n.bind(n,216752))]).then((([e,t,n,a,r])=>{if((0,o.hasService)(i.SYMBOL_LIST_SERVICE))return(0,o.service)(i.SYMBOL_LIST_SERVICE);const{store:l,runner:s}=e.configureStore(),c=s.run(t.symbolListRepositorySaga);(0,o.registerService)(i.SYMBOL_LIST_SERVICE,{store:l,runner:s,actions:{addSymbols:a.addSymbolsThunk,initWidget:n.initWidget,saveListAs:a.saveListAsThunk,createNewWatchList:a.userCreateWatchlistThunk},task:c});const d=(0,o.service)(i.SYMBOL_LIST_SERVICE);return null!==r&&r.getCustomSymbolListSynchronizationServiceInstance(d),d}))}},621618:(e,t,n)=>{"use strict";n.d(t,{ActionsProvider:()=>jn,createActionCopyPrice:()=>On,createActionToggleVisibilityDataSources:()=>Bn,createActionTrade:()=>xn,createChangeIntervalsVisibilitiesAction:()=>Dn,createLinesAction:()=>Vn,createMTPredictorActions:()=>Un,createPasteAction:()=>Fn,createSyncDrawingActions:()=>Rn,createVisualOrderAction:()=>kn,defaultContextMenuOptions:()=>En}) ;var o=n(650151),i=n(201089),a=n(960521),r=n(389137),l=n(444372),s=n(244842),c=n(373571),d=n(175070),u=n(982217),h=n(343224),p=n(794349),g=n(461794),m=n(345848),S=n(939243),v=n(651065),b=n(772466),w=n(827710),y=n(439016),T=n(406849),f=n(454984),A=n(778737),C=n(674053),_=n(516684),I=n(520533),W=n(922850),P=n(985139),M=n(346825),N=n(709081),E=n(711496),L=n(834075),x=n(125226),F=n(526075),k=n(860037),D=n(500521),O=n(263955),U=n(921692),V=n(184586),R=n(314802),B=n(638456),H=n(453817),j=n(811630),G=n(470316),Y=n(104436),q=n(7195),z=n(943855),$=n(519073),J=n(27005),K=n(568247),Z=n(356893),Q=n(713473),X=n(981107),ee=n(167975),te=n(809796),ne=n(885482),oe=n(223699),ie=n(506312),ae=n(440941),re=n(395098),le=n(793993),se=n(62745),ce=n(354950),de=n(447285),ue=n(547871),he=n(971417),pe=n(747971);const ge=(0,i.getLogger)("Chart.ActionsProvider"),me=new te.TranslatedString("change visibility",l.t(null,void 0,n(521511))),Se=new te.TranslatedString("pin to scale {label}",l.t(null,void 0,n(156015))),ve=new te.TranslatedString("pin to right scale",l.t(null,void 0,n(22615))),be=new te.TranslatedString("pin to left scale",l.t(null,void 0,n(84018))),we=new te.TranslatedString("change earnings visibility",l.t(null,void 0,n(88217))),ye=new te.TranslatedString("change dividends visibility",l.t(null,void 0,n(184944))),Te=new te.TranslatedString("change splits visibility",l.t(null,void 0,n(374488))),fe=new te.TranslatedString("change continuous contract switch visibility",l.t(null,void 0,n(407017))),Ae=new te.TranslatedString("change futures contract expiration visibility",l.t(null,void 0,n(628288))),Ce=new te.TranslatedString("change latest news and Minds visibility",l.t(null,void 0,n(819839))),_e=new te.TranslatedString("show all ideas",l.t(null,void 0,n(813622))),Ie=new te.TranslatedString("show ideas of followed users",l.t(null,void 0,n(826267))),We=new te.TranslatedString("show my ideas only",l.t(null,void 0,n(740061))),Pe=new te.TranslatedString("change events visibility on chart",l.t(null,void 0,n(979574))),Me=new te.TranslatedString("add this symbol to entire layout",l.t(null,void 0,n(527982))),Ne=new te.TranslatedString("add this indicator to entire layout",l.t(null,void 0,n(182388))),Ee=new te.TranslatedString("add this strategy to entire layout",l.t(null,void 0,n(894292))),Le=new te.TranslatedString("add this financial metric to entire layout",l.t(null,void 0,n(422856))),xe=new te.TranslatedString("apply drawing template",l.t(null,void 0,n(349037))),Fe=new te.TranslatedString("lock objects",l.t(null,void 0,n(168163))),ke=new te.TranslatedString("unlock objects",l.t(null,void 0,n(766824))),De=new te.TranslatedString("change visibility at current interval and above",l.t(null,void 0,n(678422))),Oe=new te.TranslatedString("change visibility at current interval and below",l.t(null,void 0,n(249529))),Ue=new te.TranslatedString("change visibility at current interval",l.t(null,void 0,n(416698))),Ve=new te.TranslatedString("change visibility at all intervals",l.t(null,void 0,n(666927))),Re=l.t(null,void 0,n(287085)),Be=(0, ee.appendEllipsis)(l.t(null,void 0,n(952302))),He=l.t(null,void 0,n(581428)),je=l.t(null,void 0,n(831971)),Ge=l.t(null,void 0,n(311156)),Ye=l.t(null,void 0,n(615682)),qe=l.t(null,void 0,n(266631)),ze=l.t(null,void 0,n(737422)),$e=l.t(null,void 0,n(805716)),Je=l.t(null,void 0,n(650352)),Ke=l.t(null,void 0,n(819263)),Ze=l.t(null,void 0,n(615818)),Qe=l.t(null,void 0,n(705897)),Xe=l.t(null,void 0,n(958976)),et=l.t(null,void 0,n(611661)),tt=l.t(null,void 0,n(466560)),nt=l.t(null,void 0,n(953958)),ot=l.t(null,void 0,n(734150)),it=l.t(null,void 0,n(783927)),at=l.t(null,void 0,n(315644)),rt=l.t(null,void 0,n(442660)),lt=l.t(null,void 0,n(844788)),st=l.t(null,void 0,n(770437)),ct=l.t(null,void 0,n(571263)),dt=l.t(null,void 0,n(370573)),ut=l.t(null,void 0,n(259560)),ht=l.t(null,void 0,n(514125)),pt=l.t(null,void 0,n(444538)),gt=l.t(null,void 0,n(556948)),mt=l.t(null,void 0,n(920207)),St=l.t(null,void 0,n(665810)),vt=l.t(null,void 0,n(603822)),bt=l.t(null,void 0,n(697324)),wt=l.t(null,void 0,n(500764)),yt=l.t(null,void 0,n(708128)),Tt=l.t(null,void 0,n(361201)),ft=l.t(null,void 0,n(832156)),At=l.t(null,void 0,n(591130)),Ct=l.t(null,void 0,n(737680)),_t=l.t(null,void 0,n(243707)),It=l.t(null,void 0,n(739065)),Wt=l.t(null,void 0,n(454727)),Pt=l.t(null,void 0,n(366156)),Mt=l.t(null,void 0,n(976598)),Nt=l.t(null,void 0,n(203485)),Et=l.t(null,void 0,n(745828)),Lt=l.t(null,void 0,n(702899)),xt=l.t(null,void 0,n(640887)),Ft=l.t(null,void 0,n(753387)),kt=l.t(null,void 0,n(796712)),Dt=l.t(null,void 0,n(126354)),Ot=l.t(null,void 0,n(219796)),Ut=l.t(null,void 0,n(559901)),Vt=l.t(null,void 0,n(223221)),Rt=l.t(null,void 0,n(422198)),Bt=l.t(null,void 0,n(127557)),Ht=l.t(null,void 0,n(598486)),jt=l.t(null,void 0,n(973106)),Gt=l.t(null,void 0,n(85964)),Yt=l.t(null,void 0,n(559192)),qt=l.t(null,void 0,n(583182)),zt=(0,ee.appendEllipsis)(l.t(null,void 0,n(592206))),$t=(0,ee.appendEllipsis)(l.t(null,void 0,n(303612))),Jt=(0,ee.appendEllipsis)(l.t(null,void 0,n(389517))),Kt=l.t(null,void 0,n(813345)),Zt=(0,ee.appendEllipsis)(l.t(null,void 0,n(309908))),Qt=l.t(null,void 0,n(35216)),Xt=l.t(null,void 0,n(552977)),en=l.t(null,void 0,n(419611)),tn=l.t(null,void 0,n(738342)),nn=l.t(null,void 0,n(715101)),on=l.t(null,void 0,n(642284)),an=l.t(null,void 0,n(246771)),rn=l.t(null,void 0,n(966263)),ln=l.t(null,void 0,n(830816)),sn=l.t(null,void 0,n(124620)),cn=l.t(null,void 0,n(484813)),dn=l.t(null,void 0,n(772973)),un=l.t(null,void 0,n(748284)),hn=l.t(null,void 0,n(487933)),pn=l.t(null,void 0,n(258669)),gn=(0,ee.appendEllipsis)(l.t(null,void 0,n(389517))),mn=l.t(null,void 0,n(308251)),Sn=l.t(null,void 0,n(34059)),vn=l.t(null,void 0,n(364288)),bn=l.t(null,void 0,n(777920)),wn=l.t(null,void 0,n(575669)),yn=l.t(null,void 0,n(608886)),Tn=l.t(null,void 0,n(618008)),fn=l.t(null,void 0,n(733606)),An=(0,ee.appendEllipsis)(l.t(null,void 0,n(979758))),Cn=(0, ee.appendEllipsis)(l.t(null,void 0,n(218001))),_n=l.t(null,void 0,n(729682)),In=l.t(null,void 0,n(28851)),Wn=l.t(null,void 0,n(420366)),Pn=l.t(null,void 0,n(956977)),Mn=l.t(null,void 0,n(601184)),Nn=l.t(null,void 0,n(873436)),En={general:!0,mainSeries:!0,mainSeriesTrade:!1,esdStudies:!0,studies:!0,fundamentals:!0,lineTools:!0,publishedCharts:!0,ordersAndPositions:!0,alerts:!0,chartEvents:!0,objectTree:!0,gotoLineTool:!1};function Ln(e){return(0,X.isActingAsSymbolSource)(e)?e.symbolTitle(u.TitleDisplayTarget.StatusLine,!0,!0):(0,g.clean)(e.title(u.TitleDisplayTarget.StatusLine,!0),!0)}function xn(e,t,n){if(e.model().isInReplay())return null;const o=e.model().mainSeries(),i=o.symbolInfo();if(o.isConvertedToOtherCurrency()||o.isConvertedToOtherUnit()||(0,v.isNonTradableSymbolType)(null==i?void 0:i.type))return null;const a=new c.Action({actionId:"Trading.TradeFromChart",options:{},optionsLoader:()=>{const t=new Promise((async(t,o)=>{const i=(0,y.tradingService)();if(null===i||0===(await i.brokersMetainfo()).length)return void t({label:Re,disabled:!0});const a=e.model().mainSeries();let r;n&&(r=n.localY),(0,T.createTradeContext)(a,r).then((e=>{try{return i.chartContextMenuActions(e,{hideNotExecutableAction:!0})}catch(e){return ge.logError(e.message),[]}})).then((e=>{0!==e.length?t({name:"trade",label:Re,subItems:e,statName:"Trading"}):t({label:Re,disabled:!0})})).catch((()=>{o("Unable to get Trade Context")}))}));return(0,f.makeTimeLimited)(t,5e3,"Action trade not received")}});return a}function Fn(e,t){return!t.isEmpty()&&s.enabled("datasource_copypaste")?new pe.ActionWithStandardIcon({actionId:"Chart.Clipboard.PasteSource",options:{label:_n.trim(),shortcutHint:(0,G.humanReadableHash)(G.Modifiers.Mod+86),statName:"Paste",onExecute:()=>e.chartWidgetCollection().clipboard.uiRequestPaste(t)}}):null}function kn(e,t){const n=e.model(),o=n.availableZOrderOperations(t),i=[new pe.ActionWithStandardIcon({actionId:"Chart.Source.VisualOrder.BringToFront",options:{label:Dt,statName:"BringToFront",disabled:!o.bringToFrontEnabled,onExecute:()=>n.bringToFront(t)}}),new pe.ActionWithStandardIcon({actionId:"Chart.Source.VisualOrder.SendToBack",options:{label:Ot,statName:"SendToBack",disabled:!o.sendToBackEnabled,onExecute:()=>n.sendToBack(t)}}),new pe.ActionWithStandardIcon({actionId:"Chart.Source.VisualOrder.BringForward",options:{label:Ut,statName:"BringForward",disabled:!o.bringForwardEnabled,onExecute:()=>n.bringForward(t)}}),new pe.ActionWithStandardIcon({actionId:"Chart.Source.VisualOrder.SendBackward",options:{label:Vt,statName:"SendBackward",disabled:!o.sendBackwardEnabled,onExecute:()=>n.sendBackward(t)}})];return new pe.ActionWithStandardIcon({actionId:"Chart.Source.VisualOrder",options:{label:Rt,iconId:"Chart.VisualOrder",statName:"VisualOrder",subItems:i}})}function Dn(e,t){const n=e.model(),o=(e,o)=>{const i=oe.Interval.parse(n.mainSeries().interval()),a=(0,re.getIntervalsVisibilitiesForMode)(i,e),r=[],l=[];t.forEach((e=>{const t=e.properties().intervalsVisibilities.childs();r.push(t.ticks),l.push(a.ticks), r.push(t.seconds),l.push(a.seconds),r.push(t.secondsFrom),l.push(a.secondsFrom),r.push(t.secondsTo),l.push(a.secondsTo),r.push(t.minutes),l.push(a.minutes),r.push(t.minutesFrom),l.push(a.minutesFrom),r.push(t.minutesTo),l.push(a.minutesTo),r.push(t.hours),l.push(a.hours),r.push(t.hoursFrom),l.push(a.hoursFrom),r.push(t.hoursTo),l.push(a.hoursTo),r.push(t.days),l.push(a.days),r.push(t.daysFrom),l.push(a.daysFrom),r.push(t.daysTo),l.push(a.daysTo),r.push(t.weeks),l.push(a.weeks),r.push(t.weeksFrom),l.push(a.weeksFrom),r.push(t.weeksTo),l.push(a.weeksTo),r.push(t.months),l.push(a.months),r.push(t.monthsFrom),l.push(a.monthsFrom),r.push(t.monthsTo),l.push(a.monthsTo),r.push(t.ranges),l.push(a.ranges)})),n.setProperties(r,l,o)},i=[new pe.ActionWithStandardIcon({actionId:"Chart.Source.IntervalsVisibility.CurrentAndAbove",options:{label:Ht,statName:"currentAndAboveIntervals",onExecute:()=>o(3,De)}}),new pe.ActionWithStandardIcon({actionId:"Chart.Source.IntervalsVisibility.CurrentAndBelow",options:{label:jt,statName:"currentAndBelowIntervals",onExecute:()=>o(2,Oe)}}),new pe.ActionWithStandardIcon({actionId:"Chart.Source.IntervalsVisibility.Current",options:{label:Gt,statName:"currentInterval",onExecute:()=>o(1,Ue)}}),new pe.ActionWithStandardIcon({actionId:"Chart.Source.IntervalsVisibility.All",options:{label:Yt,statName:"allIntervals",onExecute:()=>o(0,Ve)}})];return new pe.ActionWithStandardIcon({actionId:"Chart.Source.IntervalsVisibility",options:{label:Bt,statName:"IntervalsVisibility",subItems:i}})}function On(e,t){var n,o,i;const a=e.defaultPriceScale(),r=void 0!==t?a.coordinateToPrice(t,null!==(o=null===(n=e.mainDataSource())||void 0===n?void 0:n.firstValue())&&void 0!==o?o:0):e.model().mainSeries().lastValueData(4,!0,!0).price,l=null===(i=e.mainDataSource())||void 0===i?void 0:i.formatter();if(void 0===r||!l)return null;const s=l.format(r);return new pe.ActionWithStandardIcon({actionId:"Chart.Clipboard.CopyPrice",options:{label:`${In} ${s}`,statName:"CopyPrice",onExecute:()=>(0,le.getClipboard)().writeText(s)}})}function Un(e,t,n,i){const a=(a,r,l,s)=>new c.Action({actionId:s,options:{label:a,onExecute:()=>{const a=e.model(),s=a.model().timeScale(),c=t.defaultPriceScale();if(!s.isEmpty()&&!c.isEmpty())if(l&&void 0!==n&&void 0!==i){const e=(0,o.ensureNotNull)((0,o.ensureNotNull)(t.mainDataSource()).firstValue()),l=c.coordinateToPrice(n,e),d=Math.round(s.coordinateToIndex(i));a.createLineTool({pane:t,point:{index:d,price:l},linetool:r})}else ne.tool.setValue(r)}}});return new c.Action({actionId:"Chart.MtPredictor.Actions",options:{label:Ge,subItems:[a(Ye,"LineStudyMtpRiskReward",!1,"Chart.MtPredictor.RiskReward"),a(qe,"LineStudyMtpDecisionPoint",!0,"Chart.MtPredictor.DecisionPoint"),a(ze,"LineStudyMtpAnalysis",!0,"Chart.MtPredictor.Analysis"),new c.Action({actionId:"Chart.MtPredictor.ElliotWave",options:{label:$e, subItems:[a(Je,"LineStudyMtpElliotWaveMain",!0,"Chart.MtPredictor.ElliotWave.Main"),a(Ke,"LineStudyMtpElliotWaveMajor",!0,"Chart.MtPredictor.ElliotWave.Major"),a(Ze,"LineStudyMtpElliotWaveMinor",!0,"Chart.MtPredictor.ElliotWave.Minor")]}}),new c.Action({actionId:"Chart.MtPredictor.ApplyWPTUpWave",options:{label:Qe,subItems:[a(Xe,"LineStudyMtpUpWave1OrA",!1,"Chart.MtPredictor.ApplyWPTUpWave.1OrA"),a(et,"LineStudyMtpUpWave2OrB",!1,"Chart.MtPredictor.ApplyWPTUpWave.1OrB"),a(tt,"LineStudyMtpUpWaveC",!1,"Chart.MtPredictor.ApplyWPTUpWave.C"),a(nt,"LineStudyMtpUpWave3",!1,"Chart.MtPredictor.ApplyWPTUpWave.3"),a(ot,"LineStudyMtpUpWave4",!1,"Chart.MtPredictor.ApplyWPTUpWave.4"),a(it,"LineStudyMtpUpWave5",!1,"Chart.MtPredictor.ApplyWPTUpWave.5")]}}),new c.Action({actionId:"Chart.MtPredictor.ApplyWPTDownWave",options:{label:at,subItems:[a(rt,"LineStudyMtpDownWave1OrA",!1,"Chart.MtPredictor.ApplyWPTDownWave.1OrA"),a(lt,"LineStudyMtpDownWave2OrB",!1,"Chart.MtPredictor.ApplyWPTDownWave.1OrB"),a(st,"LineStudyMtpDownWaveC",!1,"Chart.MtPredictor.ApplyWPTDownWave.C"),a(ct,"LineStudyMtpDownWave3",!1,"Chart.MtPredictor.ApplyWPTDownWave.3"),a(dt,"LineStudyMtpDownWave4",!1,"Chart.MtPredictor.ApplyWPTDownWave.4"),a(ut,"LineStudyMtpDownWave5",!1,"Chart.MtPredictor.ApplyWPTDownWave.5")]}})]}})}function Vn(e){const t=e.actions(),n=[t.showPriceLine];return n.push(t.showSeriesPrevCloseLine),n.push(t.showPrePostMarketPriceLine),n.push(t.showHighLowPriceLines),e.model().model().hasCustomSource("bidask")&&n.push(t.showBidAskLines),new pe.ActionWithStandardIcon({actionId:"Chart.Lines",options:{label:qt,statName:"Lines",subItems:n}})}function Rn(e,t){const n=[];{if(ne.isToolCreatingNow.value())return n;const o=()=>{var t;return null!==(t=e.chartWidgetCollection().activeChartWidget.value())&&void 0!==t?t:e},i=()=>t.some((e=>e.isSynchronizable()));if((0,x.isFeatureEnabled)("save_shared_line_tools")){if(!window.user.is_pro)return n;if(!i())return n;let o=t[0].sharingMode().value();o=t.every((e=>e.sharingMode().value()===o))?o:null;const a=e.model();n.push(new c.Action({actionId:"Chart.LineTool.NoSync",options:{label:yn,statName:"NoSyncDrawing",checkable:!0,checked:0===o,onExecute:e=>{e.isChecked()&&a.shareLineTools(t,0)}}}),new c.Action({actionId:"Chart.LineTool.SyncInLayout",options:{label:Tn,statName:"SyncDrawingInLayout",checkable:!0,checked:1===o,onExecute:e=>{e.isChecked()&&a.shareLineTools(t,1)}}}),new c.Action({actionId:"Chart.LineTool.SyncGlobally",options:{label:fn,statName:"SyncDrawingGlobally",checkable:!0,checked:2===o,onExecute:e=>{e.isChecked()&&a.shareLineTools(t,2)}}}))}else if(s.enabled("support_multicharts")&&e.isMultipleLayout().value()){if(!i())return n;const e=t.every((e=>!!e.linkKey().value()));n.push(new pe.ActionWithStandardIcon({actionId:"Chart.LineTool.NoSync",options:{label:yn,statName:"NoSyncDrawing",checkable:!0,checked:!e,onExecute:e=>{e.isChecked()&&o().unlinkSelectedLine()}}}),new pe.ActionWithStandardIcon({actionId:"Chart.LineTool.SyncInLayout",options:{label:Tn,statName:"SyncDrawingInLayout",checkable:!0,checked:e, onExecute:e=>{e.isChecked()&&o().copyLineToOtherCharts()}}}))}}return n}function Bn(e,t){const n=t[0].properties().visible.value(),o=n?je:He,i=n?"Chart.Hide":"Chart.ShowObject",a=n?"Chart.SelectedObject.Hide":"Chart.SelectedObject.Show";return new pe.ActionWithStandardIcon({actionId:a,options:{checkable:!0,statName:"ToggleVisibilitySelectedObject",label:o,iconId:i,onExecute:()=>{const o=t.every(Q.isLineTool)&&ae.lineToolsDoNotAffectChartInvalidation,i=e.model();i.withMacro(me,(()=>{t.forEach((e=>{i.setProperty(e.properties().visible,!n,me)}))}),o)}}})}function Hn(){var e,t;return!(0,B.onWidget)()&&!(0,R.isOnMobileAppPage)("any")&&!!(null===(t=null===(e=window.widgetbar)||void 0===e?void 0:e.layout)||void 0===t?void 0:t.canOpen())}class jn{constructor(e,t){this._chartWidget=e,this._options=(0,r.merge)((0,r.clone)(En),t||{})}async contextMenuActionsForSources(e,t,n,o,i){const a=e[0],r=this._options,l=[];if(a===this._chartWidget.model().mainSeries()&&r.mainSeries)l.push(...await this._contextMenuActionsForSeries(a,n));else if((0,h.isESDStudy)(a)&&r.esdStudies)l.push(...this._contextMenuActionsForESD());else if((0,h.isRollDatesStudy)(a))l.push(...this._contextMenuActionsForRollDates());else if((0,U.isFuturesContractExpiration)(a))l.push(...this._contextMenuActionsForFuturesContractExpiration());else if((0,V.isLatestUpdatesSource)(a))l.push(...this._contextMenuActionsForisLatestUpdates());else if((0,h.isStudy)(a)&&r.studies)l.push(...await this._contextMenuActionsForStudy(a,t,n));else if(a instanceof W.PublishedChartsTimeline&&r.publishedCharts)l.push(...this._contextMenuActionsForPublishedTimeline(a));else if((a instanceof A.LineToolOrder||a instanceof C.LineToolPosition)&&r.ordersAndPositions)l.push(...this._contextMenuActionsForTradingDrawings(a));else if((0,M.isAlertLabel)(a)&&a.alert().id().value()&&!a.alert().isNew()&&r.alerts)l.push(...await this._contextMenuActionsForAlertLabel(a.alert(),o));else if((0,Q.isLineTool)(a)&&r.lineTools){const t=e.filter(Q.isLineTool);l.push(...await this._contextMenuActionsForLineTool(t))}else(function(e){return e.name()===de.ChartEventsSourceId.Value})(a)&&r.chartEvents&&l.push(...this._contextMenuActionsForChartEvents(a));return l.length&&(null==i?void 0:i.length)&&l.push(new c.Separator),l.push(...null!=i?i:[]),l}_isReadOnly(){return this._chartWidget.readOnly()}_createActionScale(e){const t=(0,o.ensureNotNull)(e.priceScale()),n=this._chartWidget.model().model(),i=(0,o.ensureNotNull)(n.paneForSource(e)),a=i.priceScalePosition(t),r=("left"===a?i.leftPriceScales():i.rightPriceScales()).indexOf(t),l=n.priceScaleSlotsCount().totallySlots<2?"dontneedname":"needname",s="overlay"===a?"":(0,d.getPriceAxisNameInfo)(a,r).label,c=It.format({label:s}),u={"left-needname":c,"left-dontneedname":Pt,"right-needname":c,"right-dontneedname":Mt,"overlay-needname":Wt,"overlay-dontneedname":Wt}[a+"-"+l];return new pe.ActionWithStandardIcon({actionId:"Chart.Source.ChangePriceScale",options:{label:u,iconId:"Chart.PriceScale",subItems:this._createActionScaleItems(e)}})}_createActionResetInputPoints(e){ const t=e.metaInfo(),o=t.inputs.filter(se.isTimeOrPriceNotHiddenInput);return 0===o.length?null:new pe.ActionWithStandardIcon({actionId:"Chart.Source.ResetInputPoints",options:{label:Cn,onExecute:async()=>{let i;try{const a=e.properties().childs().inputs.state();for(const e of Object.keys(a))o.find((t=>t.id===e))||delete a[e];const r=new ce.Property({inputs:a}),l=await Promise.all([n.e(14819),n.e(73224),n.e(72718),n.e(93327),n.e(88601),n.e(99410),n.e(67681),n.e(1893),n.e(42381),n.e(38697),n.e(7436),n.e(86282),n.e(47821),n.e(43630),n.e(11301),n.e(29218),n.e(89589),n.e(64820),n.e(8191),n.e(20442),n.e(81271),n.e(90624),n.e(2113),n.e(10456),n.e(42629),n.e(47416),n.e(85933),n.e(12742),n.e(18251),n.e(59967),n.e(86494),n.e(95348),n.e(92203),n.e(47762),n.e(42922),n.e(16971),n.e(30416),n.e(96918),n.e(89455),n.e(5801),n.e(6867),n.e(37794),n.e(43751),n.e(26317),n.e(25492),n.e(82731),n.e(1126),n.e(5522),n.e(17946),n.e(11817),n.e(95543),n.e(81659),n.e(33935),n.e(58162),n.e(3803),n.e(20845),n.e(71351),n.e(45184),n.e(57169),n.e(20130),n.e(63100),n.e(90385),n.e(92833),n.e(33974),n.e(111),n.e(46576),n.e(72536),n.e(68985),n.e(16410),n.e(99387),n.e(41833),n.e(34582),n.e(13467),n.e(53030)]).then(n.bind(n,280881));i=(await l.selectInputValuesOnChart(this._chartWidget,o,r,t.shortDescription,t.inputs)).customSourceId,e.properties().mergeAndFire(r.state())}finally{void 0!==i&&this._chartWidget.model().model().removeCustomSource(i)}}}})}_createActionLayoutChartsSync(){return new H.LayoutChartsSyncContextMenuAction(this._chartWidget.linkingGroupIndex().readonly(),(e=>this._chartWidget.model().setLinkingGroupIndex(e)))}_createActionScaleDetach(e,t,n,i){const a=this._chartWidget.model().model(),r=(0,o.ensureNotNull)(a.paneForSource(e));if(!r.canCreateNewPriceScale())return null;const l=(0,o.ensureNotNull)(e.priceScale()),s=l.canDetachSource(e),c=r.priceScalePosition(l),u=s||c!==t;if(!u)return null;const h=a.priceScaleSlotsCount(),p={left:{labelled:bt,sided:Ct},right:{labelled:bt,sided:_t}},g="left"===t?r.leftPriceScales().length:r.rightPriceScales().length,m=h[t]>g?"labelled":"sided",S=(0,d.getPriceAxisNameInfo)(t,g).label,v=p[t][m].format({label:S});return new pe.ActionWithStandardIcon({actionId:"Chart.Source.ChangePriceScale",options:{checkable:!1,disabled:!u,label:v,statName:i,payload:e,onExecute:n}})}_onDetachLeft(e){const t=e.getPayload(),n=this._chartWidget.model().model(),i=(0,o.ensureNotNull)(n.paneForSource(t));this._chartWidget.model().detachToLeft(t,i)}_onDetachRight(e){const t=e.getPayload(),n=this._chartWidget.model().model(),i=(0,o.ensureNotNull)(n.paneForSource(t));this._chartWidget.model().detachToRight(t,i)}_createActionScaleDetachLeft(e){return this._createActionScaleDetach(e,"left",this._onDetachLeft.bind(this),"ToggleScaleLeft")}_createActionScaleDetachRight(e){return this._createActionScaleDetach(e,"right",this._onDetachRight.bind(this),"ToggleScaleRight")}_onMoveToScale(e){const t=e.getPayload();if(t.datasource.priceScale()===t.priceScale)return;const n=this._chartWidget.model().model(),i=(0, o.ensureNotNull)(n.paneForSource(t.datasource));this._chartWidget.model().moveToScale(t.datasource,i,t.priceScale,t.undoText)}_createMoveToScaleAction(e,t,n,o){const i=e.priceScale()===t;return new pe.ActionWithStandardIcon({actionId:"Chart.Source.MoveToOtherScale",options:{checkable:!0,checked:i,label:n,statName:"ToggleScale",payload:{datasource:e,priceScale:t,undoText:o},onExecute:this._onMoveToScale.bind(this)}})}_onNoScale(e){const t=e.getPayload().datasource,n=this._chartWidget.model().model(),i=(0,o.ensureNotNull)(n.paneForSource(t));i.isOverlay(t)||this._chartWidget.model().detachNoScale(t,i)}_createActionNoScale(e){const t=this._chartWidget.model().model(),n=(0,o.ensureNotNull)(t.paneForSource(e)),i=n.actionNoScaleIsEnabled(e);return new pe.ActionWithStandardIcon({actionId:"Chart.Source.MoveToNoScale",options:{checkable:!0,checked:n.isOverlay(e),label:Nt,disabled:!i,statName:"ToggleNoScale",payload:{datasource:e},onExecute:this._onNoScale.bind(this)}})}_createActionScaleItems(e){const t=[],n=this._chartWidget.model().model(),i=(0,o.ensureNotNull)(n.paneForSource(e)),a=n.priceScaleSlotsCount().totallySlots>1,r=i.rightPriceScales(),l=i.leftPriceScales(),s=this._createActionScaleDetachRight(e),u=this._createActionScaleDetachLeft(e),h=r.length+l.length+(null===s?0:1)+(null===u?0:1)>2,p={right:{hidden:{checked:{labelled:ht,sided:pt},unchecked:{labelled:gt,sided:mt}},visible:{checked:{labelled:St,sided:vt},unchecked:{labelled:bt,sided:wt}}},left:{hidden:{checked:{labelled:ht,sided:yt},unchecked:{labelled:gt,sided:Tt}},visible:{checked:{labelled:St,sided:ft},unchecked:{labelled:bt,sided:At}}}},g={right:ve,left:be},m={left:i.visibleLeftPriceScales(),right:i.visibleRightPriceScales()},S=(t,n)=>{const o=("right"===n?r:l)[t],i=m[n].includes(o)?"visible":"hidden",s=e.priceScale()===o?"checked":"unchecked",c=a?"labelled":"sided",u=p[n],h=(0,d.getPriceAxisNameInfo)(n,t).label;return{actionText:u[i][s][c].format({label:h}),undoText:a?Se.format({label:h}):g[n]}};t.push(...r.map(((t,n)=>{const o=S(n,"right");return this._createMoveToScaleAction(e,t,o.actionText,o.undoText)}))),null!==s&&t.push(s);h&&(r.length>0||null!==s)&&t.push(new c.Separator);t.push(...l.map(((t,n)=>{const o=S(n,"left");return this._createMoveToScaleAction(e,t,o.actionText,o.undoText)}))),null!==u&&t.push(u);h&&(l.length>0||null!==u)&&t.push(new c.Separator);return t.push(this._createActionNoScale(e)),t}_createActionMergeUp(e){const t=this._chartWidget.model();return t.model().isMergeUpAvailableForSource(e)?new pe.ActionWithStandardIcon({actionId:"Chart.Source.MergeUp",options:{label:Lt,statName:"MergeUp",onExecute:()=>t.mergeSourceUp(e)}}):null}_createActionUnmergeUp(e){const t=this._chartWidget.model();return t.model().isUnmergeAvailableForSource(e)?new pe.ActionWithStandardIcon({actionId:"Chart.Source.UnmergeUp",options:{label:xt,statName:"UnmergeUp",onExecute:()=>t.unmergeSourceUp(e)}}):null}_createActionMergeDown(e){const t=this._chartWidget.model();return t.model().isMergeDownAvailableForSource(e)?new pe.ActionWithStandardIcon({ actionId:"Chart.Source.MergeDown",options:{label:Ft,statName:"MergeDown",onExecute:()=>t.mergeSourceDown(e)}}):null}_createActionUnmergeDown(e){const t=this._chartWidget.model();return t.model().isUnmergeAvailableForSource(e)?new pe.ActionWithStandardIcon({actionId:"Chart.Source.UnmergeDown",options:{label:kt,statName:"UnmergeDown",onExecute:()=>t.unmergeSourceDown(e)}}):null}_mergeContentMenuItems(e){return[this._createActionMergeUp(e),this._createActionUnmergeUp(e),this._createActionMergeDown(e),this._createActionUnmergeDown(e)].filter(r.notNull)}_createActionMove(e){const t=this._mergeContentMenuItems(e);return t.length>0?new pe.ActionWithStandardIcon({actionId:"Chart.Source.MoveToPane",options:{label:Et,iconId:"Chart.Move",subItems:t}}):null}async _contextMenuActionsForSeries(e,t){var n;const i=[],a=this._chartWidget.model().model(),r=(0,o.ensureNotNull)(a.paneForSource(e)),l=this._chartWidget.actions(),d=t&&"localY"in t?t.localY:void 0;if(this._isReadOnly())i.push(Bn(this._chartWidget,[e])),i.push(new c.Separator),i.push(this._createActionScale(e));else{if(e.alertCreationAvailable().value()){const t=(await(0,ue.getAlertsChartActionCreators)()).createAlert(this._chartWidget,{series:e,localY:d});null!==t&&i.push(t)}if(i.push(this._createActionAddChildStudy(e)),this._options.fundamentals){const t=this._createActionAddFundamentals(e);null!==t&&i.push(t)}if(this._options.mainSeriesTrade){const e=xn(this._chartWidget);null!==e&&i.push(e)}i.length>0&&!(i[i.length-1]instanceof c.Separator)&&i.push(new c.Separator),s.enabled("symbol_info")&&i.push(l.showSymbolInfoDialog),Hn()&&i.push(this._chartWidget.actions().showDataWindow);const t=a.mainSeries().symbolInfo();if(l.showFinancials&&null!==t&&(0,E.hasFinancialsByTypespecs)(t.type,t.typespecs)&&i.push(l.showFinancials),i.length>0&&!(i[i.length-1]instanceof c.Separator)&&i.push(new c.Separator),!r.isEmpty()&&s.enabled("datasource_copypaste")){const e=On(r,d),t=Fn(this._chartWidget,r);(e||t)&&(e&&i.push(e),t&&i.push(t),i.push(new c.Separator))}i.push(kn(this._chartWidget,[e]));const u=this._createActionMove(e);null!==u&&i.push(u),i.push(this._createActionScale(e)),this._chartWidget.isMultipleLayout().value()&&(this._chartWidget.chartWidgetCollection().lock.symbol.value()||this._chartWidget.chartWidgetCollection().lock.interval.value())&&i.push(this._createActionLayoutChartsSync()),i.push(Bn(this._chartWidget,[e])),i.push(new c.Separator);Boolean(null===(n=window.widgetbar)||void 0===n?void 0:n.widget("watchlist"))&&l.addToWatchlist&&i.push(l.addToWatchlist),s.enabled("text_notes")&&i.push(l.addToTextNotes),i[i.length-1]instanceof c.Separator||i.push(new c.Separator),window.pro&&window.pro.hasPackage("mtp-mtpredictor")&&i.push((0,o.ensureNotNull)(Un(this._chartWidget,r)),new c.Separator),s.enabled("show_chart_property_page")&&!this._chartWidget.onWidget()&&i.push(l.mainSeriesPropertiesAction),i[i.length-1]instanceof c.Separator&&i.pop()}return i}_createActionAddChildStudy(e){const t=this._chartWidget.model().model();return new pe.ActionWithStandardIcon({ actionId:"Chart.Indicator.ApplyChildIndicator",options:{label:zt.format({studyTitle:Ln(e)}),iconId:"Chart.ApplyIndicator",statName:"ApplyIndicator",onExecute:()=>{const n=this._chartWidget.showIndicators((0,h.isStudy)(e)?[e]:[]);if(n&&(0,h.isStudy)(e)){const e=()=>{(0,m.trackEvent)("SOS","Apply SOS","Apply by RC menu")},o=t.studyInserted();o.subscribe(this,e),n.visible().subscribe((t=>{t||o.unsubscribe(this,e)}),{once:!0})}}}})}_createActionAddFundamentals(e){{const t=e.symbolInfo();if(null!==t&&"forex"!==t.type&&!(0,$.hasCryptoTypespec)(t.typespecs||[]))return new pe.ActionWithStandardIcon({actionId:"Chart.Indicator.ApplyFinancials",options:{label:$t.format({instrumentName:Ln(e)}),iconId:"Chart.Financials",statName:"ApplyFundamental",onExecute:()=>{this._chartWidget.showFundamentals(e!==this._chartWidget.model().mainSeries()?e:void 0)}}})}return null}_createActionShowSymbolInfoDialog(e,t){const n=this._chartWidget.model().model();return new pe.ActionWithStandardIcon({actionId:"Chart.Dialogs.ShowSymbolInfo",options:{label:An,iconId:"Chart.SymbolInfo",checkable:!1,statName:"SymbolInfo",onExecute:()=>{const o={symbolInfo:e.symbolInfo(),unitDescription:e=>e?t.description(e):"",dateFormatter:n.dateFormatter()};(0,K.showSymbolInfoDialog)(o)}}})}_createActionShowProperties(e){return new pe.ActionWithStandardIcon({actionId:"Chart.Indicator.ShowSettingsDialog",options:{label:Jt,iconId:"Settings",statName:"EditSelectedObject",onExecute:()=>this._chartWidget.showSourceProperties(e)}})}async _contextMenuActionsForStudy(e,t,o){const i=t!==this._chartWidget.model().paneForSource(e),a=this._chartWidget.actions(),r=o&&"localY"in o?o.localY:void 0,d=[];if(!e.userEditEnabled())return d;if(this._chartWidget.readOnly())d.push(Bn(this._chartWidget,[e])),d.push(new c.Separator),(0,b.isNonSeriesStudy)(e)||d.push(this._createActionScale(e));else{if(e.alertCreationAvailable().value()){const t=(await(0,ue.getAlertsChartActionCreators)()).createAlert(this._chartWidget,{series:e,localY:r});null!==t&&d.push(t)}if(s.enabled("study_on_study")&&e.canHaveChildren()&&d.push(this._createActionAddChildStudy(e)),(e instanceof z.StudyCompare||e instanceof q.study_Overlay)&&this._options.fundamentals){const t=this._createActionAddFundamentals(e);null!==t&&d.push(t)}const t=this._createApplyToEntireLayoutCommand(e);null!==t&&d.push(t);const o=this._createAddIndicatorToFavoritesCommand(e);if(o&&d.push(o),d.length>0&&!(d[d.length-1]instanceof c.Separator)&&d.push(new c.Separator),s.enabled("symbol_info")&&(e instanceof z.StudyCompare||e instanceof q.study_Overlay)&&null!==e.symbolInfo()&&(d.push(this._createActionShowSymbolInfoDialog(e,this._chartWidget.model().model().availableUnits())),d.push(new c.Separator)),i||d.push(kn(this._chartWidget,[e])),d.push(Dn(this._chartWidget,[e])),!(0,b.isNonSeriesStudy)(e)&&!i){const t=this._createActionMove(e);null!==t&&d.push(t),d.push(this._createActionScale(e))}d.push(new c.Separator);const p=e.metaInfo();if(!(0,B.onWidget)()){const{scriptIdPart:t,id:o,pine:i}=p;let a;if((0,h.isFundamentalStudy)(e)){const e=(0, ie.getFundamentalIdFromScriptIdPart)(p.scriptIdPart);if(e){const{default:t}=await n.e(54875).then(n.t.bind(n,384898,19));e in t&&(a=()=>(0,k.showSupportDialog)({solutionId:t[e]}))}}else if(!i||F.StudyMetaInfo.hasStdSuffix(t)){const{default:e}=await n.e(95937).then(n.t.bind(n,676006,19));(t in e||o in e)&&(a=()=>(0,k.showSupportDialog)({solutionId:e[t]||e[o]}))}else F.StudyMetaInfo.hasPubSuffix(t)&&(a=async()=>{try{const{chartImageUrl:n}=await(0,_.requestScriptInfo)(t);(0,D.pushChartPage)({chartId:n,chartName:e.title(u.TitleDisplayTarget.StatusLine)})}catch(e){(0,O.showScriptInfoErrorNoticeDialog)()}});if(void 0!==a){const t=(0,h.isFundamentalStudy)(e)?(0,ee.appendEllipsis)(l.t(null,void 0,n(213563))):p.pine?(0,ee.appendEllipsis)(l.t(null,void 0,n(907859))):(0,ee.appendEllipsis)(l.t(null,void 0,n(111741)));d.push(new c.Action({actionId:"Chart.Indicator.About",options:{label:t,statName:"OpenSelectedObjectAbout",onExecute:a}}))}}if(!(0,h.isFundamentalStudy)(e)&&p.pine&&a.viewSourceCode){const{scriptIdPart:t,pine:{version:n}}=p;d.push(a.viewSourceCode);const o=this._createActionResetInputPoints(e);o&&d.push(o),d.push(new c.Separator),a.viewSourceCode.update({disabled:!1}),(0,I.isAuthToGetPineSourceCode)(t,n).then((e=>{e||a.viewSourceCode.update({disabled:!0})})).catch((e=>{ge.logError("Failed isAuthToGetPineSourceCode, reason: "+e)}))}if(window.is_authenticated&&(0,J.isUserStudyWithLogs)(e)&&(d.push(new c.Action({actionId:"Chart.Indicator.PineLogs",options:{label:l.t(null,void 0,n(249313)),statName:"PineLogs",onExecute:()=>{(0,J.openPineLogsInRightPanel)(e)}}})),d.push(new c.Separator)),e.copiable()){const t=new pe.ActionWithStandardIcon({actionId:"Chart.Clipboard.CopySource",options:{label:Qt,shortcutHint:(0,G.humanReadableHash)(G.Modifiers.Mod+67),statName:"Copy",onExecute:()=>{this._chartWidget.chartWidgetCollection().clipboard.uiRequestCopy([e])}}});d.push(t)}d.push(Bn(this._chartWidget,[e])),d.push(a.studyRemove);const g=!this._chartWidget.onWidget()&&this._options.objectTree&&a.paneObjectTree,m=Hn();(g||m)&&(d.push(new c.Separator),g&&d.push(a.paneObjectTree),m&&d.push(this._chartWidget.actions().showDataWindow)),d.push(new c.Separator),s.enabled("property_pages")&&new w.MetaInfoHelper(p).hasUserEditableOptions()&&d.push(this._createActionShowProperties(e)),d[d.length-1]instanceof c.Separator&&d.pop()}return d}_createLineToolTemplateAction(e){{const t=this._chartWidget.model(),o=n=>{t.applyLineToolTemplate(e,n,xe)};return new c.Action({actionId:"Chart.LineTool.Templates",options:{},optionsLoader:async()=>{const{LinetoolTemplatesList:i}=await Promise.all([n.e(29594),n.e(8010),n.e(3177)]).then(n.bind(n,998777)),a=new i(e.toolname,o),r=[];if(s.enabled("drawing_templates")){const t=new pe.ActionWithStandardIcon({actionId:"Chart.LineTool.Templates.SaveAs",options:{label:Zt,statName:"SaveAs",onExecute:()=>{a.showSaveDialog((t=>{const n=JSON.stringify(e.template());a.saveTemplate(t,n)}))}}});r.push(t)}const l=new pe.ActionWithStandardIcon({actionId:"Chart.LineTool.Templates.ApplyDefaults",options:{label:Kt, statName:"ApplyDefault",onExecute:()=>{t.restorePropertiesForSource(e),window.lineToolPropertiesToolbar.onSourceChanged([e])}}});return r.push(l),new Promise((e=>{a.templatesLoaded().then((()=>{var e;const t=null!==(e=a.getData())&&void 0!==e?e:[];t.length>0&&r.push(new c.Separator),t.forEach(((e,t)=>{const n=new pe.ActionWithStandardIcon({actionId:"Chart.LineTool.Templates.Apply",options:{label:e,statName:"ApplyTemplate",onExecute:()=>a.loadTemplate(e),toolbox:{type:Y.ToolboxType.Delete,action:()=>{a.deleteAction(e)}},showToolboxOnHover:!0}});r.push(n)}))}),(e=>{ge.logWarn(e)})).then((()=>{e({label:en,statName:"Template",subItems:r})}))}))}})}}_createActionToggleLockLineTools(e){const t=e[0].properties().frozen.value(),n=t?nn:on;return new pe.ActionWithStandardIcon({actionId:"Chart.SelectedObject.ToggleLocked",options:{label:n,statName:"ToggleLockSelectedObject",checkable:!0,iconId:t?"Chart.UnlockObject":"Chart.LockObject",onExecute:()=>{if(1===e.length)this._chartWidget.toggleLockSelectedObject();else{const n=t?ke:Fe,o=this._chartWidget.model();o.withMacro(n,(()=>{e.forEach((e=>{o.setProperty(e.properties().frozen,!t,n)}))}))}}}})}async _contextMenuActionsForLineTool(e){const t=[],n=this._chartWidget.actions(),i=this._chartWidget.model().model(),r=()=>{t.push(kn(this._chartWidget,e))},l=()=>{t.push(Dn(this._chartWidget,e))},d=()=>{const n=e.filter((e=>e.cloneable()));if(n.length>0){const e=new pe.ActionWithStandardIcon({actionId:"Chart.LineTool.Clone",options:{label:Xt,iconId:"Chart.Clone",shortcutHint:(0,G.humanReadableModifiers)(G.Modifiers.Mod)+"Drag",statName:"Clone",onExecute:()=>this._chartWidget.model().cloneLineTools(n,!1)},id:"Clone"});t.push(e)}return!!n.length},h=()=>{const n=e.filter((e=>e.copiable()));if(n.length>0){const e=new c.Action({actionId:"Chart.Clipboard.CopyLineTools",options:{label:Qt,shortcutHint:(0,G.humanReadableHash)(G.Modifiers.Mod+67),statName:"Copy",onExecute:()=>this._chartWidget.chartWidgetCollection().clipboard.uiRequestCopy(n)},id:"Copy"});t.push(e)}return!!n.length},p=()=>{const n=Rn(this._chartWidget,e);return t.push(...n),n.length>0},g=async e=>{if(this._chartWidget.model().isInReplay())return;const n=e.getOrderTemplate();if(null===n)return;const r=(0,y.tradingService)();if(null!==r){const e=r.activeBroker();if(e&&1===e.connectionStatus()&&e.metainfo().configFlags.supportLimitOrders){const l=i.mainSeries(),{symbol:s}=await r.getActualSymbol(l.proSymbol()),{tradable:d}=await e.isTradable(s);if(d){const{qty:{step:i}}=await e.symbolInfo(s);n.symbol=s,n.qty=function(e,t){return(0,a.Big)(e).div(t).round(void 0,0).mul(t).toNumber()}(n.qty,i),t.push(new c.Separator),t.push(function(e){const t=(0,o.ensureNotNull)((0,y.tradingService)());return new pe.ActionWithStandardIcon({actionId:"Chart.LineTool.CreateLimitOrderFromState",options:{label:Be,statName:"CreateLimitOrder",onExecute:()=>{t.trackEvent("Chart Context Menu","RiskRewardCreateLimitOrder"),(0,o.ensureNotNull)(t.brokerCommandsUI()).placeOrder(e)}}})}(n))}}else null===e&&(t.push(new c.Separator),t.push((0, o.ensureNotNull)(function(){const e=(0,o.ensureNotNull)((0,y.tradingService)());return new c.Action({actionId:"Trading.ShowSelectBrokerPanel",options:{label:Be,statName:"ShowSelectBrokerNotification",onExecute:()=>{var t;(0,L.isMobileTradingAvailable)()&&!(null===(t=window.TradingView.bottomWidgetBar)||void 0===t?void 0:t.isVisible().value())?e.toggleTradingPanelPopup():e.toggleTradingWidget(),e.onNeedSelectBroker.fire()}}})}())))}},m=e=>{const n=new pe.ActionWithStandardIcon({actionId:"Chart.ScrollToLineTool",options:{label:tn.format({lineToolName:e.title(u.TitleDisplayTarget.StatusLine)}),statName:"GoToLineTool",checkable:!1,onExecute:async()=>this._chartWidget.model().scrollToLineTool(e)}});t.push(n)},S=e=>{const t=this._chartWidget.model().model().lineToolsGroupModel(),n=e.map((e=>t.groupForLineTool(e)));return new Set(n).size<=1};if(1===e.length){const o=e[0];if(this._chartWidget.readOnly())t.push(Bn(this._chartWidget,[o]));else if(o.userEditEnabled()){if(j.alertsAvailable&&!this._chartWidget.onWidget()){const e=await(0,ue.getAlertsChartActionCreators)();if(o.hasAlert&&o.hasAlert().value())t.push(e.editAlertOnLineDataSource(o)),t.push(new c.Separator);else if(o.canHasAlert()&&o.alertCreationAvailable().value()){const n=e.createAlert(this._chartWidget,{drawing:o});null!==n&&(t.push(n),t.push(new c.Separator))}}{const e=this._createLineToolTemplateAction(o);null!==e&&t.push(e)}r(),l(),this._options.objectTree&&n.paneObjectTree&&t.push(n.paneObjectTree),await g(o),t.push(new c.Separator);let e=d();e=h()||e,e&&t.push(new c.Separator),e=p(),e&&t.push(new c.Separator),t.push(this._createActionToggleLockLineTools([o])),t.push(Bn(this._chartWidget,[o])),t.push(n.lineRemove),o.points().length>0&&this._options.gotoLineTool&&(t.push(new c.Separator),m(o));const i=await this._chartWidget.propertiesDefinitionsForSource(o);if(s.enabled("property_pages")&&null!==i&&(t.push(new c.Separator),t.push(n.format)),o.additionalActions){t.push(new c.Separator);const e=o.additionalActions(this._chartWidget.model());t.push(...e)}}}else this._options.objectTree&&n.paneObjectTree&&t.push(n.paneObjectTree),S(e)&&r(),l(),t.length>0&&t.push(new c.Separator),d(),h(),p(),t.push(new c.Separator),t.push(this._createActionToggleLockLineTools(e)),t.push(Bn(this._chartWidget,e)),t.push(n.lineRemove),s.enabled("property_pages")&&(t.push(new c.Separator),t.push(n.format));return t}_createEarningsShow(){const e=this._chartWidget.model().mainSeries().properties().childs().esdShowEarnings;return new c.Action({actionId:"Chart.ToggleVisibility.Earnings",options:{label:an,checkable:!0,checked:e.value(),name:"ToggleShowEarnings",statName:"ToggleShowEarnings",onExecute:t=>this._chartWidget.model().setProperty(e,t.isChecked(),we)}})}_createDividendsShow(){const e=this._chartWidget.model().mainSeries().properties().childs().esdShowDividends;return new c.Action({actionId:"Chart.ToggleVisibility.Dividends",options:{label:rn,checkable:!0,checked:e.value(),name:"ToggleShowDividends",statName:"ToggleShowDividends", onExecute:t=>this._chartWidget.model().setProperty(e,t.isChecked(),ye)}})}_createSplitsShow(){const e=this._chartWidget.model().mainSeries().properties().childs().esdShowSplits;return new c.Action({actionId:"Chart.ToggleVisibility.Splits",options:{checkable:!0,label:ln,checked:e.value(),name:"ToggleShowSplits",statName:"ToggleShowSplits",onExecute:t=>this._chartWidget.model().setProperty(e,t.isChecked(),Te)}})}_contextMenuActionsForESD(){const e=[];return this._chartWidget.readOnly()||e.push((0,o.ensureNotNull)(this._createDividendsShow()),(0,o.ensureNotNull)(this._createSplitsShow()),(0,o.ensureNotNull)(this._createEarningsShow())),e}_contextMenuActionsForRollDates(){const e=[];if(!this._chartWidget.readOnly()){const t=this._chartWidget.model().mainSeries().properties().childs().showContinuousContractSwitches;e.push(new c.Action({actionId:"Chart.ToggleVisibility.ContinuousContractSwitch",options:{label:sn,checkable:!0,checked:t.value(),name:"ToggleShowContractSwitches",statName:"ToggleShowContractSwitches",onExecute:e=>this._chartWidget.model().setProperty(t,e.isChecked(),fe)}}))}return e}_contextMenuActionsForFuturesContractExpiration(){const e=[];if(!this._chartWidget.readOnly()){const t=this._chartWidget.model().mainSeries().properties().childs().showFuturesContractExpiration;e.push(new c.Action({actionId:"Chart.ToggleVisibility.ContractExpiration",options:{label:cn,checkable:!0,checked:t.value(),name:"ToggleShowFuturesContractExpirations",statName:"ToggleShowFuturesContractExpirations",onExecute:e=>this._chartWidget.model().setProperty(t,e.isChecked(),Ae)}}))}return e}_contextMenuActionsForisLatestUpdates(){const e=[];if(!this._chartWidget.readOnly()){const t=this._chartWidget.model().mainSeries().properties().childs().showLastNews;e.push(new c.Action({actionId:"Chart.ToggleVisibility.LatestNewsAndMinds",options:{label:dn,checkable:!0,checked:t.value(),name:"ToggleShowLatestUpdates",statName:"ToggleShowLatestUpdates",onExecute:e=>this._chartWidget.model().setProperty(t,e.isChecked(),Ce)}}))}return e}_contextMenuActionsForPublishedTimeline(e){const t=this._chartWidget.actions(),n=[];if(n.push(t.lineHide),window.is_authenticated){const t=e.properties().childs().filter,o=new c.Action({actionId:"Chart.ShowAllIdeas",options:{checked:t.value()===P.PublishedChartsFilter.None,checkable:!0,label:un,name:"ToggleAllIdeas",statName:"ToggleAllIdeas",onExecute:()=>this._chartWidget.model().setProperty(t,P.PublishedChartsFilter.None,_e)}}),i=new c.Action({actionId:"Chart.ShowIdeasOfFollowedUsers",options:{checked:t.value()===P.PublishedChartsFilter.Following,checkable:!0,label:hn,name:"ToggleIdeasOfPeopleAndUser",statName:"ToggleIdeasOfPeopleAndUser",onExecute:()=>this._chartWidget.model().setProperty(t,P.PublishedChartsFilter.Following,Ie)}}),a=new c.Action({actionId:"Chart.ShowMyIdeasOnly",options:{checked:t.value()===P.PublishedChartsFilter.Private,checkable:!0,label:pn,name:"ToggleUserIdeas",statName:"ToggleUserIdeas",onExecute:()=>this._chartWidget.model().setProperty(t,P.PublishedChartsFilter.Private,We)}}) ;n.push(new c.Separator,o,i,a)}return n}_contextMenuActionsForTradingDrawings(e){return e.contextMenuItems()}async _contextMenuActionsForAlertLabel(e,t){if(j.alertsAvailable&&!this._chartWidget.onWidget()){const{getAlertLabelContextMenuActions:o}=await n.e(46745).then(n.bind(n,430836)),i=(0,S.getSettingsProperty)().childs().line.childs().visible,a=`chart_alert_context_menu_${null!=t?t:"line"}`,r="chart_alert";return o({alert:e,chartWidget:this._chartWidget,labelExtendProperty:i,analytics:{actionLabel:a,actionSource:r}})}return[]}_contextMenuActionsForChartEvents(e){const t=[];if(s.enabled("property_pages")){const e=new c.Action({actionId:"Chart.Dialogs.ShowGeneralSettings.EventsAndAlertsTab",options:{label:gn,statName:"Format",onExecute:()=>this._chartWidget.showGeneralChartProperties(p.TabNames.eventsAndAlerts)}});t.push(e)}const n=new c.Action({actionId:"Chart.ToggleVisibility.EconomicEvents",options:{label:mn,name:"HideEvents",statName:"HideEvents",onExecute:()=>this._chartWidget.model().setProperty(e.properties().childs().visible,!1,Pe)}});return t.push(n),t}_createApplyToEntireLayoutCommand(e){if(!this._chartWidget.chartWidgetCollection().applyIndicatorsToAllChartsAvailable())return null;const t=this._chartWidget.model().model();if(e.parentSources().length>0)return null;const n=(0,o.ensureNotNull)(t.paneForSource(e)),i=t.paneForSource(t.mainSeries())===n,a=e instanceof z.StudyCompare&&e.priceScale()===t.mainSeries().priceScale()&&(0,o.ensureNotNull)(e.priceScale()).isPercentage(),r=i?void 0:t.panes().indexOf(n);let l=vn,s=Ne,d="AddStudyToEntireLayout";return(0,X.isActingAsSymbolSource)(e)&&(l=Sn,s=Me,d="AddSymbolToEntireLayout"),(0,h.isStudyStrategy)(e)&&(l=bn,s=Ee,d="AddStrategyToEntireLayout"),e instanceof N.Fundamental&&(l=wn,s=Le,d="AddFundamentalToEntireLayout"),new c.Action({actionId:"Chart.AddIndicatorToAllCharts",options:{label:l,statName:d,onExecute:()=>{const n=(0,o.ensureNotNull)((0,Z.clipboardDataForSources)(t.id(),[e])),l=this._chartWidget.chartWidgetCollection(),c={isOnMainPane:i,asCompare:a,paneIndex:r};l.applyIndicatorToAllCharts(this._chartWidget,n,c,s)}},id:"applyStudyToEntireLayout"})}_createAddIndicatorToFavoritesCommand(e){const t=e.metaInfo();let o;if((0,B.onWidget)()||e instanceof z.StudyCompare||e instanceof q.study_Overlay)return null;if((0,h.isFundamentalStudy)(e)){const e=(0,he.extractPineId)(t.fullId);if(!e)return null;o=()=>n.e(69790).then(n.bind(n,659422)).then((({FavoriteFundamentals:t})=>{const n=t.getInstance();return{label:n.isFav(e)?Nn:Mn,onExecute:()=>n.toggleFavorite(e)}}))}else{const e=t.scriptIdPart||t.id;if(!e)return null;o=()=>n.e(69790).then(n.bind(n,158409)).then((({FavoriteScriptsModel:t})=>{const n=t.getInstance();return{label:n.isFav(e)?Pn:Wn,onExecute:()=>n.toggleFavorite(e)}}))}return new c.Action({actionId:"Chart.Indicator.AddFavorites",id:"addIndicatorToFavorites",optionsLoader:o,options:{statName:"AddIndicatorToFavorites"}})}}},451798:(e,t,n)=>{"use strict";n.d(t,{magnetEnabled:()=>g,magnetMode:()=>m,setIsMagnetEnabled:()=>S,setMagnetMode:()=>v}) ;var o=n(853965),i=n(401580),a=n(80646),r=n(885482),l=n(616117),s=n(237872);const c=new i.WatchedValue(!1),d=new i.WatchedValue(a.MagnetMode.WeakMagnet),u=(0,s.modifierPressed)(),h=(0,s.shiftPressed)();function p(){const e=u.value();if(h.value()&&(r.isToolEditingNow.value()||r.isToolCreatingNow.value()))return void c.setValue(!1);let t,n;if(r.activePointSelectionMode.value()===r.SelectPointMode.Replay)t=n=!1;else{const o=r.tool.value(),i=r.isStudyEditingNow.value()||r.activePointSelectionMode.value()===r.SelectPointMode.Study;t=e&&((0,l.isLineToolName)(o)||r.isToolEditingNow.value()||(0,r.toolIsMeasure)(o)||i),n=(0,r.properties)().childs().magnet.value()}d.setValue(!n&&t?a.MagnetMode.StrongMagnet:(0,r.properties)().childs().magnetMode.value()),c.setValue(t?!n:n)}function g(){return c}function m(){return d}function S(e){(0,o.allowSavingDefaults)(!0),(0,r.properties)().childs().magnet.setValue(e),(0,o.allowSavingDefaults)(!1)}function v(e){(0,o.allowSavingDefaults)(!0),(0,r.properties)().childs().magnetMode.setValue(e),(0,r.properties)().childs().magnet.setValue(!0),(0,o.allowSavingDefaults)(!1)}(0,r.runOnDrawingStateReady)((()=>{(0,r.properties)().childs().magnet.subscribe(null,p),(0,r.properties)().childs().magnetMode.subscribe(null,p),u.subscribe(p),h.subscribe(p),r.tool.subscribe(p),r.isToolEditingNow.subscribe(p),p()}))},466931:(e,t,n)=>{"use strict";n.d(t,{setSupportPortalProblemsHost:()=>i,supportPortalProblemsHost:()=>o});let o="";function i(e){o=e}},845437:e=>{e.exports=''}}]);