"use strict";(self.webpackChunktradingview=self.webpackChunktradingview||[]).push([[7539],{52973:(e,t,s)=>{s.r(t),s.d(t,{Sessions:()=>_});var i=s(50151),r=s(19844),l=s(19136),o=s(45530),a=s(67563),n=s(66786),h=s(37103),c=s(40472),u=s(72972);const d=new a.PriceFormatter;class _ extends n.CustomSourceBase{constructor(e,t,s,i){super(e,t),this._studySource=null,this._paneViews=[],this._metaInfo=null,this._destroyed=!1,this._isStarted=!1,this._loadedGraphics=null,this._doubleClickHandler=i,this._properties=s,this._properties.subscribe(this,this._onPropertiesChanged),this._requestAndProcessMetaInfo(),t.timeScale().onReset().subscribe(this,this._clearData),t.timeScale().logicalRangeChanged().subscribe(this,this.updateAllViews.bind(this,(0,c.viewportChangeEvent)())),t.mainSeries().properties().childs().interval.subscribe(this,this._processHibernate)}start(){this._isStarted=!0,this._processHibernate()}restart(){this._clearData(),h.enabled("stop_study_on_restart")&&this.stop(),this.start()}isStarted(){return this._isStarted}stop(){this._isStarted=!1,null!==this._studySource&&this._studySource.stop()}isHoveredEnabled(){return!1}paneViews(e){return this._paneViews}updateAllViews(e){this._paneViews.forEach((t=>t.update(e)))}updateViewsForPane(e,t){this.updateAllViews(t)}destroy(){this._destroyed=!0,null!==this._studySource&&(this._studySource.dataCleared().unsubscribeAll(this),this._studySource.dataUpdated().unsubscribeAll(this),this._studySource.destroy(),this._studySource=null),this._model.timeScale().logicalRangeChanged().unsubscribeAll(this),this._model.timeScale().onReset().unsubscribeAll(this),this._model.mainSeries().properties().childs().interval.unsubscribeAll(this),this._properties.unsubscribeAll(this)}series(){return this._model.mainSeries()}priceScale(){return this.series().priceScale()}graphics(){return this._loadedGraphics||(0,i.ensureNotNull)(this._studySource).graphics()}valueAt(e,t){return null}properties(){return this._properties}graphicsInfo(){return(0,i.ensureNotNull)(this._metaInfo).graphics}firstValue(e){return this._model.mainSeries().firstValue()}formatter(){return d}stateData(){return null!==this._metaInfo?{graphics:(0,o.saveStudyGraphics)(this.graphics(),this._model.timeScale().visibleBarsStrictRange()),metaInfo:this._metaInfo.state()}:null}restoreStateData(e){void 0!==e&&(this._loadStudyGraphics(e.graphics),this._setMetaInfo(new r.StudyMetaInfo(e.metaInfo)),this._createPaneViews())}metaInfo(){return(0,i.ensureNotNull)(this._metaInfo)}async _requestAndProcessMetaInfo(){if(this._model.isSnapshot())return;const e=await(0,u.studyMetaInfoRepository)().findById({type:"java",studyId:"Sessions@tv-basicstudies"});this._destroyed||null===this._loadedGraphics&&(this._setMetaInfo(e),null!==this._metaInfo&&(this._studySource=new l.StudyDataSource(this._model.chartApi(),this._model.mainSeries().seriesSource(),"sessions_",this._metaInfo),this._createPaneViews(),this._studySource.dataCleared().subscribe(this,this.updateAllViews.bind(this,(0,c.sourceChangeEvent)(this.id()))), this._studySource.dataUpdated().subscribe(this,this.updateAllViews.bind(this,(0,c.sourceChangeEvent)(this.id()))),this._studySource.setInputs({}),this._processHibernate()))}_loadStudyGraphics(e){const t=e.backgrounds;if(void 0!==t){const e=t.findIndex((e=>"inSession"===e.styleId));-1!==e&&t.splice(e,1)}this._loadedGraphics=(0,o.loadStudyGraphics)(e)}_setMetaInfo(e){const t=e.graphics.backgrounds;void 0!==t&&void 0!==t.inSession&&delete t.inSession,this._metaInfo=e}_clearData(){null!==this._studySource&&this._studySource.clearData()}_createPaneViews(){const e={doubleClickHandler:this._doubleClickHandler};(0,o.createGraphicsPaneViews)(this,this._model,e).then((e=>{this._paneViews=e.regularPaneViews,this._model.lightUpdate()}))}_onPropertiesChanged(){this._processHibernate(),this.updateAllViews((0,c.sourceChangeEvent)(this.id()))}_processHibernate(){if(null!==this._studySource){const e=this._canBeHibernated(),t=this._isHibernated(),s=this._studySource.isStarted();!t&&e&&s?this._studySource.stop():!t||e||s||this._studySource.start()}}_canBeHibernated(){if(this._model.mainSeries().isDWM())return!0;const e=this._properties.childs().sessionHighlight.childs(),{preMarket:t,postMarket:s,electronic:i,outOfSession:r}=e.backgrounds.childs(),{sessBreaks:l}=e.vertlines.childs(),o=t.childs().available.value()&&t.childs().visible.value()||s.childs().available.value()&&s.childs().visible.value()||i.childs().available.value()&&i.childs().visible.value()||r.childs().available.value()&&r.childs().visible.value(),a=l.childs().available.value()&&l.childs().visible.value();return!o&&!a}_isHibernated(){return this._isStarted&&(null===this._studySource||!this._studySource.isStarted())}}},96664:(e,t,s)=>{s.r(t),s.d(t,{study_PivotPointsStandard:()=>B});var i=s(50151),r=s(11485);class l extends r.Study{isLinkedToSeries(){return!0}clearData(){this._customData=null,this._indexes=null}restoreData(e,t,s){super.restoreData(e),this._customData=t,this._indexes=s}state(e){const t=super.state(e);return e&&(t.nonSeriesData=this._customData,t.indexes=this._indexes),t}customData(){return this._customData}_setPaneViews(e){this._paneViews=e,this.model().lightUpdate()}_onDataUpdated(e,t,s){null!==t&&(t.indexes_replace?((0,i.assert)("nochange"!==s),this._indexes=s):(this._customData=t.data,"nochange"!==s&&(this._indexes=s))),super._onDataUpdated(e,t,s)}}var o=s(27714),a=s(33350);class n{constructor(e,t,s,i){this._priceAxisFontSize=11,this._prices=[],this._labelWidth=0,this._pixelRatioParams=e,this._recreateCanvasAndContext((0,o.size)({width:0,height:0})),this.reset({font:t,fontSize:s,backColors:i})}destroy(){delete this._canvas,delete this._cache}canvas(){return this._canvas}reset(e){this._renderParams=e,this._prices=[],this._cache.font=e.fontSize+"px "+e.font,this._labelWidth=["P","S1","R1","S2","R2","S3","R3","S4","R4","S5","R5","/"].reduce(((e,t)=>{const s=this._cache.measureText(t).width;return Math.max(s,e)}),0)}rowHeight(){return this._priceAxisFontSize+4}labelRectByIndex(e){return{left:0,top:Math.round(this._topByIndex(e)), width:Math.round(this._labelWidth+4),height:Math.round(this._renderParams.fontSize+8)}}setPrices(e){let t=!1;const s=(e,t)=>{const s=void 0===e,r=void 0===t;return(!s&&!r||s===r)&&(0,i.ensureDefined)(e).formatted===(0,i.ensureDefined)(t).formatted};if(e.length!==this._prices.length)t=!0;else for(let i=0;i{this._cache.translate(.5,.5),this._cache.font=this._renderParams.fontSize+"px "+this._renderParams.font,this._cache.textBaseline="middle";for(let e=0;e=l||h)){this._visiblePivots.add(o[e]),this._prices=[];for(let s=0;s=t.left&&e.x<=t.left+t.width&&e.y>=t.top&&e.y<=t.top+t.height)return new x.HitTestResult(x.HitTarget.Regular);return null}_drawImpl(e){const t=this._cacheProvider(e),{horizontalPixelRatio:s,verticalPixelRatio:i,context:r}=e;this._drawRects=[];const l=e=>{const l=t.labelRectByIndex(e),o={left:Math.round(this._point.x-l.width+a),top:Math.round(this._point.y-l.height/2),width:l.width,height:l.height};return r.drawImage(t.canvas(),Math.round(l.left*s),Math.round(l.top*i),l.width*s,l.height*i,Math.round(o.left*s),Math.round(o.top*i),o.width*s,o.height*i),this._drawRects.push(o),l.width},o=this._label.split("/");let a=0;for(let e=0;e0&&(a+=l(t+11)/2),a+=l(t)/2}}}function R(e){return"P"===e?e:"S"+e[1]+"/R"+e[1]}function T(e,t,s){const i=t;void 0===e[i]?e[i]={text:s,ids:[R(s)]}:(e[i].text+="/"+s,e[i].ids.push(R(s)))}class A{constructor(e,t){this._pivots=[],this._invalidated=!0,this._renderer=new P.CompositeRenderer,this._model=e,this._source=t,this._cacheProvider=this._source.getCache.bind(this._source)}update(e){this._invalidated=!0}renderer(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),this._renderer}_updateImpl(){this._renderer.clear();const e=this._source.ownerSource();if(null===e)return;this._source.pricesView().prices(),this._pivots=[];const t=this._source.customData();if(!t||!t.pivots)return;const s=this._source.properties().childs();if(!s.visible.value())return ;const r=t.pivots,l=this._source.indexes(),o=this._model.timeScale(),a=this._source.priceScale(),n=e.firstValue();if(!a||a.isEmpty()||o.isEmpty()||!r||!l||null===n)return;const h=(0,i.ensureNotNull)(o.visibleBarsStrictRange()),c=h.firstBar(),u=h.lastBar();for(let e=0;eu)continue;const h={},d=s.levelsStyle.childs().visibility.childs();d.P.value()&&T(h,r[e].p,"P"),d["S1/R1"].value()&&(T(h,r[e].s1,"S1"),T(h,r[e].r1,"R1")),d["S2/R2"].value()&&(T(h,r[e].s2,"S2"),T(h,r[e].r2,"R2")),d["S3/R3"].value()&&(T(h,r[e].s3,"S3"),T(h,r[e].r3,"R3")),d["S4/R4"].value()&&(T(h,r[e].s4,"S4"),T(h,r[e].r4,"R4")),d["S5/R5"].value()&&(T(h,r[e].s5,"S5"),T(h,r[e].r5,"R5"));const _=o.indexToCoordinate(t),p=o.indexToCoordinate(i);for(const t of Object.keys(h)){const s=parseFloat(t),i=a.priceToCoordinate(s,n);this._pivots.push({x1:_,x2:p,y:i,label:h[t].text,labelIds:h[t].ids,src:r[e]})}}const d=s.levelsStyle.childs().colors,_=s.levelsStyle.childs().widths,p=this._source.visiblePivots();for(let e=0;ethis.processHibernate()))}pricesView(){return this._pricesView}indexes(){return this._indexes}properties(){return this._properties}getCache(e){if(null===this._cache||null==this._cachedPixelRatioParams||(t=e,s=this._cachedPixelRatioParams,t.horizontalPixelRatio!==s.horizontalPixelRatio||t.verticalPixelRatio!==s.verticalPixelRatio)){this._cache&&this._cache.destroy();const t=this._getActualCacheParams(),s={horizontalPixelRatio:e.horizontalPixelRatio,verticalPixelRatio:e.verticalPixelRatio};this._cache=new n(s,t.font,t.fontSize,t.backColors),this._cache.setPrices((0,i.ensureNotNull)(this._pricesView).prices()),this._cachedPixelRatioParams=s,this._cache.reset(t)}var t,s;return this._cache}priceLabelText(e){return this._metaInfo.value().shortDescription+":"+e.toUpperCase()}updateAllViews(e){super.updateAllViews(e),this._pricesView.update()}visiblePivots(){return this._pricesView.visiblePivots()}isVisible(){if(!this.properties().childs().visible.value()||!this.isActualInterval())return!1;const e=["P","S1/R1","S2/R2","S3/R3","S4/R4","S5/R5"],t=this.properties().childs().levelsStyle.childs().visibility;for(let s=0;st)continue;const a=[],n=this.properties().childs().levelsStyle.childs().visibility.childs();n.P.value()&&a.push(r[s].p),n["S1/R1"].value()&&a.push(r[s].s1,r[s].r1),n["S2/R2"].value()&&a.push(r[s].s2,r[s].r2),n["S3/R3"].value()&&a.push(r[s].s3,r[s].r3),n["S4/R4"].value()&&a.push(r[s].s4,r[s].r4),n["S5/R5"].value()&&a.push(r[s].s5,r[s].r5);for(let e=0;e{s.r(t),s.d(t,{study_ScriptWithDataOffset:()=>n});var i=s(50151),r=s(4148),l=s(72187),o=s(11485),a=s(64717);class n extends o.Study{constructor(e,t,s,i,r,o){super(e,t,s,i,r,o),this._underlyingData=new l.PlotList((0,a.studyPlotFunctionMap)(i),a.studyEmptyPlotValuePredicate)}clearData(){super.clearData(),this._underlyingData.clear()}_mergeData(e){this._invalidateLastNonEmptyPlotRowCache();const t=this._underlyingData.firstIndex();this._underlyingData.merge(e),t!==this._underlyingData.firstIndex()&&(this._data=new l.PlotList((0,a.studyPlotFunctionMap)(this._metaInfo.value()),a.studyEmptyPlotValuePredicate));let s=null;const i=this._data.lastIndex()??this._underlyingData.firstIndex(),o=this._underlyingData.lastIndex();if(null!==i&&null!==o)for(const e of this._underlyingData.rangeIterator(i,o))null===s&&(s=e),this._data.add(e.index,(0,r.clone)(e.value));for(const e of this._plotsForStrategyProcessing()){new h(e.strategyIndex,e.targetIndex,i).rebuildData(this._data)}return s}_plotsForStrategyProcessing(){const e=this._metaInfo.value(),t=[];return e.plots.forEach(((s,r)=>{ if("dataoffset"!==s.type)return;const l=e.plots.findIndex((e=>e.id===s.target));(0,i.assert)(l>=0,`target plot not found for strategy plot ${s.id}`),t.push({strategyIndex:r,targetIndex:l})})),t}}class h{constructor(e,t,s){this._strategyPlotIndex=e,this._targetPlotIndex=t,this._startIndex=s}rebuildData(e){const t=this._targetPlotIndex+1,s=this._strategyPlotIndex+1;let i=null,r=null;const l=this._startIndex??e.firstIndex(),o=e.lastIndex();if(null!==l&&null!==o)for(const{index:a,value:n}of e.rangeIterator(l,o)){const l=n[t],o=n[s]?Math.round(n[s]):null;if(n[t]=null,n[s]=null,!o||o>0)continue;const h=a+o,c={pointIndex:h,value:l};if(r){if(r.pointIndex!==c.pointIndex){if(h>=0){const s=e.valueAt(h);s&&(s[t]=l)}let s=!1;if(i&&r&&(s=i.value<=r.value&&r.value<=l||i.value>=r.value&&r.value>=l),s){if(r.pointIndex>=0){const s=e.valueAt(r.pointIndex);s&&(s[t]=null)}}else i=r;r=c}}else r=c}}}},10635:(e,t,s)=>{s.r(t),s.d(t,{VbPVisibleWrapper:()=>v,VolumeProfileBaseStudy:()=>d,VolumeProfileStudyWithThemedColors:()=>_,VolumeProfileWithPriceRangeStudy:()=>p});var i=s(50151),r=s(22613),l=s(24062);var o=s(36281),a=s(52859);class n extends o.PriceAxisView{constructor(e,t){super(),this._source=e,this._styleId=t}_updateRendererData(e,t,s){e.visible=!1;const i=this._source.priceScale(),r=this._source.properties().childs();if(!i||i.isEmpty()||!r.visible.value())return;const l=this._source.properties().childs().graphics.childs().horizlines?.childs()[this._styleId].childs();if(!(l&&l.visible&&l.visible.value()&&this._isLabelVisibleAccordinglyToProperties()))return;const o=this._source.model().timeScale().logicalRange(),n=this._source.firstValue();if(null===n||null===o)return;const h={price:NaN,time:-1/0},c=this._source.graphics().horizlines().get(this._styleId);if(void 0===c)return;for(const e of c){if(void 0===e.level)continue;const t=o.contains(e.startIndex,!0);t===o.contains(e.endIndex,!0)&&0!==t||h.timenew n(this,e)))}_createStudyPlotPaneView(e){return new c.StudyPlotPaneView(this,this._series,this._model,e,this._needExtendToBarsEnding())}_apiInputs(){return{...super._apiInputs(),mapRightBoundaryToBarStartTime:!!this._needExtendToBarsEnding()||void 0}}_needExtendToBarsEnding(){return void 0!==this.metaInfo().defaults.inputs?.mapRightBoundaryToBarStartTime}}class _ extends d{constructor(e,t,s,i,r,l){t.setThemedColors((0,u.volumeProfileThemedColors)(t.childs().graphics.childs().polygons?.hasChild("histBoxBg"))),super(e,t,s,i,r,l)}}class p extends _{priceRange(e,t,s){if(s.targetPriceScale!==this.priceScale())return null;let r=!1;this.graphics().hhists().forEach(((e,t)=>{r=r||(0,i.ensureDefined)(this.properties().childs().graphics.childs().hhists?.childs()[t]).value()}));const o=function(e,t,s,i){let r=null;return e.forEach((e=>{e.forEach((e=>{const i=e.firstBarTime;null!==i&&i<=s&&e.lastBarTime>=t&&(null===r?r={low:{l:e.priceLow,h:e.priceHigh},high:{h:e.priceHigh}}:(e.priceLow{s.d(t,{volumeProfileThemedColors:()=>_});var i=s(49156);const{colorColdGray200:r,colorColdGray900:l,colorBerryPink400Alpha50:o,colorBerryPink400Alpha75:a,colorSkyBlue400Alpha50:n,colorSkyBlue400Alpha5:h,colorSkyBlue400Alpha75:c,colorSkyBlue500:u}=i.colors,d={val:[l,r],poc:[l,r],vah:[l,r],developingPoc:[l,r],developingVA:[u,u],valuesColor:[l,r],volumeColorUp:[n,n],volumeColorDown:[o,o],valueAreaColorUp:[c,c],valueAreaColorDown:[a,a],histogramBoxColor:[h,h]};function _(e){const t="graphics.horizlines",s="graphics.hhists",i=[{path:`${t}.pocLines.color`,colors:d.poc},{path:`${t}.vahLines.color`,colors:d.vah},{path:`${t}.valLines.color`,colors:d.val},{path:`${s}.histBars2.colors.0`,colors:d.volumeColorUp},{path:`${s}.histBars2.colors.1`,colors:d.volumeColorDown},{path:`${s}.histBars2.valuesColor`,colors:d.valuesColor},{path:`${s}.histBarsVA.colors.0`,colors:d.valueAreaColorUp},{path:`${s}.histBarsVA.colors.1`,colors:d.valueAreaColorDown},{path:`${s}.histBarsVA.valuesColor`,colors:d.valuesColor},{path:"styles.developingPoc.color",colors:d.developingPoc},{path:"styles.developingVAHigh.color",colors:d.developingVA},{path:"styles.developingVALow.color",colors:d.developingVA}];return e&&i.push({path:"graphics.polygons.histBoxBg.color",colors:d.histogramBoxColor}),i}},51106:(e,t,s)=>{s.r(t),s.d(t,{VolumeStudy:()=>l});var i=s(11485),r=s(11542);class l extends i.Study{base(){return 1}destroy(){super.destroy()}showOnTopOnHovering(){return!1} chartFloatingTooltipView(){return this._model.paneForSource(this)===this._model.mainPane()?null:super.chartFloatingTooltipView()}_titleInParts(e,t,s,i,r,l){const o=super._titleInParts(e,t,s,i,r),a=this._getVolumeUnit();return a&&!l&&(o[0]+=` ยท ${a}`),o}_skippedTitleInputs(){return super._skippedTitleInputs()}_getVolumeUnit(){const e=this.symbolSource().symbolInfo();return e?function(e){switch(e.volume_type){case"base":return e.base_currency||void 0;case"quote":return e.currency||void 0;case"tick":return r.t(null,void 0,s(24821))}}({...e,currency:e.original_currency_code||e.currency_code}):void 0}}},34771:(e,t,s)=>{s.r(t),s.d(t,{study_Overlay:()=>He});var i=s(50151),r=s(87465),l=s(2072),o=s(49483),a=s(9343),n=s(11485),h=s(17776),c=s(91106),u=s(52746),d=s(95059),_=s(92211),p=s(43337),v=s(60911),y=s(37103),m=s(57025),b=s(36597),S=s(77380),g=s(72187),f=s(5471),w=s(24062),P=s(35727),C=s(80671),x=s(64651),V=s(36281),I=s(97902),R=s(52945),T=s(52859);const A=y.enabled("force_exchange_as_title");class L extends V.PriceAxisView{constructor(e){super(),this._source=e}_updateRendererData(e,t,s){e.visible=!1,t.visible=!1;const r=this._source.lastValueData("close",!1);if(r.noData)return;const l=this._source.model(),o=this._source.priceScale();if(null===o)return;if(!l.isPriceScaleVisible(o))return;const a=l.timeScale().visibleBarsStrictRange(),n=l.mainSeries().bars().lastIndex();if(null===a||null===n)return;if(n<=a.lastBar())s.background=(0,T.resetTransparency)(r.color),s.textColor=this.generateTextColor(r.color),e.borderVisible=!1,t.borderVisible=!1;else{const o=l.backgroundColorAtYPercentFromTop(r.coordinate/(0,i.ensureNotNull)(l.paneForSource(this._source)).height());s.background=o,s.textColor=(0,T.resetTransparency)(r.color),s.borderColor=s.textColor,e.borderVisible=!0,t.borderVisible=!0}s.coordinate=r.coordinate,s.floatCoordinate=r.floatCoordinate;const h=this._source.model().properties().childs().scalesProperties.childs();h.showSeriesLastValue.value()&&(e.text=(0,R.getCurrentModePriceText)(o,r),h.seriesLastValueMode.value()!==I.PriceAxisLastValueMode.LastPriceAndPercentageValue?e.secondLine="":e.secondLine=(0,R.getOppositeModePriceText)(o,r),e.visible=!0),t.text="",h.showSymbolLabels.value()&&(t.text=this._paneText(),t.visible=t.text.length>0)}_paneText(){let e="";const t=this._source.aliasSymbolInfo();return A?e=(0,d.displayedSymbolExchange)(t):this._source.model().properties().childs().scalesProperties.childs().showSymbolLabels.value()&&(e=(0,d.displayedSymbolName)(t)),e}}var B=s(30693);class D extends B.PriceLineAxisView{constructor(e){super(),this._study=e}_value(){return this._study.lastValueData("",!0)}_priceLineColor(e){return e}_lineWidth(){return 1}_isVisible(){const e=this._study.model().properties().childs().scalesProperties.childs().showSeriesLastValue.value();return this._study.properties().childs().showPriceLine.value()&&e}}var k=s(69558),F=s(94119);class N{constructor(e){this._lineRenderer=new F.HorizontalLineRenderer,this._visible=!1,this._source=e}update(){if(this._visible=!1, !this._source.properties().childs().showPriceLine.value())return;const e=this._source.lastValueData("",!0);e.noData||(this._visible=!0,this._lineRenderer.setData({y:e.coordinate,color:e.color,linewidth:1,linestyle:k.LINESTYLE_DOTTED,visible:this._visible}))}renderer(){return this._visible?this._lineRenderer:null}}var E=s(11946),M=s(78861),O=s(36313),H=s(50335),W=s(11542),U=s(24640),z=s(56265),$=s(3885),G=s(17161),q=s(70859),j=s(63903),Q=s(53660);const Y=G.lastDayChangeAvailable||G.alwaysShowLastPriceAndLastDayChange,K=o.CheckMobile.any(),Z=(0,z.getPercentageFormatter)();var J;!function(e){e[e.Open=0]="Open",e[e.High=1]="High",e[e.Low=2]="Low",e[e.Close=3]="Close",e[e.Source=4]="Source",e[e.LastPrice=5]="LastPrice",e[e.Change=6]="Change",e[e.LastDayChange=7]="LastDayChange"}(J||(J={}));const X=Q.notAvailable,ee=`${X} (${X}%)`;class te{constructor(e,t,i=!0){this._study=e,this._model=t,this._searchNearestLeftValue=i,this._emptyValues=[{title:W.t(null,void 0,s(16610)),visible:!1,value:"",index:0,orderIndex:0,id:"open"},{title:W.t(null,void 0,s(78254)),visible:!1,value:"",index:1,orderIndex:1,id:"high"},{title:W.t(null,void 0,s(65318)),visible:!1,value:"",index:2,orderIndex:2,id:"low"},{title:W.t(null,{context:"input"},s(51408)),visible:!1,value:"",index:3,orderIndex:3,id:"close"},{title:"",visible:!1,value:"",index:4,orderIndex:4,id:"source"},{title:"",visible:!1,value:"",index:5,orderIndex:5,id:"lastPrice"},{title:W.t(null,void 0,s(37276)),visible:!1,value:"",index:6,orderIndex:6,id:"change"},{title:W.t(null,void 0,s(63815)),visible:!1,value:"",index:7,orderIndex:7,id:"lastDayChange"}]}getItems(){return this._emptyValues}getValues(e){const t=this._emptyValues.map((e=>({...e})));if(this._model.timeScale().isEmpty())return t;const s=this._study.data(),i=s.lastIndex();if(0===s.size()||null===i)return t;const r=this._searchNearestLeftValue?f.PlotRowSearchMode.NearestLeft:f.PlotRowSearchMode.Exact,l=s.search(i,r,1);if(null===l)return t;const o=this._showLastPriceAndChangeOnly();if((0,H.isNumber)(e)||(o?e=i:(e=this._model.crosshairSource().appliedIndex(),(0,H.isNumber)(e)||(e=i))),null===e||!(0,H.isNumber)(e))return t;t[0].value=X,t[1].value=X,t[2].value=X,t[3].value=X,t[7].value=ee,t[6].value=ee;const a=s.search(e,r,1),n=this._model.backgroundTopColor().value();if(null===a)return t;const h=a.index,c=a.value,u=c[1],d=c[2],_=c[3],p=c[4];for(const e of t)e.visible=!o;const v=t[4];v.visible=!1;const{barChange:m,lastDayChange:b}=(0,$.changesData)(s,this._study.quotes(),a.value,a.index,l.value),S=(0,j.getPriceValueFormatterForSource)(this._study);if((0,j.shouldBeFormattedAsPercent)(this._study)||(0,j.shouldBeFormattedAsIndexedTo100)(this._study))t[7].value="",t[6].value="";else{const e=this._study.formatter(),s={signPositive:!0};if(void 0!==m){const{currentPrice:i,prevPrice:r,change:l}=m,o=e.formatChange?.(i,r,s)??e.format(l,s);t[6].value=(0,U.forceLTRStr)(`${o} (${Z.format(m.percentChange,s)})`)}if(void 0!==b){const{currentPrice:i,prevPrice:r,change:l,percentChange:o}=b,a=e.formatChange?.(i,r,s)??e.format(l,s);t[7].value=(0, U.forceLTRStr)(`${a} (${Z.format(o,s)})`)}}let g=null;if(o)t[5].value=null==p?X:S(p),t[5].visible=!0,g=this._getChangeColor(m?.change),t[6].visible=void 0!==m,t[7].visible=void 0!==b||Y;else{t[0].value=null==u?X:S(u),t[1].value=null==d?X:S(d),t[2].value=null==_?X:S(_),t[3].value=null==p?X:S(p),v.value=S(this._study.barFunction()(c)),t[5].visible=!1;const e=this._model.mainSeries().intervalObj().value().is1Tick(),s=21!==this._study.properties().childs().style.value();t[0].visible=!e&&s,t[1].visible=!e,t[2].visible=!e,t[7].visible=void 0!==b||Y,t[6].visible=void 0!==m;const i=this._study.barColorer().barStyle(h,!1),r=i.barBorderColor??i.barColor;g=(0,$.calculateColor)(n,r)}g=(0,T.resetTransparency)((0,$.calculateColor)(n,g));for(const e of t)e.color||(e.color=g);{const e=this._model.properties().childs().paneProperties.childs().legendProperties.childs();t[6].visible&&y.enabled("legend_bar_change_colors_based_on_value")&&e.useBarChangeCustomColors&&(t[6].color=(0,T.resetTransparency)((0,$.calculateColor)(n,this._getChangeColor(m?.change))))}return t[7].visible&&(t[7].color=(0,T.resetTransparency)((0,$.calculateColor)(n,this._getChangeColor(b?.change)))),t}_mobileNonTrackingMode(){return K&&(null===this._model.crosshairSource().pane||(0,E.isLineToolName)(M.tool.value())||null!==this._model.lineBeingEdited())}_showLastPriceAndChangeOnly(){return G.alwaysShowLastPriceAndLastDayChange||this._mobileNonTrackingMode()}_getChangeColor(e){const t=void 0===e||e>=0?q.SeriesBarColorer.upColor(this._study.properties()):q.SeriesBarColorer.downColor(this._study.properties());{const t=this._model.properties().childs().paneProperties.childs().legendProperties.childs();if(y.enabled("legend_bar_change_colors_based_on_value")&&t&&t.useBarChangeCustomColors&&t.useBarChangeCustomColors.value()){const s=void 0===e||e>=0?t.barChangeUpColor&&t.barChangeUpColor.value():t.barChangeDownColor&&t.barChangeDownColor.value();if(s)return s}}return t.barBorderColor??t.barColor}}var se=s(13212);const ie=o.CheckMobile.any();class re extends se.StudyDataWindowView{_updateImpl(){this._header=this._study.title(O.TitleDisplayTarget.DataWindow);let e;this._showLastPriceAndChangeOnly()?e=this._study.data().lastIndex():(e=this._model.crosshairSource().appliedIndex(),(null===e||isNaN(e))&&(e=this._study.data().lastIndex(),y.enabled("use_last_visible_bar_value_in_legend")&&(e=this._model.timeScale().visibleBarsStrictRange()?.lastBar()??NaN)));const t=this._valueProvider.getValues(e);for(let e=0;ee||t),s.showBarChange.weakReference(),s.showSeriesOHLC.weakReference()),this._visibilityProperty.subscribe(this,this.update.bind(this,(0,le.sourceChangeEvent)(e.id())))}areValuesVisible(){return this._visibilityProperty.value()}additional(){return this._additional}destroy(){this._backgroundColorSpawn.destroy(),this._visibilityProperty.destroy()}_updateImpl(){super._updateImpl()}_createValuesProvider(e,t){return new oe(e,t)}}var he=s(69555),ce=s(62802),ue=s(27808),de=s(32399),_e=s(4249),pe=s(46340),ve=s(43501),ye=s(54405),me=s(85630),be=s(88732),Se=s(54370),ge=s(12965);class fe extends ge.StudyStatusProvider{getSplitTitle(){return this._source.titleInParts(O.TitleDisplayTarget.StatusLine,!0,void 0,!1,!1)}text(){return this._source.isActualInterval()?this._source.isFailed()?`${this._source.title(O.TitleDisplayTarget.StatusLine,!0,void 0,!1,!1)}: ${this.sourceStatusText()}`:`${this._source.title(O.TitleDisplayTarget.StatusLine,!0,void 0,!1,!1)} ${this.sourceStatusText()}`:this._source.title(O.TitleDisplayTarget.StatusLine,!0,void 0,!1,!1)}}var we=s(55803),Pe=s(27909);class Ce extends oe{_showSeriesOHLC(){return!0}}var xe=s(28334),Ve=s(11768);class Ie{constructor(e,t){this._study=e,this._model=t,this._valuesProvider=new te(e,t,!1)}getItems(){const e=this._valuesProvider.getItems(),t=this._study.style();return(0,Ve.fillSymbolSourceValuesProviderItemsVisibility)(e,this._study.priceSource(),t,this._model),e[7].visible=!1,e}getValues(e){const t=this._study.data().lastIndex(),s=this._study.data().firstIndex();return null===t||null===s||e>t||ee.realignLineTools(this))),e.mainSeries().onIntervalChanged().subscribe(this,(()=>this._checkStyle())), this._conflatedChunksBuilder=new we.ConflatedChunksBuilder(this._data,(e=>u.barFunctions[e])),this._symbolInfoWV=(0,ae.createWVFromGetterAndSubscriptions)((()=>this.symbolInfo()),[this.symbolResolved(),this.onStatusChanged()]),(this._aliasSymbolInfoWV||this._symbolInfoWV).subscribe((()=>this._recreatePriceFormattingDependencies())),this._overlayValuesProvider=new te(this,e),this._overlayLegendValuesProvider=new oe(this,e),this._overlayTableViewValuesProvider=new Ie(this,e),this._overlayChartFloatingTooltipValuesProvider=new Ce(this,e),this._symbolSourceWV=(0,Re.combine)((e=>e?this:super.symbolSource()),this._isActingAsSymbolSource.weakReference())}destroy(){this._model.mainSeries().onIntervalChanged().unsubscribeAll(this),this._quotesProvider.destroy(),this._symbolInfoWV.destroy(),this._symbolSourceWV.destroy(),this._aliasSymbolInfoWV?.release(),super.destroy()}isActingAsSymbolSource(){return this._isActingAsSymbolSource.readonly()}precomputedBarStyle(e){return this._precomputedBarStyles.get(e)}setPrecomputedBarStyle(e,t){this._precomputedBarStyles.set(e,t)}properties(){return this._properties}barColorer(){return new q.SeriesBarColorer({data:()=>this.data(),bars:()=>this.data(),nsBars:()=>new g.PlotList,priceScale:()=>(0,i.ensureNotNull)(this.priceScale()),properties:()=>this.properties(),firstValue:()=>this.firstValue(),barFunction:()=>this.barFunction(),lineColorAtYPercentFromTop:e=>this.lineColorAtYPercentFromTop(e)})}symbolParams(){return(0,b.symbolParams)(this)}compareSymbolParams(e){return(0,b.compareSymbolParams)(this,e,this._model.unitConversionEnabled())}async setSymbolParams(e){this._setSymbolParamsInternal(e)}symbol(){return this.properties().childs().inputs.childs().symbol.value()}symbolOrAlias(){const e=this.symbol(),t=this._model.symbolAliasService()?.getAliasByProName(e);return t?.aliasName??e}symbolChanged(){return this.properties().childs().inputs.childs().symbol}onSymbolIntervalChanged(){return this.symbolChanged()}setSymbol(e){this.setSymbolParams({symbol:e})}symbolInfo(){if(!this._resolvedSymbols)return null;const e=this._properties.childs().inputs.childs().symbol.value();if(!e)return null;let t;return t=this._resolvedSymbols[this._getSymbolForResolve(e)]||null,t}symbolInfoWV(){return this._symbolInfoWV.readonly()}aliasSymbolInfo(){return(this._aliasSymbolInfoWV??this._symbolInfoWV??new l.WatchedValue(null)).value()}supportsConflatedChunks(){return!0}conflatedChunks(e,t){return this._conflatedChunksBuilder.conflatedChunks(e,t)}symbolResolved(){return this.symbolsResolved()}symbolResolvingActive(){return this._symbolResolvingActive}symbolHibernated(){return this._symbolHibernated}isVisible(){const e=super.isVisible();return this._symbolHibernated.setValue(!e),e}symbolSameAsCurrent(e){return(0,b.symbolSameAsCurrent)(e,this.symbolInfo())}symbolSameAsResolved(e){return(0,S.symbolSameAsResolved)(e,this._lastResolvedSymbolSource,this.symbol())}priceSource(){const e=this.properties().childs();switch(e.style.value()){case 2:return e.lineStyle.childs().priceSource.value();case 14: return e.lineWithMarkersStyle.childs().priceSource.value();case 15:return e.steplineStyle.childs().priceSource.value();case 3:return e.areaStyle.childs().priceSource.value();case 10:return e.baselineStyle.childs().priceSource.value();case 13:return e.columnStyle.childs().priceSource.value()}return null}barFunction(){return this._barFunction}quotesProvider(){return this._quotesProvider}quotes(){return this._quotesProvider.quotes()}currency(){return this.properties().childs().currencyId.value()||null}setCurrency(e){this.setSymbolParams({currency:e})}isConvertedToOtherCurrency(){return(0,d.isConvertedToOtherCurrency)(this.symbolInfo())}unit(){return this.properties().childs().unitId.value()||null}setUnit(e){this.setSymbolParams({unit:e})}isConvertedToOtherUnit(){return(0,d.isConvertedToOtherUnit)(this.symbolInfo(),this._model.unitConversionEnabled())}style(){return this.properties().childs().style.value()}setStyle(e){this.setSymbolParams({style:e})}interval(){return this._model.mainSeries().interval()}setInterval(e){}valueAt(e,t){return this.data().search(e)?.value[t]??null}symbolSource(){return this}symbolSourceWV(){return this._symbolSourceWV}barsProvider(){return this}state(e,t){const s=super.state(e,t);this._model.unitConversionEnabled()||delete s.state.unitId;const r=this.symbol();return s.state.inputs.symbol=(0,d.symbolToSaveInState)(this.symbolInfo()??this._model.chartApi().lastSymbolResolveInfo(r),r),e&&((0,i.ensureDefined)(s.data).symbols={___snapshot:this.symbolInfo()||void 0}),s}symbolTitle(e,t,s){return this.title(e,!0,{},!1,t)}title(e,t,s,i,r){const l=this._titleInParts(e,t,s,i,r);return[l[0],...l[1]??[]].join(` ${d.symbolTitleSeparator} `)}titleInParts(e,t,s,i,r){return[this.title(e,t,s,i,r)]}firstValue(){const e=this._model.timeScale().visibleBarsStrictRange();if(null===e)return null;const t=e.firstBar();if(0===this.data().size())return this._ownFirstValue;const s=this.data().search(t,f.PlotRowSearchMode.NearestRight,1);return this._ownFirstValue=null!==s?this._barFunction(s.value,0):null,this._ownFirstValue}lineColorAtYPercentFromTop(e){switch(this.style()){case 2:return this.properties().childs().lineStyle.childs().color.value();case 14:return this.properties().childs().lineWithMarkersStyle.childs().color.value();case 15:return this.properties().childs().steplineStyle.childs().color.value()}return null}lastValueData(e,t,s){const i={noData:!0},l=this.priceScale();if(this._model.timeScale().isEmpty()||null===l||l.isEmpty()||this.data().isEmpty())return i;const o=this._model.timeScale().visibleBarsStrictRange();if(null===o)return i;const a=this.properties().childs();if(!a.visible.value())return i;const n=this.nearestIndex(o.lastBar(),f.PlotRowSearchMode.NearestLeft,1);if(void 0===n)return i;const h=this.firstValue();if(null===h)return i;const c=this._lastNonEmptyPlotRow(4),u=null!==c&&o.contains(c.index),d=null!==c?c.value:null,_=t||u?d:this.data().valueAt(n);if(null===_)return i;const p=this._barFunction(_,2);if(!(0,r.isNumber)(p))return i;const v=l.priceToCoordinate(p,h);let y;switch(a.style.value()){ case 0:y=_[1]<=_[4]?a.barStyle.childs().upColor.value():a.barStyle.childs().downColor.value();break;case 1:y=_[1]<=_[4]?a.candleStyle.childs().upColor.value():a.candleStyle.childs().downColor.value();break;case 9:y=_[1]<=_[4]?a.hollowCandleStyle.childs().upColor.value():a.hollowCandleStyle.childs().downColor.value();break;case 13:y=_[1]<=_[4]?a.columnStyle.childs().upColor.value():a.columnStyle.childs().downColor.value();break;case 2:y=a.lineStyle.childs().color.value();break;case 14:y=a.lineWithMarkersStyle.childs().color.value();break;case 15:y=a.steplineStyle.childs().color.value();break;case 3:y=a.areaStyle.childs().linecolor.value();break;case 16:y=a.hlcAreaStyle.childs().closeLineColor.value();break;case 10:{const e=a.baselineStyle.childs();y=ve.StudyOverlayDefinitionsViewModel))}_setQuotesSymbol(e){const t=this.symbolInfo(),s=(0,_.extractSymbolNameFromSymbolInfo)(t,e);this._quotesProvider.setQuotesSessionSymbol(s)}_onQuotesUpdate(e,t){!this._legendView||void 0===t.values.change&&void 0===t.values.change_percent||(this._legendView.update((0,le.sourceChangeEvent)(this.id())),this._model.updateSource(this))}_createViews(){this._priceAxisViews=[];const e=new L(this);this._priceAxisViewsBase=[e];const t=new D(this) ;this._priceLinesAxisViews=[t],this._paneViews=[],this._labelPaneViews=[];let s=null,r=null;switch(this.properties().childs().style.value()){case 0:r=new ce.SeriesBarsPaneView(this,this._model);break;case 1:r=new ue.SeriesCandlesPaneView(this,this._model);break;case 9:r=new ye.SeriesHollowCandlesPaneView(this,this._model);break;case 13:r=new me.SeriesColumnsPaneView(this,this._model);break;case 2:case 14:case 15:r=new de.SeriesLinePaneView(this,this._model);break;case 3:r=new _e.SeriesAreaPaneView(this,this._model);break;case 16:r=new pe.SeriesHLCAreaPaneView(this,this._model);break;case 10:{r=new ve.SeriesBaselinePaneView(this,this._model);const e=this.properties().childs().baselineStyle.childs();s=new x.SeriesWaterlinePaneView({paneHeight:()=>(0,i.ensureNotNull)(this.priceScale()).height(),color:()=>e.baselineColor.value(),baseLevelPercentage:()=>e.baseLevelPercentage.value()});break}case 12:r=new be.SeriesHiLoPaneView(this,this._model);break;case 21:r=new xe.SeriesHLCBarsPaneView(this,this._model)}r&&this._paneViews.push(r),null!==s&&this._paneViews.push(s),this._paneViews.push(new N(this)),this._dataWindowView||(this._dataWindowView=new re(this,this._model)),this._legendView||(this._legendView=new ne(this,this._model)),this._statusView||(this._statusView=new C.StudyStatusView(this)),this._floatingTooltipView||(this._floatingTooltipView=new Pe.StudyChartFloatingTooltipView(this,this._model)),this._priceAxisViews=[...this._priceAxisViewsBase],this._labelPaneViews.push(new he.PanePriceAxisView(e,this,this._model))}_createStudyOnServer(){const e=super._createStudyOnServer();return this._realignLineToolsIfParamsChanged(),e}_modifyStudyOnServer(e){super._modifyStudyOnServer(e,0)}_titleInParts(e,t,s,i,r){const l=this.symbolInfo();return[this._getSymbolTitlePart(l),[this._getExchangeTitlePart(l,r),this._getPriceSourceTitlePart(l)].filter((e=>null!==e))]}_mergeData(e){return this._invalidateLastNonEmptyPlotRowCache(),this._conflatedChunksBuilder.mergeData(e)}_clearData(){this._conflatedChunksBuilder.clearData()}_moveData(e){this._conflatedChunksBuilder.moveData(e)}_getSymbolTitlePart(e){if(null===e)return ke?"":(e=>this._model.symbolAliasService()?.getAliasByProName(e)?.aliasName??e)(this.properties().childs().inputs.childs().symbol.value());const t=this._model.symbolAliasService()?.getAliasByProName(e.pro_name)?.aliasName??e.name;if(Be)switch(this._model.mainSeries().symbolTextSourceProxyProperty().value()){case"description":return e.description;case"ticker-and-description":return`${t}, ${e.description}`;case"long-description":return e.long_description??e.description}return t}_getExchangeTitlePart(e,t){return null===e||t?null:(0,d.getSymbolListedExchange)(e)}_getPriceSourceTitlePart(e){return Ne&&!1!==this._model.properties().childs().paneProperties.childs().legendProperties.childs().showPriceSource.value()&&void 0!==e?.price_source_id?this._model.availablePriceSources(this.getSymbolString(this._getSymbolForApi(this.symbol()))).name(e.price_source_id)??null:null}_onAllowExtendTimeScaleChanged(){if(!De)return ;const e=this.isStarted();e&&this.stop(!0);const t=this.properties().childs().allowExtendTimeScale.value();this.properties().childs().inputs.childs().extendTimeScale.setValue(t),e&&this.start(!0)}_setSymbolParamsInternal(e,t){const{symbol:s,currency:i,unit:r,style:l}=e,o=this.properties().childs(),a=o.inputs.childs().symbol.value(),n=o.currencyId.value(),h=o.unitId.value(),c=o.style.value();if(void 0!==s&&o.inputs.childs().symbol.setValueSilently(s),void 0!==i&&o.currencyId.setValueSilently(i),void 0!==r&&o.unitId.setValueSilently(r),void 0!==l&&o.style.setValueSilently(l),t)this._resolvedSymbolsByInput[this.symbol()]=t,this._resolvedSymbols[this._getSymbolForResolve(this.symbol())]=t,this._realignToolsLastParams=null;else{const e=this.symbolInfo();null!==e&&(o.currencyId.setValueSilently((0,d.symbolCurrency)(e)),o.unitId.setValueSilently((0,d.symbolUnit)(e,this._model.unitConversionEnabled())))}o.inputs.childs().symbol.value()!==a&&o.inputs.childs().symbol.fireChanged(),o.currencyId.value()!==n&&o.currencyId.fireChanged(),o.unitId.value()!==h&&o.unitId.fireChanged(),o.style.value()!==c&&o.style.fireChanged(),this._checkStyle(),this._realignLineToolsIfParamsChanged()}_updateBarFunction(){this._barFunction=(0,h.barFunctionByStyle)(this.style(),this.priceSource())}_onMinTickChanged(){this._recreatePriceFormattingDependencies(),this.updateAllViews({type:"global-change"}),this._model.fullUpdate()}_onChartStyleChanged(){this._updateBarFunction(),this._styleToRecover?.originalStyle!==this.style()&&(this._styleToRecover=null)}_checkStyle(){const e=this.style();(0,d.isCloseBasedSymbol)(this.symbolInfo())||this.model().mainSeries().intervalObj().value().is1Tick()?(0,d.isSingleValueBasedStyle)(e)||(this.setStyle(2),this._styleToRecover={correctedStyle:this.style(),originalStyle:e}):null!==this._styleToRecover&&(this.setStyle(this._styleToRecover.originalStyle),this._styleToRecover=null)}_realignLineToolsIfParamsChanged(){let e=null===this._realignToolsLastParams;if(null!==this._realignToolsLastParams){const t=this.compareSymbolParams(this._realignToolsLastParams);e=t.symbolChanged||t.intervalChanged||t.currencyChanged||t.unitChanged}e&&(this._model.realignLineTools(this),this._realignToolsLastParams=this.symbolParams())}}}}]);