"use strict";(self.webpackChunktradingview=self.webpackChunktradingview||[]).push([[7806],{37130:(e,t,i)=>{i.r(t),i.d(t,{LineToolIcon:()=>C});var n=i(78861),s=i(87347),o=i(70099),r=i(9343),a=i(90054),l=i(16738),c=i(49156),u=i(88636),h=i(37293),d=i(78176),g=i(31558),p=i(65045);const v={intervalsVisibilities:{...h.intervalsVisibilitiesDefaults},color:c.colors.colorTvBlue500,size:72},P={icon:61720,angle:.5*Math.PI},f=(0,d.extractAllPropertiesKeys)(v),y=(0,d.extractAllPropertiesKeys)(P),m=[...new Set([...y,...f,...g.commonLineToolPropertiesStateKeys])];class b extends u.LineDataSourceProperty{constructor(e){super(e),this.addChild("backgroundsColors",new p.LineToolColorsProperty([this.childs().color]))}static create(e,t,i){return new this({defaultName:"linetoolicon",factoryDefaultsSupplier:()=>(0,a.default)(v),nonThemedDefaultsKeys:f,themedDefaultsKeys:[],state:(0,l.default)({},P,{icon:i},t??{}),allStateKeys:m,theme:e})}}const V=(0,r.getLogger)("Chart.LineToolIcon");var S;!function(e){e[e.Version=1]="Version"}(S||(S={}));class C extends o.LineToolSvgIconBase{constructor(e,t,i,n){super(e,t??C.createProperties(e.backgroundTheme().spawnOwnership()),i,n),this.version=1,this._loadViews()}name(){return"Icon"}template(){return this._properties.template()}static createProperties(e,t){const i=b.create(e,t,n.iconTool.value());return this._configureProperties(i),i}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(3198),i.e(5410),i.e(2745),i.e(8823),i.e(8537)]).then(i.bind(i,37120)).then((e=>e.IconsDefinitionsViewModel))}async _loadViews(){const[{getSvgContentForCharCode:e,getSvgRenderer:t},{IconPaneView:n}]=await Promise.all([i.e(7987).then(i.bind(i,40606)),Promise.all([i.e(6290),i.e(986),i.e(6668),i.e(1583)]).then(i.bind(i,20497))]);if(!this._isDestroyed){const i=this._properties.childs().icon.value();this._svgContent=e(i),this._onIconChanged.fire();const o=t(s.svgRenderer,i);null===o&&V.logWarn(`Couldn't create svg renderer for icon ${i}`),this._setPaneViews([new n(this,this._model,o)])}}}},31558:(e,t,i)=>{i.d(t,{commonLineToolPropertiesStateKeys:()=>n});const n=["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 s,o,r;!function(e){e[e.NotShared=0]="NotShared",e[e.SharedInLayout=1]="SharedInLayout",e[e.GloballyShared=2]="GloballyShared"}(s||(s={})),function(e){e.BeforeAllAction="BeforeAll",e.CustomAction="CustomAction"
}(o||(o={})),function(e){e.FloatingToolbarButton="FloatingToolbarButton",e.Default="Default"}(r||(r={}))},88636:(e,t,i)=>{i.d(t,{LineDataSourceProperty:()=>a});var n=i(90054),s=i(16738),o=i(50151),r=i(78176);class a extends r.DefaultProperty{constructor({templateKeys:e,...t}){super({ignoreAllowSavingDefaults:!0,saveNonDefaultUserPreferencesOnly:!0,...t}),this._templateKeys=(0,o.ensureDefined)(e||this._allDefaultsKeys)}template(){return(0,r.extractState)(this.state(),this._templateKeys,[])}applyTemplate(e){this.mergeAndFire((0,r.extractState)((0,s.default)((0,n.default)(this._factoryDefaultsSupplier()),e),this._templateKeys))}}},70099:(e,t,i)=>{i.d(t,{LineToolSvgIconBase:()=>h});var n,s=i(50151),o=i(10555),r=i(22613),a=i(39612),l=i(48096),c=i(41414);function u(e,t,i){return i>=4&&(i-=4),Math.atan2(e.y-t.y,e.x-t.x)+Math.PI/4+Math.PI/2*i+Math.PI/2}!function(e){e[e.AdditionalPaddingFor72PxSize=4]="AdditionalPaddingFor72PxSize",e[e.MinSizeWithoutPadding=20]="MinSizeWithoutPadding"}(n||(n={}));class h extends c.LineDataSource{constructor(e,t,i,n){super(e,t,i,n),this._onIconChanged=new l.Delegate,this._svgContent=null,this._iconUrl=null,this._hasEditableCoordinates=new r.WatchedValue(!1),this._changePointData=null,this._loadViews()}pointsCount(){return 1}getAdditionalPadding(){return 4*Math.max(1,this.properties().childs().size.value()/72)}getChangePointForSync(e){return null}startChanging(e,t){const i=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[0])),n=this.properties().childs(),r=n.size.value();let l;if(t)l=(0,s.ensureNotNull)(this.pointToScreenPoint(t));else{const e=r/2+this.getAdditionalPadding();l=(0,o.point)(i.y+e,i.y+e),t=(0,s.ensureNotNull)(this.screenPointToPoint(l,!0))}const c=i.subtract(l).length();this._changePointData={centerPoint:i,initialLength:c,initialSize:r,originalAngle:n.angle.value(),startChangeAngle:u(l,i,e??0),alwaysChangeAngle:(0,a.lastMouseOrTouchEventInfo)().isTouch,startPoint:t},super.startChanging(e,t)}setPoint(e,t,i){const{centerPoint:n,initialLength:o,initialSize:r,startChangeAngle:a,originalAngle:l,alwaysChangeAngle:c,startPoint:h}=(0,s.ensureNotNull)(this._changePointData),d=(0,s.ensureNotNull)(this.pointToScreenPoint(t)),g=this.properties().childs();if(e>=4||c){const t=u(d,n,e);g.angle.setValue(l+(t-a))}if(e<4){const e=n.subtract(d).length(),i=Math.max(20,r*(e/o));if(g.size.setValue(i),!c){const{index:e,price:i}=this._points[0],{index:n,price:s}=h,{index:o,price:r}=t;s<=i!=r<=i||n<=e!=o<=e?g.angle.setValue(l+Math.PI):g.angle.setValue(l)}}}getSourceIcon(){if(this._iconUrl)return{type:"url",href:this._iconUrl};const e=this.svgContent();return null===e?null:{type:"svgContent",content:e}}onSourceIconChanged(){return this._onIconChanged}svgContent(){return this._svgContent}static _configureProperties(e){super._configureProperties(e),e.addExcludedKey("angle",1)}}}}]);