"use strict";(self.webpackChunktradingview=self.webpackChunktradingview||[]).push([[9378],{18348:(e,t,o)=>{o.d(t,{AbstractFilledAreaPaneView:()=>_});var i=o(50151),r=o(10555),l=o(48892),n=o(12217),s=o(3156),a=o(97126),d=o(50516);function c(e,t){return Array.from({length:e},((e,o)=>({timePointIndex:o+t})))}function u(e,t,o){let i,r;const l=e.length;for(let n=t;n>=0&&ne.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 r=this._source.offset(this._plotAId()),l=this._source.offset(this._plotBId()),s=Math.min(r,l),a=Math.max(r,l);let d=e.firstIndex;const u=o+(a-s)+1,h=this._plotIndex1(),p=this._plotIndex2();u!==this._items.length&&(void 0===d||0===this._items.length||de.timePointIndex=0&&te.timePointIndex=this._items.length)return;const x=Math.min(this._items.length-1,(0,n.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 r.Point(P.xCoordinate,P.plot1Coordinate),n=new r.Point(P.xCoordinate,P.plot2Coordinate),s=new r.Point(o,e),a=new r.Point(o,t),d=(0,l.intersectLineSegments)(i,s,n,a);if(null!==d){const e=i.add(i.subtract(s).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}},A=this._commonColor();let B;1===A.type?(A.coordinate1=c(A.value1),A.coordinate2=c(A.value2), A.color1=A.color1&&this._generateColor(A.color1,_),A.color2=A.color2&&this._generateColor(A.color2,_)):A.color=this._generateColor(A.color,_);for(let e=f;e<=g;e+=1){const t=this._items[e],i=t.timePointIndex;let r,l;!this._fillGaps&&void 0!==B&&i-B>1&&(C=null),void 0!==o?(r=o.level1,l=o.level2):(r=t.plot1Coordinate=void 0===t.plot1Value?void 0:c(t.plot1Value),l=t.plot2Coordinate=void 0===t.plot2Value?void 0:c(t.plot2Value));const n=t.xCoordinate=s.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!==r||void 0!==l:void 0!==r&&void 0!==l){const o=null!==this._colorPlotIndex?t.color||p:A;if(V(r,l,n),R=o,!(null===(S=w)||null===R?S===R:0===S.type&&0===R.type?S.color===R.color:1===S.type&&1===R.type&&S.color1===R.color1&&S.color2===R.color2&&S.coordinate1===R.coordinate1&&S.coordinate2===R.coordinate2)||null===C){if(null!==C&&(void 0!==r&&C.addPoints1Point(n,r),void 0!==l&&C.addPoints2Point(n,l)),e===g)continue;w=o;const t=h(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!==r&&C.addPoints1Point(n,r),void 0!==l&&C.addPoints2Point(n,l)}else this._fillGaps||(w=null,C=null,y=null);B=i,P=t}var S,R;b.delete(h(p));const k={barSpacing:this._model.timeScale().barSpacing(),colorAreas:b};this._areaRenderer.setData(k)}}},5605:(e,t,o)=>{o.d(t,{AreaBackgroundPaneView:()=>l});var i=o(50151),r=o(18348);class l extends r.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()}}},63670:(e,t,o)=>{o.d(t,{StudyPriceAxisView:()=>n});var i=o(50151),r=o(36281),l=o(52859);class n extends r.PriceAxisView{constructor(e,t){super(),this._model=e.model(),this._source=e,this._data=t,this._isForceOverlay=!!this._source.metaInfo().isPlotForceOverlay(this._data.plotIndex)}update(e){"hover-change"!==e.type&&super.update(e)}_updateRendererData(e,t,o){e.visible=!1,t.visible=!1;const r=this._source.model(),n=this._isForceOverlay?r.mainSeries().priceScale():this._source.priceScale();if(null===n)return;if(!r.isPriceScaleVisible(n))return;const s=this._source.lastValueData(this._data.plotIndex,!1);if(s.noData)return;const a=r.timeScale().visibleBarsStrictRange(),d=r.mainSeries().bars().lastIndex();if(null!==a&&null!==d){if(d<=a.lastBar()){o.background=(0,l.resetTransparency)(s.color);let i=s.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 n=r.backgroundColorAtYPercentFromTop(s.coordinate/(0,i.ensureNotNull)(r.paneForSource(this._source)).height());o.background=n,o.textColor=(0,l.resetTransparency)(s.color),o.borderColor=(0,l.resetTransparency)(o.textColor),e.borderVisible=!0,t.borderVisible=!0}o.coordinate=s.coordinate,o.floatCoordinate=s.floatCoordinate,this._showAxisLabel()&&(e.text=s.text,e.visible=!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.plotIndex,4)}_showAxisLabel(){return!!this._model.properties().childs().scalesProperties.childs().showStudyLastValue.value()&&this._source.properties().childs().showLabelsOnPriceScale.value()&&this._source.isPlotVisibleAt(this._data.plotIndex,4)}_updatePaneRendererData(e){e.text="",this._showPaneLabel()&&(e.text=this._source.priceLabelText(this._data.plotIndex),e.visible=!0)}}},89323:(e,t,o)=>{function i(e,t){return r(e,t,t?["&"]:["&"])}function r(e,t,o){const i=[["&","&"],["<","<"],[">",">"],['"',"""],["'","'"],["'","'"]];t&&i.forEach((e=>e.reverse()));let r=e;if(!e||!e.replace)return r;for(const e of i){const[t,i]=e;o&&-1!==o.indexOf(t)||(r=r.replace(new RegExp(t,"g"),i))}return r}o.d(t,{clean:()=>r,cleanButAmpersand:()=>i})},3156:(e,t,o)=>{o.d(t,{generateColorCached:()=>n});var i=o(59332),r=o(52859),l=o(16659);function n(e=1e3){const t=i.default.Cache;i.default.Cache=l.CircularCacheBuffer.bind(l.CircularCacheBuffer,e);const o=(0,i.default)(r.generateColor,((e,t,o)=>`${e}_${t}_${o}`));return i.default.Cache=t,o}}}]);