"use strict";(self.webpackChunktradingview=self.webpackChunktradingview||[]).push([[2501],{21701:(e,t,i)=>{i.r(t),i.d(t,{LineTool5PointsPattern:()=>o});var n=i(82014),r=i(64077),s=i(30340);class o extends n.LineDataSource{constructor(e,t,i,n){super(e,t??o.createProperties(e.backgroundTheme().spawnOwnership()),i,n),this._setPaneViews([new s.Pattern5pointsPaneView(this,e)])}pointsCount(){return 5}name(){return"XABCD Pattern"}static createProperties(e,t){const i=r.LineTool5PointsPatternPropertiesImpl.create(e,t);return this._configureProperties(i),i}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(1982),i.e(7686),i.e(2428),i.e(3920),i.e(9328)]).then(i.bind(i,57207)).then((e=>e.PatternWithBackgroundDefinitionViewModel))}}},30340:(e,t,i)=>{i.d(t,{Pattern5pointsPaneView:()=>g});var n=i(80140),r=i(95385),s=i(68459),o=i(99680),a=i(61208),l=i(93489),h=i(6353),d=i(34192),c=i(83077),u=i(5915),p=i(41928),_=i(14491);class g extends p.LineSourcePaneView{constructor(e,t){super(e,t),this._abRetracement=NaN,this._bcRetracement=NaN,this._cdRetracement=NaN,this._xdRetracement=NaN,this._bcRetracementTrend=new h.TrendLineRenderer,this._xdRetracementTrend=new h.TrendLineRenderer,this._xbTrend=new h.TrendLineRenderer,this._bdTrend=new h.TrendLineRenderer,this._polylineRenderer=new u.PolygonRenderer(new c.HitTestResult(c.HitTarget.MovePoint)),this._mainTriangleRenderer=new l.TriangleRenderer,this._triangleRendererPoints234=new l.TriangleRenderer,this._xbLabelRenderer=new a.TextRenderer,this._acLabelRenderer=new a.TextRenderer,this._bdLabelRenderer=new a.TextRenderer,this._xdLabelRenderer=new a.TextRenderer,this._textRendererALabel=new a.TextRenderer,this._textRendererBLabel=new a.TextRenderer,this._textRendererCLabel=new a.TextRenderer,this._textRendererDLabel=new a.TextRenderer,this._textRendererXLabel=new a.TextRenderer,this._renderer=null}renderer(e){return this._invalidated&&this._updateImpl(e),this._renderer}_updateImpl(e){if(super._updateImpl(e),this._updateBaseData(),this._renderer=null,this._points.length<2)return;const t=this._source.properties().childs(),i=new o.CompositeRenderer,a=(e,i)=>({points:[e],text:i,color:t.textcolor.value(),vertAlign:r.VerticalAlign.Middle,horzAlign:r.HorizontalAlign.Center,font:_.CHART_FONT_FAMILY,offsetX:0,offsetY:0,bold:t.bold&&t.bold.value(),italic:t.italic&&t.italic.value(),fontsize:t.fontsize.value(),backgroundColor:t.color.value(),backgroundRoundRect:4}),l=(e,i)=>({points:[e,i],color:t.color.value(),linewidth:1,linestyle:n.LINESTYLE_DOTTED,extendleft:!1,extendright:!1,leftend:s.LineEnd.Normal,rightend:s.LineEnd.Normal}),[h,c,u,p,g]=this._points,f={points:[h,c,this._points.length<3?c:u],color:"rgba(0, 0, 0, 0)",linewidth:t.linewidth.value(),backcolor:t.backgroundColor.value(),fillBackground:t.fillBackground.value(),transparency:t.transparency.value()};if(this._mainTriangleRenderer.setData(f),i.append(this._mainTriangleRenderer),this._points.length>3){const e={points:[u,p,5===this._points.length?g:p],color:"rgba(0, 0, 0, 0)",linewidth:t.linewidth.value(), backcolor:t.backgroundColor.value(),fillBackground:t.fillBackground.value(),transparency:t.transparency.value()};this._triangleRendererPoints234.setData(e),i.append(this._triangleRendererPoints234)}const y={points:this._points,color:t.color.value(),linewidth:t.linewidth.value(),backcolor:t.backgroundColor.value(),fillBackground:!1,linestyle:n.LINESTYLE_SOLID,filled:!1};this._polylineRenderer.setData(y),i.append(this._polylineRenderer);const x=(0,d.getNumericFormatter)();if(this._points.length>=3){const e=a(h.add(u).scaled(.5),x.format(this._abRetracement));this._xbLabelRenderer.setData(e),i.append(this._xbLabelRenderer),this._xbTrend.setData(l(h,u)),i.append(this._xbTrend)}if(this._points.length>=4){this._bcRetracementTrend.setData(l(c,p)),i.append(this._bcRetracementTrend);const e=a(c.add(p).scaled(.5),x.format(this._bcRetracement));this._acLabelRenderer.setData(e),i.append(this._acLabelRenderer)}if(this._points.length>=5){const e=a(u.add(g).scaled(.5),x.format(this._cdRetracement));this._bdLabelRenderer.setData(e),i.append(this._bdLabelRenderer),this._xdRetracementTrend.setData(l(h,g)),i.append(this._xdRetracementTrend);const t=a(h.add(g).scaled(.5),x.format(this._xdRetracement));this._xdLabelRenderer.setData(t),i.append(this._xdLabelRenderer),this._bdTrend.setData(l(u,g)),i.append(this._bdTrend)}const P=a(h,"X");c.y>h.y?(P.vertAlign=r.VerticalAlign.Bottom,P.offsetY=5):(P.vertAlign=r.VerticalAlign.Top,P.offsetY=5),this._textRendererXLabel.setData(P),i.append(this._textRendererXLabel);const m=a(c,"A");if(c.y2){const e=a(u,"B");u.y3){const e=a(p,"C");p.y4){const e=a(g,"D");g.y=3){const[e,t,i]=this._source.points();this._abRetracement=Math.round(1e3*Math.abs((i.price-t.price)/(t.price-e.price)))/1e3}if(this._source.points().length>=4){const[,e,t,i]=this._source.points();this._bcRetracement=Math.round(1e3*Math.abs((i.price-t.price)/(t.price-e.price)))/1e3}if(this._source.points().length>=5){const[e,t,i,n,r]=this._source.points();this._cdRetracement=Math.round(1e3*Math.abs((r.price-n.price)/(n.price-i.price)))/1e3,this._xdRetracement=Math.round(1e3*Math.abs((r.price-t.price)/(t.price-e.price)))/1e3}}}},64077:(e,t,i)=>{i.d(t,{LineTool5PointsPatternPropertiesImpl:()=>w,nonThemedFactoryDefaults:()=>g, themedFactoryDefaults:()=>y});var n=i(85842),r=i(11284),s=i(47097),o=i(88483),a=i(25432),l=i(5829),h=i(93445),d=i(86371),c=i(33993),u=i(17567);const p=(0,r.getHexColorByName)("color-tv-blue-500"),_=(0,r.getHexColorByName)("color-white"),g={intervalsVisibilities:{...o.intervalsVisibilitiesDefaults},fillBackground:!0,transparency:85,linewidth:l.DEFAULT_LINE_TOOL_LINE_WIDTH,fontsize:12,bold:!1,italic:!1},f={color:p,textcolor:_,backgroundColor:p},y=new Map([[s.StdTheme.Light,f],[s.StdTheme.Dark,f]]),x=(0,h.extractThemedColors)((0,n.ensureDefined)(y.get(s.StdTheme.Light)),(0,n.ensureDefined)(y.get(s.StdTheme.Dark))),P=(0,h.extractAllPropertiesKeys)((0,n.ensureDefined)(y.get(s.StdTheme.Light))),m=(0,h.extractAllPropertiesKeys)(g),b=[...P,...m],T=[...new Set([...b,...a.commonLineToolPropertiesStateKeys])];class w extends d.LineDataSourceProperty{constructor(e){super(e),this.addChild("linesColors",new c.LineToolColorsProperty([(0,n.ensureDefined)(this.child("color"))])),this.addChild("textsColors",new c.LineToolColorsProperty([(0,n.ensureDefined)(this.child("textcolor"))])),this.addChild("backgroundsColors",new c.LineToolColorsProperty([(0,n.ensureDefined)(this.child("backgroundColor"))]))}static create(e,t,i){return w._createWithDefaults("linetool5pointspattern",e,g,y,t,i)}static _createWithDefaults(e,t,i,n,r,s){return new this({defaultName:e,factoryDefaultsSupplier:()=>(0,u.factoryDefaultsForCurrentTheme)(i,n),nonThemedDefaultsKeys:m,themedDefaultsKeys:P,allStateKeys:T,themedColors:x,templateKeys:b,replaceThemedColorsOnThemeChange:!0,state:r,theme:t,useUserPreferences:s})}}},58729:(e,t,i)=>{i.r(t),i.d(t,{LineToolCypherPattern:()=>l});var n=i(21701),r=i(64077);class s extends r.LineTool5PointsPatternPropertiesImpl{static create(e,t,i){return r.LineTool5PointsPatternPropertiesImpl._createWithDefaults("linetoolcypherpattern",e,r.nonThemedFactoryDefaults,r.themedFactoryDefaults,t,i)}}var o=i(30340);class a extends o.Pattern5pointsPaneView{_updateBaseData(){if(this._source.points().length>=3){const[e,t,i]=this._source.points();this._abRetracement=Math.round(1e3*Math.abs((i.price-t.price)/(t.price-e.price)))/1e3}if(this._source.points().length>=4){const[e,t,,i]=this._source.points();this._bcRetracement=Math.round(1e3*Math.abs((i.price-e.price)/(t.price-e.price)))/1e3}if(this._source.points().length>=5){const[e,,t,i,n]=this._source.points();this._cdRetracement=Math.round(1e3*Math.abs((n.price-i.price)/(i.price-t.price)))/1e3,this._xdRetracement=Math.round(1e3*Math.abs((n.price-i.price)/(e.price-i.price)))/1e3}}}class l extends n.LineTool5PointsPattern{constructor(e,t,i,n){super(e,t??l.createProperties(e.backgroundTheme().spawnOwnership()),i,n),this._setPaneViews([new a(this,e)])}name(){return"Cypher Pattern"}static createProperties(e,t){const i=s.create(e,t);return this._configureProperties(i),i}}},25432:(e,t,i)=>{i.d(t,{commonLineToolPropertiesStateKeys:()=>n}) ;const n=["symbolStateVersion","zOrderVersion","frozen","title","interval","symbol","currencyId","unitId","metricId","visible","adjustedToSplitTime","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,s,o;!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"}(s||(s={})),function(e){e.FloatingToolbarButton="FloatingToolbarButton",e.Default="Default"}(o||(o={}))},41928:(e,t,i)=>{i.d(t,{LineSourcePaneView:()=>f,anchorResizeCursorType:()=>_,createLineSourcePaneViewPoint:()=>g});var n=i(11284),r=i(85842),s=i(29968),o=i(83077),a=i(71367),l=i(8165),h=i(28031),d=i(61208);const c=n.colorsPalette["color-tv-blue-600"];var u,p;function _(e,t){const i=e.x-t.x,n=e.y-t.y;if(!Number.isFinite(i)||!Number.isFinite(n)||0===i&&0===n)return h.PaneCursorType.Default;let s=Math.atan2(n,i);return s<0&&(s+=2*Math.PI),s>=p.deg337_5||s=p.deg157_5&&s=p.deg22_5&&s=p.deg202_5&&s=p.deg67_5&&s=p.deg247_5&&s=p.deg112_5&&s=p.deg292_5&&s{const i=n[t],r=(0,l.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)),n=this._getOwnerSource();if(this.isLocked()){const r=this._getSelectionRenderer(t);return r.setData({bgColors:this._lineAnchorColors(i),points:e.points,visible:this.areAnchorsVisible(),hittestResult:o.HitTarget.Regular,ownerSourceId:n?.id(),barSpacing:this._model.timeScale().barSpacing()}),r}const r=(0,s.lastMouseOrTouchEventInfo)().isTouch,a=this._getLineAnchorRenderer(t),l=this.isHoveredSource()?this._model.lastHittestData()?.pointIndex??null:null;return a.setData({...e,color:this.anchorColor(),backgroundColors:this._lineAnchorColors(i),hoveredPointIndex:l,linePointBeingEdited:this.isBeingEdited()?this._model.linePointBeingEdited():null,radius:this._anchorRadius(),strokeWidth:r?u.TouchStrokeWidth:u.RegularStrokeWidth,selected:this.isSelectedSource(),selectedStrokeWidth:r?u.TouchSelectedStrokeWidth:u.RegularSelectedStrokeWidth,visible:this.areAnchorsVisible(),clickHandler:e.clickHandler,ownerSourceId:n?.id()}),a}_getOwnerSource(){return this._ownerSource??this._source.ownerSource()}_anchorRadius(){return(0,s.lastMouseOrTouchEventInfo)().isTouch?u.TouchAnchorRadius:u.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(g(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){return null} _getSelectionRenderer(e){for(;this._selectionRenderers.length<=e;)this._selectionRenderers.push(new a.SelectionRenderer);return this._selectionRenderers[e]}_getLineAnchorRenderer(e){for(;this._lineAnchorRenderers.length<=e;)this._lineAnchorRenderers.push(new l.LineAnchorRenderer);return this._lineAnchorRenderers[e]}}},86371:(e,t,i)=>{i.d(t,{LineDataSourceProperty:()=>l});var n=i(57600),r=i(35558),s=i(85842),o=i(93445),a=i(47895);class l extends o.DefaultProperty{constructor({templateKeys:e,factoryDefaultsSupplier:t,...i}){let n=t;t&&(n=()=>{const e=t();return(0,a.applyDefaultsOverrides)(e,void 0,void 0,i.defaultName),e}),super({saveNonDefaultUserPreferencesOnly:!0,factoryDefaultsSupplier:n,...i}),this._templateKeys=(0,s.ensureDefined)(e||this._allDefaultsKeys)}template(){return(0,o.extractState)(this.state(),this._templateKeys,[])}applyTemplate(e){this.mergeAndFire((0,o.extractState)((0,r.default)((0,n.default)(this._factoryDefaultsSupplier()),e),this._templateKeys))}}},80071:(e,t,i)=>{i.d(t,{intersectLineWithViewport:()=>o});var n=i(57415);function r(e,t,i){return e>=t&&e<=i?e:null}function s(e,t,i,n){return Math.sign(e.x-t.x)===Math.sign(i.x-n.x)&&Math.sign(e.y-t.y)===Math.sign(i.y-n.y)}function o(e,t,i,o,a,l,h){const d=e.x>=0&&e.x<=a&&e.y>=0&&e.y<=l,c=t.x>=0&&t.x<=a&&t.y>=0&&t.y<=l;if(d&&c&&!i&&!o)return[e,t];if(e.x<0&&t.x<0&&(e.xa&&t.x>a&&(e.xl&&t.y>l&&(e.ya)return null;e.yl?l+(e.y-l)%h:l+(h-(l-e.y)%h)),new n.Point(t.x,0))}else if(e.y===t.y){if(e.y<0||e.y>l)return null;e.xa?a+(e.x-a)%h:a+(h-(a-e.x)%h),e.y),new n.Point(0,t.y))}else{const s=(t.y-e.y)/(t.x-e.x),o=e.y-s*e.x;let d=0,c=0;const p=r(o,0,l);if(null!==p)if(h>0&&(e.x<=0||i&&e.x0&&(e.x>=a||i&&e.x>t.x)){const t=e.x>=a?Math.sqrt(Math.pow(e.x-a,2)+Math.pow(e.y-_,2))%h:h-Math.sqrt(Math.pow(e.x-a,2)+Math.pow(e.y-_,2))%h;d=Math.cos(Math.atan(s))*t,c=s*d,u.push(new n.Point(a+d,_+c))}else u.push(new n.Point(a,_));const g=r(-o/s,0,a);if(null!==g&&(0!==g||0!==p))if(h>0&&(e.y<=0||i&&e.y0&&(e.y>=l||i&&e.y>t.y)){const t=e.y>=l?Math.sqrt(Math.pow(e.x-f,2)+Math.pow(e.y-l,2))%h:h-Math.sqrt(Math.pow(e.x-f,2)+Math.pow(e.y-l,2))%h;d=Math.cos(Math.atan(s))*t,c=s*d, u.push(new n.Point(f+Math.sign(s)*d,l+Math.sign(s)*c))}else u.push(new n.Point(f,l))}if(u.length<1)return null;if(u.length<2&&u.push(u[0]),!i&&d){return[e,s(u[0],u[1],e,t)?u[1]:u[0]]}if(!o&&c){return[s(u[0],u[1],e,t)?u[0]:u[1],t]}return s(u[0],u[1],e,t)?[u[0],u[1]]:[u[1],u[0]]}},8165:(e,t,i)=>{i.d(t,{LineAnchorRenderer:()=>y,lineSourcePaneViewPointToLineAnchorPoint:()=>x,lineSourcePaneViewPointToLineAnchorPoint2:()=>P,mapLineSourcePaneViewPointToLineAnchorPoint:()=>m});var n=i(57415),r=i(91069),s=i(85842),o=i(51946),a=i(7321),l=i(83077),h=i(28031),d=i(72244),c=i(57507);function u(e,t,i,n){const{point:r}=t,s=i+n/2;(0,o.drawRoundRect)(e,r.x-s,r.y-s,2*s,2*s,(i+n)/2),e.closePath(),e.lineWidth=n}function p(e,t,i,n){e.globalAlpha=.2,u(e,t,i,n),e.stroke(),e.globalAlpha=1}function _(e,t,i,n){u(e,t,i-n,n),e.fill(),e.stroke()}function g(e,t,i,n){const{point:r}=t;e.globalAlpha=.2,e.beginPath(),e.arc(r.x,r.y,i+n/2,0,2*Math.PI,!0),e.closePath(),e.lineWidth=n,e.stroke(),e.globalAlpha=1}function f(e,t,i,n){const{point:r}=t;e.beginPath(),e.arc(r.x,r.y,i-n/2,0,2*Math.PI,!0),e.closePath(),e.lineWidth=n,e.fill(),e.stroke()}class y extends c.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,n=t+(0,d.interactionTolerance)().anchor;for(const t of i){if(t.point.subtract(e).length()<=n)return new l.HitTestResult(t.hitTarget??l.HitTarget.ChangePoint,{areaName:l.AreaName.AnchorPoint,pointIndex:t.pointIndex,cursorType:t.cursorType??h.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=[],n=[],r=[];for(let e=0;e{i.d(t,{PolygonRenderer:()=>_});var n=i(91069),r=i(17086),s=i(6353),o=i(68459),a=i(83077),l=i(82347),h=i(56568),d=i(72244),c=i(51946),u=i(80140),p=i(40450);class _ extends h.MediaCoordinatesPaneRenderer{constructor(e){super(),this._data=null,this._backHittest=new a.HitTestResult(a.HitTarget.MovePointBackground),this._points=[],this._hittest=e??new a.HitTestResult(a.HitTarget.MovePoint)}setData(e){this._data=e,this._points=e.points}hitTest(e){if(null===this._data||this._data.disableInteractions)return null;const t=Math.max((0,d.interactionTolerance)().line,Math.ceil(this._data.linewidth/2)),i=this._points.length;if(1===i){return(0,n.pointInCircle)(e,this._points[0],t)?this._hittest:null}for(let n=1;n0){const n=this._points[0],s=this._points[i-1];if((0,r.distanceToSegment)(n,s,e).distance<=t)return this._hittest}return this._data.filled&&this._data.fillBackground&&(0,n.pointInPolygon)(e,this._data.points)?this._backHittest:null}_drawImpl(e){const t=e.context,i=this._points.length;if(null===this._data||0===i)return;const n=t.globalAlpha;try{if(void 0!==this._data.globalAlpha&&(t.globalAlpha=this._data.globalAlpha),1===i)return void this._drawPoint(t,this._points[0],this._data.linewidth/2,this._data.color);t.beginPath();const e=this._data.linestyle===u.LINESTYLE_SOLID?"round":"butt",n=this._data.linecap??e;t.lineCap=n,t.strokeStyle=this._data.color,t.lineWidth=this._data.linewidth,t.lineJoin=this._data.linejoin??"round",(0,c.setLineStyle)(t,this._data.linestyle);const r=this._points[0];t.moveTo(r.x,r.y);for(const e of this._points)t.lineTo(e.x,e.y);if(this._data.filled&&this._data.fillBackground&&(t.fillStyle=(0,l.generateColor)(this._data.backcolor,this._data.transparency),t.fill()),this._data.filled&&!this._data.skipClosePath&&t.closePath(),i>1){if(this._data.leftend===o.LineEnd.Arrow){const e=this._correctArrowPoints(this._points[1],this._points[0],t.lineWidth,n);(0,s.drawArrow)(e[0],e[1],t,t.lineWidth,p.dpr1PixelRatioInfo)}if(this._data.rightend===o.LineEnd.Arrow){const e=this._correctArrowPoints(this._points[i-2],this._points[i-1],t.lineWidth,n);(0,s.drawArrow)(e[0],e[1],t,t.lineWidth,p.dpr1PixelRatioInfo)}}this._data.linewidth>0&&t.stroke()}finally{t.globalAlpha=n}}_drawPoint(e,t,i,n){0!==i&&(e.beginPath(),e.fillStyle=n,e.arc(t.x,t.y,i,0,2*Math.PI,!0),e.fill(),e.closePath())}_correctArrowPoints(e,t,i,n){ const r=t.subtract(e),s=r.length();if("butt"===n||s<1)return[e,t];const o=s+i/2;return[e,r.scaled(o/s).add(e)]}}},93489:(e,t,i)=>{i.d(t,{TriangleRenderer:()=>p});var n=i(57415),r=i(17086),s=i(91069),o=i(56568),a=i(83077),l=i(82347),h=i(72244),d=i(51946),c=i(80140),u=i(80071);class p extends o.MediaCoordinatesPaneRenderer{constructor(){super(...arguments),this._data=null}setData(e){this._data=e}hitTest(e){if(null===this._data||this._data.points.length<2)return null;const[t,i]=this._data.points;let n=(0,r.distanceToSegment)(t,i,e);const o=(0,h.interactionTolerance)().line;if(n.distance<=o)return new a.HitTestResult(a.HitTarget.MovePoint);if(3!==this._data.points.length)return null;const l=this._data.points[2];return n=(0,r.distanceToSegment)(i,l,e),n.distance<=o?new a.HitTestResult(a.HitTarget.MovePoint):(n=(0,r.distanceToSegment)(l,t,e),n.distance<=o?new a.HitTestResult(a.HitTarget.MovePoint):this._data.fillBackground&&(0,s.pointInTriangle)(e,t,i,l)?new a.HitTestResult(a.HitTarget.MovePointBackground):null)}_drawImpl(e){if(null===this._data||this._data.points.length<2)return;const t=e.context,i=(this._data.linestyle??c.LINESTYLE_SOLID)===c.LINESTYLE_SOLID?"round":"butt";t.lineCap=i,t.lineJoin="round",t.strokeStyle=this._data.color,t.lineWidth=this._data.linewidth,void 0!==this._data.linestyle&&(0,d.setLineStyle)(t,this._data.linestyle);const[r,s,o=s]=this._data.points,{mediaSize:a}=e;if(this._data.fillBackground&&Math.abs((r.x-o.x)*(s.y-o.y)-(s.x-o.x)*(r.y-o.y))>1e-10){let e=[new n.Point(0,0),new n.Point(a.width,0),new n.Point(a.width,a.height),new n.Point(0,a.height)];if(e=(0,d.clipPolygonByEdge)(e,r,s,[s,o]),e=(0,d.clipPolygonByEdge)(e,s,o,[o,r]),e=(0,d.clipPolygonByEdge)(e,o,r,[r,s]),e&&e.length>1){t.save(),t.beginPath(),t.moveTo(e[0].x,e[0].y);for(let i=1;ie+t),0);[[r,s],[s,o],[o,r]].forEach((([e,t])=>{const i=(0,u.intersectLineWithViewport)(e,t,!1,!1,a.width,a.height,p);i&&h.push(i)})),h.length&&(t.beginPath(),h.forEach((([e,i])=>{t.moveTo(e.x,e.y),t.lineTo(i.x,i.y)})),t.stroke())}}},17567:(e,t,i)=>{i.d(t,{factoryDefaultsForCurrentTheme:()=>l});var n=i(35558),r=i(57600),s=i(85842),o=i(49841),a=i(47097);function l(e,t){const i=o.watchedTheme.value()??a.StdTheme.Light,l=(0,r.default)(e);return(0,n.default)(l,(0,s.ensureDefined)(t.get(i))),l}}}]);