"use strict";(self.webpackChunktradingview=self.webpackChunktradingview||[]).push([[380],{91445:(e,t,i)=>{i.d(t,{createTextStyleDefinition:()=>w});var o=i(11542),r=i(95804),n=i(95338),s=i(91682);const l=new r.TranslatedString("change {toolName} text visibility",o.t(null,void 0,i(56634))),a=new r.TranslatedString("change {toolName} text color",o.t(null,void 0,i(64500))),c=new r.TranslatedString("change {toolName} text font size",o.t(null,void 0,i(21781))),d=new r.TranslatedString("change {toolName} text font bold",o.t(null,void 0,i(24701))),u=new r.TranslatedString("change {toolName} text font italic",o.t(null,void 0,i(42694))),h=new r.TranslatedString("change {toolName} text",o.t(null,void 0,i(66668))),p=new r.TranslatedString("change {toolName} labels alignment vertical",o.t(null,void 0,i(31689))),g=new r.TranslatedString("change {toolName} labels alignment horizontal",o.t(null,void 0,i(88277))),_=new r.TranslatedString("change {toolName} labels direction",o.t(null,void 0,i(61160))),b=new r.TranslatedString("change {toolName} text background visibility",o.t(null,void 0,i(31133))),f=new r.TranslatedString("change {toolName} text background color",o.t(null,void 0,i(22231))),v=new r.TranslatedString("change {toolName} text border visibility",o.t(null,void 0,i(58704))),m=new r.TranslatedString("change {toolName} text border width",o.t(null,void 0,i(35423))),P=new r.TranslatedString("change {toolName} text border color",o.t(null,void 0,i(36666))),S=new r.TranslatedString("change {toolName} text wrap",o.t(null,void 0,i(39587))),y=o.t(null,void 0,i(79468)),T=o.t(null,void 0,i(38408)),x=o.t(null,void 0,i(7560)),C=o.t(null,void 0,i(6060));function w(e,t,i,o){const r={},w={id:`${(0,s.removeSpaces)(i.originalText())}Text`,title:o.customTitles&&o.customTitles.text||"",placeholder:o.placeholder??C};if(void 0===t.showText||o.hideTextCheckbox||(r.checked=(0,n.convertToDefinitionProperty)(e,t.showText,l.format({toolName:i}))),void 0!==t.textColor&&(r.color=(0,n.getColorDefinitionProperty)(e,t.textColor,t.transparency||null,a.format({toolName:i}))),void 0!==t.fontSize&&(r.size=(0,n.convertToDefinitionProperty)(e,t.fontSize,c.format({toolName:i}))),void 0!==t.bold&&(r.bold=(0,n.convertToDefinitionProperty)(e,t.bold,d.format({toolName:i}))),void 0!==t.italic&&(r.italic=(0,n.convertToDefinitionProperty)(e,t.italic,u.format({toolName:i}))),void 0!==t.text){const s=h.format({toolName:i});r.text=(0,n.convertToDefinitionProperty)(e,t.text,s,void 0),w.isEditable=Boolean(o.isEditable),w.isMultiLine=Boolean(o.isMultiLine)}if(void 0!==t.vertLabelsAlign&&(r.alignmentVertical=(0,n.convertToDefinitionProperty)(e,t.vertLabelsAlign,p.format({toolName:i})),w.alignmentVerticalItems=o.alignmentVerticalItems),void 0!==t.horzLabelsAlign&&(r.alignmentHorizontal=(0,n.convertToDefinitionProperty)(e,t.horzLabelsAlign,g.format({toolName:i})),w.alignmentHorizontalItems=o.alignmentHorizontalItems),void 0!==t.textOrientation&&(r.orientation=(0,n.convertToDefinitionProperty)(e,t.textOrientation,_.format({toolName:i}))),
void 0!==t.backgroundVisible&&(r.backgroundVisible=(0,n.convertToDefinitionProperty)(e,t.backgroundVisible,b.format({toolName:i}))),void 0!==t.backgroundColor){let o=null;void 0!==t.backgroundTransparency&&(o=t.backgroundTransparency),r.backgroundColor=(0,n.getColorDefinitionProperty)(e,t.backgroundColor,o,f.format({toolName:i}))}return void 0===t.backgroundVisible&&void 0===t.backgroundColor||(w.backgroundTitle=o.customTitles&&o.customTitles.backgroundTitle||y),void 0!==t.borderVisible&&(r.borderVisible=(0,n.convertToDefinitionProperty)(e,t.borderVisible,v.format({toolName:i}))),void 0!==t.borderWidth&&(r.borderWidth=(0,n.convertToDefinitionProperty)(e,t.borderWidth,m.format({toolName:i}))),void 0!==t.borderColor&&(r.borderColor=(0,n.getColorDefinitionProperty)(e,t.borderColor,null,P.format({toolName:i}))),void 0===t.borderVisible&&void 0===t.borderColor&&void 0===t.borderWidth||(w.borderTitle=o.customTitles&&o.customTitles.borderTitle||T),void 0!==t.wrap&&(r.wrap=(0,n.convertToDefinitionProperty)(e,t.wrap,S.format({toolName:i})),w.wrapTitle=o.customTitles&&o.customTitles.wrapTitle||x),(0,n.createTextPropertyDefinition)(r,w)}},14472:(e,t,i)=>{i.r(t),i.d(t,{LineDataSourceDefinitionsViewModel:()=>P,LineDataSourceTabTypes:()=>o,pointPriceBarTitle:()=>m});var o,r=i(50151),n=i(11542),s=i(95804),l=(i(40167),i(95338)),a=i(60567),c=i(22613),d=i(73863),u=i(97578),h=i(81634),p=i(36313);!function(e){e.Visibility="visibility",e.Coordinates="coordinates",e.Style="style",e.Text="text",e.Inputs="inputs"}(o||(o={}));const g=n.t(null,void 0,i(40091)),_=n.t(null,void 0,i(78930)),b=n.t(null,void 0,i(92516)),f=n.t(null,void 0,i(70320)),v=n.t(null,void 0,i(21429)),m=n.t(null,{context:"linetool point"},i(80166));class P{constructor(e,t){this._yCoordinateStepWV=null,this._propertyPages=[],this._source=t,this._undoModel=e,this._ownerSource=(0,r.ensureNotNull)(this._source.ownerSource()),this._propertyApplier=new h.PropertyApplierWithoutSavingChart((()=>e)),this._createPropertyRages()}destroy(){null!==this._yCoordinateStepWV&&(this._source.ownerSourceChanged().unsubscribeAll(this),this._ownerSource.priceStepChanged().unsubscribeAll(this)),this._source.pointAdded().unsubscribeAll(this),this._propertyPages.forEach((e=>{(0,l.destroyDefinitions)(e.definitions.value())}))}propertyPages(){return Promise.resolve(this._propertyPages)}_createPropertyRages(){this._propertyPages=[];const e=this._createInputsPropertyPage();null!==e&&this._propertyPages.push(e);const t=this._createStylePropertyPage();null!==t&&this._propertyPages.push(t);const i=this._createTextPropertyPage();null!==i&&this._propertyPages.push(i);const o=this._createCoordinatesPropertyPage();null!==o&&(o.visible=this._source.hasEditableCoordinates(),this._propertyPages.push(o));const r=this._createVisibilitiesPropertyPage();this._propertyPages.push(r)}_createVisibilitiesPropertyPage(){const e=this._source.properties().childs().intervalsVisibilities.childs();return(0,a.createPropertyPage)((0,
d.getIntervalsVisibilitiesPropertiesDefinitions)(this._propertyApplier,e,new s.TranslatedString(this._source.name(),this._source.title(p.TitleDisplayTarget.StatusLine,!0))),"visibility",g)}_createCoordinatesPropertyPage(){const e=this._coordinatesPropertyDefinitions();return null!==e?(e.definitions.length<this._source.pointsCount()&&this._source.pointAdded().subscribe(this,this._updateCoordinatesPropertyDefinitons),(0,a.createPropertyPage)(e,"coordinates",_)):null}_getYCoordinateStepWV(){return null===this._yCoordinateStepWV&&(this._yCoordinateStepWV=new c.WatchedValue(function(e){if(null!==e){const t=e.priceStep();if(null!==t)return t}return 1}(this._source.ownerSource())),this._ownerSource.priceStepChanged().subscribe(this,(()=>this._updateYCoordinateStep())),this._source.ownerSourceChanged().subscribe(this,(()=>{this._ownerSource.priceStepChanged().unsubscribeAll(this),this._ownerSource=(0,r.ensureNotNull)(this._source.ownerSource()),this._ownerSource.priceStepChanged().subscribe(this,(()=>this._updateYCoordinateStep()))}))),this._yCoordinateStepWV}_coordinatesPropertyDefinitions(){const e=this._source.points(),t=this._source.pointsProperty().childs().points,i=[],o=this._getYCoordinateStepWV();return e.forEach(((e,r)=>{const n=t[r].childs();n&&i.push((0,u.getCoordinatesPropertiesDefinitions)(this._propertyApplier,n,e,o,m.format({count:(r+1).toString()}),this._source.name()))})),{definitions:i}}_createStylePropertyPage(){const e=this._stylePropertyDefinitions();return null!==e?(0,a.createPropertyPage)(e,"style",b):null}_stylePropertyDefinitions(){return null}_createTextPropertyPage(){const e=this._textPropertyDefinitions();return null!==e?(0,a.createPropertyPage)(e,"text",f):null}_textPropertyDefinitions(){return null}_createInputsPropertyPage(){const e=this._inputsPropertyDefinitions();return null!==e?(0,a.createPropertyPage)(e,"inputs",v):null}_inputsPropertyDefinitions(){return null}_updateYCoordinateStep(){const e=this._ownerSource.priceStep();this._getYCoordinateStepWV().setValue(e||1)}_updateCoordinatesPropertyDefinitons(){const e=this._coordinatesPropertyDefinitions();if(null!==e){(0,r.ensureDefined)(this._propertyPages.find((e=>"coordinates"===e.id))).definitions.setValue(e.definitions),this._source.points().length===this._source.pointsCount()&&this._source.pointAdded().unsubscribeAll(this)}}}},31558:(e,t,i)=>{i.d(t,{commonLineToolPropertiesStateKeys:()=>o})
;const o=["symbolStateVersion","zOrderVersion","frozen","title","interval","symbol","currencyId","unitId","visible","intervalsVisibilities.ticks","intervalsVisibilities.seconds","intervalsVisibilities.secondsFrom","intervalsVisibilities.secondsTo","intervalsVisibilities.minutes","intervalsVisibilities.minutesFrom","intervalsVisibilities.minutesTo","intervalsVisibilities.hours","intervalsVisibilities.hoursFrom","intervalsVisibilities.hoursTo","intervalsVisibilities.days","intervalsVisibilities.daysFrom","intervalsVisibilities.daysTo","intervalsVisibilities.weeks","intervalsVisibilities.weeksFrom","intervalsVisibilities.weeksTo","intervalsVisibilities.months","intervalsVisibilities.monthsFrom","intervalsVisibilities.monthsTo","intervalsVisibilities.ranges"];var r,n,s;!function(e){e[e.NotShared=0]="NotShared",e[e.SharedInLayout=1]="SharedInLayout",e[e.GloballyShared=2]="GloballyShared"}(r||(r={})),function(e){e.BeforeAllAction="BeforeAll",e.CustomAction="CustomAction"}(n||(n={})),function(e){e.FloatingToolbarButton="FloatingToolbarButton",e.Default="Default"}(s||(s={}))},54707:(e,t,i)=>{i.d(t,{LineSourcePaneView:()=>b,anchorResizeCursorType:()=>g,createLineSourcePaneViewPoint:()=>_});var o=i(58978),r=i(50151),n=i(39612),s=i(2383),l=i(45801),a=i(73914),c=i(43838),d=i(4753);const u=o.colorsPalette["color-tv-blue-600"];var h,p;function g(e,t){const i=e.x-t.x,o=e.y-t.y;if(!Number.isFinite(i)||!Number.isFinite(o)||0===i&&0===o)return c.PaneCursorType.Default;let n=Math.atan2(o,i);return n<0&&(n+=2*Math.PI),n>=p.deg337_5||n<p.deg22_5||n>=p.deg157_5&&n<p.deg202_5?c.PaneCursorType.HorizontalResize:n>=p.deg22_5&&n<p.deg67_5||n>=p.deg202_5&&n<p.deg247_5?c.PaneCursorType.DiagonalNwSeResize:n>=p.deg67_5&&n<p.deg112_5||n>=p.deg247_5&&n<p.deg292_5?c.PaneCursorType.VerticalResize:n>=p.deg112_5&&n<p.deg157_5||n>=p.deg292_5&&n<p.deg337_5?c.PaneCursorType.DiagonalNeSwResize:void(0,r.assert)(!1,"unexpected angle")}function _(e,t){return e.pointIndex=t,e}!function(e){e[e.RegularAnchorRadius=6]="RegularAnchorRadius",e[e.TouchAnchorRadius=13]="TouchAnchorRadius",e[e.RegularStrokeWidth=1]="RegularStrokeWidth",e[e.TouchStrokeWidth=3]="TouchStrokeWidth",e[e.RegularSelectedStrokeWidth=3]="RegularSelectedStrokeWidth",e[e.TouchSelectedStrokeWidth=0]="TouchSelectedStrokeWidth"}(h||(h={})),function(e){e[e.deg22_5=Math.PI/8]="deg22_5",e[e.deg67_5=3*Math.PI/8]="deg67_5",e[e.deg112_5=5*Math.PI/8]="deg112_5",e[e.deg157_5=7*Math.PI/8]="deg157_5",e[e.deg202_5=9*Math.PI/8]="deg202_5",e[e.deg247_5=11*Math.PI/8]="deg247_5",e[e.deg292_5=13*Math.PI/8]="deg292_5",e[e.deg337_5=15*Math.PI/8]="deg337_5"}(p||(p={}));class b{constructor(e,t,i){this._invalidated=!0,this._points=[],this._middlePoint=null,this._selectionRenderers=[],this._lineAnchorRenderers=[],this._source=e,this._model=t,this._ownerSource=i??null}priceToCoordinate(e){const t=this._getOwnerSource(),i=t?.priceScale();if(null==i)return null;const o=null!==t?t.firstValue():null;return null===o?null:i.priceToCoordinate(e,o)}anchorColor(){return u}isHoveredSource(){
return this._source===this._model.hoveredSource()}isSelectedSource(){return this._model.selection().isSelected(this._source)}isBeingEdited(){return this._model.lineBeingEdited()===this._source}isEditMode(){return!this._model.isSnapshot()}areAnchorsVisible(){return(this.isHoveredSource()&&!this.isLocked()||this.isSelectedSource())&&this.isEditMode()}update(){this._invalidated=!0}isLocked(){return Boolean(this._source.isLocked&&this._source.isLocked())}addAnchors(e,t={}){let i=this._getPoints();this._model.lineBeingCreated()===this._source&&(i=i.slice(0,-1));const o=this._source.points(),r=i.map(((e,t)=>{const i=o[t],r=(0,a.lineSourcePaneViewPointToLineAnchorPoint)(e);return i&&(r.snappingPrice=i.price,r.snappingIndex=i.index),r}));e.append(this.createLineAnchor({...t,points:r},0))}createLineAnchor(e,t){const i=e.points.map((e=>e.point)),o=this._getOwnerSource();if(this.isLocked()){const r=this._getSelectionRenderer(t);return r.setData({bgColors:this._lineAnchorColors(i),points:e.points,visible:this.areAnchorsVisible(),hittestResult:s.HitTarget.Regular,ownerSourceId:o?.id(),barSpacing:this._model.timeScale().barSpacing()}),r}const r=(0,n.lastMouseOrTouchEventInfo)().isTouch,l=this._getLineAnchorRenderer(t),a=this.isHoveredSource()?this._model.lastHittestData()?.pointIndex??null:null;return l.setData({...e,color:this.anchorColor(),backgroundColors:this._lineAnchorColors(i),hoveredPointIndex:a,linePointBeingEdited:this.isBeingEdited()?this._model.linePointBeingEdited():null,radius:this._anchorRadius(),strokeWidth:r?h.TouchStrokeWidth:h.RegularStrokeWidth,selected:this.isSelectedSource(),selectedStrokeWidth:r?h.TouchSelectedStrokeWidth:h.RegularSelectedStrokeWidth,visible:this.areAnchorsVisible(),clickHandler:e.clickHandler,ownerSourceId:o?.id()}),l}_getOwnerSource(){return this._ownerSource??this._source.ownerSource()}_anchorRadius(){return(0,n.lastMouseOrTouchEventInfo)().isTouch?h.TouchAnchorRadius:h.RegularAnchorRadius}_lineAnchorColors(e){const t=(0,r.ensureNotNull)(this._model.paneForSource(this._source)).height();return e.map((e=>this._model.backgroundColorAtYPercentFromTop(e.y/t)))}_updateImpl(e){this._points=[];this._model.timeScale().isEmpty()||this._validatePriceScale()&&(this._source.points().forEach(((e,t)=>{const i=this._source.pointToScreenPoint(e,this._ownerSource??void 0);i&&this._points.push(_(i,t))})),2===this._points.length&&(this._middlePoint=this._source.calcMiddlePoint(this._points[0],this._points[1])),this._invalidated=!1)}_validatePriceScale(){const e=this._getOwnerSource()?.priceScale();return null!=e&&!e.isEmpty()}_getSource(){return this._source}_getPoints(){return this._points}_getModel(){return this._model}_height(){const e=this._getOwnerSource()?.priceScale();return null!=e?e.height():0}_width(){return this._model.timeScale().width()}_needLabelExclusionPath(e,t){const i=this._source.properties().childs();return"middle"===(t??i.vertLabelsAlign.value())&&(0,d.needTextExclusionPath)(e)}_addAlertRenderer(e,t,i=this._source.properties().linecolor.value()){}
_getAlertRenderer(e,t=this._source.properties().linecolor.value(),i){return null}_getSelectionRenderer(e){for(;this._selectionRenderers.length<=e;)this._selectionRenderers.push(new l.SelectionRenderer);return this._selectionRenderers[e]}_getLineAnchorRenderer(e){for(;this._lineAnchorRenderers.length<=e;)this._lineAnchorRenderers.push(new a.LineAnchorRenderer);return this._lineAnchorRenderers[e]}}},88636:(e,t,i)=>{i.d(t,{LineDataSourceProperty:()=>l});var o=i(90054),r=i(16738),n=i(50151),s=i(78176);class l extends s.DefaultProperty{constructor({templateKeys:e,...t}){super({ignoreAllowSavingDefaults:!0,saveNonDefaultUserPreferencesOnly:!0,...t}),this._templateKeys=(0,n.ensureDefined)(e||this._allDefaultsKeys)}template(){return(0,s.extractState)(this.state(),this._templateKeys,[])}applyTemplate(e){this.mergeAndFire((0,s.extractState)((0,r.default)((0,o.default)(this._factoryDefaultsSupplier()),e),this._templateKeys))}}},9750:(e,t,i)=>{i.d(t,{alignByAngle:()=>r});var o=i(50605);function r(e){let t,i;return e>=-135&&e<=-45?(t=o.HorizontalAlign.Center,i=o.VerticalAlign.Bottom):e>-45&&e<45?(t=o.HorizontalAlign.Left,i=o.VerticalAlign.Middle):e>=45&&e<=135?(t=o.HorizontalAlign.Center,i=o.VerticalAlign.Top):(t=o.HorizontalAlign.Right,i=o.VerticalAlign.Middle),{horzAlign:t,vertAlign:i}}},97865:(e,t,i)=>{i.r(t),i.d(t,{LineToolPriceNote:()=>te});var o=i(50151),r=i(41414),n=i(58978),s=i(24633),l=i(50605),a=i(31558),c=i(65045),d=i(37293),u=i(78176),h=i(70031),p=i(88636);const g={intervalsVisibilities:{...d.intervalsVisibilitiesDefaults},horzLabelsAlign:l.HorizontalAlign.Center,vertLabelsAlign:l.VerticalAlign.Bottom,fontSize:14,bold:!1,italic:!1,priceLabelFontSize:12,priceLabelBold:!1,priceLabelItalic:!1},_=(0,n.getHexColorByName)("color-tv-blue-500"),b={lineColor:_,textColor:_,priceLabelBackgroundColor:_,priceLabelBorderColor:_,priceLabelTextColor:(0,n.getHexColorByName)("color-white")},f=new Map([[s.StdTheme.Light,b],[s.StdTheme.Dark,b]]),v=(0,u.extractThemedColors)((0,o.ensureDefined)(f.get(s.StdTheme.Light)),(0,o.ensureDefined)(f.get(s.StdTheme.Dark))),m=(0,u.extractAllPropertiesKeys)((0,o.ensureDefined)(f.get(s.StdTheme.Light))),P=(0,u.extractAllPropertiesKeys)(g),S=[...new Set([...m,...P,...a.commonLineToolPropertiesStateKeys,"text"])],y=[...new Set([...m,...P,"text"])];class T extends p.LineDataSourceProperty{constructor(e){super(e),this.hasChild("text")||this.addProperty("text",""),this.addChild("linesColors",new c.LineToolColorsProperty([(0,o.ensureDefined)(this.child("lineColor"))])),this.addChild("backgroundsColors",new c.LineToolColorsProperty([(0,o.ensureDefined)(this.child("priceLabelBackgroundColor"))])),this.addChild("textsColors",new c.LineToolColorsProperty([(0,o.ensureDefined)(this.child("priceLabelTextColor"))]))}static create(e,t){return new this({defaultName:"linetoolpricenote",factoryDefaultsSupplier:()=>(0,h.factoryDefaultsForCurrentTheme)(g,f),nonThemedDefaultsKeys:P,themedDefaultsKeys:m,allStateKeys:S,themedColors:v,templateKeys:y,replaceThemedColorsOnThemeChange:!0,state:t,theme:e})}}
var x,C,w=i(40472),D=i(10555),L=i(94602),A=i(4753),k=i(54707),R=i(73914),V=i(2624),I=i(69558),M=i(33350),N=i(84617),z=i(39612),B=i(2383),W=i(58221),H=i(4539),E=i(9750);!function(e){e[e.Label=1]="Label"}(x||(x={})),function(e){e[e.Tolerance=3]="Tolerance",e[e.TouchTolerance=20]="TouchTolerance",e[e.LineWidth=1]="LineWidth",e[e.CircleRadius=2]="CircleRadius",e[e.CircleStrokeWidth=1]="CircleStrokeWidth",e[e.BackgroundRoundRect=4]="BackgroundRoundRect",e[e.PriceLabelFontSize=12]="PriceLabelFontSize",e[e.LabelVertPadding=6]="LabelVertPadding",e[e.LabelHorzPadding=8]="LabelHorzPadding"}(C||(C={}));class F{constructor(){this._data=null,this._priceLabelRenderer=new A.TextRenderer(void 0,new B.HitTestResult(B.HitTarget.MovePoint,{areaName:B.AreaName.Style,activeItem:1})),this._hittest=new B.HitTestResult(B.HitTarget.MovePoint,{areaName:B.AreaName.Style})}setData(e){this._data=e;const t=e.points[0],i=e.points[1],o=Math.round(180*Math.atan2(i.y-t.y,i.x-t.x)/Math.PI);this._priceLabelRenderer.setData({...(0,E.alignByAngle)(o),points:[i],text:e.text,color:e.textColor,font:N.CHART_FONT_FAMILY,fontSize:e.fontSize,bold:e.bold,italic:e.italic,offsetX:0,offsetY:0,borderColor:e.borderColor,borderWidth:1,backgroundColor:e.backgroundColor,backgroundRoundRect:4,boxPaddingVert:6,boxPaddingHorz:8})}setHitTest(e){this._hittest=e}draw(e,t){const i=this._data;if(null===i||i.points.length<2)return;e.save();const{horizontalPixelRatio:o,verticalPixelRatio:r}=t,n=Math.round(i.points[0].x*o),s=Math.round(i.points[0].y*r),l=Math.round(i.points[1].x*o),a=Math.round(i.points[1].y*r);e.lineCap="round",(0,W.setLineStyle)(e,I.LINESTYLE_SOLID),e.strokeStyle=i.lineColor,e.fillStyle=i.lineColor,e.lineWidth=Math.round(1*o);const c=(0,H.fillScaledRadius)(2,o);(0,W.createCircle)(e,n,s,c),e.fill(),void 0!==i.excludeBoundaries&&(e.save(),(0,M.addExclusionArea)(e,t,i.excludeBoundaries)),(0,W.drawLine)(e,n,s,l,a),void 0!==i.excludeBoundaries&&e.restore(),this._priceLabelRenderer.draw(e,t);const d=1*o;e.strokeStyle=i.circleBorderColor,e.lineWidth=d;const u=c+d/2;(0,W.createCircle)(e,n,s,u),e.stroke(),e.restore()}hitTest(e){const t=this._data;if(null===t)return null;const i=(0,z.lastMouseOrTouchEventInfo)().isTouch?20:3;return(0,V.distanceToSegment)(t.points[0],t.points[1],e).distance<=i?this._hittest:this._priceLabelRenderer.hitTest(e)}}class O extends k.LineSourcePaneView{constructor(){super(...arguments),this._renderer=new L.CompositeRenderer,this._priceNoteRenderer=new F,this._customLabelRenderer=new A.TextRenderer}renderer(e){return this._invalidated&&this._updateImpl(e),this._renderer}_updateImpl(e){super._updateImpl(e),this._renderer.clear();const t=this._source.priceScale();if(!t||t.isEmpty())return;const i=this._points;if(i.length<2)return;const r=(0,o.ensureNotNull)(this._source.ownerSource()).firstValue();if(null===r)return;const s=this._source.properties().childs(),a=this._model.dark().value()?n.colorsPalette["color-cold-gray-900"]:n.colorsPalette["color-white"],c=this._source.points()[0].price,d={text:t.formatPrice(c,r),points:i,
lineColor:s.lineColor.value(),circleBorderColor:a,backgroundColor:s.priceLabelBackgroundColor.value(),borderColor:s.priceLabelBorderColor.value(),textColor:s.priceLabelTextColor.value(),fontSize:s.priceLabelFontSize.value(),bold:s.priceLabelBold.value(),italic:s.priceLabelItalic.value()};{const t=i[0],o=i[1],r=t.x<o.x?t:o,n=r===t?o:t,a=s.vertLabelsAlign.value(),c=s.horzLabelsAlign.value();let u;u="left"===c?r.clone():"right"===c?n.clone():new D.Point((t.x+o.x)/2,(t.y+o.y)/2);const h=Math.atan((n.y-r.y)/(n.x-r.x)),p={points:[u],text:s.text.value(),color:s.textColor.value(),vertAlign:a,horzAlign:c,font:N.CHART_FONT_FAMILY,offsetX:0,offsetY:0,bold:s.bold.value(),italic:s.italic.value(),fontsize:s.fontSize.value(),forceTextAlign:!0,angle:h};if(this._customLabelRenderer.setData(p),this._renderer.append(this._customLabelRenderer),a===l.VerticalAlign.Middle){const{mediaSize:{width:t,height:i}}=e;d.excludeBoundaries=(0,A.getTextBoundaries)(this._customLabelRenderer,t,i)??void 0}}this._renderer.append(this._priceNoteRenderer),this._priceNoteRenderer.setData(d),this._renderer.append(this.createLineAnchor({points:i.map(R.mapLineSourcePaneViewPointToLineAnchorPoint)},0))}}var K=i(11542),Y=i(95804),q=i(91445),G=i(14472),X=i(95338),$=i(91682);const U=new Y.TranslatedString("change {title} line color",K.t(null,void 0,i(7455))),j=K.t(null,void 0,i(95170)),J=K.t(null,void 0,i(97575)),Q=K.t(null,void 0,i(34974)),Z=K.t(null,void 0,i(16236));class ee extends G.LineDataSourceDefinitionsViewModel{_stylePropertyDefinitions(){const e=this._source.properties().childs(),t=this._source.name(),i=(0,$.removeSpaces)(t),o=new Y.TranslatedString(t,this._source.translatedType()),r=(0,X.createColorPropertyDefinition)({color:(0,X.getColorDefinitionProperty)(this._propertyApplier,e.lineColor,null,U.format({title:o}))},{id:`${i}LineColor`,title:J});return{definitions:[(0,q.createTextStyleDefinition)(this._propertyApplier,{textColor:e.priceLabelTextColor,fontSize:e.priceLabelFontSize,bold:e.priceLabelBold,italic:e.priceLabelItalic,backgroundColor:e.priceLabelBackgroundColor,borderColor:e.priceLabelBorderColor},o,{isEditable:!1,isMultiLine:!1,customTitles:{text:j,borderTitle:Q,backgroundTitle:Z}}),r]}}_textPropertyDefinitions(){const e=this._source.properties().childs();return{definitions:[(0,q.createTextStyleDefinition)(this._propertyApplier,{...e,textColor:e.textColor,fontSize:e.fontSize},new Y.TranslatedString(this._source.name(),this._source.translatedType()),{isEditable:!0,isMultiLine:!0})]}}}class te extends r.LineDataSource{constructor(e,t,i,o){super(e,t??te.createProperties(e.backgroundTheme().spawnOwnership()),i,o),this._labelMovingDelta=null,this._setPaneViews([new O(this,e)])}pointsCount(){return 2}name(){return"Price Note"}template(){return this._properties.template()}startMoving(e,t,i){if(1===t){if(this.isSourceHidden())return;const i=(0,o.ensureDefined)(e.logical),r=this.points()[1];this._labelMovingDelta={index:r.index-i.index,price:r.price-i.price},this.startChanging(t,i)}else this._labelMovingDelta=null,super.startMoving(e,t,i)}
move(e,t,i){if(null!==this._labelMovingDelta){const t=(0,o.ensureDefined)(e.logical),r={index:t.index+this._labelMovingDelta.index,price:t.price+this._labelMovingDelta.price};this.setPoint(1,r,i),this.updateAllViews((0,w.sourceChangeEvent)(this.id()))}else super.move(e,t,i)}endMoving(e,t,i){return null!==this._labelMovingDelta?(this._labelMovingDelta=null,this.endChanging(!1,e)):super.endMoving(e,t,i)}snapTo45DegreesAvailable(){return!0}static createProperties(e,t){const i=T.create(e,t);return this._configureProperties(i),i}_normalizePoint(e,t){return 0===t?super._normalizePointWithoutOffset(e)??super._normalizePoint(e,t):super._normalizePoint(e,t)}async _getPropertyDefinitionsViewModelClass(){return ee}static _addCollectedProperties(e){}}},73914:(e,t,i)=>{i.d(t,{LineAnchorRenderer:()=>f,lineSourcePaneViewPointToLineAnchorPoint:()=>v,lineSourcePaneViewPointToLineAnchorPoint2:()=>m,mapLineSourcePaneViewPointToLineAnchorPoint:()=>P});var o=i(10555),r=i(6453),n=i(50151),s=i(58221),l=i(87465),a=i(2383),c=i(43838),d=i(4539),u=i(10307);function h(e,t,i,o){const{point:r}=t,n=i+o/2;(0,s.drawRoundRect)(e,r.x-n,r.y-n,2*n,2*n,(i+o)/2),e.closePath(),e.lineWidth=o}function p(e,t,i,o){e.globalAlpha=.2,h(e,t,i,o),e.stroke(),e.globalAlpha=1}function g(e,t,i,o){h(e,t,i-o,o),e.fill(),e.stroke()}function _(e,t,i,o){const{point:r}=t;e.globalAlpha=.2,e.beginPath(),e.arc(r.x,r.y,i+o/2,0,2*Math.PI,!0),e.closePath(),e.lineWidth=o,e.stroke(),e.globalAlpha=1}function b(e,t,i,o){const{point:r}=t;e.beginPath(),e.arc(r.x,r.y,i-o/2,0,2*Math.PI,!0),e.closePath(),e.lineWidth=o,e.fill(),e.stroke()}class f extends u.BitmapCoordinatesPaneRenderer{constructor(e){super(),this._data=e??null}setData(e){this._data=e}hitTest(e){if(null===this._data||this._data.disableInteractions)return null;const{radius:t,points:i}=this._data,o=t+(0,d.interactionTolerance)().anchor;for(const t of i){if(t.point.subtract(e).length()<=o)return new a.HitTestResult(t.hitTarget??a.HitTarget.ChangePoint,{areaName:a.AreaName.AnchorPoint,pointIndex:t.pointIndex,cursorType:t.cursorType??c.PaneCursorType.Default,activeItem:t.activeItem,snappingPrice:t.snappingPrice,snappingIndex:t.snappingIndex,nonDiscreteIndex:t.nonDiscreteIndex,possibleMovingDirections:t.possibleMovingDirections,clickHandler:this._data.clickHandler,tapHandler:this._data.clickHandler,ownerSourceId:this._data.ownerSourceId})}return null}doesIntersectWithBox(e){return null!==this._data&&this._data.points.some((t=>(0,r.pointInBox)(t.point,e)))}_drawImpl(e){if(null===this._data||!this._data.visible)return;const t=[],i=[],o=[],r=[];for(let e=0;e<this._data.points.length;++e){const n=this._data.points[e],s=this._data.backgroundColors[e];n.square?(t.push(n),i.push(s)):(o.push(n),r.push(s))}t.length&&this._drawPoints(e,t,i,g,p),o.length&&this._drawPoints(e,o,r,b,_)}_drawPoints(e,t,i,r,s){const{context:a,horizontalPixelRatio:c,verticalPixelRatio:d}=e,u=(0,n.ensureNotNull)(this._data),h=u.radius;let p=Math.max(1,Math.floor((u.strokeWidth||2)*c));u.selected&&(p+=Math.max(1,Math.floor(c/2)));const g=Math.max(1,Math.floor(c))
;let _=Math.round(h*c*2);_%2!=g%2&&(_+=1);const b=g%2/2;a.strokeStyle=u.color;for(let e=0;e<t.length;++e){const n=t[e];if(!((0,l.isInteger)(n.pointIndex)&&u.linePointBeingEdited===n.pointIndex)){a.fillStyle=i[e];if(r(a,{...n,point:new o.Point(Math.round(n.point.x*c)+b,Math.round(n.point.y*d)+b)},_/2,p),!u.disableInteractions){if(null!==u.hoveredPointIndex&&n.pointIndex===u.hoveredPointIndex){const e=Math.max(1,Math.floor(u.selectedStrokeWidth*c));let t=Math.round(h*c*2);t%2!=g%2&&(t+=1);s(a,{...n,point:new o.Point(Math.round(n.point.x*c)+b,Math.round(n.point.y*d)+b)},t/2,e)}}}}}}function v(e,t=e.pointIndex,i,o,r,n,s,l,a,c){return{point:e,pointIndex:t,cursorType:i,square:o,hitTarget:r,snappingPrice:n,snappingIndex:s,nonDiscreteIndex:l,activeItem:a,possibleMovingDirections:c}}function m(e){return v(e.point,e.pointIndex,e.cursorType,e.square,e.hitTarget,e.snappingPrice,e.snappingIndex,e.nonDiscreteIndex,e.activeItem,e.possibleMovingDirections)}function P(e){return v(e)}},70031:(e,t,i)=>{i.d(t,{factoryDefaultsForCurrentTheme:()=>a});var o=i(16738),r=i(90054),n=i(50151),s=i(45345),l=i(24633);function a(e,t){const i=s.watchedTheme.value()??l.StdTheme.Light,a=(0,r.default)(e);return(0,o.default)(a,(0,n.ensureDefined)(t.get(i))),a}}}]);