"use strict";(self.webpackChunktradingview=self.webpackChunktradingview||[]).push([[8042],{70005:(e,t,i)=>{i.r(t),i.d(t,{LineToolExtended:()=>l});var r=i(47004),s=i(90450);const n={...s.nonThemedFactoryDefaults,extendLeft:!0,extendRight:!0};class o extends s.LineToolTrendLinePropertiesImpl{static create(e,t,i){return s.LineToolTrendLinePropertiesImpl._createWithDefaults("linetoolextended",e,n,s.themedFactoryDefaults,t,i)}}class l extends r.LineToolTrendLine{constructor(e,t,i,r){super(e,t??l.createProperties(e.backgroundTheme().spawnOwnership()),i,r)}name(){return"Extended Line"}static createProperties(e,t){const i=o.create(e,t);return this._configureProperties(i),i}}},90450:(e,t,i)=>{i.d(t,{LineToolTrendLinePropertiesImpl:()=>S,nonThemedFactoryDefaults:()=>P,themedFactoryDefaults:()=>w});var r=i(11284),s=i(85842),n=i(25432),o=i(47097),l=i(95385),a=i(68459),h=i(45124),d=i(62565),u=i(88483),c=i(5829),p=i(93445),_=i(86371),g=i(17567);const x=(0,r.getHexColorByName)("color-tv-blue-500"),P={intervalsVisibilities:{...u.intervalsVisibilitiesDefaults},linewidth:c.DEFAULT_LINE_TOOL_LINE_WIDTH,linestyle:d.LineStyle.Solid,extendLeft:!1,extendRight:!1,leftEnd:a.LineEnd.Normal,rightEnd:a.LineEnd.Normal,horzLabelsAlign:l.HorizontalAlign.Center,vertLabelsAlign:l.VerticalAlign.Bottom,fontsize:14,bold:!1,italic:!1,alwaysShowStats:!1,showMiddlePoint:!1,showPriceLabels:!1,showPriceRange:!1,showPercentPriceRange:!1,showPipsPriceRange:!1,showBarsRange:!1,showDateTimeRange:!1,showDistance:!1,showAngle:!1,statsPosition:h.StatsPosition.Right},T={linecolor:x,textcolor:x},w=new Map([[o.StdTheme.Light,T],[o.StdTheme.Dark,T]]),m=(0,p.extractThemedColors)((0,s.ensureDefined)(w.get(o.StdTheme.Light)),(0,s.ensureDefined)(w.get(o.StdTheme.Dark))),f=(0,p.extractAllPropertiesKeys)((0,s.ensureDefined)(w.get(o.StdTheme.Light))),v=(0,p.extractAllPropertiesKeys)(P),b=[...f,...v,"text"],L=[...new Set([...b,...n.commonLineToolPropertiesStateKeys])];class S extends _.LineDataSourceProperty{constructor(e){super(e),this.hasChild("text")||this.addProperty("text","")}static create(e,t,i){return S._createWithDefaults("linetooltrendline",e,P,w,t,i)}static _createWithDefaults(e,t,i,r,s,n){return new this({defaultName:e,factoryDefaultsSupplier:()=>(0,g.factoryDefaultsForCurrentTheme)(i,r),nonThemedDefaultsKeys:v,themedDefaultsKeys:f,allStateKeys:L,themedColors:m,templateKeys:b,replaceThemedColorsOnThemeChange:!0,state:s,theme:t,useUserPreferences:n})}}},47004:(e,t,i)=>{i.r(t),i.d(t,{Consts:()=>f,LineToolTrendLine:()=>b});var r=i(85842),s=i(33993),n=i(63212),o=i(91569),l=i(57415),a=i(91069),h=i(78792),d=i(61208),u=i(16965),c=i(79083),p=i(45124),_=i(71367),g=i(6353),x=i(14491),P=i(83077),T=i(35428),w=i(7955);class m extends T.TrendToolWithStatsPaneView{constructor(e,t,i,r,s,n){super(e,t,r,s,n),this._trendRenderer=new g.TrendLineRenderer,this._pane=i,this._labelRenderer=new u.LineToolTextRenderer(void 0,new P.HitTestResult(P.HitTarget.MovePoint,(0,w.inplaceEditHandlers)(this._tryActivateEditMode.bind(this,null)))),this._source.setAdditionalCursorData((()=>({ color:this._source.editableTextStyle().cursorColor,rotationPoint:this._labelRenderer.rotation()??void 0,...this._labelRenderer.getTextInfo()})),this._labelRenderer.positionToCoordinate.bind(this._labelRenderer))}_getPointsForStats(){return[this._points[0],(0,r.ensureNotNull)(this._middlePoint),this._points[1]]}_updateImpl(e){this._renderer.clear(),this._invalidated=!1;const t=this._getOwnerSource();if(!t||this._pane&&!this._pane.sourcesByGroup().hasLineSource(this._source))return;const i=t.priceScale(),r=this._model.timeScale();if(!i||i.isEmpty()||r.isEmpty())return;const s=this._model.timeScale().visibleBarsStrictRange();if(null===s)return;const n=this._source.points();if(n.length<2)return;const o=n[0],u=n[1],g=this._source.properties().childs();if(o.index=2&&this._addAlertRenderer(this._renderer,y.points)}}var f,v=i(90450);!function(e){e[e.PointsCount=2]="PointsCount",e.Name="Trend Line"}(f||(f={}));class b extends n.InplaceTextLineDataSource{constructor(e,t,i,r){super(e,t??b.createProperties(e.backgroundTheme().spawnOwnership()),i,r)}destroy(){super.destroy()}pointsCount(){return 2}name(){return"Trend Line"}canHasAlert(){return!0}showPriceLabels(){return this._properties.childs().showPriceLabels.value()}createPriceAxisView(e){return new o.LineToolPriceAxisView(this,{pointIndex:e,backgroundPropertyGetter:()=>this.showPriceLabels()?this._properties.childs().linecolor.value():null})}isForcedDrawPriceAxisLabel(){return this.showPriceLabels()}template(){const e=super.template();return e.text=this.properties().childs().text.value(),e}editableTextProperties(){const e=this.properties().childs();return{text:e.text,textColor:e.textcolor}}supportsTargetSignature(){return!1}isMultiPaneAvailable(){return this.supportsTargetSignature()}isMultiPaneEnabled(){return null!==this.targetSignature().value()}snapTo45DegreesAvailable(){return!0}static createProperties(e,t,i){return b._createPropertiesImpl(e,t,i)}_getPaneViews(e){return null!==this.targetSignature().value()||this._paneViews.has(e)||e&&!e.hasDataSource(this)||this._paneViews.set(e,[new m(this,this._model,e??null,this._openTextEditor.bind(this),this._closeTextEditor.bind(this))]),super._getPaneViews(e)}_getAlertPlots(){const e=this._linePointsToAlertPlot(this._points,null,this._properties.childs().extendLeft.value(),this._properties.childs().extendRight.value());return null===e?[]:[e]}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(1982),i.e(7686),i.e(2428),i.e(3920),i.e(9328)]).then(i.bind(i,44252))).TrendLineDefinitionsViewModel}_applyTemplateImpl(e){super._applyTemplateImpl(e),this.properties().childs().text.setValue(e.text||"")}_createSignatureSourcePaneViews(e){return[new m(this,this._model,null,this._openTextEditor.bind(this),this._closeTextEditor.bind(this),e)]}static _createPropertiesImpl(e,t,i){const r=v.LineToolTrendLinePropertiesImpl.create(e,t,i);return this._configureProperties(r),r}static _configureProperties(e){super._configureProperties(e),e.addChild("textsColors",new s.LineToolColorsProperty([(0,r.ensureDefined)(e.child("textcolor"))]))}}}}]);