"use strict";(self.webpackChunktradingview=self.webpackChunktradingview||[]).push([[3945],{15399:(e,t,s)=>{s.d(t,{LevelsProperty:()=>P});var n=s(90054),i=s(16738),r=s(37265),o=s(32679),l=s(35039);const a={prefixes:[""],range:[0,0],names:["coeff","color","visible","linestyle","linewidth"],typecheck:{pack:()=>Object(),unpack:()=>[]}};function c(e,t,s,n){return n.push(s[t]),n}function u(e,t,s,n){return n[t]=s[e],n}function p(){return[]}function h(){return{}}function d(e,t,s){return s.prefixes.forEach((n=>{const i=n+"level";for(let n=s.range[0];n<=s.range[1];n++)if(e[i+n]&&(0,r.isSameType)(e[i+n],t.typecheck())){let r=t.tpl();s.names.forEach(((s,o)=>{r=t.fill(""+o,s,e[i+n],r)})),e[i+n]=r}})),e}function f(e,t,s){return s(e,{tpl:h,fill:u,typecheck:t.typecheck.unpack},t)}class P extends o.DefaultProperty{constructor(e){const{levelsIterator:t=d,map:s={},...n}=e,i={...a,...s};n.state&&(n.state=f(n.state,i,t)),super(n),this._map=i,this._levelsIterator=t}state(e,t,s){const n=super.state(e,t);return s?n:(i=n,r=this._map,(0,this._levelsIterator)(i,{tpl:p,fill:c,typecheck:r.typecheck.pack},r));var i,r}preferences(){return(0,o.extractState)(this.state(this._excludedDefaultsKeys,void 0,!0),this._allDefaultsKeys)}applyTemplate(e,t){this.mergeAndFire((0,o.extractState)((0,i.default)((0,n.default)(t),f(e,this._map,this._levelsIterator)),this._allStateKeys,this._excludedTemplateKeys))}saveDefaults(){this._useUserPreferences&&(0,l.saveDefaults)(this._defaultName,this.preferences())}clone(){return new P(this._options())}merge(e,t){return super.merge(this._map?f(e,this._map,this._levelsIterator):e,t)}_options(){return{...super._options(),map:{...this._map},levelsIterator:this._levelsIterator}}}},90882:(e,t,s)=>{s.d(t,{LineToolFibWedgeBase:()=>l});var n=s(50151),i=s(86441),r=s(10568),o=s(64147);class l extends r.InplaceTextLineDataSource{constructor(){super(...arguments),this._hasEditableCoordinates=new o.WatchedValue(!1)}pointsCount(){return 3}setPoint(e,t){if(super.setPoint(e,t),!this._recursiveGuard)try{if(this._recursiveGuard=!0,2===e){const e=(0,n.ensureNotNull)(this.pointToScreenPoint(this._points[0]));let t=(0,n.ensureNotNull)(this.pointToScreenPoint(this._points[1]));const s=(0,n.ensureNotNull)(this.pointToScreenPoint(this._points[2])).subtract(e).length();let r=t.subtract(e);r.length()<=0&&(r=new i.Point(1,0)),t=e.add(r.normalized().scaled(s));const o=(0,n.ensureNotNull)(this.screenPointToPoint(t)),l=this._pointsProperty.childs().points[1];l.childs().price.setValue(o.price),l.childs().bar.setValue(o.index)}else{const e=(0,n.ensureNotNull)(this.pointToScreenPoint(this._points[0])),t=(0,n.ensureNotNull)(this.pointToScreenPoint(this._points[1]));let s=(0,n.ensureNotNull)(this.pointToScreenPoint(this._points[2]));const r=t.subtract(e).length();let o=s.subtract(e);o.length()<=0&&(o=new i.Point(1,0)),s=e.add(o.normalized().scaled(r));const l=(0,n.ensureNotNull)(this.screenPointToPoint(s)),a=this._pointsProperty.childs().points[2];a.childs().price.setValue(l.price),a.childs().bar.setValue(l.index)}}finally{this._recursiveGuard=!1}} addPoint(e){if(2===this._points.length){const t=(0,n.ensureNotNull)(this.pointToScreenPoint(this._points[0])),s=(0,n.ensureNotNull)(this.pointToScreenPoint(this._points[1]));let i=(0,n.ensureNotNull)(this.pointToScreenPoint(e));const r=s.subtract(t).length(),o=i.subtract(t).normalized();i=t.add(o.scaled(r));const l=(0,n.ensureNotNull)(this.ownerSource()),a=(0,n.ensureNotNull)(l.firstValue()),c=(0,n.ensureNotNull)(this.priceScale()).coordinateToPrice(i.y,a);e={index:Math.round(this._model.timeScale().coordinateToIndex(i.x)),price:c}}return super.addPoint(e)}editableTextProperties(){(0,n.assert)(!1,"unexpected method call")}}},12120:(e,t,s)=>{s.r(t),s.d(t,{LineToolProjection:()=>l});var n,i=s(90882),r=s(15399),o=s(73305);!function(e){e[e.LevelsCount=1]="LevelsCount"}(n||(n={}));class l extends i.LineToolFibWedgeBase{constructor(e,t,n,i){super(e,t??l.createProperties(e.backgroundTheme().spawnOwnership()),n,i),Promise.all([s.e(2870),s.e(2211),s.e(1583)]).then(s.bind(s,31869)).then((e=>{this._setPaneViews([new e.ProjectionLinePaneView(this,this._model)])}))}levelsCount(){return 1}name(){return"Projection"}static createProperties(e,t){const s=new r.LevelsProperty({defaultName:"linetoolprojection",state:t,map:{range:[1,1]},theme:e});return this._configureProperties(s),s}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([s.e(3401),s.e(3889),s.e(8009),s.e(6204),s.e(1963),s.e(8537)]).then(s.bind(s,48306))).ProjectionDefinitionsViewModel}static _configureProperties(e){super._configureProperties(e),e.addChild("linesColors",new o.LineToolColorsProperty([e.childs().trendline.childs().color]))}}}}]);