"use strict";(self.webpackChunktradingview=self.webpackChunktradingview||[]).push([[5967],{79530:(t,e,i)=>{e.rotationMatrix=function(t){const e=Math.cos(t),i=Math.sin(t);return[[e,-i,0],[i,e,0],[0,0,1]]},e.scalingMatrix=function(t,e){return[[t,0,0],[0,e,0],[0,0,1]]},e.translationMatrix=function(t,e){return[[1,0,t],[0,1,e],[0,0,1]]},e.transformPoint=function(t,e){const i=[e.x,e.y,1],s=[0,0,0];for(let e=0;e<3;e++)for(let n=0;n<3;n++)s[e]+=i[n]*t[e][n];return new n.Point(s[0],s[1])};const n=i(10555)},20272:(t,e,i)=>{i.r(e),i.d(e,{LineToolArc:()=>d});var n,s=i(50151),o=i(2624),r=i(10555),a=i(79530),l=i(78176),c=i(41414),h=i(65045),u=i(22613);!function(t){t[t.ArcWithTwoPoints=1]="ArcWithTwoPoints",t[t.ArcWithTheePoints=2]="ArcWithTheePoints",t[t.TheLatest=2]="TheLatest"}(n||(n={}));class d extends c.LineDataSource{constructor(t,e,n,s){super(t,e??d.createProperties(t.backgroundTheme().spawnOwnership()),n,s),this._hasEditableCoordinates=new u.WatchedValue(!1),this.version=2,this._dist=null,Promise.all([i.e(6290),i.e(986),i.e(6668),i.e(1583)]).then(i.bind(i,77425)).then((({ArcPaneView:e})=>{const i=[new e(this,t)];this._setPaneViews(i)}))}startChanging(t,e){if(super.startChanging(t,e),0===t||1===t){const t=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[0])),e=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[1])),i=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[2]));this._dist=(0,o.distanceToLine)(t,e,i).distance;const n=e.subtract(t),a=new r.Point(-n.y,n.x),l=t.add(e).scaled(.5);i.subtract(l).dotProduct(a)<0&&(this._dist=-this._dist)}}endChanging(t,e){return this._dist=null,super.endChanging(t,e)}pointsCount(){return 3}name(){return"Arc"}setPoint(t,e){const i={...e},n=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[0])),l=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[1])),c=this._model.mainSeries().interval();switch(t){case 0:{const t=(0,s.ensureNotNull)(this._dist),e=(0,s.ensureNotNull)(this.pointToScreenPoint(i)),n=l.subtract(e),o=e.add(l).scaled(.5);let a=new r.Point(-n.y,n.x);a=a.normalized();const h=o.add(a.scaled(t));this._points[0]={...i,interval:c},this._points[2]={...(0,s.ensureNotNull)(this.screenPointToPoint(h)),interval:c};break}case 1:{const t=(0,s.ensureNotNull)(this._dist),e=(0,s.ensureNotNull)(this.pointToScreenPoint(i)),o=e.subtract(n),a=n.add(e).scaled(.5),l=new r.Point(-o.y,o.x).normalized(),h=a.add(l.scaled(t));this._points[1]={...i,interval:c},this._points[2]={...(0,s.ensureNotNull)(this.screenPointToPoint(h)),interval:c};break}case 2:{let t=(0,s.ensureNotNull)(this.pointToScreenPoint(i));const e=(0,o.distanceToLine)(n,l,t).distance,h=l.subtract(n),u=n.add(l).scaled(.5),d=new r.Point(-h.y,h.x).normalized(),P=u.add(d.scaled(e)),p=u.add(d.scaled(-e)),_=h.length(),f=h.x/_,m=h.y/_;let N=Math.acos(f);m<0&&(N=-N);let w=(0,a.translationMatrix)(-u.x,-u.y);t=(0,a.transformPoint)(w,t);let g=(0,a.transformPoint)(w,P);w=(0,a.rotationMatrix)(-N),t=(0,a.transformPoint)(w,t),g=(0,a.transformPoint)(w,g),w=(0,a.scalingMatrix)(1,_/(2*e)),t=(0,a.transformPoint)(w,t),g=(0,
a.transformPoint)(w,g);const T=t.y*g.y>=0?new r.Point(P.x,P.y):new r.Point(p.x,p.y);this._points[2]={...(0,s.ensureNotNull)(this.screenPointToPoint(T)),interval:c};break}}this._normalizePoints()}migrateVersion(t,e,i){if(1===t&&2===this._points.length){const t=this._model.mainSeries().interval(),e=(2*this._points[0].price+3*this._points[1].price)/5;this._points.push({price:e,index:this._points[1].index,interval:t})}if(1===t&&2===this._timePoint.length){const t={price:(2*this._timePoint[0].price+3*this._timePoint[1].price)/5,offset:this._timePoint[1].offset,time_t:this._timePoint[1].time_t,interval:this._properties.childs().interval.value()};this._timePoint.push(t)}}static createProperties(t,e){const i=new l.DefaultProperty({defaultName:"linetoolarc",state:e,theme:t});return this._configureProperties(i),i}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(3198),i.e(5410),i.e(2745),i.e(8823),i.e(8537)]).then(i.bind(i,27877))).GeneralFiguresDefinitionsViewModelBase}static _configureProperties(t){super._configureProperties(t),t.addChild("linesColors",new h.LineToolColorsProperty([t.childs().color]))}}}}]);