"use strict";(self.webpackChunktradingview=self.webpackChunktradingview||[]).push([[6336],{15399:(e,t,s)=>{s.d(t,{LevelsProperty:()=>v});var r=s(90054),i=s(16738),n=s(37265),l=s(32679),o=s(35039);const c={prefixes:[""],range:[0,0],names:["coeff","color","visible","linestyle","linewidth"],typecheck:{pack:()=>Object(),unpack:()=>[]}};function a(e,t,s,r){return r.push(s[t]),r}function h(e,t,s,r){return r[t]=s[e],r}function u(){return[]}function p(){return{}}function d(e,t,s){return s.prefixes.forEach((r=>{const i=r+"level";for(let r=s.range[0];r<=s.range[1];r++)if(e[i+r]&&(0,n.isSameType)(e[i+r],t.typecheck())){let n=t.tpl();s.names.forEach(((s,l)=>{n=t.fill(""+l,s,e[i+r],n)})),e[i+r]=n}})),e}function f(e,t,s){return s(e,{tpl:p,fill:h,typecheck:t.typecheck.unpack},t)}class v extends l.DefaultProperty{constructor(e){const{levelsIterator:t=d,map:s={},...r}=e,i={...c,...s};r.state&&(r.state=f(r.state,i,t)),super(r),this._map=i,this._levelsIterator=t}state(e,t,s){const r=super.state(e,t);return s?r:(i=r,n=this._map,(0,this._levelsIterator)(i,{tpl:u,fill:a,typecheck:n.typecheck.pack},n));var i,n}preferences(){return(0,l.extractState)(this.state(this._excludedDefaultsKeys,void 0,!0),this._allDefaultsKeys)}applyTemplate(e,t){this.mergeAndFire((0,l.extractState)((0,i.default)((0,r.default)(t),f(e,this._map,this._levelsIterator)),this._allStateKeys,this._excludedTemplateKeys))}saveDefaults(){this._useUserPreferences&&(0,o.saveDefaults)(this._defaultName,this.preferences())}clone(){return new v(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}}}},12121:(e,t,s)=>{s.d(t,{createPropertiesObject:()=>o});var r=s(37265),i=s(15399);function n(e,t,s){for(const i of Object.keys(e.levels??{}))if(e.levels[i]&&(0,r.isSameType)(e.levels[i],t.typecheck())){let r=t.tpl();s.names.forEach(((s,n)=>{r=t.fill(""+n,s,e.levels[i],r)})),e.levels[i]=r}return e}class l extends i.LevelsProperty{constructor(e,t,s){super({defaultName:e,state:s,map:{names:["width","color","visible"]},levelsIterator:n,theme:t})}}function o(e,t,s){return new l(e,t,s)}},8308:(e,t,s)=>{s.r(t),s.d(t,{LineToolGannFixed:()=>c});var r=s(86441),i=s(50151),n=s(29875),l=s(73305),o=s(12121);class c extends n.LineDataSource{constructor(e,t,r,i){super(e,t??c.createProperties(e.backgroundTheme().spawnOwnership()),r,i),this._constructor="LineToolGannFixed",Promise.all([s.e(6290),s.e(9116),s.e(1200),s.e(1583)]).then(s.bind(s,57736)).then((({GannFixedPaneView:e})=>{this._setPaneViews([new e(this,this.model())])})),this.properties().childs().reverse.subscribe(this,this._reversePoints)}pointsCount(){return 2}name(){return"Gann Square Fixed"}axisPoints(){const e=this.points(),t=this.getScreenPoints();return e.length<2||t.length<2?[]:[e[0],(0,i.ensureNotNull)(this.screenPointToPoint(t[1]))]}getScreenPoints(){const e=this.points();if(e.length<2)return[];const t=this._calcAngle();if(null===t)return[];const[s,n]=e,l=(0, i.ensureNotNull)(this.pointToScreenPoint(s)),o=(0,i.ensureNotNull)(this.pointToScreenPoint(n)),c=Math.sqrt(Math.pow(l.x-o.x,2)+Math.pow(l.y-o.y,2)),a=new r.Point(Math.cos(t),-Math.sin(t)),h=a.normalized(),u=h.x<0?-1:1,p=h.y<0?-1:1;return[l.addScaled(a,c),l.add(new r.Point(5*c*u,5*c*p))]}levelsCount(){return this.properties().childs().levels.childCount()}levels(){const e=[],t=this.properties().childs(),s=t.levels.childCount();for(let r=0;re.GannComplexAndFixedDefinitionsViewModel))}static _configureProperties(e){super._configureProperties(e);const t=[],s=[],r=e.childs();{const e=r.levels.childCount();for(let i=0;i0&&(l=-l),l}_reversePoints(){const[e,t]=this._points;this._points[0]=t,this._points[1]=e,this._normalizePoints(),this.restart()}}}}]);