"use strict";(self.webpackChunktradingview=self.webpackChunktradingview||[]).push([[62994],{304986:(e,t,n)=>{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)=>{n.r(t),n.d(t,{DEFAULT_THEME:()=>c.DEFAULT_THEME,extractThemeFromModel:()=>N,getCurrentTheme:()=>h,getStdTheme:()=>A,getStdThemeNames:()=>y,getStdThemedValue:()=>f,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(A(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 A(e){return l.getStdChartTheme(e)||{content:void 0}}function f(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=f(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)=>{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)=>{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)=>{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)=>{n.d(t,{initSymbolListService:()=>r});var o=n(564894),i=n(83871),a=n(244842);function r(){ return Promise.all([Promise.all([n.e(62253),n.e(22666),n.e(92108),n.e(92191),n.e(32109),n.e(9817),n.e(34465),n.e(69121),n.e(66639),n.e(30006),n.e(88194),n.e(26855),n.e(40812),n.e(50690),n.e(88087),n.e(29594),n.e(8010),n.e(34654),n.e(62526),n.e(80870),n.e(5069),n.e(65973),n.e(1026)]).then(n.bind(n,818062)),Promise.all([n.e(62253),n.e(22666),n.e(92108),n.e(92191),n.e(32109),n.e(9817),n.e(34465),n.e(69121),n.e(66639),n.e(30006),n.e(88194),n.e(26855),n.e(40812),n.e(50690),n.e(88087),n.e(29594),n.e(8010),n.e(34654),n.e(62526),n.e(80870),n.e(5069),n.e(65973),n.e(1026)]).then(n.bind(n,38506)),Promise.all([n.e(62253),n.e(22666),n.e(92108),n.e(92191),n.e(32109),n.e(9817),n.e(34465),n.e(69121),n.e(66639),n.e(30006),n.e(88194),n.e(26855),n.e(40812),n.e(50690),n.e(88087),n.e(29594),n.e(8010),n.e(34654),n.e(62526),n.e(80870),n.e(5069),n.e(65973),n.e(1026)]).then(n.bind(n,850935)),Promise.all([n.e(62253),n.e(22666),n.e(92108),n.e(92191),n.e(32109),n.e(9817),n.e(34465),n.e(69121),n.e(66639),n.e(30006),n.e(88194),n.e(26855),n.e(40812),n.e(50690),n.e(88087),n.e(29594),n.e(8010),n.e(34654),n.e(62526),n.e(80870),n.e(5069),n.e(65973),n.e(1026)]).then(n.bind(n,244692)),a.enabled("widget")?null:Promise.all([n.e(62253),n.e(22666),n.e(92108),n.e(92191),n.e(32109),n.e(9817),n.e(34465),n.e(69121),n.e(66639),n.e(30006),n.e(88194),n.e(26855),n.e(40812),n.e(50690),n.e(88087),n.e(29594),n.e(8010),n.e(34654),n.e(62526),n.e(80870),n.e(5069),n.e(65973),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)=>{n.d(t,{ActionsProvider:()=>Hn,createActionCopyPrice:()=>Dn,createActionToggleVisibilityDataSources:()=>Rn,createActionTrade:()=>Ln,createChangeIntervalsVisibilitiesAction:()=>kn,createLinesAction:()=>Un,createMTPredictorActions:()=>On,createPasteAction:()=>xn,createSyncDrawingActions:()=>Vn,createVisualOrderAction:()=>Fn,defaultContextMenuOptions:()=>Nn}) ;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(427937),p=n(794349),g=n(461794),m=n(345848),S=n(939243),v=n(772466),b=n(827710),w=n(439016),y=n(406849),T=n(454984),A=n(778737),f=n(674053),C=n(516684),_=n(520533),I=n(922850),W=n(985139),P=n(346825),M=n(709081),N=n(711496),E=n(834075),L=n(125226),x=n(526075),F=n(860037),k=n(500521),D=n(263955),O=n(921692),U=n(184586),V=n(314802),R=n(638456),B=n(453817),H=n(811630),j=n(470316),G=n(104436),Y=n(7195),q=n(943855),z=n(519073),$=n(27005),J=n(568247),K=n(356893),Z=n(713473),Q=n(981107),X=n(167975),ee=n(809796),te=n(885482),ne=n(223699),oe=n(506312),ie=n(440941),ae=n(395098),re=n(793993),le=n(62745),se=n(190973),ce=n(447285),de=n(547871),ue=n(971417),he=n(747971);const pe=(0,i.getLogger)("Chart.ActionsProvider"),ge=new ee.TranslatedString("change visibility",l.t(null,void 0,n(521511))),me=new ee.TranslatedString("pin to scale {label}",l.t(null,void 0,n(156015))),Se=new ee.TranslatedString("pin to right scale",l.t(null,void 0,n(22615))),ve=new ee.TranslatedString("pin to left scale",l.t(null,void 0,n(84018))),be=new ee.TranslatedString("change earnings visibility",l.t(null,void 0,n(88217))),we=new ee.TranslatedString("change dividends visibility",l.t(null,void 0,n(184944))),ye=new ee.TranslatedString("change splits visibility",l.t(null,void 0,n(374488))),Te=new ee.TranslatedString("change continuous contract switch visibility",l.t(null,void 0,n(407017))),Ae=new ee.TranslatedString("change futures contract expiration visibility",l.t(null,void 0,n(628288))),fe=new ee.TranslatedString("change latest news and Minds visibility",l.t(null,void 0,n(819839))),Ce=new ee.TranslatedString("show all ideas",l.t(null,void 0,n(813622))),_e=new ee.TranslatedString("show ideas of followed users",l.t(null,void 0,n(826267))),Ie=new ee.TranslatedString("show my ideas only",l.t(null,void 0,n(740061))),We=new ee.TranslatedString("change events visibility on chart",l.t(null,void 0,n(979574))),Pe=new ee.TranslatedString("add this symbol to entire layout",l.t(null,void 0,n(527982))),Me=new ee.TranslatedString("add this indicator to entire layout",l.t(null,void 0,n(182388))),Ne=new ee.TranslatedString("add this strategy to entire layout",l.t(null,void 0,n(894292))),Ee=new ee.TranslatedString("add this financial metric to entire layout",l.t(null,void 0,n(422856))),Le=new ee.TranslatedString("apply drawing template",l.t(null,void 0,n(349037))),xe=new ee.TranslatedString("lock objects",l.t(null,void 0,n(168163))),Fe=new ee.TranslatedString("unlock objects",l.t(null,void 0,n(766824))),ke=new ee.TranslatedString("change visibility at current interval and above",l.t(null,void 0,n(678422))),De=new ee.TranslatedString("change visibility at current interval and below",l.t(null,void 0,n(249529))),Oe=new ee.TranslatedString("change visibility at current interval",l.t(null,void 0,n(416698))),Ue=new ee.TranslatedString("change visibility at all intervals",l.t(null,void 0,n(666927))),Ve=l.t(null,void 0,n(287085)),Re=(0, X.appendEllipsis)(l.t(null,void 0,n(952302))),Be=l.t(null,void 0,n(581428)),He=l.t(null,void 0,n(831971)),je=l.t(null,void 0,n(311156)),Ge=l.t(null,void 0,n(615682)),Ye=l.t(null,void 0,n(266631)),qe=l.t(null,void 0,n(737422)),ze=l.t(null,void 0,n(805716)),$e=l.t(null,void 0,n(650352)),Je=l.t(null,void 0,n(819263)),Ke=l.t(null,void 0,n(615818)),Ze=l.t(null,void 0,n(705897)),Qe=l.t(null,void 0,n(958976)),Xe=l.t(null,void 0,n(611661)),et=l.t(null,void 0,n(466560)),tt=l.t(null,void 0,n(953958)),nt=l.t(null,void 0,n(734150)),ot=l.t(null,void 0,n(783927)),it=l.t(null,void 0,n(315644)),at=l.t(null,void 0,n(442660)),rt=l.t(null,void 0,n(844788)),lt=l.t(null,void 0,n(770437)),st=l.t(null,void 0,n(571263)),ct=l.t(null,void 0,n(370573)),dt=l.t(null,void 0,n(259560)),ut=l.t(null,void 0,n(514125)),ht=l.t(null,void 0,n(444538)),pt=l.t(null,void 0,n(556948)),gt=l.t(null,void 0,n(920207)),mt=l.t(null,void 0,n(665810)),St=l.t(null,void 0,n(603822)),vt=l.t(null,void 0,n(697324)),bt=l.t(null,void 0,n(500764)),wt=l.t(null,void 0,n(708128)),yt=l.t(null,void 0,n(361201)),Tt=l.t(null,void 0,n(832156)),At=l.t(null,void 0,n(591130)),ft=l.t(null,void 0,n(737680)),Ct=l.t(null,void 0,n(243707)),_t=l.t(null,void 0,n(739065)),It=l.t(null,void 0,n(454727)),Wt=l.t(null,void 0,n(366156)),Pt=l.t(null,void 0,n(976598)),Mt=l.t(null,void 0,n(203485)),Nt=l.t(null,void 0,n(745828)),Et=l.t(null,void 0,n(702899)),Lt=l.t(null,void 0,n(640887)),xt=l.t(null,void 0,n(753387)),Ft=l.t(null,void 0,n(796712)),kt=l.t(null,void 0,n(126354)),Dt=l.t(null,void 0,n(219796)),Ot=l.t(null,void 0,n(559901)),Ut=l.t(null,void 0,n(223221)),Vt=l.t(null,void 0,n(422198)),Rt=l.t(null,void 0,n(127557)),Bt=l.t(null,void 0,n(598486)),Ht=l.t(null,void 0,n(973106)),jt=l.t(null,void 0,n(85964)),Gt=l.t(null,void 0,n(559192)),Yt=l.t(null,void 0,n(583182)),qt=(0,X.appendEllipsis)(l.t(null,void 0,n(592206))),zt=(0,X.appendEllipsis)(l.t(null,void 0,n(303612))),$t=(0,X.appendEllipsis)(l.t(null,void 0,n(389517))),Jt=l.t(null,void 0,n(813345)),Kt=(0,X.appendEllipsis)(l.t(null,void 0,n(309908))),Zt=l.t(null,void 0,n(35216)),Qt=l.t(null,void 0,n(552977)),Xt=l.t(null,void 0,n(419611)),en=l.t(null,void 0,n(738342)),tn=l.t(null,void 0,n(715101)),nn=l.t(null,void 0,n(642284)),on=l.t(null,void 0,n(246771)),an=l.t(null,void 0,n(966263)),rn=l.t(null,void 0,n(830816)),ln=l.t(null,void 0,n(124620)),sn=l.t(null,void 0,n(484813)),cn=l.t(null,void 0,n(772973)),dn=l.t(null,void 0,n(748284)),un=l.t(null,void 0,n(487933)),hn=l.t(null,void 0,n(258669)),pn=(0,X.appendEllipsis)(l.t(null,void 0,n(389517))),gn=l.t(null,void 0,n(308251)),mn=l.t(null,void 0,n(34059)),Sn=l.t(null,void 0,n(364288)),vn=l.t(null,void 0,n(777920)),bn=l.t(null,void 0,n(575669)),wn=l.t(null,void 0,n(608886)),yn=l.t(null,void 0,n(618008)),Tn=l.t(null,void 0,n(733606)),An=(0,X.appendEllipsis)(l.t(null,void 0,n(979758))),fn=(0, X.appendEllipsis)(l.t(null,void 0,n(218001))),Cn=l.t(null,void 0,n(729682)),_n=l.t(null,void 0,n(28851)),In=l.t(null,void 0,n(420366)),Wn=l.t(null,void 0,n(956977)),Pn=l.t(null,void 0,n(601184)),Mn=l.t(null,void 0,n(873436)),Nn={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 En(e){return(0,Q.isActingAsSymbolSource)(e)?e.symbolTitle(u.TitleDisplayTarget.StatusLine,!0,!0):(0,g.clean)(e.title(u.TitleDisplayTarget.StatusLine,!0),!0)}function Ln(e,t,n){if(e.model().isInReplay())return null;const o=e.model().mainSeries();if(o.isConvertedToOtherCurrency()||o.isConvertedToOtherUnit())return null;const i=new c.Action({actionId:"Trading.TradeFromChart",options:{},optionsLoader:()=>{const t=new Promise((async(t,o)=>{const i=(0,w.tradingService)();if(null===i||0===(await i.brokersMetainfo()).length)return void t({label:Ve,disabled:!0});const a=e.model().mainSeries();let r;n&&(r=n.localY),(0,y.createTradeContext)(a,r).then((e=>{try{return i.chartContextMenuActions(e,{hideNotExecutableAction:!0})}catch(e){return pe.logError(e.message),[]}})).then((e=>{0!==e.length?t({name:"trade",label:Ve,subItems:e,statName:"Trading"}):t({label:Ve,disabled:!0})})).catch((()=>{o("Unable to get Trade Context")}))}));return(0,T.makeTimeLimited)(t,5e3,"Action trade not received")}});return i}function xn(e,t){return!t.isEmpty()&&s.enabled("datasource_copypaste")?new he.ActionWithStandardIcon({actionId:"Chart.Clipboard.PasteSource",options:{label:Cn.trim(),shortcutHint:(0,j.humanReadableHash)(j.Modifiers.Mod+86),statName:"Paste",onExecute:()=>e.chartWidgetCollection().clipboard.uiRequestPaste(t)}}):null}function Fn(e,t){const n=e.model(),o=n.availableZOrderOperations(t),i=[new he.ActionWithStandardIcon({actionId:"Chart.Source.VisualOrder.BringToFront",options:{label:kt,statName:"BringToFront",disabled:!o.bringToFrontEnabled,onExecute:()=>n.bringToFront(t)}}),new he.ActionWithStandardIcon({actionId:"Chart.Source.VisualOrder.SendToBack",options:{label:Dt,statName:"SendToBack",disabled:!o.sendToBackEnabled,onExecute:()=>n.sendToBack(t)}}),new he.ActionWithStandardIcon({actionId:"Chart.Source.VisualOrder.BringForward",options:{label:Ot,statName:"BringForward",disabled:!o.bringForwardEnabled,onExecute:()=>n.bringForward(t)}}),new he.ActionWithStandardIcon({actionId:"Chart.Source.VisualOrder.SendBackward",options:{label:Ut,statName:"SendBackward",disabled:!o.sendBackwardEnabled,onExecute:()=>n.sendBackward(t)}})];return new he.ActionWithStandardIcon({actionId:"Chart.Source.VisualOrder",options:{label:Vt,iconId:"Chart.VisualOrder",statName:"VisualOrder",subItems:i}})}function kn(e,t){const n=e.model(),o=(e,o)=>{const i=ne.Interval.parse(n.mainSeries().interval()),a=(0,ae.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 he.ActionWithStandardIcon({actionId:"Chart.Source.IntervalsVisibility.CurrentAndAbove",options:{label:Bt,statName:"currentAndAboveIntervals",onExecute:()=>o(3,ke)}}),new he.ActionWithStandardIcon({actionId:"Chart.Source.IntervalsVisibility.CurrentAndBelow",options:{label:Ht,statName:"currentAndBelowIntervals",onExecute:()=>o(2,De)}}),new he.ActionWithStandardIcon({actionId:"Chart.Source.IntervalsVisibility.Current",options:{label:jt,statName:"currentInterval",onExecute:()=>o(1,Oe)}}),new he.ActionWithStandardIcon({actionId:"Chart.Source.IntervalsVisibility.All",options:{label:Gt,statName:"allIntervals",onExecute:()=>o(0,Ue)}})];return new he.ActionWithStandardIcon({actionId:"Chart.Source.IntervalsVisibility",options:{label:Rt,statName:"IntervalsVisibility",subItems:i}})}function Dn(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 he.ActionWithStandardIcon({actionId:"Chart.Clipboard.CopyPrice",options:{label:`${_n} ${s}`,statName:"CopyPrice",onExecute:()=>(0,re.getClipboard)().writeText(s)}})}function On(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 te.tool.setValue(r)}}});return new c.Action({actionId:"Chart.MtPredictor.Actions",options:{label:je,subItems:[a(Ge,"LineStudyMtpRiskReward",!1,"Chart.MtPredictor.RiskReward"),a(Ye,"LineStudyMtpDecisionPoint",!0,"Chart.MtPredictor.DecisionPoint"),a(qe,"LineStudyMtpAnalysis",!0,"Chart.MtPredictor.Analysis"),new c.Action({actionId:"Chart.MtPredictor.ElliotWave",options:{label:ze,subItems:[a($e,"LineStudyMtpElliotWaveMain",!0,"Chart.MtPredictor.ElliotWave.Main"),a(Je,"LineStudyMtpElliotWaveMajor",!0,"Chart.MtPredictor.ElliotWave.Major"),a(Ke,"LineStudyMtpElliotWaveMinor",!0,"Chart.MtPredictor.ElliotWave.Minor")]}}),new c.Action({ actionId:"Chart.MtPredictor.ApplyWPTUpWave",options:{label:Ze,subItems:[a(Qe,"LineStudyMtpUpWave1OrA",!1,"Chart.MtPredictor.ApplyWPTUpWave.1OrA"),a(Xe,"LineStudyMtpUpWave2OrB",!1,"Chart.MtPredictor.ApplyWPTUpWave.1OrB"),a(et,"LineStudyMtpUpWaveC",!1,"Chart.MtPredictor.ApplyWPTUpWave.C"),a(tt,"LineStudyMtpUpWave3",!1,"Chart.MtPredictor.ApplyWPTUpWave.3"),a(nt,"LineStudyMtpUpWave4",!1,"Chart.MtPredictor.ApplyWPTUpWave.4"),a(ot,"LineStudyMtpUpWave5",!1,"Chart.MtPredictor.ApplyWPTUpWave.5")]}}),new c.Action({actionId:"Chart.MtPredictor.ApplyWPTDownWave",options:{label:it,subItems:[a(at,"LineStudyMtpDownWave1OrA",!1,"Chart.MtPredictor.ApplyWPTDownWave.1OrA"),a(rt,"LineStudyMtpDownWave2OrB",!1,"Chart.MtPredictor.ApplyWPTDownWave.1OrB"),a(lt,"LineStudyMtpDownWaveC",!1,"Chart.MtPredictor.ApplyWPTDownWave.C"),a(st,"LineStudyMtpDownWave3",!1,"Chart.MtPredictor.ApplyWPTDownWave.3"),a(ct,"LineStudyMtpDownWave4",!1,"Chart.MtPredictor.ApplyWPTDownWave.4"),a(dt,"LineStudyMtpDownWave5",!1,"Chart.MtPredictor.ApplyWPTDownWave.5")]}})]}})}function Un(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 he.ActionWithStandardIcon({actionId:"Chart.Lines",options:{label:Yt,statName:"Lines",subItems:n}})}function Vn(e,t){const n=[];{if(te.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,L.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:wn,statName:"NoSyncDrawing",checkable:!0,checked:0===o,onExecute:e=>{e.isChecked()&&a.shareLineTools(t,0)}}}),new c.Action({actionId:"Chart.LineTool.SyncInLayout",options:{label:yn,statName:"SyncDrawingInLayout",checkable:!0,checked:1===o,onExecute:e=>{e.isChecked()&&a.shareLineTools(t,1)}}}),new c.Action({actionId:"Chart.LineTool.SyncGlobally",options:{label:Tn,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 he.ActionWithStandardIcon({actionId:"Chart.LineTool.NoSync",options:{label:wn,statName:"NoSyncDrawing",checkable:!0,checked:!e,onExecute:e=>{e.isChecked()&&o().unlinkSelectedLine()}}}),new he.ActionWithStandardIcon({actionId:"Chart.LineTool.SyncInLayout",options:{label:yn,statName:"SyncDrawingInLayout",checkable:!0,checked:e,onExecute:e=>{e.isChecked()&&o().copyLineToOtherCharts()}}}))}}return n}function Rn(e,t){const n=t[0].properties().visible.value(),o=n?He:Be,i=n?"Chart.Hide":"Chart.ShowObject",a=n?"Chart.SelectedObject.Hide":"Chart.SelectedObject.Show" ;return new he.ActionWithStandardIcon({actionId:a,options:{checkable:!0,statName:"ToggleVisibilitySelectedObject",label:o,iconId:i,onExecute:()=>{const o=t.every(Z.isLineTool)&&ie.lineToolsDoNotAffectChartInvalidation,i=e.model();i.withMacro(ge,(()=>{t.forEach((e=>{i.setProperty(e.properties().visible,!n,ge)}))}),o)}}})}function Bn(){var e,t;return!(0,R.onWidget)()&&!(0,V.isOnMobileAppPage)("any")&&!!(null===(t=null===(e=window.widgetbar)||void 0===e?void 0:e.layout)||void 0===t?void 0:t.canOpen())}class Hn{constructor(e,t){this._chartWidget=e,this._options=(0,r.merge)((0,r.clone)(Nn),t||{})}async contextMenuActionsForSources(e,t,n,o){const i=e[0],a=this._options,r=[];if(i===this._chartWidget.model().mainSeries()&&a.mainSeries)r.push(...await this._contextMenuActionsForSeries(i,t));else if((0,h.isESDStudy)(i)&&a.esdStudies)r.push(...this._contextMenuActionsForESD());else if((0,h.isRollDatesStudy)(i))r.push(...this._contextMenuActionsForRollDates());else if((0,O.isFuturesContractExpiration)(i))r.push(...this._contextMenuActionsForFuturesContractExpiration());else if((0,U.isLatestUpdatesSource)(i))r.push(...this._contextMenuActionsForisLatestUpdates());else if((0,h.isStudy)(i)&&a.studies)r.push(...await this._contextMenuActionsForStudy(i,t));else if(i instanceof I.PublishedChartsTimeline&&a.publishedCharts)r.push(...this._contextMenuActionsForPublishedTimeline(i));else if((i instanceof A.LineToolOrder||i instanceof f.LineToolPosition)&&a.ordersAndPositions)r.push(...this._contextMenuActionsForTradingDrawings(i));else if((0,P.isAlertLabel)(i)&&i.alert().id().value()&&a.alerts)r.push(...await this._contextMenuActionsForAlertLabel(i.alert(),n));else if((0,Z.isLineTool)(i)&&a.lineTools){const t=e.filter(Z.isLineTool);r.push(...await this._contextMenuActionsForLineTool(t))}else(function(e){return e.name()===ce.ChartEventsSourceId.Value})(i)&&a.chartEvents&&r.push(...this._contextMenuActionsForChartEvents(i));return r.length&&(null==o?void 0:o.length)&&r.push(new c.Separator),r.push(...null!=o?o:[]),r}_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=_t.format({label:s}),u={"left-needname":c,"left-dontneedname":Wt,"right-needname":c,"right-dontneedname":Pt,"overlay-needname":It,"overlay-dontneedname":It}[a+"-"+l];return new he.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(le.isTimeOrPriceNotHiddenInput);return 0===o.length?null:new he.ActionWithStandardIcon({actionId:"Chart.Source.ResetInputPoints",options:{label:fn,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 se.default({inputs:a}),l=await Promise.all([n.e(78596),n.e(11165),n.e(44335),n.e(88601),n.e(99410),n.e(62253),n.e(22666),n.e(92108),n.e(5993),n.e(92191),n.e(32109),n.e(9817),n.e(4015),n.e(53842),n.e(34465),n.e(69121),n.e(93502),n.e(66639),n.e(30006),n.e(88194),n.e(38669),n.e(5145),n.e(35649),n.e(72639),n.e(36884),n.e(89842),n.e(25190),n.e(68992),n.e(10990),n.e(81643),n.e(13152),n.e(26855),n.e(91033),n.e(84281),n.e(58056),n.e(21625),n.e(8740),n.e(61631),n.e(90684),n.e(40866),n.e(99916),n.e(40812),n.e(73954),n.e(36956),n.e(77807),n.e(56388),n.e(9227),n.e(89434),n.e(24215),n.e(58289),n.e(77474),n.e(18511),n.e(21895),n.e(22333),n.e(54474),n.e(15886),n.e(36740),n.e(27074),n.e(71762),n.e(50690),n.e(30979),n.e(88087),n.e(111),n.e(80870),n.e(46513),n.e(49829),n.e(32046),n.e(59703),n.e(99144),n.e(12716),n.e(48037),n.e(36403),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 B.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:vt,sided:ft},right:{labelled:vt,sided:Ct}},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 he.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 he.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 he.ActionWithStandardIcon({actionId:"Chart.Source.MoveToNoScale",options:{checkable:!0,checked:n.isOverlay(e),label:Mt,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:ut,sided:ht},unchecked:{labelled:pt,sided:gt}},visible:{checked:{labelled:mt,sided:St},unchecked:{labelled:vt,sided:bt}}},left:{hidden:{checked:{labelled:ut,sided:wt},unchecked:{labelled:pt,sided:yt}},visible:{checked:{labelled:mt,sided:Tt},unchecked:{labelled:vt,sided:At}}}},g={right:Se,left:ve},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?me.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 he.ActionWithStandardIcon({actionId:"Chart.Source.MergeUp",options:{label:Et,statName:"MergeUp",onExecute:()=>t.mergeSourceUp(e)}}):null}_createActionUnmergeUp(e){const t=this._chartWidget.model();return t.model().isUnmergeAvailableForSource(e)?new he.ActionWithStandardIcon({actionId:"Chart.Source.UnmergeUp",options:{label:Lt,statName:"UnmergeUp",onExecute:()=>t.unmergeSourceUp(e)}}):null}_createActionMergeDown(e){const t=this._chartWidget.model();return t.model().isMergeDownAvailableForSource(e)?new he.ActionWithStandardIcon({actionId:"Chart.Source.MergeDown",options:{label:xt,statName:"MergeDown",onExecute:()=>t.mergeSourceDown(e)}}):null}_createActionUnmergeDown(e){const t=this._chartWidget.model();return t.model().isUnmergeAvailableForSource(e)?new he.ActionWithStandardIcon({actionId:"Chart.Source.UnmergeDown",options:{label:Ft, 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 he.ActionWithStandardIcon({actionId:"Chart.Source.MoveToPane",options:{label:Nt,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(Rn(this._chartWidget,[e])),i.push(new c.Separator),i.push(this._createActionScale(e));else{if(e.alertCreationAvailable().value()){const t=(await(0,de.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=Ln(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),Bn()&&i.push(this._chartWidget.actions().showDataWindow);const t=a.mainSeries().symbolInfo();if(l.showFinancials&&null!==t&&(0,N.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=Dn(r,d),t=xn(this._chartWidget,r);(e||t)&&(e&&i.push(e),t&&i.push(t),i.push(new c.Separator))}i.push(Fn(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(Rn(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)(On(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 he.ActionWithStandardIcon({actionId:"Chart.Indicator.ApplyChildIndicator",options:{label:qt.format({studyTitle:En(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,z.hasCryptoTypespec)(t.typespecs||[]))return new he.ActionWithStandardIcon({actionId:"Chart.Indicator.ApplyFinancials",options:{label:zt.format({instrumentName:En(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 he.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,J.showSymbolInfoDialog)(o)}}})}_createActionShowProperties(e){return new he.ActionWithStandardIcon({actionId:"Chart.Indicator.ShowSettingsDialog",options:{label:$t,iconId:"Settings",statName:"EditSelectedObject",onExecute:()=>this._chartWidget.showSourceProperties(e)}})}async _contextMenuActionsForStudy(e,t){const o=this._chartWidget.actions(),i=t&&"localY"in t?t.localY:void 0,a=[];if(!e.userEditEnabled())return a;if(this._chartWidget.readOnly())a.push(Rn(this._chartWidget,[e])),a.push(new c.Separator),(0,v.isNonSeriesStudy)(e)||a.push(this._createActionScale(e));else{if(e.alertCreationAvailable().value()){const t=(await(0,de.getAlertsChartActionCreators)()).createAlert(this._chartWidget,{series:e,localY:i});null!==t&&a.push(t)}if(s.enabled("study_on_study")&&e.canHaveChildren()&&a.push(this._createActionAddChildStudy(e)),(e instanceof q.StudyCompare||e instanceof Y.study_Overlay)&&this._options.fundamentals){const t=this._createActionAddFundamentals(e);null!==t&&a.push(t)}const t=this._createApplyToEntireLayoutCommand(e);null!==t&&a.push(t);const r=this._createAddIndicatorToFavoritesCommand(e);if(r&&a.push(r),a.length>0&&!(a[a.length-1]instanceof c.Separator)&&a.push(new c.Separator),s.enabled("symbol_info")&&(e instanceof q.StudyCompare||e instanceof Y.study_Overlay)&&null!==e.symbolInfo()&&(a.push(this._createActionShowSymbolInfoDialog(e,this._chartWidget.model().model().availableUnits())),a.push(new c.Separator)),a.push(Fn(this._chartWidget,[e])),a.push(kn(this._chartWidget,[e])),!(0,v.isNonSeriesStudy)(e)){const t=this._createActionMove(e);null!==t&&a.push(t),a.push(this._createActionScale(e))}a.push(new c.Separator);const d=e.metaInfo();if(!(0,R.onWidget)()){const{scriptIdPart:t,id:o,pine:i}=d;let r;if((0,h.isFundamentalStudy)(e)){const e=(0,oe.getFundamentalIdFromScriptIdPart)(d.scriptIdPart);if(e){const{default:t}=await n.e(54875).then(n.t.bind(n,384898,19));e in t&&(r=()=>(0,F.showSupportDialog)({solutionId:t[e]}))}}else if(!i||x.StudyMetaInfo.hasStdSuffix(t)){const{default:e}=await n.e(95937).then(n.t.bind(n,676006,19));(t in e||o in e)&&(r=()=>(0,F.showSupportDialog)({solutionId:e[t]||e[o]})) }else x.StudyMetaInfo.hasPubSuffix(t)&&(r=async()=>{try{const{chartImageUrl:n}=await(0,C.requestScriptInfo)(t);(0,k.pushChartPage)({chartId:n,chartName:e.title(u.TitleDisplayTarget.StatusLine)})}catch(e){(0,D.showScriptInfoErrorNoticeDialog)()}});if(void 0!==r){const t=(0,h.isFundamentalStudy)(e)?(0,X.appendEllipsis)(l.t(null,void 0,n(213563))):d.pine?(0,X.appendEllipsis)(l.t(null,void 0,n(907859))):(0,X.appendEllipsis)(l.t(null,void 0,n(111741)));a.push(new c.Action({actionId:"Chart.Indicator.About",options:{label:t,statName:"OpenSelectedObjectAbout",onExecute:r}}))}}if(!(0,h.isFundamentalStudy)(e)&&d.pine&&o.viewSourceCode){const{scriptIdPart:t,pine:{version:n}}=d;a.push(o.viewSourceCode);const i=this._createActionResetInputPoints(e);i&&a.push(i),a.push(new c.Separator),o.viewSourceCode.update({disabled:!1}),(0,_.isAuthToGetPineSourceCode)(t,n).then((e=>{e||o.viewSourceCode.update({disabled:!0})})).catch((e=>{pe.logError("Failed isAuthToGetPineSourceCode, reason: "+e)}))}if(window.is_authenticated&&(0,$.isUserStudyWithLogs)(e)&&(a.push(new c.Action({actionId:"Chart.Indicator.PineLogs",options:{label:l.t(null,void 0,n(249313)),statName:"PineLogs",onExecute:()=>{(0,$.openPineLogsInRightPanel)(e)}}})),a.push(new c.Separator)),e.copiable()){const t=new he.ActionWithStandardIcon({actionId:"Chart.Clipboard.CopySource",options:{label:Zt,shortcutHint:(0,j.humanReadableHash)(j.Modifiers.Mod+67),statName:"Copy",onExecute:()=>{this._chartWidget.chartWidgetCollection().clipboard.uiRequestCopy([e])}}});a.push(t)}a.push(Rn(this._chartWidget,[e])),a.push(o.studyRemove);const p=!this._chartWidget.onWidget()&&this._options.objectTree&&o.paneObjectTree,g=Bn();(p||g)&&(a.push(new c.Separator),p&&a.push(o.paneObjectTree),g&&a.push(this._chartWidget.actions().showDataWindow)),a.push(new c.Separator),s.enabled("property_pages")&&new b.MetaInfoHelper(d).hasUserEditableOptions()&&a.push(this._createActionShowProperties(e)),a[a.length-1]instanceof c.Separator&&a.pop()}return a}_createLineToolTemplateAction(e){{const t=this._chartWidget.model(),o=n=>{t.applyLineToolTemplate(e,n,Le)};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 he.ActionWithStandardIcon({actionId:"Chart.LineTool.Templates.SaveAs",options:{label:Kt,statName:"SaveAs",onExecute:()=>{a.showSaveDialog((t=>{const n=JSON.stringify(e.template());a.saveTemplate(t,n)}))}}});r.push(t)}const l=new he.ActionWithStandardIcon({actionId:"Chart.LineTool.Templates.ApplyDefaults",options:{label:Jt,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 he.ActionWithStandardIcon({ actionId:"Chart.LineTool.Templates.Apply",options:{label:e,statName:"ApplyTemplate",onExecute:()=>a.loadTemplate(e),toolbox:{type:G.ToolboxType.Delete,action:()=>{a.deleteAction(e)}},showToolboxOnHover:!0}});r.push(n)}))}),(e=>{pe.logWarn(e)})).then((()=>{e({label:Xt,statName:"Template",subItems:r})}))}))}})}}_createActionToggleLockLineTools(e){const t=e[0].properties().frozen.value(),n=t?tn:nn;return new he.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?Fe:xe,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(Fn(this._chartWidget,e))},l=()=>{t.push(kn(this._chartWidget,e))},d=()=>{const n=e.filter((e=>e.cloneable()));if(n.length>0){const e=new he.ActionWithStandardIcon({actionId:"Chart.LineTool.Clone",options:{label:Qt,iconId:"Chart.Clone",shortcutHint:(0,j.humanReadableModifiers)(j.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:Zt,shortcutHint:(0,j.humanReadableHash)(j.Modifiers.Mod+67),statName:"Copy",onExecute:()=>this._chartWidget.chartWidgetCollection().clipboard.uiRequestCopy(n)},id:"Copy"});t.push(e)}return!!n.length},p=()=>{const n=Vn(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,w.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,w.tradingService)());return new he.ActionWithStandardIcon({actionId:"Chart.LineTool.CreateLimitOrderFromState",options:{label:Re,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,w.tradingService)());return new c.Action({actionId:"Trading.ShowSelectBrokerPanel",options:{label:Re,statName:"ShowSelectBrokerNotification",onExecute:()=>{var t;(0, E.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 he.ActionWithStandardIcon({actionId:"Chart.ScrollToLineTool",options:{label:en.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(Rn(this._chartWidget,[o]));else if(o.userEditEnabled()){if(H.alertsAvailable&&!this._chartWidget.onWidget()){const e=await(0,de.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(Rn(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(Rn(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:on,checkable:!0,checked:e.value(),name:"ToggleShowEarnings",statName:"ToggleShowEarnings",onExecute:t=>this._chartWidget.model().setProperty(e,t.isChecked(),be)}})}_createDividendsShow(){const e=this._chartWidget.model().mainSeries().properties().childs().esdShowDividends;return new c.Action({actionId:"Chart.ToggleVisibility.Dividends",options:{label:an,checkable:!0,checked:e.value(),name:"ToggleShowDividends",statName:"ToggleShowDividends",onExecute:t=>this._chartWidget.model().setProperty(e,t.isChecked(),we)}})}_createSplitsShow(){const e=this._chartWidget.model().mainSeries().properties().childs().esdShowSplits;return new c.Action({actionId:"Chart.ToggleVisibility.Splits",options:{checkable:!0,label:rn, checked:e.value(),name:"ToggleShowSplits",statName:"ToggleShowSplits",onExecute:t=>this._chartWidget.model().setProperty(e,t.isChecked(),ye)}})}_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:ln,checkable:!0,checked:t.value(),name:"ToggleShowContractSwitches",statName:"ToggleShowContractSwitches",onExecute:e=>this._chartWidget.model().setProperty(t,e.isChecked(),Te)}}))}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:sn,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:cn,checkable:!0,checked:t.value(),name:"ToggleShowLatestUpdates",statName:"ToggleShowLatestUpdates",onExecute:e=>this._chartWidget.model().setProperty(t,e.isChecked(),fe)}}))}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()===W.PublishedChartsFilter.None,checkable:!0,label:dn,name:"ToggleAllIdeas",statName:"ToggleAllIdeas",onExecute:()=>this._chartWidget.model().setProperty(t,W.PublishedChartsFilter.None,Ce)}}),i=new c.Action({actionId:"Chart.ShowIdeasOfFollowedUsers",options:{checked:t.value()===W.PublishedChartsFilter.Following,checkable:!0,label:un,name:"ToggleIdeasOfPeopleAndUser",statName:"ToggleIdeasOfPeopleAndUser",onExecute:()=>this._chartWidget.model().setProperty(t,W.PublishedChartsFilter.Following,_e)}}),a=new c.Action({actionId:"Chart.ShowMyIdeasOnly",options:{checked:t.value()===W.PublishedChartsFilter.Private,checkable:!0,label:hn,name:"ToggleUserIdeas",statName:"ToggleUserIdeas",onExecute:()=>this._chartWidget.model().setProperty(t,W.PublishedChartsFilter.Private,Ie)}});n.push(new c.Separator,o,i,a)}return n}_contextMenuActionsForTradingDrawings(e){return e.contextMenuItems()}async _contextMenuActionsForAlertLabel(e,t){if(H.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:pn,statName:"Format",onExecute:()=>this._chartWidget.showGeneralChartProperties(p.TabNames.eventsAndAlerts)}});t.push(e)}const n=new c.Action({actionId:"Chart.ToggleVisibility.EconomicEvents",options:{label:gn,name:"HideEvents",statName:"HideEvents",onExecute:()=>this._chartWidget.model().setProperty(e.properties().childs().visible,!1,We)}});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 q.StudyCompare&&e.priceScale()===t.mainSeries().priceScale()&&(0,o.ensureNotNull)(e.priceScale()).isPercentage(),r=i?void 0:t.panes().indexOf(n);let l=Sn,s=Me,d="AddStudyToEntireLayout";return(0,Q.isActingAsSymbolSource)(e)&&(l=mn,s=Pe,d="AddSymbolToEntireLayout"),(0,h.isStudyStrategy)(e)&&(l=vn,s=Ne,d="AddStrategyToEntireLayout"),e instanceof M.Fundamental&&(l=bn,s=Ee,d="AddFundamentalToEntireLayout"),new c.Action({actionId:"Chart.AddIndicatorToAllCharts",options:{label:l,statName:d,onExecute:()=>{const n=(0,o.ensureNotNull)((0,K.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,R.onWidget)()||e instanceof q.StudyCompare||e instanceof Y.study_Overlay)return null;if((0,h.isFundamentalStudy)(e)){const e=(0,ue.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)?Mn:Pn,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)?Wn:In,onExecute:()=>n.toggleFavorite(e)}}))}return new c.Action({actionId:"Chart.Indicator.AddFavorites",id:"addIndicatorToFavorites",optionsLoader:o,options:{statName:"AddIndicatorToFavorites"}})}}},451798:(e,t,n)=>{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.saveDefaultProperties)(!0),(0,r.properties)().childs().magnet.setValue(e),(0,o.saveDefaultProperties)(!1)}function v(e){(0,o.saveDefaultProperties)(!0),(0,r.properties)().childs().magnetMode.setValue(e),(0,r.properties)().childs().magnet.setValue(!0),(0,o.saveDefaultProperties)(!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)=>{n.d(t,{setSupportPortalProblemsHost:()=>i,supportPortalProblemsHost:()=>o});let o="";function i(e){o=e}}}]);