"use strict";(self.webpackChunktradingview=self.webpackChunktradingview||[]).push([[311],{4865:(e,t,o)=>{function i(e,t){return e?.studyIds.has(t)??!1}o.d(t,{highlightContainsSource:()=>i})},97411:(e,t,o)=>{o.d(t,{AbstractFilledAreaPaneView:()=>p});var i=o(85842),l=o(57415),r=o(78792),s=o(21515),n=o(33812),a=o(59557),d=o(54025);function c(e,t){return Array.from({length:e},((e,o)=>({timePointIndex:o+t})))}function h(e,t,o){let i,l;const r=e.length;for(let s=t;s>=0&&se.id))}_plotIndex1(){return null===this._plIndex1&&(this._plIndex1=this._plotNames().indexOf(this._plotAId())+1),this._plIndex1}_plotIndex2(){return null===this._plIndex2&&(this._plIndex2=this._plotNames().indexOf(this._plotBId())+1),this._plIndex2}_updateImplFull(e){if(this._areaRenderer.setData(null),this._dataInvalidated?.clearData&&(this._items=[]),!this._visible())return!1;if(null===this._priceScale())return!1;if(null===this._firstValue())return!1;const t=this._source.plots().plottableRange(),o=t.size();if(0===o)return!1;const l=this._source.offset(this._plotAId()),r=this._source.offset(this._plotBId()),n=Math.min(l,r),a=Math.max(l,r);let d=e.firstIndex;const h=o+(a-n)+1,u=this._plotIndex1(),_=this._plotIndex2();h!==this._items.length&&(void 0===d||0===this._items.length||de.timePointIndex=0&&te.timePointIndex=this._items.length)return;const I=Math.min(this._items.length-1,(0,s.lowerbound)(this._items,d.lastBar(),((e,t)=>e.timePointIndex{if(this._model.timeScale().barSpacing()<1||!this._fillToIntersection||void 0===P||void 0===P.xCoordinate||void 0===P.plot1Coordinate||void 0===P.plot2Coordinate||null===y||null===C||0===C.points1.length()||void 0===e||void 0===t)return;const i=new l.Point(P.xCoordinate,P.plot1Coordinate),s=new l.Point(P.xCoordinate,P.plot2Coordinate),n=new l.Point(o,e),a=new l.Point(o,t),d=(0,r.intersectLineSegments)(i,n,s,a);if(null!==d){const e=i.add(i.subtract(n).scaled(-d));y.addPoints1Point(C.points1.at(C.points1.length()-1).x,C.points1.at(C.points1.length()-1).y),y.addPoints2Point(C.points2.at(C.points1.length()-1).x,C.points2.at(C.points1.length()-1).y),y.addPoints1Point(e.x,e.y),y.addPoints1Point(e.x,e.y),C.points1.at(C.points1.length()-1).x=e.x,C.points1.at(C.points1.length()-1).y=e.y,C.points2.at(C.points2.length()-1).x=e.x, C.points2.at(C.points2.length()-1).y=e.y}},S=this._commonColor();let A;1===S.type?(S.coordinate1=c(S.value1),S.coordinate2=c(S.value2),S.color1=S.color1&&this._generateColor(S.color1,p),S.color2=S.color2&&this._generateColor(S.color2,p)):S.color=this._generateColor(S.color,p);for(let e=f;e<=x;e+=1){const t=this._items[e],i=t.timePointIndex;let l,r;!this._fillGaps&&void 0!==A&&i-A>1&&(C=null),void 0!==o?(l=o.level1,r=o.level2):(l=t.plot1Coordinate=void 0===t.plot1Value?void 0:c(t.plot1Value),r=t.plot2Coordinate=void 0===t.plot2Value?void 0:c(t.plot2Value));const s=t.xCoordinate=n.indexToCoordinate(t.timePointIndex);if(t.color&&1===t.color.type&&(t.color.coordinate1=c(t.color.value1),t.color.coordinate2=c(t.color.value2)),this._fillGaps?void 0!==l||void 0!==r:void 0!==l&&void 0!==r){const o=null!==this._colorPlotIndex?t.color||_:S;if(V(l,r,s),R=o,!(null===(B=w)||null===R?B===R:0===B.type&&0===R.type?B.color===R.color:1===B.type&&1===R.type&&B.color1===R.color1&&B.color2===R.color2&&B.coordinate1===R.coordinate1&&B.coordinate2===R.coordinate2)||null===C){if(null!==C&&(void 0!==l&&C.addPoints1Point(s,l),void 0!==r&&C.addPoints2Point(s,r)),e===x)continue;w=o;const t=u(o),i=b.get(t)??new a.AreaBackgroundItemsGroup(o);y=C,C=i.newItem()??new a.AreaBackgroundItem,i.push(C),b.set(t,i)}void 0!==l&&C.addPoints1Point(s,l),void 0!==r&&C.addPoints2Point(s,r)}else this._fillGaps||(w=null,C=null,y=null);A=i,P=t}var B,R;b.delete(u(_));const k={barSpacing:this._model.timeScale().barSpacing(),colorAreas:b};this._areaRenderer.setData(k)}}},61874:(e,t,o)=>{o.d(t,{AreaBackgroundPaneView:()=>r});var i=o(85842),l=o(97411);class r extends l.AbstractFilledAreaPaneView{constructor(e,t){super(e,t)}_plotAId(){return(0,i.ensureDefined)(this._source.metaInfo().area)[0].name}_plotBId(){return(0,i.ensureDefined)(this._source.metaInfo().area)[1].name}_commonColor(){return{type:0,color:this._source.properties().areaBackground.backgroundColor.value()}}_transparency(){return this._source.properties().areaBackground.transparency?.value()??0}_visible(){return this._source.properties().areaBackground.fillBackground.value()}_getColorByPlotValue(e){return this._commonColor()}}},40180:(e,t,o)=>{o.d(t,{StudyPriceAxisView:()=>s});var i=o(85842),l=o(15269),r=o(82347);class s extends l.PriceAxisView{constructor(e,t){super(),this._model=e.model(),this._source=e,this._data=t,this._isForceOverlay=!!this._source.metaInfo().isPlotForceOverlay(this._data.plotName)}update(e){"hover-change"!==e.type&&super.update(e)}isPlotHighlighted(){return!!this._source.hasHighlightedPlots()&&(0,i.ensureNotNull)(this._model.highlightedPlotInfo()).plotId===this._data?.plotName}_updateRendererData(e,t,o){e.visible=!1,t.visible=!1;const l=this._source.model(),s=this._isForceOverlay?l.mainSeries().priceScale():this._source.priceScale();if(null===s)return;if(!l.isPriceScaleVisible(s))return;const n=this._source.lastValueData(this._data.plotName,!1);if(n.noData)return;const a=l.timeScale().visibleBarsStrictRange(),d=l.mainSeries().bars().lastIndex();if(null===a||null===d)return;let c ;if(d<=a.lastBar()){o.background=(0,r.resetTransparency)(n.color),c=o.background;let i=n.color;"transparent"===i&&(i=this._model.properties().childs().scalesProperties.childs().backgroundColor.value()),o.textColor=this.generateTextColor(i),o.borderColor=void 0,e.borderVisible=!1,t.borderVisible=!1}else{const s=l.backgroundColorAtYPercentFromTop(n.coordinate/(0,i.ensureNotNull)(l.paneForSource(this._source)).height());o.background=s,o.textColor=(0,r.resetTransparency)(n.color),o.borderColor=(0,r.resetTransparency)(o.textColor),c=o.borderColor,e.borderVisible=!0,t.borderVisible=!0}o.coordinate=n.coordinate,this._showAxisLabel()&&(e.text=n.text,e.visible=!0),e.selectedMarkColor=this._model.selection().isSelected(this._source)&&!this._source.hasHighlightedPlots()||this.isPlotHighlighted()?c:void 0,this._updatePaneRendererData(t)}_showPaneLabel(){return!!this._model.properties().childs().scalesProperties.childs().showStudyPlotLabels.value()&&this._source.properties().childs().showLabelsOnPriceScale.value()&&this._source.isPlotVisibleAt(this._data.plotName,4)}_showAxisLabel(){return!!this._model.properties().childs().scalesProperties.childs().showStudyLastValue.value()&&this._source.properties().childs().showLabelsOnPriceScale.value()&&this._source.isPlotVisibleAt(this._data.plotName,4)}_updatePaneRendererData(e){e.text="",this._showPaneLabel()&&(e.text=this._source.priceLabelText(this._data.plotName),e.visible=!0)}}},59793:(e,t,o)=>{function i(e,t){return l(e,t,t?["&"]:["&"])}function l(e,t,o){const i=[["&","&"],["<","<"],[">",">"],['"',"""],["'","'"],["'","'"]];t&&i.forEach((e=>e.reverse()));let l=e;if(!e||!e.replace)return l;for(const e of i){const[t,i]=e;o&&-1!==o.indexOf(t)||(l=l.replace(new RegExp(t,"g"),i))}return l}o.d(t,{clean:()=>l,cleanButAmpersand:()=>i})},33812:(e,t,o)=>{o.d(t,{generateColorCached:()=>s});var i=o(4003),l=o(82347),r=o(19050);function s(e=1e3){const t=i.default.Cache;i.default.Cache=r.CircularCacheBuffer.bind(r.CircularCacheBuffer,e);const o=(0,i.default)(l.generateColor,((e,t,o)=>`${e}_${t}_${o}`));return i.default.Cache=t,o}}}]);