"use strict";(self.webpackChunktradingview=self.webpackChunktradingview||[]).push([[8949],{31558:(e,t,i)=>{i.d(t,{commonLineToolPropertiesStateKeys:()=>s});const s=["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 n,r,o;!function(e){e[e.NotShared=0]="NotShared",e[e.SharedInLayout=1]="SharedInLayout",e[e.GloballyShared=2]="GloballyShared"}(n||(n={})),function(e){e.BeforeAllAction="BeforeAll",e.CustomAction="CustomAction"}(r||(r={})),function(e){e.FloatingToolbarButton="FloatingToolbarButton",e.Default="Default"}(o||(o={}))},88636:(e,t,i)=>{i.d(t,{LineDataSourceProperty:()=>a});var s=i(90054),n=i(16738),r=i(50151),o=i(78176);class a extends o.DefaultProperty{constructor({templateKeys:e,...t}){super({ignoreAllowSavingDefaults:!0,saveNonDefaultUserPreferencesOnly:!0,...t}),this._templateKeys=(0,r.ensureDefined)(e||this._allDefaultsKeys)}template(){return(0,o.extractState)(this.state(),this._templateKeys,[])}applyTemplate(e){this.mergeAndFire((0,o.extractState)((0,n.default)((0,s.default)(this._factoryDefaultsSupplier()),e),this._templateKeys))}}},13238:(e,t,i)=>{i.r(t),i.d(t,{LineToolSticker:()=>m});var s=i(78861),n=i(87347),r=i(70099),o=i(9343),a=i(90054),l=i(16738),c=i(88636),u=i(37293),h=i(78176),d=i(31558);const g={intervalsVisibilities:{...u.intervalsVisibilitiesDefaults},size:72},p={sticker:"bitcoin",angle:.5*Math.PI},v=(0,h.extractAllPropertiesKeys)(g),f=(0,h.extractAllPropertiesKeys)(p),P=[...new Set([...f,...v,...d.commonLineToolPropertiesStateKeys])];class y extends c.LineDataSourceProperty{constructor(e){super(e)}static create(e,t,i){return new this({defaultName:"linetoolsticker",factoryDefaultsSupplier:()=>(0,a.default)(g),nonThemedDefaultsKeys:v,themedDefaultsKeys:[],allStateKeys:P,state:(0,l.default)({},p,{sticker:i},t??{}),theme:e})}}const S=(0,o.getLogger)("Chart.LineToolSticker");var b;!function(e){e[e.Version=1]="Version"}(b||(b={}));class m extends r.LineToolSvgIconBase{constructor(e,t,i,s){super(e,t??m.createProperties(e.backgroundTheme().spawnOwnership()),i,s),this.version=1,this._loadViews()}name(){return"Sticker"}static createProperties(e,t){const i=y.create(e,t,s.stickerTool.value());return m._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,14472))).LineDataSourceDefinitionsViewModel}
async _loadViews(){const[{getSvgContentForSticker:e,getSvgRenderer:t},{StickerPaneView:s}]=await Promise.all([i.e(5598).then(i.bind(i,51871)),Promise.all([i.e(6290),i.e(986),i.e(6668),i.e(1583)]).then(i.bind(i,44826))]);if(!this._isDestroyed){const i=this._properties.childs().sticker.value();this._svgContent=e(i),this._onIconChanged.fire();const r=t(n.svgRenderer,i);null===r&&S.logWarn(`Couldn't create svg renderer for sticker ${i}`),this._setPaneViews([new s(this,this._model,r)])}}}},70099:(e,t,i)=>{i.d(t,{LineToolSvgIconBase:()=>h});var s,n=i(50151),r=i(10555),o=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"}(s||(s={}));class h extends c.LineDataSource{constructor(e,t,i,s){super(e,t,i,s),this._onIconChanged=new l.Delegate,this._svgContent=null,this._iconUrl=null,this._hasEditableCoordinates=new o.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,n.ensureNotNull)(this.pointToScreenPoint(this._points[0])),s=this.properties().childs(),o=s.size.value();let l;if(t)l=(0,n.ensureNotNull)(this.pointToScreenPoint(t));else{const e=o/2+this.getAdditionalPadding();l=(0,r.point)(i.y+e,i.y+e),t=(0,n.ensureNotNull)(this.screenPointToPoint(l,!0))}const c=i.subtract(l).length();this._changePointData={centerPoint:i,initialLength:c,initialSize:o,originalAngle:s.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:s,initialLength:r,initialSize:o,startChangeAngle:a,originalAngle:l,alwaysChangeAngle:c,startPoint:h}=(0,n.ensureNotNull)(this._changePointData),d=(0,n.ensureNotNull)(this.pointToScreenPoint(t)),g=this.properties().childs();if(e>=4||c){const t=u(d,s,e);g.angle.setValue(l+(t-a))}if(e<4){const e=s.subtract(d).length(),i=Math.max(20,o*(e/r));if(g.size.setValue(i),!c){const{index:e,price:i}=this._points[0],{index:s,price:n}=h,{index:r,price:o}=t;n<=i!=o<=i||s<=e!=r<=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)}}}}]);