"use strict";(self.webpackChunktradingview=self.webpackChunktradingview||[]).push([[92360],{846778:(e,t,i)=>{i.d(t,{showPasteLineToolHint:()=>c});var s=i(444372),r=i(62802),n=i(638456),o=i(470316),l=i(244842);const a=s.t(null,void 0,i(13262));function c(e,t){l.enabled("popup_hints")&&!n.CheckMobile.any()&&Promise.all([i.e(86282),i.e(4288),i.e(90385),i.e(26166)]).then(i.bind(i,410837)).then((i=>{const s=new i.ChartEventHintRenderer(e),n=a.format({shortcut:(0,o.humanReadableHash)(o.Modifiers.Mod+86)});let l=null;s.show(n,(()=>{null!==l&&(clearTimeout(l),l=null,r.setValue(t,!0,{forceFlush:!0}))})),l=setTimeout((()=>{l=null,s.hide()}),5e3)}))}},1500:(e,t,i)=>{i.d(t,{solutionIds:()=>s}) ;const s=JSON.parse('{"EXTENDED_HOURS":43000502023,"PRE_MARKET":43000502023,"POST_MARKET":43000502023,"SPREAD_CHARTS":43000502298,"ALERTS":43000520149,"ALERT_ON_STRATEGY":43000481368,"ALERT_WEBHOOK":43000529348,"ALERT_DESCRIPTION_PLACEHOLDER":43000531021,"ALERT_RECEIVE_NOTIFICATIONS_OH_PHONE":43000474389,"ALERT_USE_ALTERNATIVE_EMAIL":43000474394,"ALERT_WEBHOOK_CREDENTIALS":43000722015,"VOLUME_PROFILE":43000502040,"VOLUME_PROFILE_INDICATOR":43000557450,"RENKO":43000502284,"KAGI":43000502272,"LINE_BREAK":43000502273,"PNF":43000502276,"FINANCIAL_DATA":43000543506,"BROKER_RATING":43000542490,"CRYPTO_MARKET_CAP":43000540941,"CRYPTO_PAYMENT":43000485536,"ALERT_ON_SPREAD":43000478406,"ALERT_ON_LOG_SCALE":43000690942,"ALERT_ON_CUSTOM_SCRIPT":43000478415,"ALERT_FUNCTION":43000597494,"SMS_VERIFICATION":43000553429,"MAGNET_MODE":43000537270,"PINE_CANNOT_DETERMINE":43000587849,"PRIVACY_SETTINGS":43000548335,"PUBLICATION_TYPE":43000609497,"SCRIPT_ACCESS":43000482573,"MEMORY_LIMITS_EXCEEDED":43000590233,"FREE_USER_FAQS":43000590947,"STRATEGY_UNREALISTIC_RESULTS":43000481029,"STRATEGY_FUTURE_DATA":43000614705,"STREAM_RULES":43000591348,"HOW_TO_USE_PAPER":43000516466,"HOW_TO_USE_CQG":43000516372,"HOW_TO_USE_OANDA":43000516375,"HOW_TO_USE_FOREXCOM":43000516374,"FAVORITE_IDEA":43000555216,"YOUTUBE_ERROR":43000612153,"AUTHORS_INSTRUCTIONS_PUBCLICATION":43000549951,"AUTHORS_INSTRUCTIONS_EDIT":43000614618,"SCRIPT_INSTRUCTIONS":43000482573,"BAR_REPLAY_UNAVAILABILITY":43000475470,"WHAT_IS_CBOE_BZX_EXCHANGE":43000473924,"GOPRO_UPGRADE_DESCRIPTION":43000473324,"GOPRO_DOWNGRADE_DESCRIPTION":43000485437,"FINANCIALS_OWNERSHIP":43000699479,"FINANCIALS_VALUATION_SUMMARY":43000699484,"FINANCIALS_VALUATION_RATIOS":43000699495,"FINANCIALS_GROWTH_AND_PROFITABILITY":43000699485,"FINANCIALS_REVENUE_TO_PROFIT_CONVERSION":43000699496,"FINANCIALS_REVENUE_BREAKDOWN_BY_SOURCE":43000699487,"FINANCIALS_REVENUE_BREAKDOWN_BY_COUNTRY":43000699497,"FINANCIALS_REVENUE_ESTIMATES":43000699489,"FINANCIALS_EARNINGS_ESTIMATES":43000699498,"FINANCIALS_DIVIDEND_SUMMARY":43000699500,"FINANCIALS_DIVIDEND_HISTORY":43000699501,"FINANCIALS_DEBT_LEVEL":43000699502,"FINANCIALS_POSITION":43000699503,"BROKERAGE_REVIEWS":43000591351,"CHANGE_SUBSCRIPTION":43000635806,"PINE_LIBRARY_INFO":43000638371,"HOW_TO_CREATE_A_STREAM":43000646171,"HOW_DO_I_UPDATE_DESKTOP_APP":43000647779,"TECHNICAL_RATINGS":43000614331,"BACKTESTING_WIDGET":43000562362,"BACKTESTING_NO_DATA":43000478450,"DEEP_BACKTESTING_WIDGET":43000670566,"DEEP_BACKTESTING":43000666199,"DEEP_BACKTESTING_AVAILABLE_DATA":43000668210,"BETA_BROKERS":43000673434,"VIDEO_UPLOAD_FAILED":43000666607,"VIDEO_DEVICE_ACCESS":43000677209,"PUBLIC_INVITE_ONLY_SCRIPTS":43000614617,"HOW_DOES_BRACKETS_MANAGEMENT_WORK":43000631987,"HOW_TO_SEE_THE_DEEPEST_HIST_DATA":43000687053,"I_CANT_SEE_ALL_HIST_DATA_ON_RES_LOWER_THAN_DAY":43000480679,"IDEAS_ON_CHART":43000694285,"GET_A_REFUND":43000485430,"USE_SETTLEMENT_AS_CLOSE_ON_DAILY_INTREVAL":43000685268,"ADJUST_FOR_CONTRACT_CHANGES":43000685266,"ADJUST_DATA_FOR_DIVIDENDS":43000590597,"WHY_IS_MY_ACCOUNT_BANNED":43000674726,"HOW_TO_PUBLISH_A_VIDEO_IDEA":43000476752,"WHAT_ARE_TRADINGVIEW_LIVE_STREAMS_BEST_PRACTICES":43000685377,"TELL_ME_MORE_ABOUT_THE_COMMUNITY_SCRIPTS":43000558522,"HOW_TO_POST_AWESOME_IDEAS_AND_GET_LOTS_OF_LIKES":43000603748,"ABOUT_EXPERT_PLAN":43000677382,"CONNECTIONS_LIMIT_EXCEEDED":43000693877,"ACCOUNT_RECOVERY":43000619597,"HOW_TO_SYNC_CHARTS_ON_LAYOUT":43000629992,"HOW_TO_SEE_BUILTIN_INDICATOR_SOURCE":43000481659,"HOW_CAN_I_GET_ACCESS_TO_STREAMS":43000685376,"MULTI_CHART_MODE":43000629990,"QUICK_SEARCH":43000659671,"WHATS_AN_INDICATOR":43000543626,"CHART_TYPES":43000703407,"DRAWING_TOOLS":43000703396,"CUSTOM_INTERVALS":43000543883,"CANDLESTICK_PATTERNS":43000584462,"MULTI_TIMEFRAME_CHARTS":43000502591,"BAR_REPLAY":43000712747,"PINE_SCRIPT":43000561836,"SCREENER_OVERVIEW":43000635796,"STREAMS_OBS_SETUP":43000639464,"AUTO_CHART_PATTERNS":43000690464,"HOW_TO_PROTECT_YOUR_ACCOUNT":43000582277,"PLUS_BUTTON":43000645256,"PLAN_UPGRADED_BUT_DATA_STILL_DELAYED":43000471705,"WHY_TAX_HAS_BEEN_ADDED_TO_MY_BILL":43000684741,"COMPARE_SYMBOLS_TOOL":43000543053,"SAVED_CHART":43000692404,"CUSTOM_INDICATOR":43000543048,"BIST_MIXED_SUBSCRIPTION":43000609137,"WHY_RENKO_NOT_WORK":43000711502,"ALERTS_SEPARATION_BY_TYPE":43000696403,"HOW_TO_SET_UP_ALERTS":43000595315,"PINE_SCRIPT_STRATEGIES":43000562362,"ECONOMIC_CALENDAR":43000707391,"DIFFERENCE_BETWEEN_PRO_AND_NONPRO_PLANS":43000677382,"HOW_TO_USE_MINDS":43000690226,"HOW_TO_USE_TRADINGVIEW_CHAT":43000604448,"PAPER_COMPETITION":43000593579,"PAPER_COMPETITION_ACCOUNT":43000721315,"PAPER_COMPETITION_PRIZE":43000721317,"PAPER_COMPETITION_FREE_ACCOUNT":43000721310,"PUBLISHING_AND_UPDATING_IDEAS":43000591338,"USING_MINDS":43000696301,"PUBLISH_VIDEO_IDEA":43000476752,"STREAM_GUIDE":43000646171,"TAROT_DECK":43000724020,"VAT_NUMBER_GUIDE":43000721910,"AVAILABLE_COMPETITION_INSTRUMENTS":43000721311,"PINE_PERFORMANCE_PROFILER":43000725216,"PINE_LOGS_INFO":43000710876}') },626333:(e,t,i)=>{function s(e,t=window){const i="theme-"+e,s=t.document.documentElement.classList;for(const e of Array.from(s))e.startsWith("theme-")&&e!==i&&s.remove(e);s.add(i)}i.d(t,{applyTheme:()=>s})},983898:(e,t,i)=>{function s(e,t,i){const s=e.get(t);return void 0!==s?s:(e.set(t,i),i)}function r(e,t,i){const s=e.get(t);if(void 0!==s)return s;const r=i();return e.set(t,r),r}function n(e,t,i,r){const n=s(e,t,new Map);return s(n,i,r)}function o(e,t,i,n){return r(s(e,t,new Map),i,n)}function l(e,t,i,r,n){const o=s(e,t,new Map),l=s(o,i,new Map);return s(l,r,n)}i.d(t,{AbstractMapContainer:()=>a,getDefault2:()=>n,getDefault2Lazy:()=>o,getDefault3:()=>l});class a{constructor(){this._map=new Map,this._size=0}size(){return this._size}clear(){this._map.clear(),this._size=0}}},407478:(e,t,i)=>{i.d(t,{CircularCacheBuffer:()=>n});var s=i(650151);function r(e){const{prevItem:t,nextItem:i}=e;null!==t&&(t.nextItem=i),null!==i&&(i.prevItem=t)}class n{constructor(e=0,t=1.3){this._cache=new Map,this._lastItem=null,this._firstItem=null,this._size=e,this._sizeLimited=e>0,this._capacityFactor=t}set(e,t){const i={key:e,value:t,prevItem:this._lastItem,nextItem:null};null!==this._lastItem&&(this._lastItem.nextItem=i);const s=this._cache.get(e);return void 0!==s&&(r(s),s===this._firstItem&&(this._firstItem=s.nextItem)),this._cache.set(e,i),this._lastItem=i,null===this._firstItem&&(this._firstItem=i),this._sizeLimited&&this._cache.size>this._size*this._capacityFactor&&this._removeExtraItems(),this}has(e){return this._cache.has(e)}get(e){var t;const i=this._cache.get(e);if(void 0===i)return i;if(i===this._firstItem&&(this._firstItem=null!==(t=i.nextItem)&&void 0!==t?t:i),i!==this._lastItem){r(i);const e=(0,s.ensureNotNull)(this._lastItem);e.nextItem=i,i.prevItem=e,i.nextItem=null,this._lastItem=i}return i.value}clear(){this._cache.clear(),this._firstItem=null,this._lastItem=null}delete(e){const t=this._cache.get(e);return void 0!==t&&(r(t),t===this._lastItem&&(this._lastItem=t.prevItem),t===this._firstItem&&(this._firstItem=t.nextItem)),this._cache.delete(e)}_removeExtraItems(){const e=this._cache.size-this._size;let t=(0,s.ensureNotNull)(this._firstItem);for(let i=0;i<e;i+=1)this._cache.delete(t.key),t=(0,s.ensureNotNull)(t.nextItem);t.prevItem=null,this._firstItem=t}}},809796:(e,t,i)=>{i.d(t,{TranslatedString:()=>s});class s{constructor(e,t){this._originalText=e,this._translatedText=t}originalText(){return this._originalText}translatedText(){return this._translatedText}format(e){const t={},i={};for(const r of Object.keys(e)){const n=e[r];n instanceof s?(t[r]=n.originalText(),i[r]=n.translatedText()):(t[r]=n.toString(),i[r]=n.toString())}const r=this._originalText.format(t),n=this._translatedText.format(i);return new s(r,n)}}},938550:(e,t,i)=>{i.d(t,{WatchedObject:()=>o});var s=i(401580),r=i(389137);function n(e,t){return(0,r.deepEquals)(e,t)[0]}class o extends s.WatchedValue{constructor(e,t=n){super(e),this._comparator=t}setValue(e,t){!1===this._comparator(this.value(),e)&&super.setValue(e,t)}}},199471:(e,t,i)=>{i.d(t,{ addExclusionArea:()=>x,addExclusionAreaByScope:()=>b,calcTextHorizontalShift:()=>y,clearRect:()=>p,createBoundCanvas:()=>g,createDisconnectedCanvas:()=>f,createDisconnectedCanvasByRenderingInfo:()=>m,disableSelection:()=>S,drawScaled:()=>_,drawWithExclusionAreaByScope:()=>w,fillRect:()=>d,getBindingRenderingInfo:()=>c,getContext2D:()=>u,getPrescaledContext2D:()=>h,measureText:()=>I,tryApplySuggestedCanvasBitmapSize:()=>P});var s=i(871934),r=i(650151),n=i(109154),o=i(31341),l=i(638456);function a(e){return{horizontalPixelRatio:Math.max(1,e.bitmapSize.width/e.canvasElementClientSize.width),verticalPixelRatio:Math.max(1,e.bitmapSize.height/e.canvasElementClientSize.height)}}function c(e){return{...a(e),bitmapSize:e.bitmapSize,mediaSize:e.canvasElementClientSize}}function u(e){const t=(0,r.ensureNotNull)(e.getContext("2d"));return t.setTransform(1,0,0,1,0,0),t}function h(e){const t=(0,r.ensureNotNull)(e.getContext("2d")),i=(0,n.getCanvasDevicePixelRatio)(e);return t.setTransform(i,0,0,i,0,0),t}function d(e,t,i,s,r,n){e.save(),e.fillStyle=n,e.fillRect(t,i,s,r),e.restore()}function p(e,t,i,s,r,n){e.save(),e.globalCompositeOperation="copy",e.fillStyle=n,e.fillRect(t,i,s,r),e.restore()}function _(e,t,i,s){e.save(),e.scale(t,i),s(),e.restore()}function f(e,t,i){const s=v(e);return void 0===i&&(i=(0,n.getCanvasDevicePixelRatio)(s)),s.width=t.width*i,s.height=t.height*i,s}function m(e,t){const{bitmapSize:i,mediaSize:s}=t,r=v(e);return r.style.width=`${s.width}px`,r.style.height=`${s.height}px`,r.width=i.width,r.height=i.height,r}function v(e){const t=e.createElement("canvas");return S(t),t}function g(e,t){const i=v((0,r.ensureNotNull)(e.ownerDocument));e.appendChild(i);const n=(0,s.bindCanvasElementBitmapSizeTo)(i,{type:"device-pixel-content-box",transform:(e,t)=>0===e.width||0===e.height?e:{width:Math.max(e.width,t.width),height:Math.max(e.height,t.height)}});return n.resizeCanvasElement(t),n}function P(e){const t=e.suggestedBitmapSize;return null!==t&&t.width>0&&t.height>0&&(e.applySuggestedBitmapSize(),!0)}function y(e,t){return"center"===e.textAlign?0:(0,o.isRtl)()?"start"===e.textAlign||"right"===e.textAlign?t:0:"start"===e.textAlign||"left"===e.textAlign?0:t}function S(e){e.style.userSelect="none",e.style.webkitUserSelect="none",e.style.msUserSelect="none",e.style.MozUserSelect="none",e.style.webkitTapHighlightColor="transparent"}function b(e,t){const{context:i,horizontalPixelRatio:s,verticalPixelRatio:r,bitmapSize:n}=e;i.beginPath(),i.rect(0,0,n.width,n.height);for(let e=0;e<t.length;e++){let{x:n,y:o}=t[e];n*=s,o*=r,0!==e?i.lineTo(n,o):i.moveTo(n,o)}i.closePath(),i.clip("evenodd")}function x(e,t,i){b({context:e,...t},i)}function w(e,t,i){e.context.save(),b(e,t),i(),e.context.restore()}let C;function I(e,t){return C||function(){const e=document.createElement("canvas");e.width=0,e.height=0,(0,l.isMac)()&&(e.style.display="none",document.body.append(e)),C=(0,r.ensureNotNull)(e.getContext("2d")),C.textBaseline="alphabetic",C.textAlign="center"}(),C.font=t,C.measureText(e)}},422333:(e,t,i)=>{i.r(t),i.d(t,{ CHART_FONT_FAMILY:()=>l,CHART_MONOSPACE_FONT_FAMILY:()=>a,setChartFontFamily:()=>o});var s=i(314802);const r="'Trebuchet MS', Roboto, Ubuntu, sans-serif",n=`-apple-system, BlinkMacSystemFont, ${r}`;function o(e){l=e}let l=((0,s.isOnMobileAppPage)("old"),r);const a="monospace";{const e=["U+2E80-2FD5","U+3040-309F","U+1B100-1B12F","U+1AFF0-1AFFF","U+1B000-1B0FF","U+1B130-1B16F","U+3190-319F","U+30A0-30FF","U+31F0-31FF","U+3400-4DBF","U+4E00-9FFF","U+0E00-0E7F"],t=l;(async()=>{if(!/iPhone OS 15_\d+?/.test(navigator.userAgent))return n;{if(["kr","zh_CN","zh_TW"].includes(window.locale))return l;const t=new FontFace("ChartIosFont","local(Helvetica), local(Arial)",{unicodeRange:e.join(", ")});try{return document.fonts.add(await t.load()),`ChartIosFont, ${n}`}catch(e){return l}}})().then((e=>{t===l&&o(e)}))}},543373:(e,t,i)=>{i.d(t,{showCustomUrlEventDialog:()=>l});var s=i(444372),r=i(779923);const n=s.t(null,void 0,i(468988)),o=s.t(null,void 0,i(620036));async function l(e){const{onConfirm:t,onClose:i,title:s,placeholderText:l}=e;return(0,r.showRename)({title:s,text:"",placeholder:l,mainButtonText:n,cancelButtonText:o,onRename:({newValue:e,dialogClose:i})=>{t(e),i()},onClose:i})}},109154:(e,t,i)=>{function s(e){var t,i;return Math.max(1,(null===(i=null===(t=e.ownerDocument)||void 0===t?void 0:t.defaultView)||void 0===i?void 0:i.devicePixelRatio)||1)}i.d(t,{getCanvasDevicePixelRatio:()=>s})},270294:(e,t,i)=>{i.d(t,{CHART_WIDGET_COLLECTION_SERVICE:()=>r,CollectionViewMode:()=>o,chartWidgetCollectionService:()=>n});var s=i(564894);const r={id:"ChartWidgetCollectionService"};function n(){return(0,s.hasService)(r)?(0,s.service)(r):null}var o;!function(e){e.Multichart="multichart",e.ForceFullscreen="force-fullscreen"}(o||(o={}))},86121:(e,t,i)=>{i.d(t,{lastMouseOrTouchEventInfo:()=>r,setLastMouseOrTouchEventInfo:()=>n});let s=(0,i(638456).supportTouch)()?{isTouch:!0,stylus:!1}:{isTouch:!1};function r(){return s}function n(e){s=e.isTouch?{isTouch:!0,stylus:e.stylus}:{isTouch:!1}}},522991:(e,t,i)=>{i.d(t,{PaneInvalidationMask:()=>r});var s=i(877009);class r{constructor(e=s.defaultInvalidationLevel){this._paneInvalidationLevel=s.defaultInvalidationLevel,this._leftPriceScalesInvalidationMap=new Map,this._rightPriceScalesInvalidationMap=new Map,this._legendWidgetInvalidated=!1,this._invalidationLevel=e}fullInvalidation(){return this._invalidationLevel}invalidateAll(e){this._invalidationLevel=Math.max(this._invalidationLevel,e)}invalidatePane(e){this._paneInvalidationLevel=Math.max(this._invalidationLevel,e)}invalidateLegendWidgetLayout(){this._legendWidgetInvalidated=!0}invalidatePriceScale(e,t,i){const r="left"===e?this._leftPriceScalesInvalidationMap:this._rightPriceScalesInvalidationMap,n=r.get(t)||s.defaultInvalidationLevel;r.set(t,Math.max(n,i))}invalidationLevelForPane(){return Math.max(this._paneInvalidationLevel,this._invalidationLevel)}legendWidgetLayoutInvalidated(){return this._legendWidgetInvalidated||this._invalidationLevel===s.InvalidationLevel.Full}getterForPriceScaleInvalidationLevelBySide(e){ const t="left"===e?this._leftPriceScalesInvalidationMap:this._rightPriceScalesInvalidationMap;return e=>Math.max(t.get(e)||s.defaultInvalidationLevel,this._invalidationLevel)}priceScaleSideMaxLevel(e){const t="left"===e?this._leftPriceScalesInvalidationMap:this._rightPriceScalesInvalidationMap;let i=this._invalidationLevel;return t.size>0&&t.forEach((e=>{e>i&&(i=e)})),i}merge(e){this._invalidationLevel=Math.max(this._invalidationLevel,e._invalidationLevel),this._paneInvalidationLevel=Math.max(this._paneInvalidationLevel,e._paneInvalidationLevel),e._leftPriceScalesInvalidationMap.forEach(((e,t)=>{const i=this._leftPriceScalesInvalidationMap.get(t)||s.defaultInvalidationLevel;this._leftPriceScalesInvalidationMap.set(t,Math.max(i,e))})),e._rightPriceScalesInvalidationMap.forEach(((e,t)=>{const i=this._rightPriceScalesInvalidationMap.get(t)||s.defaultInvalidationLevel;this._rightPriceScalesInvalidationMap.set(t,Math.max(i,e))})),this._legendWidgetInvalidated=this._legendWidgetInvalidated||e._legendWidgetInvalidated}}},318041:(e,t,i)=>{i.d(t,{TextImageCachesContainer:()=>l});var s=i(650151),r=i(983898),n=i(511131),o=i(600642);class l extends r.AbstractMapContainer{constructor(e){super(),this._maxSize=e,this._keysQueue=[]}get(e){const{fontSize:t,text:i,align:s,font:l,lineSpacing:a=0}=e;if(!i||!t||!s)return null;const c=(0,n.makeFont)(t,l),u=(0,r.getDefault3)(this._map,a,s,c,new Map);let h=u.get(i);return void 0!==h||(this._size>=this._maxSize?this._deleteFirstKey():++this._size,this._keysQueue.push([c,s,a,i]),h=new o.TextImageCache(i,e.bold,e.italic,l,t,s,a),u.set(i,h)),h}_deleteFirstKey(){const e=this._keysQueue.shift(),[t,i,r,n]=e,o=(0,s.ensureDefined)(this._map.get(r)),l=(0,s.ensureDefined)(o.get(i)),a=(0,s.ensureDefined)(l.get(t));a.delete(n),0===a.size&&l.delete(t),0===l.size&&o.delete(i),0===o.size&&this._map.delete(r)}}},600642:(e,t,i)=>{i.d(t,{HorizontalAlign:()=>s,TextImageCache:()=>u,VerticalAlign:()=>r});var s,r,n=i(871934),o=i(650151),l=i(511131),a=i(199471);!function(e){e.Left="left",e.Right="right",e.Center="center"}(s||(s={})),function(e){e.Top="top",e.Bottom="bottom",e.Middle="middle"}(r||(r={}));const c=(0,a.createDisconnectedCanvas)(document,(0,n.size)({width:0,height:0}),1);class u{constructor(e,t,i,s,r,n="center",a=0){this._lines=e.split(/[^\S\r\n]*(?:\r\n|\r|\n)/),this._font=function(e,t,i,s){return(0,l.makeFont)(s,i,`${e?"bold ":""}${t?"italic ":""}`)}(t,i,s,r),this._fontSize=r,this._verticalPadding=~~(r/6),this._textAlign=n,this._lineSpacing=a;const u=(0,o.ensureNotNull)(c.getContext("2d"));u.font=this._font,u.textBaseline="top";let h=0;for(let e=0;e<this._lines.length;++e){const t=this._lines[e],i=u.measureText(t).width;h=Math.max(h,i)}this.textImageWidth=h+1,this.textImageHeight=this._lines.length*r+(this._lines.length-1)*this._lineSpacing+this._verticalPadding}paintTo(e,t){const{context:i,horizontalPixelRatio:s,verticalPixelRatio:r}=e;i.save();const n=t.location;i.translate(Math.round(function(e,t,i){let s=e;switch(t){case"left":break;case"right":s-=i;break;case"center":s-=i/2}return Math.round(s) }(n.x,n.horzAlign,this.textImageWidth)*s),Math.round(function(e,t,i){let s=e;switch(t){case"top":break;case"bottom":s-=i;break;case"middle":s-=i/2}return Math.round(s)}(n.y,n.vertAlign,this.textImageHeight)*r));const o=t.style;let l;switch(i.textBaseline="top",i.font=this._font,i.lineJoin="round",i.fillStyle=o.fillStyle,o.strokeStyle&&(i.strokeStyle=o.strokeStyle),o.lineWidth&&(i.lineWidth=o.lineWidth),this._textAlign){case"left":l=0,i.textAlign="left";break;case"right":l=this.textImageWidth-1,i.textAlign="right";break;default:l=this.textImageWidth/2,i.textAlign="center"}let c=this._verticalPadding;(0,a.drawScaled)(i,s,r,(()=>{for(const e of this._lines)o.strokeStyle&&i.strokeText(e,l,c),i.fillText(e,l,c),c+=this._fontSize,c+=this._lineSpacing})),i.restore()}}},938471:(e,t,i)=>{i.d(t,{AbstractBarColorer:()=>s});class s{constructor(){this._backColorers=[]}barStyle(e,t,i){const s={};for(const r of this._backColorers)r.applyBarStyle(e,t,s,i);return this.applyBarStyle(e,t,s,i),s}pushBackBarColorer(e){this._backColorers.unshift(e)}firstColoredBar(e){return null}}},811630:(e,t,i)=>{i.d(t,{alertsAvailable:()=>s});const s=i(244842).enabled("alerts")},593804:(e,t,i)=>{i.d(t,{alignToStep:()=>n});var s=i(960521),r=i.n(s);function n(e,t){return r()(e).div(t).round(0,r().roundHalfUp).mul(t).toNumber()}},995310:(e,t,i)=>{i.d(t,{BarBuilderBase:()=>l,SessionInfo:()=>o});var s=i(988124),r=i(987571),n=i(44031);class o{constructor(e,t,i,s){this.init(e,t,i,s),this._state={timezone:e,spec:t,holidays:i,corrections:s}}init(e,t,i,r){this.timezone=s.get_timezone(e),this.spec=new n.SessionSpec(e,t,i,r)}state(){return this._state}static fromState(e){return new o(e.timezone,e.spec,e.holidays,e.corrections)}}class l{alignTime(e){if(isNaN(e))return NaN;let t=this.indexOfBar(e);return t===r.SessionStage.POST_SESSION&&(this.moveTo(e),t=this.indexOfBar(e)),t<0?NaN:this.startOfBar(t)}}},586784:(e,t,i)=>{var s=i(511131).makeFont,r=i(511131).parseFont,n=i(201089).getLogger;const{drawPoly:o}=i(787123);var l=n("Model.ChartTradingUtils"),a={_fontHeightCache:{},_parsedColorCache:{},_parseColor:function(e){if(this._parsedColorCache[e])return this._parsedColorCache[e];var t=document.createElement("div");t.style.color=e;var i=t.style.color.match(/^rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i)||t.style.color.match(/^rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d*\.?\d+)\s*\)$/i),s={r:i[1],g:i[2],b:i[3],a:i[4]||"1"};return this._parsedColorCache[e]=s,s},getColorFromProperties:function(e,t){var i=1-t.value()/100,s=this._parseColor(e.value());return"rgba("+s.r+","+s.g+","+s.b+","+i+")"},setColorToProperties:function(e,t,i){var s=this._parseColor(e);t.setValue("rgb("+s.r+","+s.g+","+s.b+")");var r=100*(1-s.a);i.setValue(Math.max(0,Math.min(r,100)))},getFontFromProperties:function(e,t,i,r){return s(t.value(),e.value(),r.value()?"italic":"",i.value()?"bold":"")},setFontToProperties:function(e,t,i,s,n){var o=r(e);null!==o?(o.family.length>0&&t.setValue(o.family),i.setValue(o.size),s.setValue(o.bold),n.setValue(o.italic)):l.logError("Invalid font: "+e)}, fontHeight:function(e){if(!this._fontHeightCache[e]){var t=document.createElement("span");t.appendChild(document.createTextNode("height")),document.body.appendChild(t),t.style.cssText="font: "+e+"; white-space: nowrap; display: inline;";var i=t.offsetHeight;document.body.removeChild(t),this._fontHeightCache[e]=Math.ceil(i)}return this._fontHeightCache[e]},drawPolyHoverOrPress:function(e,t,i,s){s?(e.save(),e.fillStyle="rgba(0, 0, 0, 0.15)",o(e,t,!0),e.restore()):i&&(e.save(),e.fillStyle="rgba(0, 0, 0, 0.1)",o(e,t,!0),e.restore())},repaint:function(e){e.lightUpdate()},roundToMinTick:function(e,t){var i=1/e.mainSource().base();return i*Math.round(t/i)}};e.exports=a},261066:(e,t,i)=>{i.d(t,{currencyUnitVisibilityOptions:()=>l,currencyUnitVisibilityProperty:()=>o,migrateShowCurrencyAndShowUnitProperties:()=>u,restoreCurrencyUnitVisibilitySettingsValue:()=>a});var s=i(87053),r=i(62802),n=i.n(r);const{property:o,availableValues:l,restoreDefaultValue:a}=(0,s.createVisibilityController)("PriceAxisCurrencyAndUnit.visibility");let c=!1;function u(e,t){c||(c=!0,void 0===n().getValue("PriceAxisCurrencyAndUnit.visibility")&&o().setValue(e||t?"alwaysOn":"alwaysOff"))}},996986:(e,t,i)=>{i.d(t,{DataSource:()=>c,getTranslatedStringForSource:()=>a});var s=i(809796),r=i(541558),n=i(707957),o=i(811630),l=i(401580);function a(e,t){return new s.TranslatedString(t.name(),t.title(e))}class c{constructor(e){this._isDestroyed=!1,this._hasAlert=new l.WatchedValue(!1),this._alertCreationAvailable=new l.WatchedValue(o.alertsAvailable),this._zorder=0,this._priceScale=null,this._ownerSource=null,this._userEditEnabled=!0,this._priceScaleChanged=new n.Delegate,this._isSelectionEnabled=!0,this._instanceId=(0,r.randomHashN)(6),this._ownerSourceChanged=new n.Delegate,this._zOrderChanged=new n.Delegate,this._id=null!=e?e:(0,r.randomHashN)(6),o.alertsAvailable&&Promise.resolve().then((()=>{this._isDestroyed||this._hasAlert.subscribe(this._updateAlertCreationAvailable.bind(this),{callWithLast:!0})}))}destroy(){this._isDestroyed=!0}id(){return this._id}instanceId(){return this._instanceId}preferNoScale(){return!1}setId(e){this._id=e}zorder(){return this._zorder}setZorder(e){"number"==typeof e&&this._zorder!==e&&(this._zorder=e,this._zOrderChanged.fire(e))}preferredZOrder(){return null}isSpeciallyZOrderedSource(){return!1}title(e){return this.name()}priceScale(){return this._priceScale}setPriceScale(e){this._priceScale=e,this._priceScaleChanged.fire(e)}priceScaleChanged(){return this._priceScaleChanged}ownerSource(){return this._ownerSource}setOwnerSource(e){const t=this._ownerSource;this._ownerSource=e,this._ownerSourceChanged.fire(t,e)}ownerSourceChanged(){return this._ownerSourceChanged}zOrderChanged(){return this._zOrderChanged}isSavedInChart(e){return!0}isSavedInStudyTemplates(){return!0}isRemovedByStudyTemplates(){return!0}hasContextMenu(){return!0}showInObjectTree(){return!0}setUserEditEnabled(e){this._userEditEnabled=e}userEditEnabled(){return this._userEditEnabled}canBeHidden(){return this.userEditEnabled()}isUserDeletable(){ return this.userEditEnabled()}properties(){return null}isVisible(){return this.properties().visible.value()}dataWindowView(){return null}priceAxisViews(e,t){return null}timeAxisViews(){return null}updateAllViews(e){}paneViews(e){return null}labelPaneViews(e){return null}isFailed(){return!1}isLoading(){return!1}isPhantom(){return!1}isChildStudy(){return!1}hasChildren(){return!1}canHaveChildren(){return!1}onClickOutside(e,t){}getSourceIcon(){return null}state(e){return null}doesMovingAffectsUndo(){return!0}isMultiPaneAvailable(){return!1}isMultiPaneEnabled(){return!1}copiable(){return!1}cloneable(){return!1}movable(){return!1}isIncludedInAutoScale(){return!1}isHoveredEnabled(){return this.isSelectionEnabled()}showOnTopOnHovering(){return!0}isSelectionEnabled(){return this._isSelectionEnabled}setSelectionEnabled(e){this._isSelectionEnabled=e}firstValue(){return null}priceRange(e,t,i){return null}autoScaleInfo(e,t,i){return{range:this.priceRange(e,t,i)}}stateForAlert(){return null}canHasAlert(){return!1}canHasAlertOnLineTools(){return!1}hasAlert(){return this._hasAlert.readonly()}alertCreationAvailable(){return this._alertCreationAvailable.readonly()}hasStateForAlert(){return o.alertsAvailable}idForAlert(){return this._id}_getAlertCreationAvailable(){return o.alertsAvailable&&this.hasStateForAlert()}_updateAlertCreationAvailable(){o.alertsAvailable&&this._alertCreationAvailable.setValue(this._getAlertCreationAvailable())}}},782086:(e,t,i)=>{i.d(t,{DataWindowItem:()=>s,DataWindowView:()=>r});class s{constructor(e,t,i,s=!1){this._visible=!0,this._id=e,this._title=t,this._value=i,this._unimportant=s}id(){return this._id}title(){return this._title}setTitle(e){this._title=e}text(){return this._value}value(){return this._value}setValue(e){this._value=e}visible(){return this._visible}setVisible(e){this._visible=e}color(){return this._color}setColor(e){this._color=e}unimportant(){return this._unimportant}}class r{constructor(){this._items=[],this._header="",this._title=""}header(){return this._header}title(){return this._title}items(){return this._items}update(){}}},853965:(e,t,i)=>{i.r(t),i.d(t,{DefaultProperty:()=>A,allowSavingDefaults:()=>x,createDefaultsState:()=>S,extractAllPropertiesKeys:()=>w,extractState:()=>I});var s=i(822914),r=i(852290),n=i(702040),o=i(438004),l=i(267199),a=i(571059),c=i(316230),u=i(138651),h=i(598279),d=i(86746),p=i(331633),_=i(42292),f=i(707957),m=i(194582),v=i(354950),g=i(650151);const P=(0,m.getLogger)("ThemedDefaults");function y(e,t,i){for(const s of t)if((0,n.default)(e,s),i){const t=s.split(".");for(t.pop();t.length;){const i=(0,o.default)(e,t);if(!(0,h.default)(i)||0!==Object.keys(i).length)break;(0,n.default)(e,t),t.pop()}}}function S(e,t,i,n){const o=e?_.defaults:_.factoryDefaults,l=t.startsWith("study_")?(0,s.default)(o("study")):{};let a=(0,s.default)(o(t,n));return t.startsWith("study_")&&a.inputs&&delete a.inputs.symbol,"linetoolicon"===t&&e&&(a.icon=(0,_.defaults)(t).icon),"linetooemoji"===t&&e&&(a.emoji=(0,_.defaults)(t).emoji),"linetoolsticker"===t&&e&&(a.sticker=(0, _.defaults)(t).sticker),a=(0,s.default)(a),y(a,i),(0,r.default)(l,a),l}let b=!1;function x(e){b=e}function w(e){const t=Object.keys(e),i=[];return t.forEach((t=>{const s=e[t];if((0,h.default)(s)){w(s).forEach((e=>i.push(`${t}.${e}`)))}else i.push(t)})),i}function C(e,t,i=""){const s={};for(const r of t){const n=r.split("."),o=n[0],l=e[o],a=""===i?o:`${i}.${o}`;if(e.hasOwnProperty(o))if(n.length>1){if(!(0,h.default)(l)){P.logError(`path ${a} must be an object, but it is a primitive`);continue}{const e=t.filter((e=>e.startsWith(`${o}.`))).map((e=>e.split(".").slice(1).join(".")));s[o]=C(l,e,a)}}else{if((0,h.default)(l)){P.logError(`path ${a} must be a primitive, but it is an object`);continue}s[o]=l}}return s}function I(e,t,i){if(!e)return{};let s=e;return t&&(s=C(e,t)),i&&y(s,i,!0),s}function T(e,t){e.includes(t)||e.push(t)}function V(e,t){const i=e.indexOf(t);-1!==i&&e.splice(i,1)}function M(e,t){const i=(0,a.default)(e,((e,i,s)=>{if(void 0===t[s])return e;if(!(0,c.default)(i,t[s]))if((0,h.default)(i)&&(0,h.default)(t[s])){const r=M(i,t[s]);void 0!==r&&(e[s]=r)}else e[s]=i;return e}),{});return(0,u.default)(i)?void 0:i}function D(e){return e===d.StdTheme.Dark?1:0}class A extends v.Property{constructor(e){const{defaultName:t,nonThemedDefaultsKeys:i,themedDefaultsKeys:s,excludedDefaultsKeys:n=[],themedColors:o,allStateKeys:l,excludedStateKeys:a=[],state:c,useUserPreferences:u=!0,saveNonDefaultUserPreferencesOnly:h=!1,ignoreAllowSavingDefaults:d=!1,saveDefaultsConsumer:p=_.saveDefaults,factoryDefaultsSupplier:m=(()=>S(!1,t,[],null))}=e;super(),this._themedColors=[],this._restoreFactoryDefaultsEvent=new f.Delegate,this._defaultName=t,this._useUserPreferences=u,this._saveNonDefaultUserPreferencesOnly=h,this._ignoreAllowSavingDefaults=d,this._saveDefaultsConsumer=p,this._factoryDefaultsSupplier=m,this._allStateKeys=l,this._excludedStateKeys=a,this._nonThemedDefaultsKeys=i,this._themedDefaultsKeys=s,this._allDefaultsKeys=i||s?[...null!=i?i:[],...null!=s?s:[]]:void 0,this._themedColors=o,this._excludedDefaultsKeys=n,(0,g.assert)(void 0===this._allDefaultsKeys||0===this._excludedDefaultsKeys.length,"Defaults keys and excluded defaults keys cannot be used at the same time"),(0,g.assert)(void 0===this._allStateKeys||0===this._excludedStateKeys.length,"State keys and excluded state keys cannot be used at the same time"),this.merge((0,r.default)(this._factoryDefaultsSupplier(),this._userSettings(),I(c,l,a))),this._restoreFactoryDefaultsEvent=new f.Delegate}destroy(){var e;null===(e=this._unsubscribeWatchedTheme)||void 0===e||e.call(this),super.destroy()}applyTemplate(e,t){this.mergePreferences((0,r.default)((0,s.default)(t),e))}preferences(){return I(super.state(this._excludedDefaultsKeys),this._allDefaultsKeys)}mergePreferences(e){this.mergeAndFire(I(e,this._allDefaultsKeys,this._excludedDefaultsKeys))}addExcludedKey(e,t){1&t&&T(this._excludedDefaultsKeys,e),2&t&&T(this._excludedStateKeys,e)}removeExcludedKey(e,t){1&t&&V(this._excludedDefaultsKeys,e),2&t&&V(this._excludedStateKeys,e)}restoreFactoryDefaults(){ const e=this._factoryDefaultsSupplier();if(y(e,this._excludedDefaultsKeys),this._themedColors){const t=D(p.watchedTheme.value());for(const i of this._themedColors)(0,l.default)(e,i.path,i.colors[t])}this.mergeAndFire(e),this._defaultName.startsWith("study_")&&!this._defaultName.startsWith("study_VbPFixed")||this.saveDefaults(),this._restoreFactoryDefaultsEvent.fire()}onRestoreFactoryDefaults(){return this._restoreFactoryDefaultsEvent}childChanged(e,t){var i;super.childChanged(e,t),!this._ignoreAllowSavingDefaults&&!b||this._defaultName.startsWith("study_")&&!this._defaultName.startsWith("study_VbPFixed")||!(this._allDefaultsKeys&&this._allDefaultsKeys.includes(t)||!this._allDefaultsKeys&&!(null===(i=this._excludedDefaultsKeys)||void 0===i?void 0:i.includes(t)))||this.saveDefaults()}saveDefaults(){if(!this._useUserPreferences)return;let e;if(this._saveNonDefaultUserPreferencesOnly){const t=super.state(this._excludedDefaultsKeys),i=this._factoryDefaultsSupplier();e=M(I(t,this._nonThemedDefaultsKeys),I(i,this._nonThemedDefaultsKeys,this._excludedDefaultsKeys));const s=I(i,this._themedDefaultsKeys,this._excludedDefaultsKeys),n=I(t,this._themedDefaultsKeys),o=M(n,s);(0,u.default)(o)||(e=null!=e?e:{},(0,r.default)(e,n))}else e=this.preferences();this._saveDefaultsConsumer(this._defaultName,e)}clone(e){return new A(this._options())}setThemedColors(e){if(this._themedColors=e,void 0===this._unsubscribeWatchedTheme){const e=()=>this.updateThemedColors();p.watchedTheme.subscribe(e),this._unsubscribeWatchedTheme=()=>p.watchedTheme.unsubscribe(e)}this.updateThemedColors()}updateThemedColors(e){if(!this._themedColors)return;const t=p.watchedTheme.value(),i=t===d.StdTheme.Light?d.StdTheme.Dark:d.StdTheme.Light;for(const s of this._themedColors){const r=(0,g.ensureDefined)(this.childByPath(s.path)),n=s.colors[D(i)];!e&&r.value()!==n&&r.value()||r.setValue(s.colors[D(t)])}}state(e){return I(super.state([...this._excludedStateKeys,...null!=e?e:[]]),this._allStateKeys)}_userSettings(){if(!this._useUserPreferences)return;const e=S(!0,this._defaultName,[],null);return e?I((0,s.default)(e),this._allDefaultsKeys,this._excludedDefaultsKeys):void 0}_options(){return{defaultName:this._defaultName,factoryDefaultsSupplier:this._factoryDefaultsSupplier,state:this.state(),nonThemedDefaultsKeys:this._nonThemedDefaultsKeys,themedDefaultsKeys:this._themedDefaultsKeys,excludedDefaultsKeys:this._excludedDefaultsKeys,themedColors:this._themedColors,allStateKeys:this._allStateKeys,excludedStateKeys:this._excludedDefaultsKeys,useUserPreferences:this._useUserPreferences,saveNonDefaultUserPreferencesOnly:this._saveNonDefaultUserPreferencesOnly,ignoreAllowSavingDefaults:this._ignoreAllowSavingDefaults,saveDefaultsConsumer:this._saveDefaultsConsumer}}}},885482:(e,t,i)=>{i.r(t),i.d(t,{SelectPointMode:()=>s,activePointSelectionMode:()=>j,barTimesUnderCursor:()=>$,beenSetLineToolLastPoint:()=>B,cancelLineTool:()=>J,cancelledLineTool:()=>L,changeLineStyle:()=>ce,changeLineTool:()=>ne,changedLineStyle:()=>H,changedLineTool:()=>O,continueLineTool:()=>Z, continuedLineTool:()=>A,copiedLineTool:()=>U,copyLineTool:()=>ue,createLineTool:()=>X,createdLineTool:()=>D,crosshairLock:()=>y,cursorTool:()=>C,drawOnAllCharts:()=>be,drawOnAllChartsMode:()=>xe,emojiTool:()=>x,finishChangingLineTool:()=>oe,finishLineTool:()=>ae,finishMovingLineTool:()=>se,finishedChangingLineTool:()=>F,finishedLineTool:()=>z,finishedMovingLineTool:()=>k,hideAllDrawings:()=>ge,hideAllIndicators:()=>Pe,hideMarksOnBars:()=>Se,iconTool:()=>b,init:()=>fe,isDirectionalMovementActive:()=>M,isStudyEditingNow:()=>q,isToolCreatingNow:()=>I,isToolEditingNow:()=>T,isToolMovingNow:()=>V,lockDrawings:()=>ye,moveLineTool:()=>ie,movedLineTool:()=>N,properties:()=>ve,removeLineTool:()=>le,removedLineTool:()=>W,resetToCursor:()=>_,restoreLineTool:()=>he,restoreLineToolState:()=>de,restoredLineTool:()=>K,restoredLineToolState:()=>G,runOnDrawingStateReady:()=>me,setLineToolLastPoint:()=>ee,startChangingLineTool:()=>re,startMovingLineTool:()=>te,startedChangingLineTool:()=>E,startedMovingLineTool:()=>R,stickerTool:()=>w,tool:()=>S,toolIsCursor:()=>d,toolIsMeasure:()=>p});var s,r=i(650151),n=i(152633),o=i(853965),l=i(401580),a=i(938550),c=i(707957),u=i(62802),h=i(251954);function d(e){return"cursor"===e||"arrow"===e||"dot"===e||"performance"===e}function p(e){return"measure"===e}function _(e=!1){if(!e&&f){if(f.childs().stayInDrawingMode.value())return}S.setValue(C.value())}!function(e){e[e.None=0]="None",e[e.Replay=1]="Replay",e[e.Study=2]="Study"}(s||(s={}));let f=null,m=null,v=null,g=null,P=null;const y=new a.WatchedObject(null),S=new l.WatchedValue,b=new l.WatchedValue,x=new l.WatchedValue,w=new l.WatchedValue,C=new l.WatchedValue,I=new l.WatchedValue(!1),T=new l.WatchedValue(!1),V=new l.WatchedValue(!1),M=new l.WatchedValue(!1),D=new c.Delegate,A=new c.Delegate,L=new c.Delegate,B=new c.Delegate,R=new c.Delegate,N=new c.Delegate,k=new c.Delegate,E=new c.Delegate,O=new c.Delegate,F=new c.Delegate,W=new c.Delegate,z=new c.Delegate,H=new c.Delegate,U=new c.Delegate,K=new c.Delegate,G=new c.Delegate,j=new l.WatchedValue(s.None),q=new l.WatchedValue(!1),$=new Map;function Y(e,t){const i=t||{value:!1};return t=>{i.value||(i.value=!0,e.fire(t),i.value=!1)}}const Q={value:!1},X=Y(D,Q),Z=Y(A,Q),J=Y(L,Q),ee=Y(B,Q),te=Y(R),ie=Y(N),se=Y(k),re=Y(E),ne=Y(O),oe=Y(F),le=Y(W),ae=Y(z),ce=Y(H,Q),ue=Y(U,Q),he=Y(K),de=Y(G);let pe=!1,_e=[];function fe(){pe||(S.setValue(u.getValue("chart.cursorPreference","cursor")),S.subscribe((e=>d(e)&&C.setValue(e)),{callWithLast:!0}),C.subscribe((e=>{e&&"performance"!==e&&u.setValue("chart.cursorPreference",e)})),f=new o.DefaultProperty({defaultName:"drawings"}),m=(0,n.createPrimitiveProperty)(),v=(0,n.createPrimitiveProperty)(),g=(0,n.createPrimitiveProperty)(),P=(0,n.createPrimitiveProperty)(),m.setValue(!1),v.setValue(!1),g.setValue(!1),P.setValue(!1),S.subscribe((e=>{(0,h.emit)("onSelectedLineToolChanged")})),pe=!0,_e.forEach((e=>e())),_e=[])}function me(e){pe?e():_e.push(e)}function ve(){return(0,r.ensureNotNull)(f)}function ge(){return(0,r.ensureNotNull)(m)}function Pe(){return(0, r.ensureNotNull)(v)}function ye(){return(0,r.ensureNotNull)(g)}function Se(){return(0,r.ensureNotNull)(P)}function be(){return ve().childs().drawOnAllCharts}function xe(){return ve().childs().drawOnAllChartsMode}},327453:(e,t,i)=>{i.d(t,{LimitedPrecisionNumericFormatter:()=>r});var s=i(389137);class r{constructor(e=1){this._precision=e}format(e){(0,s.isNumber)(e)||(e=parseFloat(e));const t=e.toFixed(this._precision),i=Math.pow(10,-this._precision);return Math.max(parseFloat(t),i)+""}parse(e){const t=parseFloat(e);return isNaN(t)?{res:!1}:{res:!0,value:t,suggest:this.format(t)}}}},570226:(e,t,i)=>{i.d(t,{getPriceValueFormatterForSource:()=>a,getPriceValueFormatterForStudy:()=>c,shouldBeFormattedAsIndexedTo100:()=>o,shouldBeFormattedAsPercent:()=>n});var s=i(444331),r=i(981107);function n(e){const t=e.priceScale();return!(null===t||!t.isPercentage())&&(!(0,r.isActingAsSymbolSource)(e)||(0,s.isPriceSourceStyle)(e.style()))}function o(e){const t=e.priceScale();return!(null===t||!t.isIndexedTo100())&&(!(0,r.isActingAsSymbolSource)(e)||(0,s.isPriceSourceStyle)(e.style()))}function l(e){const t=e.priceScale();return o(e)&&null!==t?i=>{var s;return t.formatPriceIndexedTo100(i,null!==(s=e.firstValue())&&void 0!==s?s:100)}:n(e)&&null!==t?i=>{var s;return t.formatPricePercentage(i,null!==(s=e.firstValue())&&void 0!==s?s:100)}:null}function a(e){const t=l(e);if(t)return t;const i=e.formatter();return i.format.bind(i)}function c(e,t){const i=l(e);if(i)return i;const s=e.plotFormatter(t);return s.format.bind(s)}},315801:(e,t,i)=>{function s(e,t,i){if(e.isTouch){if(void 0!==i)return i(e),!0}else if(void 0!==t)return t(e),!0;return!1}function r(e,t,i,s){return void 0!==t.executeDefaultAction&&(e.isTouch?Boolean(t.executeDefaultAction[s]):Boolean(t.executeDefaultAction[i]))}var n,o;function l(e,t){return e&&t&&e.equals&&t.equals?e.equals(t):e===t}i.d(t,{AreaName:()=>n,HitTarget:()=>o,HitTestResult:()=>a,hitTestResultDataAreEqual:()=>l,shouldDefaultActionBeExecuted:()=>r,tryCallHandler:()=>s}),function(e){e.Style="Style",e.Text="Text",e.Line="Line",e.Tooltip="Tooltip",e.Button="Button",e.SourceItemMove="SourceItemMove"}(n||(n={})),function(e){e[e.MovePointBackground=1]="MovePointBackground",e[e.Regular=2]="Regular",e[e.MovePoint=3]="MovePoint",e[e.ChangePoint=4]="ChangePoint",e[e.Custom=5]="Custom"}(o||(o={}));class a{constructor(e,t,i){this._target=e,this._data=t||null,this._eraseMarker=i}target(){return this._target}data(){return this._data}hasPressedMoveHandler(e){return null!==this._data&&function(e,t,i){if(e.isTouch){if(void 0!==i)return!0}else if(void 0!==t)return!0;return!1}(e,this._data.pressedMouseMoveHandler,this._data.touchMoveHandler)}tryCallMouseDownOrTouchStartHandler(e){return null!==this._data&&s(e,this._data.mouseDownHandler,this._data.touchStartHandler)}tryCallMouseUpOrTouchEndHandler(e){return null!==this._data&&s(e,this._data.mouseUpHandler,this._data.touchEndHandler)}tryCallMouseEnterHandler(e){return null!==this._data&&s(e,this._data.mouseEnterHandler)}tryCallMouseLeaveHandler(e){ return null!==this._data&&s(e,this._data.mouseLeaveHandler)}tryCallMouseMoveHandler(e){return null!==this._data&&s(e,this._data.mouseMoveHandler)}tryCallClickOrTapHandler(e){return null!==this._data&&s(e,this._data.clickHandler,this._data.tapHandler)}tryCallDblClickOrDblTapHandler(e){return null!==this._data&&s(e,this._data.doubleClickHandler,this._data.doubleTapHandler)}tryCallContextMenuHandler(e){return null!==this._data&&s(e,this._data.contextMenuHandler,this._data.touchContextMenuHandler)}eraseMarker(){return this._eraseMarker}}},955831:(e,t,i)=>{i.d(t,{HorizontalLinePaneView:()=>n});var s=i(9524),r=i(458963);class n{constructor(){this._lineRendererData={y:0,color:"rgba(0, 0, 0, 0)",linewidth:1,linestyle:r.LINESTYLE_SOLID,visible:!1},this._lineRenderer=new s.HorizontalLineRenderer,this._invalidated=!0,this._lineRenderer.setData(this._lineRendererData)}update(e){this._invalidated=!0}renderer(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),this._lineRenderer}}},808068:(e,t,i)=>{i.d(t,{intervalsVisibilitiesDefaults:()=>s});const s={ticks:!0,seconds:!0,secondsFrom:1,secondsTo:59,minutes:!0,minutesFrom:1,minutesTo:59,hours:!0,hoursFrom:1,hoursTo:24,days:!0,daysFrom:1,daysTo:366,weeks:!0,weeksFrom:1,weeksTo:52,months:!0,monthsFrom:1,monthsTo:12,ranges:!0}},312449:(e,t,i)=>{i.d(t,{IntervalsVisibilitiesProperty:()=>n});var s=i(354950),r=i(395098);class n extends s.Property{state(e){var t;return null!==(t=(0,r.nonDefaultIntervalsVisibilities)(super.state(e)))&&void 0!==t?t:void 0}storeStateIfUndefined(){return!1}}},534741:(e,t,i)=>{var s;i.d(t,{PlotRowSearchMode:()=>s}),function(e){e[e.NearestLeft=-1]="NearestLeft",e[e.Exact=0]="Exact",e[e.NearestRight=1]="NearestRight"}(s||(s={}))},826989:(e,t,i)=>{var s;i.d(t,{SymbolErrorPermissionDeniedReason:()=>s,invalidSymbol:()=>n,permissionDenied:()=>r}),function(e){e.Symbol="symbol",e.GroupPermission="group"}(s||(s={}));const r="permission denied",n="invalid symbol"},981107:(e,t,i)=>{function s(e){const t=(null==e?void 0:e.symbolSource)&&e.symbolSource()===e,i=void 0!==(null==e?void 0:e.isActingAsSymbolSource);return t||i}function r(e){return s(e)&&"quotesProvider"in e}function n(e){return s(e)&&e.isActingAsSymbolSource().value()}i.d(t,{isActingAsSymbolSource:()=>n,isSymbolSource:()=>s,isSymbolSourceWithQuotesProvider:()=>r})},517336:(e,t,i)=>{i.d(t,{LevelsProperty:()=>f});var s=i(822914),r=i(852290),n=i(389137),o=i(853965),l=i(42292);const a={prefixes:[""],range:[0,0],names:["coeff","color","visible","linestyle","linewidth"],typecheck:{pack:()=>Object(),unpack:()=>[]}};function c(e,t,i,s){return s.push(i[t]),s}function u(e,t,i,s){return s[t]=i[e],s}function h(){return[]}function d(){return{}}function p(e,t,i){return i.prefixes.forEach((s=>{const r=s+"level";for(let s=i.range[0];s<=i.range[1];s++)if(e[r+s]&&(0,n.isSameType)(e[r+s],t.typecheck())){let n=t.tpl();i.names.forEach(((i,o)=>{n=t.fill(""+o,i,e[r+s],n)})),e[r+s]=n}})),e}function _(e,t,i){return i(e,{tpl:d,fill:u,typecheck:t.typecheck.unpack},t)}class f extends o.DefaultProperty{constructor(e){ const{levelsIterator:t=p,map:i={},...s}=e,r={...a,...i};s.state&&(s.state=_(s.state,r,t)),super(s),this._map=r,this._levelsIterator=t}state(e,t){const i=super.state(e);return t?i:(s=i,r=this._map,(0,this._levelsIterator)(s,{tpl:h,fill:c,typecheck:r.typecheck.pack},r));var s,r}applyTemplate(e,t){this.mergePreferences((0,r.default)((0,s.default)(t),_(e,this._map,this._levelsIterator)))}saveDefaults(){this._useUserPreferences&&(0,l.saveDefaults)(this._defaultName,this.preferences())}clone(){return new f(this._options())}merge(e,t){return super.merge(this._map?_(e,this._map,this._levelsIterator):e,t)}_options(){return{...super._options(),map:{...this._map},levelsIterator:this._levelsIterator}}}},147985:(e,t,i)=>{i.d(t,{LineTool5PointsPattern:()=>l});var s=i(650151),r=i(853965),n=i(821979),o=i(31712);class l extends n.LineDataSource{constructor(e,t,i,s){super(e,t||l.createProperties(),i,s),this._loadPaneViews(e)}pointsCount(){return 5}name(){return"XABCD Pattern"}static createProperties(e){const t=new r.DefaultProperty({defaultName:"linetool5pointspattern",state:e});return this._configureProperties(t),t}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(96461),i.e(24770),i.e(30154),i.e(82375),i.e(18537)]).then(i.bind(i,63124)).then((e=>e.PatternWithBackgroundDefinitionViewModel))}_loadPaneViews(e){Promise.all([i.e(39232),i.e(33193),i.e(99898),i.e(76792),i.e(77028),i.e(51583)]).then(i.bind(i,382242)).then((t=>{this._setPaneViews([new t.Pattern5pointsPaneView(this,e)])}))}static _configureProperties(e){super._configureProperties(e),e.addChild("linesColors",new o.LineToolColorsProperty([(0,s.ensureDefined)(e.child("color"))])),e.addChild("textsColors",new o.LineToolColorsProperty([(0,s.ensureDefined)(e.child("textcolor"))]))}}},78:(e,t,i)=>{i.d(t,{LineToolABCD:()=>l});var s=i(650151),r=i(853965),n=i(821979),o=i(31712);class l extends n.LineDataSource{constructor(e,t,s,r){const n=t||l.createProperties();super(e,n,s,r),Promise.all([i.e(39232),i.e(33193),i.e(99898),i.e(76792),i.e(77028),i.e(51583)]).then(i.bind(i,662657)).then((t=>{this._setPaneViews([new t.ABCDPaneView(this,e)])}))}pointsCount(){return 4}name(){return"ABCD Pattern"}static createProperties(e){const t=new r.DefaultProperty({defaultName:"linetoolabcd",state:e});return this._configureProperties(t),t}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(96461),i.e(24770),i.e(30154),i.e(82375),i.e(18537)]).then(i.bind(i,669403)).then((e=>e.PatternWithoutBackgroundDefinitionsViewModel))}static _configureProperties(e){super._configureProperties(e),e.addChild("linesColors",new o.LineToolColorsProperty([(0,s.ensureDefined)(e.child("color"))])),e.addChild("textsColors",new o.LineToolColorsProperty([(0,s.ensureDefined)(e.child("textcolor"))]))}}},907416:(e,t,i)=>{i.d(t,{LineToolArc:()=>u});var s=i(650151),r=i(204652),n=i(86441),o=i(625422),l=i(853965),a=i(821979),c=i(31712);class u extends a.LineDataSource{constructor(e,t,s,r){const n=t||u.createProperties();super(e,n,s,r),this.version=2,this._dist=null, Promise.all([i.e(39232),i.e(33193),i.e(99898),i.e(76792),i.e(77028),i.e(51583)]).then(i.bind(i,953940)).then((({ArcPaneView:t})=>{const i=[new t(this,e)];this._setPaneViews(i)}))}startChanging(e,t){if(super.startChanging(e,t),0===e||1===e){const e=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[0])),t=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[1])),i=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[2]));this._dist=(0,r.distanceToLine)(e,t,i).distance;const o=t.subtract(e),l=new n.Point(-o.y,o.x),a=e.add(t).scaled(.5);i.subtract(a).dotProduct(l)<0&&(this._dist=-this._dist)}}endChanging(e,t){return this._dist=null,super.endChanging(e,t)}pointsCount(){return 3}name(){return"Arc"}hasEditableCoordinates(){return!1}setPoint(e,t){const i={...t},l=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[0])),a=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[1]));switch(e){case 0:{const e=(0,s.ensureNotNull)(this._dist),t=(0,s.ensureNotNull)(this.pointToScreenPoint(i)),r=a.subtract(t),o=t.add(a).scaled(.5);let l=new n.Point(-r.y,r.x);l=l.normalized();const c=o.add(l.scaled(e));this._points[0]=i,this._points[2]=(0,s.ensureNotNull)(this.screenPointToPoint(c));break}case 1:{const e=(0,s.ensureNotNull)(this._dist),t=(0,s.ensureNotNull)(this.pointToScreenPoint(i)),r=t.subtract(l),o=l.add(t).scaled(.5),a=new n.Point(-r.y,r.x).normalized(),c=o.add(a.scaled(e));this._points[1]=i,this._points[2]=(0,s.ensureNotNull)(this.screenPointToPoint(c));break}case 2:{let e=(0,s.ensureNotNull)(this.pointToScreenPoint(i));const t=(0,r.distanceToLine)(l,a,e).distance,c=a.subtract(l),u=l.add(a).scaled(.5),h=new n.Point(-c.y,c.x).normalized(),d=u.add(h.scaled(t)),p=u.add(h.scaled(-t)),_=c.length(),f=c.x/_,m=c.y/_;let v=Math.acos(f);m<0&&(v=-v);let g=(0,o.translationMatrix)(-u.x,-u.y);e=(0,o.transformPoint)(g,e);let P=(0,o.transformPoint)(g,d);g=(0,o.rotationMatrix)(-v),e=(0,o.transformPoint)(g,e),P=(0,o.transformPoint)(g,P),g=(0,o.scalingMatrix)(1,_/(2*t)),e=(0,o.transformPoint)(g,e),P=(0,o.transformPoint)(g,P);const y=e.y*P.y>=0?new n.Point(d.x,d.y):new n.Point(p.x,p.y);this._points[2]=(0,s.ensureNotNull)(this.screenPointToPoint(y));break}}this._normalizePoints()}migrateVersion(e,t,i){if(1===e&&2===this._points.length){const e=(2*this._points[0].price+3*this._points[1].price)/5;this._points.push({price:e,index:this._points[1].index})}if(1===e&&2===this._timePoint.length){const e={price:(2*this._timePoint[0].price+3*this._timePoint[1].price)/5,offset:this._timePoint[1].offset,time_t:this._timePoint[1].time_t};this._timePoint.push(e)}}static createProperties(e){const t=new l.DefaultProperty({defaultName:"linetoolarc",state:e});return this._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(96461),i.e(24770),i.e(30154),i.e(82375),i.e(18537)]).then(i.bind(i,967382))).GeneralFiguresDefinitionsViewModelBase}static _configureProperties(e){super._configureProperties(e),e.addChild("linesColors",new c.LineToolColorsProperty([e.childs().color]))}}},41394:(e,t,i)=>{i.d(t,{ LineToolArrowMark:()=>l,LineToolArrowMarkDown:()=>h,LineToolArrowMarkLeft:()=>a,LineToolArrowMarkRight:()=>u,LineToolArrowMarkUp:()=>c});var s=i(853965),r=i(821979),n=i(354950),o=i(31712);class l extends r.LineDataSource{constructor(e,t,s,r,n){const o=t||l.createProperties(null,s);super(e,o,r,n),this._textPaneView=null,Promise.all([i.e(39232),i.e(33193),i.e(99898),i.e(76792),i.e(77028),i.e(51583)]).then(i.bind(i,129022)).then((({ArrowMarkPaneView:t})=>{const i=[new t(this,e)];this._setPaneViews(i)}))}paneViews(e){const t=super.paneViews();return null!==t&&this._textPaneView&&t.push(this._textPaneView),t}pointsCount(){return 1}template(){const e=super.template();return e.text=this.properties().childs().text.value(),e}static createProperties(e,t){const i=new s.DefaultProperty({defaultName:t,state:e});return this._configureProperties(i),i}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(96461),i.e(24770),i.e(30154),i.e(82375),i.e(18537)]).then(i.bind(i,952842)).then((e=>e.ArrowMarkDefinitionsViewModel))}_applyTemplateImpl(e){super._applyTemplateImpl(e),this.properties().childs().text.setValue(e.text)}static _configureProperties(e){super._configureProperties(e),e.addChild("linesColors",new o.LineToolColorsProperty([e.childs().arrowColor])),e.addChild("textsColors",new o.LineToolColorsProperty([e.childs().color])),e.hasChild("text")||e.addChild("text",new n.Property("")),e.addExcludedKey("text",1)}}l.version=2;class a extends l{constructor(e,t,i,s){super(e,t,"linetoolarrowmarkleft",i,s)}direction(){return"left"}name(){return"Arrow Mark Left"}textAlignParams(){return{horzAlign:"left",vertAlign:"middle",offsetX:22,offsetY:3}}static createProperties(e){return super.createProperties(e,"linetoolarrowmarkleft")}}class c extends l{constructor(e,t,i,s){super(e,t,"linetoolarrowmarkup",i,s)}direction(){return"up"}name(){return"Arrow Mark Up"}textAlignParams(){return{horzAlign:"center",vertAlign:"top",offsetX:0,offsetY:20}}static createProperties(e){return super.createProperties(e,"linetoolarrowmarkup")}}class u extends l{constructor(e,t,i,s){super(e,t,"linetoolarrowmarkright",i,s)}direction(){return"right"}name(){return"Arrow Mark Right"}textAlignParams(){return{horzAlign:"right",vertAlign:"middle",offsetX:22,offsetY:3,forceTextAlign:!0}}static createProperties(e){return super.createProperties(e,"linetoolarrowmarkright")}}class h extends l{constructor(e,t,i,s){super(e,t,"linetoolarrowmarkdown",i,s)}direction(){return"down"}name(){return"Arrow Mark Down"}textAlignParams(){return{horzAlign:"center",vertAlign:"bottom",offsetX:0,offsetY:20}}static createProperties(e){return super.createProperties(e,"linetoolarrowmarkdown")}}},683396:(e,t,i)=>{i.d(t,{LineToolArrowMarker:()=>o});var s=i(821979),r=i(853965),n=i(354950);class o extends s.LineDataSource{constructor(e,t,s,r){super(e,null!=t?t:o.createProperties(),s,r),Promise.all([i.e(39232),i.e(33193),i.e(99898),i.e(76792),i.e(77028),i.e(51583)]).then(i.bind(i,922514)).then((({ArrowMarkerPaneView:e})=>{this._setPaneViews([new e(this,this.model())])}))}pointsCount(){return 2} name(){return"Trend Line"}static createProperties(e){const t=new r.DefaultProperty({defaultName:"linetoolarrowmarker",state:e});return this._configureProperties(t),t}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(96461),i.e(24770),i.e(30154),i.e(82375),i.e(18537)]).then(i.bind(i,470719)).then((e=>e.ArrowMarkerDefinitionsViewModel))}static _configureProperties(e){super._configureProperties(e),e.hasChild("text")||e.addChild("text",new n.Property("")),e.addExcludedKey("text",1)}}},548160:(e,t,i)=>{i.d(t,{LineToolArrow:()=>r});var s=i(956268);class r extends s.LineToolTrendLine{constructor(e,t,i,s){super(e,null!=t?t:r.createProperties(),i,s)}name(){return"Arrow"}static createProperties(e){const t=s.LineToolTrendLine._createPropertiesImpl("linetoolarrow",e);return r._configureProperties(t),t}}},179180:(e,t,i)=>{i.d(t,{LineToolBalloon:()=>c});var s=i(444372),r=i(853965),n=i(821979),o=i(354950),l=i(31712);const a=s.t(null,void 0,i(119372));class c extends n.LineDataSource{constructor(e,t,i,s){super(e,t||c.createProperties(),i,s),this._createPaneView()}pointsCount(){return 1}name(){return"Balloon"}template(){const e=super.template();return e.text=this.properties().childs().text.value(),e}shouldBeRemovedOnDeselect(){return""===this._properties.childs().text.value().trim()}static createProperties(e){const t=new r.DefaultProperty({defaultName:"linetoolballoon",state:e});return this._configureProperties(t),t}_applyTemplateImpl(e){super._applyTemplateImpl(e),this.properties().childs().text.setValue(e.text)}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(96461),i.e(24770),i.e(30154),i.e(82375),i.e(18537)]).then(i.bind(i,417540)).then((e=>e.BalloonDefinitionsViewModel))}_createPaneView(){Promise.all([i.e(39232),i.e(33193),i.e(99898),i.e(76792),i.e(77028),i.e(51583)]).then(i.bind(i,35986)).then((e=>{this._setPaneViews([new e.BalloonPaneView(this,this._model)])}))}static _configureProperties(e){super._configureProperties(e),e.hasChild("text")||e.addChild("text",new o.Property(a)),e.addExcludedKey("text",1),e.addChild("linesColors",new l.LineToolColorsProperty([e.childs().borderColor])),e.addChild("textsColors",new l.LineToolColorsProperty([e.childs().color]))}}},180148:(e,t,i)=>{i.d(t,{LineToolBarsPattern:()=>P});var s=i(650151),r=i(444372),n=i(809796),o=i(389137),l=i(373571),a=i(853965),c=i(534741),u=i(821979),h=i(540598),d=i(964824);const p=new n.TranslatedString("mirror bars pattern",r.t(null,void 0,i(881870))),_=new n.TranslatedString("flip bars pattern",r.t(null,void 0,i(559942))),f=r.t(null,void 0,i(363158)),m=r.t(null,void 0,i(892754)),v={0:2,1:4,2:1,3:1,4:2,5:3,6:-1},g={0:3,1:4,2:4,3:1,4:2,5:3,6:-1};class P extends u.LineDataSource{constructor(e,t=P.createProperties(),s,r){super(e,t,s,r),this._pattern=[],this._scale=1,this._pointsCoordinatePricesDiff=null;const n=t.childs().mode.value();(0,o.isString)(n)&&t.childs().mode.setValue(parseInt(n)),t.childs().mirrored.listeners().subscribe(this,this._mirror),t.childs().flipped.listeners().subscribe(this,this._flip), t.childs().mode.subscribe(this,this._updateLastPoint),this.version=2,Promise.all([i.e(39232),i.e(33193),i.e(99898),i.e(76792),i.e(77028),i.e(51583)]).then(i.bind(i,416645)).then((t=>{this._setPaneViews([new t.BarsPatternPaneView(this,e)])}))}pattern(){return this._pattern}isSynchronizable(){return!1}additionalActions(e){return[new l.Action({actionId:"Chart.LineTool.BarsPattern.ToggleMirrored",options:{checked:this.properties().childs().mirrored.value(),checkable:!0,label:f,onExecute:()=>{e.setProperty(this.properties().childs().mirrored,!this.properties().childs().mirrored.value(),p),this.updateAllViews((0,d.sourceChangeEvent)(this.id())),this._model.updateSource(this)}}}),new l.Action({actionId:"Chart.LineTool.BarsPattern.ToggleFlipped",options:{checked:this.properties().childs().flipped.value(),checkable:!0,label:m,onExecute:()=>{e.setProperty(this.properties().childs().flipped,!this.properties().childs().flipped.value(),_),this.updateAllViews((0,d.sourceChangeEvent)(this.id())),this._model.updateSource(this)}}})]}pointsCount(){return 2}state(e){return{...super.state(e),pattern:this._pattern,scale:this._scale,diff:this._pointsCoordinatePricesDiff}}restoreData(e){const{pattern:t=this._pattern,scale:i=this._scale,diff:s=this._pointsCoordinatePricesDiff}=e;this._pattern=t,this._scale=i,this._pointsCoordinatePricesDiff=s}name(){return"Bars Pattern"}hasEditableCoordinates(){return!1}cloneData(e){this._pattern=(0,o.clone)(e._pattern),this._scale=e._scale,this._pointsCoordinatePricesDiff=e._pointsCoordinatePricesDiff}firstPatternPrice(){const{mode:e,flipped:t}=this.properties().childs(),i=this._pattern[0];return e.value()===h.LineToolBarsPatternMode.LineHL2?(i[2]+i[3])/2:t.value()?i[g[e.value()]]:i[v[e.value()]]}lastPatternPrice(){const{mode:e,flipped:t}=this.properties().childs(),i=this._pattern[this._pattern.length-1];return e.value()===h.LineToolBarsPatternMode.LineHL2?(i[2]+i[3])/2:t.value()?i[v[e.value()]]:i[g[e.value()]]}addPoint(e,t,i){const r=super.addPoint(e,t,!0);if(r){const e=this._model.mainSeries(),[{index:t},{index:i}]=this.points(),r=(0,s.ensureDefined)(e.nearestIndex(Math.min(t,i),c.PlotRowSearchMode.NearestRight)),n=(0,s.ensureDefined)(e.nearestIndex(Math.max(t,i),c.PlotRowSearchMode.NearestLeft));this._pattern=this._createPattern(r,n),this._pattern.length>0&&(t>i&&this._points.reverse(),this._points[1].price=this._points[0].price+this._patternPriceDiff(),this._points[1].index=this._points[0].index+(n-r),this._normalizePoints(),this.createServerPoints()),this._updatePointsCoordinatePricesDiff()}return r}setPoint(e,t,i,s){1===e&&t.index<=this._points[0].index&&(t.index=this._points[0].index+1),0===e&&t.index>=this._points[1].index&&(t.index=this._points[1].index-1),super.setPoint(e,t,i),this._updatePointsCoordinatePricesDiff()}move(e,t,i,s){super.move(e,t,i,s),this._updatePointsCoordinatePricesDiff()}migrateVersion(e,t,i){if(1===e&&this._pattern.length>0){const e=this._patternPriceDiff();2===this._timePoint.length&&(this._timePoint[1].price=this._timePoint[0].price+e), 2===this._points.length&&(this._points[1].price=this._points[0].price+e)}}getScale(){return this._scale=this._calculateScale()}static createProperties(e){const t=new a.DefaultProperty({defaultName:"linetoolbarspattern",state:e});return this._configureProperties(t),t}_preparePoint(e,t){var i;const r=this._alignPointToRangeOfActualData(e),n=this._model.mainSeries(),o=(0,s.ensureNotNull)(n.bars().valueAt(r.index));this.properties().childs().mode.value()===h.LineToolBarsPatternMode.Bars?r.price=(0,s.ensure)(o[2]):r.price=(0,s.ensure)(o[4]);const l=(0,s.ensureNotNull)(this.priceScale()),a=(0,s.ensure)(null===(i=this.ownerSource())||void 0===i?void 0:i.firstValue()),c=.05*l.height(),u=l.priceToCoordinate(r.price,a)-c;return r.price=l.coordinateToPrice(u,a),super._preparePoint(r,t)}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(96461),i.e(24770),i.e(30154),i.e(82375),i.e(18537)]).then(i.bind(i,154403))).BarsPatternDefinitionsViewModel}static _configureProperties(e){super._configureProperties(e),e.addExcludedKey("mirrored",1),e.addExcludedKey("flipped",1)}_calculatePatternCoordinatePricesDiff(){var e;return this._pattern.length>0&&null!==(e=this._priceCoordinateDiff([this.firstPatternPrice(),this.lastPatternPrice()]))&&void 0!==e?e:null}_updatePointsCoordinatePricesDiff(){this._pointsCoordinatePricesDiff=this._calculatePointsCoordinatePricesDiff()}_calculatePointsCoordinatePricesDiff(){var e;if(2===this._points.length){const[{price:t},{price:i}]=this.points();return null!==(e=this._priceCoordinateDiff([t,i]))&&void 0!==e?e:null}return null}_createPattern(e,t){const i=this._model.mainSeries().data(),r=[];for(let n=e;n<=t;n++)r.push((0,o.clone)((0,s.ensureNotNull)(i.valueAt(n))));return r}_switchPointsPrice(){const e=this._points[0].price;this._timePoint[0].price=this._points[0].price=this._points[1].price,this._timePoint[1].price=this._points[1].price=e}_mirror(){const e=this._pattern;let t=Math.min(e[0][3],e[0][2]),i=Math.max(e[0][3],e[0][2]);for(let s=1;s<e.length;s++)t=Math.min(t,e[s][3]),i=Math.max(i,e[s][2]);if(t<i){const s=(t+i)/2,r=e=>s-(e-s);for(let t=0;t<e.length;t++)e[t][2]=r(e[t][2]),e[t][3]=r(e[t][3]),e[t][1]=r(e[t][1]),e[t][4]=r(e[t][4])}this._switchPointsPrice(),this.updateAllViews((0,d.sourceChangeEvent)(this.id()))}_flip(){const e=this._pattern,t=e.length;for(let i=0;i<t/2;i++){const s=e[i];e[i]=e[t-i-1],e[t-i-1]=s}this._switchPointsPrice(),this.updateAllViews((0,d.sourceChangeEvent)(this.id()))}_patternPriceDiff(){return this.lastPatternPrice()-this.firstPatternPrice()}_pricesToCoordinates(e){var t,i;const s=this.priceScale(),r=null!==(i=null===(t=this.ownerSource())||void 0===t?void 0:t.firstValue())&&void 0!==i?i:null;if(null!==r&&null!==s&&!s.isEmpty())return e.map((e=>s.priceToCoordinate(e,r)))}_priceCoordinateDiff(e){const t=this._pricesToCoordinates(e);if(t)return t[1]-t[0]}_calculateScale(){let e=1;if(2===this._points.length){const t=this._calculatePatternCoordinatePricesDiff();if(!t)return e;const i=this._calculatePointsCoordinatePricesDiff() ;if(t&&null!==i&&(e=+(i/t).toFixed(8)),this._pointsCoordinatePricesDiff!==i){if(this._scale!==e)return this._updateLastPoint(),this._scale;this._updatePointsCoordinatePricesDiff()}}return e}_updateLastPoint(){var e,t;if(this._points.length<2)return;const i=this.priceScale(),s=null!==(t=null===(e=this.ownerSource())||void 0===e?void 0:e.firstValue())&&void 0!==t?t:null;if(null===s||null===i||i.isEmpty())return;const r=this._calculatePatternCoordinatePricesDiff(),n=this._pricesToCoordinates([this.points()[0].price]);null!==r&&n&&(this._timePoint[1].price=this._points[1].price=i.coordinateToPrice(+(this._scale*r).toFixed(8)+n[0],s),this._updatePointsCoordinatePricesDiff())}}},511628:(e,t,i)=>{i.d(t,{LineToolBezierCubic:()=>o});var s=i(650151),r=i(853965),n=i(821979);class o extends n.LineDataSource{constructor(e,t,s,r){const n=t||o.createProperties();super(e,n,s,r),this._controlPoints=null,Promise.all([i.e(39232),i.e(33193),i.e(99898),i.e(76792),i.e(77028),i.e(51583)]).then(i.bind(i,98321)).then((t=>{this._setPaneViews([new t.BezierCubicPaneView(this,e)])}))}pointsCount(){return 2}name(){return"Double Curve"}setLastPoint(e,t){const i=super.setLastPoint(e,t);return this._controlPoints=this._calculateControlPoints(),i}addPoint(e,t,i){const s=super.addPoint(e,t,i);if(s){const e=this._calculateControlPoints();this._controlPoints=null,this._points.push(e[0]),this._points.push(e[1]),i||(this._normalizePoints(),this.createServerPoints()),this._createPointProperty(2),this._createPointProperty(3)}return s}restorePoints(e,t,i){super.restorePoints(e,t,i),this._createPointProperty(2),this._createPointProperty(3)}controlPoints(){return this._controlPoints}static createProperties(e){const t=new r.DefaultProperty({defaultName:"linetoolbeziercubic",state:e});return this._configureProperties(t),t}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(96461),i.e(24770),i.e(30154),i.e(82375),i.e(18537)]).then(i.bind(i,383716)).then((e=>e.GeneralBezierDefinitionsViewModel))}_calculateControlPoints(){const e=(0,s.ensureNotNull)(this.pointToScreenPoint(this.points()[0])),t=(0,s.ensureNotNull)(this.pointToScreenPoint(this.points()[1])),i=t.subtract(e).scaled(.5).transposed().scaled(.3),r=e.add(t).scaled(.33),n=e.add(t).scaled(.67),o=r.add(i),l=n.subtract(i);return[(0,s.ensureNotNull)(this.screenPointToPoint(o)),(0,s.ensureNotNull)(this.screenPointToPoint(l))]}}},516487:(e,t,i)=>{i.d(t,{LineToolBezierQuadro:()=>o});var s=i(650151),r=i(853965),n=i(821979);class o extends n.LineDataSource{constructor(e,t,s,r){const n=t||o.createProperties();super(e,n,s,r),this._controlPoint=null,Promise.all([i.e(39232),i.e(33193),i.e(99898),i.e(76792),i.e(77028),i.e(51583)]).then(i.bind(i,545357)).then((t=>{this._setPaneViews([new t.BezierQuadroPaneView(this,e)])}))}pointsCount(){return 2}name(){return"Curve"}setLastPoint(e,t){const i=super.setLastPoint(e,t);return this._controlPoint=this._calculateControlPoint(),i}addPoint(e,t,i){const s=super.addPoint(e,t,i);if(s){const e=this._calculateControlPoint();this._points.push(e),this._controlPoint=null, i||(this._normalizePoints(),this.createServerPoints()),this._createPointProperty(2)}return s}restorePoints(e,t,i){super.restorePoints(e,t,i),this._createPointProperty(2)}controlPoint(){return this._controlPoint}static createProperties(e){const t=new r.DefaultProperty({defaultName:"linetoolbezierquadro",state:e});return this._configureProperties(t),t}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(96461),i.e(24770),i.e(30154),i.e(82375),i.e(18537)]).then(i.bind(i,383716)).then((e=>e.GeneralBezierDefinitionsViewModel))}_calculateControlPoint(){const e=(0,s.ensureNotNull)(this.pointToScreenPoint(this.points()[0])),t=(0,s.ensureNotNull)(this.pointToScreenPoint(this.points()[1])),i=t.subtract(e).scaled(.5).transposed().scaled(.3),r=e.add(t).scaled(.5).add(i);return(0,s.ensureNotNull)(this.screenPointToPoint(r))}}},168504:(e,t,i)=>{i.d(t,{LineToolBrushBase:()=>n});var s=i(650151),r=i(821979);class n extends r.LineDataSource{constructor(){super(...arguments),this._finished=!1}pointsCount(){return-1}finished(){return this._finished}finish(){this._finished=!0,this._lastPoint=null,this._normalizePoints(),this.createServerPoints()}hasEditableCoordinates(){return!1}addPoint(e,t,i){if(this._finished)return!0;if(this._lastPoint=null,this._points.length>0){const t=this._points[this._points.length-1],i=(0,s.ensureNotNull)(this.pointToScreenPoint(t));if((0,s.ensureNotNull)(this.pointToScreenPoint(e)).subtract(i).length()<2)return this._finished}return super.addPoint(e),this._finished}restorePoints(e,t,i){super.restorePoints(e,t,i),this._finished=!0}}},271133:(e,t,i)=>{i.d(t,{LineToolBrush:()=>o});var s=i(853965),r=i(168504),n=i(31712);class o extends r.LineToolBrushBase{constructor(e,t,i,s){super(e,t||o.createProperties(),i,s),this._loadPaneViews(e)}smooth(){return this.properties().childs().smooth.value()}name(){return"Brush"}hasEditableCoordinates(){return!1}static createProperties(e){const t=new s.DefaultProperty({defaultName:"linetoolbrush",state:e});return this._configureProperties(t),t}_loadPaneViews(e){Promise.all([i.e(39232),i.e(33193),i.e(99898),i.e(76792),i.e(77028),i.e(51583)]).then(i.bind(i,411733)).then((t=>{this._setPaneViews([new t.BrushPaneView(this,e)])}))}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(96461),i.e(24770),i.e(30154),i.e(82375),i.e(18537)]).then(i.bind(i,351109)).then((e=>e.BrushDefinitionsViewModel))}static _configureProperties(e){super._configureProperties(e),e.addChild("backgroundsColors",new n.LineToolColorsProperty([e.childs().backgroundColor],e.childs().fillBackground))}}},844295:(e,t,i)=>{i.d(t,{LineToolCallout:()=>u});var s=i(790188),r=i(354950),n=i(853965),o=i(31712),l=i(138886);const a={selectionColor:(0,s.getHexColorByName)("color-tv-blue-500"),cursorColor:(0,s.getHexColorByName)("color-black")},c={selectionColor:(0,s.getHexColorByName)("color-white"),cursorColor:(0,s.getHexColorByName)("color-white")};class u extends l.InplaceTextLineDataSource{constructor(e,t,s,r){super(e,t||u.createProperties(),s,r),this._barOffset=0,this._dragStartLeftEdgeIndex=NaN, this._timeScale=e.timeScale(),Promise.all([i.e(39232),i.e(33193),i.e(99898),i.e(76792),i.e(77028),i.e(51583)]).then(i.bind(i,279537)).then((e=>{this._setPaneViews([new e.CalloutPaneView(this,this._model,this._openTextEditor.bind(this),this._closeTextEditor.bind(this),this.onSelectionChange.bind(this))])}))}pointsCount(){return 2}name(){return"Callout"}getBarOffset(){return this._barOffset}getStyle(){return this._model.dark().value()?c:a}shouldBeRemovedOnDeselect(){const e=this._properties.childs().text.value().trim();return this._points.length===this.pointsCount()&&""===e}addPoint(e){const t=super.addPoint(e);return t&&this._calculateBarOffset(),t}setLastPoint(e){const t=super.setLastPoint(e);return 2===this.points().length&&this._calculateBarOffset(),t}setPoint(e,t){switch(e){case 0:super.setPoint(e,t),this._calculateBarOffset();break;case 1:const i=this.properties().childs();if(!i.wordWrapWidth)return;const s=this._points,r=this._dragStartLeftEdgeIndex,n=Math.round((t.index-r)/2);if(isFinite(r)&&isFinite(n)){s[1]={index:r+n,price:s[1].price},this._calculateBarOffset(),this._normalizePoints();const e=this._timeScale.indexToCoordinate(r+2*n)-this._timeScale.indexToCoordinate(r)-8-2;if(!isFinite(e))return;i.wordWrapWidth.setValue(Math.max(100,e));break}s[1]=t,this._calculateBarOffset(),this._normalizePoints()}}setPoints(e){super.setPoints(e);const t=this.properties().childs();if(!t.wordWrapWidth)return;const i=this._dragStartLeftEdgeIndex,s=Math.round((e[1].index-i)/2);if(this._calculateBarOffset(),this._normalizePoints(),isFinite(i)&&isFinite(s)){const e=this._timeScale.indexToCoordinate(i+2*s)-this._timeScale.indexToCoordinate(i)-8-2;if(!isFinite(e))return;t.wordWrapWidth.setValue(Math.max(100,e))}}move(e,t,i){super.move(e,t,i),this._calculateBarOffset()}state(e){const t=super.state(e);return t.barOffset=this._barOffset,t}restoreData(e){e.barOffset?this._barOffset=e.barOffset:this._calculateBarOffset(),this.calculatePoint2()}setPriceScale(e){super.setPriceScale(e),e&&e.priceRange()&&this.calculatePoint2()}template(){const e=super.template();return e.text=this.properties().childs().text.value(),e}calculatePoint2(){if(this._model.lineBeingEdited()===this||this._model.sourcesBeingMoved().includes(this))return;if(this._points.length<2)return;const[e,t]=this.points();this._points[1]={price:t.price,index:e.index+this._barOffset}}static createProperties(e){const t=new n.DefaultProperty({defaultName:"linetoolcallout",state:e});return this._configureProperties(t),t}_applyTemplateImpl(e){this.properties().childs().text.setValue(e.text),super._applyTemplateImpl(e)}_correctPoints(e,t){if(null===this._currentMovingPoint||void 0===this._currentMovingPoint.logical||null===this._startMovingPoint||void 0===this._startMovingPoint.logical)return!1;const i=this._currentMovingPoint.logical.index-this._startMovingPoint.logical.index,s=this._currentMovingPoint.logical.price-this._startMovingPoint.logical.price,r=e[1];return r.index=r.index+i,r.price+=s,e[1]=r,!0}_onPointsetUpdated(e){super._onPointsetUpdated(e), 0!==e.length&&(1===this._points.length&&this._points.push(this._points[0]),this._dragStartLeftEdgeIndex=this.points()[1].index)}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(96461),i.e(24770),i.e(30154),i.e(82375),i.e(18537)]).then(i.bind(i,334183))).CalloutDefinitionsViewModel}static _configureProperties(e){super._configureProperties(e),e.hasChild("text")||e.addChild("text",new r.Property("")),e.addExcludedKey("text",1),e.addChild("textsColors",new o.LineToolColorsProperty([e.childs().color]))}_calculateBarOffset(){this.points().length>1&&(this._barOffset=this.points()[1].index-this.points()[0].index)}}},638202:(e,t,i)=>{i.d(t,{LineToolCircle:()=>l});var s=i(354950),r=i(853965),n=i(821979),o=i(31712);class l extends n.LineDataSource{constructor(e,t,s,r){const n=t||l.createProperties();super(e,n,s,r),Promise.all([i.e(39232),i.e(33193),i.e(99898),i.e(76792),i.e(77028),i.e(51583)]).then(i.bind(i,434475)).then((({CirclePaneView:t})=>{const i=[new t(this,e)];this._setPaneViews(i)}))}pointsCount(){return 2}name(){return"Circle"}template(){const e=super.template();return e.text=this.properties().childs().text.value(),e}static createProperties(e){const t=new r.DefaultProperty({defaultName:"linetoolcircle",state:e});return this._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(96461),i.e(24770),i.e(30154),i.e(82375),i.e(18537)]).then(i.bind(i,70418))).EllipseCircleDefinitionsViewModel}_snapTo45DegreesAvailable(){return!0}_applyTemplateImpl(e){super._applyTemplateImpl(e),this.properties().childs().text.setValue(e.text)}static _configureProperties(e){super._configureProperties(e),e.hasChild("text")||e.addChild("text",new s.Property("")),e.addChild("linesColors",new o.LineToolColorsProperty([e.childs().color])),e.addChild("linesWidths",new o.LineToolWidthsProperty([e.childs().linewidth])),e.addChild("backgroundsColors",new o.LineToolColorsProperty([e.childs().backgroundColor])),e.addChild("textsColors",new o.LineToolColorsProperty([e.childs().textColor],e.childs().showLabel)),e.addExcludedKey("linesColors",3),e.addExcludedKey("linesWidths",3),e.addExcludedKey("backgroundsColors",3),e.addExcludedKey("textsColors",3),e.addExcludedKey("text",1)}}},768574:(e,t,i)=>{i.d(t,{LineToolComment:()=>n});var s=i(853965),r=i(179180);class n extends r.LineToolBalloon{constructor(e,t,i,s){super(e,t||n.createProperties(),i,s)}name(){return"Comment"}static createProperties(e){const t=new s.DefaultProperty({defaultName:"linetoolcomment",state:e});return n._configureProperties(t),t}_createPaneView(){Promise.all([i.e(39232),i.e(33193),i.e(99898),i.e(76792),i.e(77028),i.e(51583)]).then(i.bind(i,229548)).then((e=>{this._setPaneViews([new e.CommentPaneView(this,this._model)])}))}}},73217:(e,t,i)=>{i.d(t,{LineToolCrossLine:()=>l});var s=i(853965),r=i(682912),n=i(421644),o=i(821979);class l extends o.LineDataSource{constructor(e,t,s,o){super(e,t||l.createProperties(),s,o),this._priceAxisView=new r.LineToolHorzLinePriceAxisView(this), this._timeAxisView=new n.LineToolVertLineTimeAxisView(this),Promise.all([i.e(39232),i.e(33193),i.e(99898),i.e(76792),i.e(77028),i.e(51583)]).then(i.bind(i,533661)).then((({CrossLinePaneView:e})=>{this._setPaneViews([new e(this,this._model)])}))}pointsCount(){return 1}name(){return"Cross Line"}priceAxisViews(e,t){return this.isSourceHidden()?null:t===this.priceScale()&&this.properties().childs().showPrice.value()&&this._model.paneForSource(this)===e?[this._priceAxisView]:null}timeAxisViews(){return this.isSourceHidden()?null:this.properties().childs().showTime.value()?[this._timeAxisView]:null}updateAllViews(e){super.updateAllViews(e),this._priceAxisView.update(e),this._timeAxisView.update()}canHasAlert(){return!1}lineColor(){return this.properties().childs().linecolor.value()}lineWidth(){return this.properties().childs().linewidth.value()}lineStyle(){return this.properties().childs().linestyle.value()}static createProperties(e){const t=new s.DefaultProperty({defaultName:"linetoolcrossline",state:e});return this._configureProperties(t),t}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(96461),i.e(24770),i.e(30154),i.e(82375),i.e(18537)]).then(i.bind(i,184062)).then((e=>e.CrossLineDefinitionsViewModel))}}},70726:(e,t,i)=>{i.d(t,{CustomEventItem:()=>n,LineToolCustomUrlEvent:()=>o});var s=i(650151),r=i(776954);class n{constructor(e){this._source=e}position(){return this._props().childs().position.value()}_props(){return this._source.properties()}}class o extends r.LineToolWithRelativePriceCoordinate{constructor(){super(...arguments),this._item=null,this._eventTimePointIndex=null}pointsCount(){return 1}cloneable(){return!1}eventTimePointIndex(){return this._eventTimePointIndex}customEvent(){return this._item}restorePoints(e,t,i){i&&t.length>0&&(this._eventTimePointIndex=t[0].index),super.restorePoints(e,t,i)}priceAxisPoints(){return[]}_baseSeriesIndexForPoint(e){var t;return null!==(t=this._eventTimePointIndex)&&void 0!==t?t:e.index}_alignPointHorizontallyOrVertically(e){var t,i;if(null===this._eventTimePointIndex)return e;const r=this._points[0].index-this._eventTimePointIndex,n=(0,s.ensure)(null===(i=null===(t=this._startMovingPoint)||void 0===t?void 0:t.logical)||void 0===i?void 0:i.index)-r;return{price:e.price,index:n}}_snapPoint45Degree(e,t,i){this._eventTimePointIndex&&(e.index=this._eventTimePointIndex)}_snapTo45DegreesAvailable(){return!0}_allowChangeAnchorHorizontally(){return!0}_pointsForPointset(){return[[(0,s.ensureNotNull)(this._item).time(),0],...super._pointsForPointset()]}_onPointsetUpdated(e){if(0===e.length)return;const t=e.findIndex((e=>0===e.index));-1!==t&&(this._eventTimePointIndex=e[t].value[0]);const i=e.slice(1).map((e=>({value:e.value,index:e.index-1})));super._onPointsetUpdated(i)}_readyToCreatePointset(){return super._readyToCreatePointset()&&null!==this._item}}},224777:(e,t,i)=>{i.d(t,{LineToolCypherPattern:()=>n});var s=i(147985),r=i(853965);class n extends s.LineTool5PointsPattern{constructor(e,t,i,s){super(e,t||n.createProperties(),i,s)}name(){return"Cypher Pattern"} static createProperties(e){const t=new r.DefaultProperty({defaultName:"linetoolcypherpattern",state:e});return this._configureProperties(t),t}_loadPaneViews(e){Promise.all([i.e(39232),i.e(33193),i.e(99898),i.e(76792),i.e(77028),i.e(51583)]).then(i.bind(i,100417)).then((t=>{this._setPaneViews([new t.CypherPaneView(this,e)])}))}}},941883:(e,t,i)=>{i.d(t,{DateAndPriceBaseProperties:()=>p,allPropertiesStateKeysBase:()=>d,nonThemedFactoryDefaultsBase:()=>u,themedFactoryDefaultsBase:()=>h});var s=i(790188),r=i(61499),n=i(246733),o=i(808068),l=i(354950),a=i(33249);const c=(0,s.getHexColorByName)("color-tv-blue-500"),u={linewidth:2,fontsize:12,fillLabelBackground:!0,fillBackground:!0,backgroundTransparency:60,intervalsVisibilities:{...o.intervalsVisibilitiesDefaults},customText:{visible:!1,fontsize:12,bold:!1,italic:!1}},h=new Map([[r.StdTheme.Light,{textcolor:(0,s.getHexColorByName)("color-black"),labelBackgroundColor:(0,s.getHexColorByName)("color-white"),linecolor:c,backgroundColor:(0,n.generateColor)(c,85),shadow:"rgba(0, 0, 0, 0.2)",customText:{color:c}}],[r.StdTheme.Dark,{textcolor:(0,s.getHexColorByName)("color-white"),labelBackgroundColor:(0,s.getHexColorByName)("color-cold-gray-800"),linecolor:c,backgroundColor:(0,n.generateColor)(c,85),shadow:"rgba(0, 0, 0, 0.4)",customText:{color:c}}]]),d=["customText.text"];class p extends a.LineDataSourceProperty{constructor({nonThemedDefaultsKeys:e,themedDefaultsKeys:t,...i}){var s,r,n;super({nonThemedDefaultsKeys:e,themedDefaultsKeys:t,templateKeys:[...null!=e?e:[],...null!=t?t:[],...d],...i});const o=null===(s=i.state)||void 0===s?void 0:s.customText;this._textProperty=new l.Property(null!==(r=null==o?void 0:o.text)&&void 0!==r?r:""),null===(n=this.childs().customText)||void 0===n||n.addChild("text",this._textProperty)}template(){const e=super.template();return e.customText.text=this._textProperty.value(),e}}},836843:(e,t,i)=>{i.d(t,{LineToolDateAndPriceRange:()=>P});var s=i(650151),r=i(821979),n=i(3140),o=i(61499),l=i(790188),a=i(853965),c=i(738232),u=i(923237),h=i(941883);const d=(0,l.getHexColorByName)("color-tv-blue-500"),p={...h.nonThemedFactoryDefaultsBase,drawBorder:!1,borderWidth:1},_=new Map([[o.StdTheme.Light,{...h.themedFactoryDefaultsBase.get(o.StdTheme.Light),borderColor:d}],[o.StdTheme.Dark,{...h.themedFactoryDefaultsBase.get(o.StdTheme.Dark),borderColor:d}]]),f=(0,a.extractAllPropertiesKeys)((0,s.ensureDefined)(_.get(o.StdTheme.Light))),m=(0,a.extractAllPropertiesKeys)(p),v=[...f,...m,...u.commonLineToolPropertiesStateKeys,...h.allPropertiesStateKeysBase];class g extends h.DateAndPriceBaseProperties{static create(e){return new this({defaultName:"linetooldateandpricerange",factoryDefaultsSupplier:()=>(0,c.factoryDefaultsForCurrentTheme)(p,_),nonThemedDefaultsKeys:m,themedDefaultsKeys:f,allStateKeys:v,state:e})}}class P extends r.LineDataSource{constructor(e,t,s,r){super(e,t||P.createProperties(),s,r),this._volumeCalculator=null,Promise.all([i.e(39232),i.e(33193),i.e(99898),i.e(76792),i.e(77028),i.e(51583)]).then(i.bind(i,745062)).then((e=>{ this._setPaneViews([new e.DateAndPriceRangePaneView(this,this._model)])}))}destroy(){super.destroy(),null!==this._volumeCalculator&&this._volumeCalculator.destroy()}pointsCount(){return 2}name(){return"Date and Price Range"}template(){return this._properties.template()}volume(){if(null===this._volumeCalculator)return NaN;const e=this.points();return this._volumeCalculator.volume(e[0].index,e[1].index)}setOwnerSource(e){e===this._model.mainSeries()&&((0,s.assert)(null===this._volumeCalculator),this._volumeCalculator=new n.SeriesTimeRangeVolumeCalculator(this._model.mainSeries())),super.setOwnerSource(e)}static createProperties(e){const t=g.create(e);return this._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(96461),i.e(24770),i.e(30154),i.e(82375),i.e(18537)]).then(i.bind(i,133954))).GeneralDatePriceRangeDefinitionsViewModel}}},727264:(e,t,i)=>{i.d(t,{LineToolDateRange:()=>v});var s=i(650151),r=i(821979),n=i(3140),o=i(61499),l=i(853965),a=i(738232),c=i(941883),u=i(923237);const h={...c.nonThemedFactoryDefaultsBase,extendTop:!1,extendBottom:!1},d=c.themedFactoryDefaultsBase,p=(0,l.extractAllPropertiesKeys)((0,s.ensureDefined)(d.get(o.StdTheme.Light))),_=(0,l.extractAllPropertiesKeys)(h),f=[...p,..._,...u.commonLineToolPropertiesStateKeys,...c.allPropertiesStateKeysBase];class m extends c.DateAndPriceBaseProperties{static create(e){return new this({defaultName:"linetooldaterange",factoryDefaultsSupplier:()=>(0,a.factoryDefaultsForCurrentTheme)(h,d),nonThemedDefaultsKeys:_,themedDefaultsKeys:p,allStateKeys:f,state:e})}}class v extends r.LineDataSource{constructor(e,t,s,r){super(e,t||v.createProperties(),s,r),this._volumeCalculator=null,Promise.all([i.e(39232),i.e(33193),i.e(99898),i.e(76792),i.e(77028),i.e(51583)]).then(i.bind(i,691448)).then((e=>{this._setPaneViews([new e.DateRangePaneView(this,this._model)])}))}destroy(){super.destroy(),null!==this._volumeCalculator&&this._volumeCalculator.destroy()}pointsCount(){return 2}name(){return"Date Range"}template(){return this._properties.template()}volume(){if(null===this._volumeCalculator)return NaN;const e=this.points();return this._volumeCalculator.volume(e[0].index,e[1].index)}setOwnerSource(e){e===this._model.mainSeries()&&((0,s.assert)(null===this._volumeCalculator),this._volumeCalculator=new n.SeriesTimeRangeVolumeCalculator(this._model.mainSeries())),super.setOwnerSource(e)}static createProperties(e){const t=m.create(e);return this._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(96461),i.e(24770),i.e(30154),i.e(82375),i.e(18537)]).then(i.bind(i,133954))).GeneralDatePriceRangeDefinitionsViewModel}}},709638:(e,t,i)=>{i.d(t,{LineToolDisjointChannel:()=>l});var s=i(821979),r=i(853965),n=i(389137),o=i(354950);class l extends s.LineDataSource{constructor(e,t,s,r){super(e,null!=t?t:l.createProperties(),s,r),this.version=1,Promise.all([i.e(39232),i.e(33193),i.e(99898),i.e(76792),i.e(77028),i.e(51583)]).then(i.bind(i,318467)).then((e=>{ this._setPaneViews([new e.DisjointChannelPaneView(this,this._model)])}))}pointsCount(){return 3}name(){return"Disjoint Channel"}hasEditableCoordinates(){return!1}addPoint(e,t,i){return t&&t.shift()&&2===this.points().length&&this._snapPoint45Degree(e,this.points()[this.points().length-2]),super.addPoint(e)}setLastPoint(e,t){return t&&t.shift()&&2===this.points().length&&this._snapPoint45Degree(e,this.points()[this.points().length-2]),super.setLastPoint(e)}setPoint(e,t,i,s){const r=.5*(this._points[1].price+this._points[2].price);if(i&&i.shift()&&1===e){const e=0;this._snapPoint45Degree(t,this.points()[e])}if(e<3&&super.setPoint(e,t),0!==e&&2!==e){if(1===e){const e=this._points[1].price-r;this._points[2].price=this._points[1].price-2*e}else if(3===e){const e=t.price-this._points[2].price;this._points[0].price=this._points[1].price-e,this._points[0].index=t.index}this._normalizePoints()}}getPoint(e){if(e<3)return super.getPoint(e);const t=this._points[0].price-this._points[2].price;return{index:this._points[0].index,price:this._points[1].price-t}}canHasAlert(){return!0}template(){const e=super.template();return e.labelText=this.properties().childs().labelText.value(),e}static createProperties(e){const t=new r.DefaultProperty({defaultName:"linetooldisjointangle",state:e});return this._configureProperties(t),t}_applyTemplateImpl(e){var t;super._applyTemplateImpl(e),this.properties().childs().labelText.setValue(null!==(t=e.labelText)&&void 0!==t?t:"")}_getAlertPlots(){const e=this._points[0],t=this._points[1],i=[];e.index<=t.index?(i.push(e),i.push(t)):(i.push(t),i.push(e));const s=this._points[2];s.time=t.time,s.index=t.index;const r={price:s.price+(t.price-e.price),time:e.time,index:e.index},o=[];let l,a,c,u;s.index<=r.index?(o.push(s),o.push(r)):(o.push(r),o.push(s)),i[0].price>o[0].price?(l=i,a=o):o[0].price>i[0].price||o[1].price>i[1].price?(l=o,a=i):(l=i,a=o);const h=this.properties().childs().extendLeft.value(),d=this.properties().childs().extendRight.value();return e.index<=t.index?(c=h,u=d):(c=d,u=h),[this._linePointsToAlertPlot(l,"Upper",c,u),this._linePointsToAlertPlot(a,"Lower",c,u)].filter(n.notNull)}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(96461),i.e(24770),i.e(30154),i.e(82375),i.e(18537)]).then(i.bind(i,872077))).GeneralTrendFiguresDefinitionsViewModel}static _configureProperties(e){super._configureProperties(e),e.hasChild("labelText")||e.addChild("labelText",new o.Property("")),e.addExcludedKey("labelText",1)}}},960690:(e,t,i)=>{i.d(t,{LineToolElliott:()=>d,LineToolElliottCorrection:()=>b,LineToolElliottDoubleCombo:()=>w,LineToolElliottImpulse:()=>f,LineToolElliottTriangle:()=>v,LineToolElliottTripleCombo:()=>P});var s=i(444372),r=i(809796),n=i(821979),o=i(373571),l=i(853965),a=i(31712);const c=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14],u=new r.TranslatedString("change Elliott degree",s.t(null,void 0,i(876020))),h=[{value:0,title:s.t(null,void 0,i(433820))},{value:1,title:s.t(null,void 0,i(558397))},{value:2,title:s.t(null,void 0,i(609753))},{value:3, title:s.t(null,void 0,i(718367))},{value:4,title:s.t(null,void 0,i(591889))},{value:5,title:s.t(null,void 0,i(495176))},{value:6,title:s.t(null,void 0,i(348404))},{value:7,title:s.t(null,void 0,i(671778))},{value:8,title:s.t(null,{context:"wave"},i(266051))},{value:9,title:s.t(null,{context:"wave"},i(486054))},{value:10,title:s.t(null,void 0,i(185884))},{value:11,title:s.t(null,void 0,i(471722))},{value:12,title:s.t(null,void 0,i(210931))},{value:13,title:s.t(null,void 0,i(729662))},{value:14,title:s.t(null,void 0,i(609632))}];class d extends n.LineDataSource{constructor(e,t,s,r){super(e,null!=t?t:d.createProperties(),s,r),this.version=4,Promise.all([i.e(39232),i.e(33193),i.e(99898),i.e(76792),i.e(77028),i.e(51583)]).then(i.bind(i,762994)).then((e=>{this._setPaneViews([new e.ElliottLabelsPaneView(this,this._model)])}))}migrateVersion(e,t,i){if(i.properties.hasChild("background")&&i.properties.removeProperty("background"),i.properties.hasChild("backgroundColor")&&i.properties.removeProperty("backgroundColor"),i.properties.hasChild("showBackground")&&i.properties.removeProperty("showBackground"),1===e){const e=Object.assign({},this._timePoint[0]);if(this._timePoint.unshift(e),this._points.length>0){const e=Object.assign({},this._points[0]);this._points.unshift(e)}}}applyTemplate(e){const t=e;delete t.background,delete t.backgroundColor,delete t.showBackground,super.applyTemplate(e)}name(){return"Elliott Labels"}additionalActions(e){return[new o.Action({actionId:"Chart.LineTool.Elliot.ChangeDegreeProperty",options:{label:s.t(null,void 0,i(69479)),subItems:c.map((t=>{const i=h.filter((e=>e.value===t))[0];return new o.Action({actionId:"Chart.LineTool.Elliot.ChangeDegreeProperty",options:{label:i.title,checkable:!0,checked:this.properties().childs().degree.value()===t,onExecute:()=>{e.setProperty(this.properties().childs().degree,t,u)}}})}))}})]}label(e){const t=c.length-this.properties().childs().degree.value()-1,i=Math.floor(t/3);return{group:i,bold:!!(i%2),decoration:["","brackets","circle"][t%3],label:this.labelsGroup()[i][e]}}availableDegreesValues(){return h}static createProperties(e){const t=new l.DefaultProperty({defaultName:"linetoolelliott",state:e});return this._configureProperties(t),t}static migrateState(e){const t={0:11,1:10,2:9,3:8,4:7,5:6,6:5,7:4,8:3},i={0:11,1:8};"LineToolElliottSubminuette"===e.type&&(e.type="LineToolElliottImpulse",e.state.degree=t[e.state.wavesize]),"LineToolElliottMinor"===e.type&&(e.type="LineToolElliottImpulse",e.state.degree=t[e.state.wavesize]),"LineToolElliottCircle"===e.type&&(e.type="LineToolElliottImpulse",e.state.degree=t[e.state.wavesize]),"LineToolElliottMinorRetr"===e.type&&(e.type="LineToolElliottCorrection",e.state.degree=i[e.state.wavesize]),"LineToolElliottMajorRetr"===e.type&&(e.type="LineToolElliottCorrection",e.state.degree=i[e.state.wavesize])}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(96461),i.e(24770),i.e(30154),i.e(82375),i.e(18537)]).then(i.bind(i,46971))).ElliottPatternDefinitionsViewModel}static _configureProperties(e){ super._configureProperties(e),e.addChild("linesColors",new a.LineToolColorsProperty([e.childs().color])),e.addExcludedKey("linesColors",3)}}class p extends d{pointsCount(){return 6}}const _=[["0","1","2","3","4","5"],["0","i","ii","iii","iv","v"],["0","1","2","3","4","5"],["0","I","II","III","IV","V"],["0","1","2","3","4","5"]];class f extends p{constructor(e,t,i,s){super(e,t||f.createProperties(),i,s)}name(){return"Elliott Impulse Wave (12345)"}labelsGroup(){return _}static createProperties(e){const t=new l.DefaultProperty({defaultName:"linetoolelliottimpulse",state:e});return this._configureProperties(t),t}}const m=[["0","A","B","C","D","E"],["0","a","b","c","d","e"],["0","A","B","C","D","E"],["0","a","b","c","d","e"],["0","A","B","C","D","E"]];class v extends p{constructor(e,t,i,s){super(e,t||v.createProperties(),i,s)}name(){return"Elliott Triangle Wave (ABCDE)"}labelsGroup(){return m}static createProperties(e){const t=new l.DefaultProperty({defaultName:"linetoolelliotttriangle",state:e});return this._configureProperties(t),t}}const g=[["0","W","X","Y","X","Z"],["0","w","x","y","x","z"],["0","W","X","Y","X","Z"],["0","w","x","y","x","z"],["0","W","X","Y","X","Z"]];class P extends p{constructor(e,t,i,s){super(e,null!=t?t:P.createProperties(),i,s)}name(){return"Elliott Triple Combo Wave (WXYXZ)"}labelsGroup(){return g}static createProperties(e){const t=new l.DefaultProperty({defaultName:"linetoolelliotttriplecombo",state:e});return this._configureProperties(t),t}}class y extends d{pointsCount(){return 4}}const S=[["0","A","B","C"],["0","a","b","c"],["0","A","B","C"],["0","a","b","c"],["0","A","B","C"]];class b extends y{constructor(e,t,i,s){super(e,null!=t?t:b.createProperties(),i,s)}name(){return"Elliott Correction Wave (ABC)"}labelsGroup(){return S}static createProperties(e){const t=new l.DefaultProperty({defaultName:"linetoolelliottcorrection",state:e});return this._configureProperties(t),t}}const x=[["0","W","X","Y"],["0","w","x","y"],["0","W","X","Y"],["0","w","x","y"],["0","W","X","Y"]];class w extends y{constructor(e,t,i,s){super(e,null!=t?t:w.createProperties(),i,s)}name(){return"Elliott Double Combo Wave (WXY)"}labelsGroup(){return x}static createProperties(e){const t=new l.DefaultProperty({defaultName:"linetoolelliottdoublecombo",state:e});return this._configureProperties(t),t}}},43853:(e,t,i)=>{i.d(t,{LineToolEllipse:()=>u});var s=i(650151),r=i(204652),n=i(86441),o=i(354950),l=i(853965),a=i(821979),c=i(31712);class u extends a.LineDataSource{constructor(e,t,s,r){super(e,t||u.createProperties(),s,r),this.version=2,this._dist=null,this._fakePointAdded=!1,Promise.all([i.e(39232),i.e(33193),i.e(99898),i.e(76792),i.e(77028),i.e(51583)]).then(i.bind(i,555422)).then((({EllipsePaneView:e})=>{this._setPaneViews([new e(this,this._model)])}))}startChanging(e,t){if(super.startChanging(e,t),0===e||1===e){const e=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[0])),t=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[1])),i=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[2]));this._dist=(0, r.distanceToLine)(e,t,i).distance||0}}addPoint(e,t,i){const s=super.addPoint(e,t,i);return s&&(this._fakePointAdded=!1),s}setPoint(e,t,i,o){const l={...t};let a=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[0])),c=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[1])),u=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[2]));switch(e){case 0:{if(i&&i.shift()){this._snapPoint45Degree(l,this._points[1]),this._points[0]=l,this._points[2]=this._preparePointInternal(this._points[2],i,!0),this._points[0].index===this._points[1].index&&this._fixVerticalDiameterPoints(this._points[0],this._points[1],this._points[2]);break}a=(0,s.ensureNotNull)(this.pointToScreenPoint(l));const e=c.subtract(a),t=a.add(c).scaled(.5),r=new n.Point(-e.y,e.x).normalized();u=t.add(r.scaled((0,s.ensureNotNull)(this._dist))),this._points[0]=l,this._points[2]=(0,s.ensureNotNull)(this.screenPointToPoint(u));break}case 1:{if(i&&i.shift()){this._snapPoint45Degree(l,this._points[0]),this._points[1]=l,this._points[2]=this._preparePointInternal(this._points[2],i,!0),this._points[0].index===this._points[1].index&&this._fixVerticalDiameterPoints(this._points[1],this._points[0],this._points[2]);break}c=(0,s.ensureNotNull)(this.pointToScreenPoint(l));const e=c.subtract(a),t=a.add(c).scaled(.5),r=new n.Point(-e.y,e.x).normalized();u=t.add(r.scaled((0,s.ensureNotNull)(this._dist))),this._points[1]=l,this._points[2]=(0,s.ensureNotNull)(this.screenPointToPoint(u));break}case 2:{const e=(0,s.ensureNotNull)(this.pointToScreenPoint(l)),t=(0,r.distanceToLine)(a,c,e).distance,i=c.subtract(a),o=a.add(c).scaled(.5),h=new n.Point(-i.y,i.x).normalized();u=o.add(h.scaled(t)),this._points[2]=(0,s.ensureNotNull)(this.screenPointToPoint(u));break}case 3:{const e=(0,s.ensureNotNull)(this.pointToScreenPoint(l)),t=(0,r.distanceToLine)(a,c,e).distance,i=c.subtract(a),o=a.add(c).scaled(.5),h=new n.Point(-i.y,i.x).normalized();u=o.add(h.scaled(t)),this._points[2]=(0,s.ensureNotNull)(this.screenPointToPoint(u));break}}this._normalizePoints()}pointsCount(){return 3}name(){return"Ellipse"}hasEditableCoordinates(){return!1}migrateVersion(e,t,i){if(1===e&&2===this._points.length){const e=this._points[0].price,t=.5*(this._points[0].price+this._points[1].price);this._points[0]={price:t,index:this._points[0].index},this._points[1]={price:t,index:this._points[1].index},this._points.push({price:e,index:this._points[0].index})}if(1===e&&2===this._timePoint.length){const e=this._timePoint[0].price,t=.5*(this._timePoint[0].price+this._timePoint[1].price);this._timePoint[0].price=t,this._timePoint[1].price=t;const i={price:e,offset:this._timePoint[0].offset,time_t:this._timePoint[0].time_t};this._timePoint.push(i)}}template(){const e=super.template();return e.text=this.properties().childs().text.value(),e}static createProperties(e){const t=new l.DefaultProperty({defaultName:"linetoolellipse",state:e});return this._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){ return(await Promise.all([i.e(96461),i.e(24770),i.e(30154),i.e(82375),i.e(18537)]).then(i.bind(i,70418))).EllipseCircleDefinitionsViewModel}_preparePoint(e,t){const i=this._preparePointInternal(e,t,!1);return t&&t.shift()&&this._points[0].index===this._points[1].index&&this._fixVerticalDiameterPoints(this._points[1],this._points[0],i),i}_applyTemplateImpl(e){super._applyTemplateImpl(e),this.properties().childs().text.setValue(e.text)}static _configureProperties(e){super._configureProperties(e),e.hasChild("text")||e.addChild("text",new o.Property("")),e.addChild("linesColors",new c.LineToolColorsProperty([e.childs().color])),e.addChild("textsColors",new c.LineToolColorsProperty([e.childs().textColor],e.childs().showLabel)),e.addExcludedKey("text",1)}_preparePointInternal(e,t,i){let r={...e};if(t&&t.shift()){const t=this.points().length;if(!this._fakePointAdded&&3===t&&!i)return r;if(this._fakePointAdded||2===t||i){this._snapPoint45Degree(e,this._points[0]),this._fakePointAdded?this._points[1]=e:i||(this._fakePointAdded=!0,super._addPointIntenal(e));const t=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[0])),o=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[1])),l=o.x-t.x,a=o.y-t.y,c=Math.sqrt(l*l+a*a)/2,u=o.subtract(t),h=t.add(o).scaled(.5),d=new n.Point(-u.y,u.x).normalized(),p=h.add(d.scaled(c));r=(0,s.ensureNotNull)(this.screenPointToPoint(p)),(isNaN(r.price)||isNaN(r.index))&&(r=(0,s.ensureNotNull)(this.screenPointToPoint(h)))}}else this._fakePointAdded&&(this._points.splice(1,1),this._fakePointAdded=!1);return r}_fixVerticalDiameterPoints(e,t,i){const r=(0,s.ensureNotNull)(this.pointToScreenPoint(e)),o=(0,s.ensureNotNull)(this.pointToScreenPoint(t)),l=this._model.timeScale(),a=l.indexToCoordinate(e.index),c=l.indexToCoordinate(i.index);let u=2*Math.abs(a-c);u*=t.price>e.price?1:-1,e.price=(0,s.ensureNotNull)(this.screenPointToPoint(new n.Point(r.x,o.y+u))).price}}},167843:(e,t,i)=>{i.d(t,{LineToolEmoji:()=>b});var s=i(328530),r=i(201089),n=i(120780),o=i(885482),l=i(500477),a=i(760184),c=i(822914),u=i(852290),h=i(33249),d=i(808068),p=i(853965),_=i(923237);const f={intervalsVisibilities:{...d.intervalsVisibilitiesDefaults},size:40},m={emoji:"😀",angle:.5*Math.PI},v=(0,p.extractAllPropertiesKeys)(f),g=(0,p.extractAllPropertiesKeys)(m),P=[...v,...g,..._.commonLineToolPropertiesStateKeys];class y extends h.LineDataSourceProperty{constructor(e){super(e)}static create(e,t){return new this({defaultName:"linetoolemoji",factoryDefaultsSupplier:()=>(0,c.default)(f),nonThemedDefaultsKeys:v,themedDefaultsKeys:[],state:(0,u.default)({},m,{emoji:t},null!=e?e:{}),allStateKeys:P})}}const S=(0,r.getLogger)("Chart.LineToolEmoji");class b extends a.LineToolSvgIconBase{constructor(e,t,i,s){super(e,t||b.createProperties(),i,s),this.version=1,this._loadViews()}name(){return"Emoji"}template(){return this.properties().template()}static createProperties(e){const t=y.create(e,o.emojiTool.value());return b._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){ return(await Promise.all([i.e(96461),i.e(24770),i.e(30154),i.e(82375),i.e(18537)]).then(i.bind(i,282375))).LineDataSourceDefinitionsViewModel}async _loadViews(){const e=this._properties.childs().emoji.value(),t=(0,s.getTwemojiUrl)(e,"svg");try{const[s,{EmojiPaneView:r}]=await Promise.all([(0,n.fetch)(t).then((e=>e.text())),Promise.all([i.e(39232),i.e(33193),i.e(99898),i.e(76792),i.e(77028),i.e(51583)]).then(i.bind(i,496259))]);if(!this._isDestroyed){this._svgContent=s,this._onIconChanged.fire();const t=(0,l.svgRenderer)(s);null===t&&S.logWarn(`Couldn't create svg renderer for emoji ${e}`),this._setPaneViews([new r(this,this._model,t)])}}catch(t){S.logWarn(`An error ocurred while loading emoji content ${e}: ${t}`)}}}},252598:(e,t,i)=>{i.d(t,{LineToolExtended:()=>r});var s=i(956268);class r extends s.LineToolTrendLine{constructor(e,t,i,s){super(e,null!=t?t:r.createProperties(),i,s)}name(){return"Extended Line"}static createProperties(e){const t=s.LineToolTrendLine._createPropertiesImpl("linetoolextended",e);return r._configureProperties(t),t}}},965989:(e,t,i)=>{i.d(t,{LineToolFibChannel:()=>u});var s=i(650151),r=i(444372),n=i(809796),o=i(821979),l=i(517336),a=i(31712);const c=new n.TranslatedString("erase level line",r.t(null,void 0,i(812962)));class u extends o.LineDataSource{constructor(e,t,s,r){super(e,t||u.createProperties(),s,r),this.version=2,Promise.all([i.e(39232),i.e(33193),i.e(99898),i.e(76792),i.e(77028),i.e(51583)]).then(i.bind(i,361501)).then((({FibChannelPaneView:e})=>{this._setPaneViews([new e(this,this._model)])}))}levelsCount(){return 24}migrateVersion(e,t,i){i.properties.removeProperty("reverse")}pointsCount(){return 3}name(){return"Fib Channel"}processErase(e,t){const i="level"+t,s=this.properties().child(i).childs().visible;e.setProperty(s,!1,c)}static createProperties(e){const t=new l.LevelsProperty({defaultName:"linetoolfibchannel",state:e,map:{range:[1,24],names:["coeff","color","visible"]}});return this._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(96461),i.e(24770),i.e(30154),i.e(82375),i.e(18537)]).then(i.bind(i,866406))).FibDrawingsWith24LevelsDefinitionsViewModel}static _configureProperties(e){super._configureProperties(e);const t=[];for(let i=1;i<=24;i++){const r=(0,s.ensureDefined)(e.child("level"+i));t.push((0,s.ensureDefined)(r.child("color")))}e.addChild("linesColors",new a.LineToolColorsProperty(t))}}},953718:(e,t,i)=>{i.d(t,{LineToolFibCircles:()=>u});var s=i(650151),r=i(444372),n=i(809796),o=i(821979),l=i(517336),a=i(31712);const c=new n.TranslatedString("erase level line",r.t(null,void 0,i(812962)));class u extends o.LineDataSource{constructor(e,t,s,r){super(e,t||u.createProperties(),s,r),Promise.all([i.e(39232),i.e(33193),i.e(99898),i.e(76792),i.e(77028),i.e(51583)]).then(i.bind(i,889131)).then((e=>{this._setPaneViews([new e.FibCirclesPaneView(this,this._model)])}))}levelsCount(){return 11}pointsCount(){return 2}name(){return"Fib Circles"}processErase(e,t){const i=(0,s.ensureDefined)(this.properties().child(`level${t}`)) ;e.setProperty(i,!1,c)}static createProperties(e){const t=new l.LevelsProperty({defaultName:"linetoolfibcircles",state:e,map:{range:[1,11]}});return this._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(96461),i.e(24770),i.e(30154),i.e(82375),i.e(18537)]).then(i.bind(i,151611))).FibCirclesDefinitionsViewModel}_snapTo45DegreesAvailable(){return!0}static _configureProperties(e){var t,i;super._configureProperties(e);const r=e.childs(),n=[r.trendline.childs().linewidth],o=[r.trendline.childs().color];for(let r=1;r<=11;r++)n.push((0,s.ensureDefined)(null===(t=e.child("level"+r))||void 0===t?void 0:t.child("linewidth"))),o.push((0,s.ensureDefined)(null===(i=e.child("level"+r))||void 0===i?void 0:i.child("color")));e.addChild("linesColors",new a.LineToolColorsProperty(o)),e.addChild("linesWidths",new a.LineToolWidthsProperty(n))}}},498995:(e,t,i)=>{i.d(t,{LineToolFibRetracement:()=>c});var s=i(444372),r=i(809796),n=i(517336),o=i(821979),l=i(31712);const a=new r.TranslatedString("erase level line",s.t(null,void 0,i(812962)));class c extends o.LineDataSource{constructor(e,t,s,r){super(e,t||c.createProperties(),s,r),this.version=2,Promise.all([i.e(39232),i.e(33193),i.e(99898),i.e(76792),i.e(77028),i.e(51583)]).then(i.bind(i,832307)).then((e=>{this._setPaneViews([new e.FibRetracementPaneView(this,this._model)])}))}levelsCount(){return 24}pointsCount(){return 2}name(){return"Fib Retracement"}migrateVersion(e){1===e&&this.properties().childs().extendLines.setValue(!0)}processErase(e,t){const i="level"+t,{visible:s}=this.properties().childs()[i].childs();e.setProperty(s,!1,a)}fibLevelsBasedOnLogScale(){var e;return this.properties().childs().fibLevelsBasedOnLogScale.value()&&!!(null===(e=this.priceScale())||void 0===e?void 0:e.isLog())}static createProperties(e){const t=new n.LevelsProperty({defaultName:"linetoolfibretracement",state:e,map:{range:[1,24],names:["coeff","color","visible"]}});return this._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(96461),i.e(24770),i.e(30154),i.e(82375),i.e(18537)]).then(i.bind(i,866406))).FibDrawingsWith24LevelsDefinitionsViewModel}static _configureProperties(e){var t;const i=e;super._configureProperties(i);const s=[i.childs().trendline.childs().linewidth,i.childs().levelsStyle.childs().linewidth],r=[i.childs().trendline.childs().color];for(let e=1;e<=24;e++){const s=null===(t=i.child("level"+e))||void 0===t?void 0:t.child("color");r.push(s)}i.addChild("linesColors",new l.LineToolColorsProperty(r)),i.addChild("linesWidths",new l.LineToolWidthsProperty(s))}}},974472:(e,t,i)=>{i.d(t,{LineToolFibSpeedResistanceArcs:()=>u});var s=i(650151),r=i(444372),n=i(809796),o=i(821979),l=i(517336),a=i(31712);const c=new n.TranslatedString("erase level line",r.t(null,void 0,i(812962)));class u extends o.LineDataSource{constructor(e,t,s,r){super(e,null!=t?t:u.createProperties(),s,r),Promise.all([i.e(39232),i.e(33193),i.e(99898),i.e(76792),i.e(77028),i.e(51583)]).then(i.bind(i,303842)).then((e=>{ this._setPaneViews([new e.FibSpeedResistanceArcsPaneView(this,this._model)])}))}levelsCount(){return 11}pointsCount(){return 2}name(){return"Fib Speed Resistance Arcs"}processErase(e,t){const i=(0,s.ensureDefined)(this.properties().child(`level${t}`)).childs().visible;e.setProperty(i,!1,c)}static createProperties(e){const t=new l.LevelsProperty({defaultName:"linetoolfibspeedresistancearcs",state:e,map:{range:[1,11]}});return this._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(96461),i.e(24770),i.e(30154),i.e(82375),i.e(18537)]).then(i.bind(i,149820))).FibSpeedResistanceArcsDefinitionsViewModel}static _configureProperties(e){super._configureProperties(e);const t=e.childs().trendline.childs(),i=[t.linewidth],r=[t.color];for(let t=1;t<=11;t++){const n=(0,s.ensureDefined)(e.child(`level${t}`)).childs();i.push(n.linewidth),r.push(n.color)}e.addChild("linesColors",new a.LineToolColorsProperty(r)),e.addChild("linesWidths",new a.LineToolWidthsProperty(i))}}},63491:(e,t,i)=>{i.d(t,{LineToolFibSpeedResistanceFan:()=>u});var s=i(650151),r=i(444372),n=i(809796),o=i(821979),l=i(517336),a=i(31712);const c=new n.TranslatedString("erase level line",r.t(null,void 0,i(812962)));class u extends o.LineDataSource{constructor(e,t,s,r){super(e,null!=t?t:u.createProperties(),s,r),Promise.all([i.e(39232),i.e(33193),i.e(99898),i.e(76792),i.e(77028),i.e(51583)]).then(i.bind(i,446261)).then((e=>{this._setPaneViews([new e.FibSpeedResistanceFanPaneView(this,this._model)])}))}hLevelsCount(){return 7}vLevelsCount(){return 7}pointsCount(){return 2}name(){return"Fib Speed Resistance Fan"}processErase(e,t){const i=`${t.type}level${t.index}`,r=(0,s.ensureDefined)(this.properties().child(i)).childs().visible;e.setProperty(r,!1,c)}static createProperties(e){e&&void 0===e.reverse&&(e.reverse=!0);const t=new l.LevelsProperty({defaultName:"linetoolfibspeedresistancefan",state:e,map:{range:[1,7],prefixes:["h","v"],names:["coeff","color","visible"]}});return this._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(96461),i.e(24770),i.e(30154),i.e(82375),i.e(18537)]).then(i.bind(i,233169))).FibSpeedResistanceFanDefinitionsViewModel}_snapTo45DegreesAvailable(){return!0}static _configureProperties(e){var t,i;super._configureProperties(e);const r=[e.childs().grid.childs().color];for(let i=1;i<=7;i++)r.push((0,s.ensureDefined)(null===(t=e.child(`hlevel${i}`))||void 0===t?void 0:t.child("color")));for(let t=1;t<=7;t++)r.push((0,s.ensureDefined)(null===(i=e.child(`vlevel${t}`))||void 0===i?void 0:i.child("color")));e.addChild("linesColors",new a.LineToolColorsProperty(r)),e.addExcludedKey("linesColors",3)}}},958849:(e,t,i)=>{i.d(t,{LineToolFibTimeZone:()=>c});var s=i(444372),r=i(809796),n=i(31712),o=i(517336),l=i(821979);const a=new r.TranslatedString("erase level line",s.t(null,void 0,i(812962)));class c extends l.LineDataSource{constructor(e,t,s,r){super(e,t||c.createProperties(),s,r),this.version=2, Promise.all([i.e(39232),i.e(33193),i.e(99898),i.e(76792),i.e(77028),i.e(51583)]).then(i.bind(i,122613)).then((({FibTimeZonePaneView:e})=>{this._setPaneViews([new e(this,this._model)])}))}levelsCount(){return 11}migrateVersion(e,t,i){if(1===e){const e=i.properties.childs(),t=i.properties,s=t.baselinecolor.value(),r=t.linecolor.value(),n=t.linewidth.value(),o=t.linestyle.value();e.level1.childs().color.setValue(s);for(let t=2;t<=11;t++)e["level"+t].childs().color.setValue(r);for(let t=1;t<=11;t++)e["level"+t].childs().linewidth.setValue(n),e["level"+t].childs().linestyle.setValue(o)}}pointsCount(){return 2}name(){return"Fib Time Zone"}processErase(e,t){const i="level"+t,s=this.properties().childs()[i].childs().visible;e.setProperty(s,!1,a)}static createProperties(e){const t=new o.LevelsProperty({defaultName:"linetoolfibtimezone",state:e,map:{range:[1,11]}});return this._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(96461),i.e(24770),i.e(30154),i.e(82375),i.e(18537)]).then(i.bind(i,542375))).FibTimezoneDefinitionsViewModel}static _configureProperties(e){super._configureProperties(e);const t=[],i=[];for(let s=1;s<=11;s++){const r=e.childs()["level"+s].childs();t.push(r.linewidth),i.push(r.color)}e.addChild("linesColors",new n.LineToolColorsProperty(i)),e.addChild("linesWidths",new n.LineToolWidthsProperty(t))}}},672688:(e,t,i)=>{i.d(t,{LineToolFibWedgeBase:()=>o});var s=i(650151),r=i(86441),n=i(821979);class o extends n.LineDataSource{pointsCount(){return 3}hasEditableCoordinates(){return!1}setPoint(e,t){if(super.setPoint(e,t),!this._recursiveGuard)try{if(this._recursiveGuard=!0,2===e){const e=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[0]));let t=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[1]));const i=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[2])).subtract(e).length();let n=t.subtract(e);n.length()<=0&&(n=new r.Point(1,0)),t=e.add(n.normalized().scaled(i));const o=(0,s.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,s.ensureNotNull)(this.pointToScreenPoint(this._points[0])),t=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[1]));let i=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[2]));const n=t.subtract(e).length();let o=i.subtract(e);o.length()<=0&&(o=new r.Point(1,0)),i=e.add(o.normalized().scaled(n));const l=(0,s.ensureNotNull)(this.screenPointToPoint(i)),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,s.ensureNotNull)(this.pointToScreenPoint(this._points[0])),i=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[1]));let r=(0,s.ensureNotNull)(this.pointToScreenPoint(e));const n=i.subtract(t).length(),o=r.subtract(t).normalized();r=t.add(o.scaled(n));const l=(0,s.ensureNotNull)(this.ownerSource()),a=(0, s.ensureNotNull)(l.firstValue()),c=(0,s.ensureNotNull)(this.priceScale()).coordinateToPrice(r.y,a);e={index:Math.round(this._model.timeScale().coordinateToIndex(r.x)),price:c}}return super.addPoint(e)}}},781811:(e,t,i)=>{i.d(t,{LineToolFibWedge:()=>u});var s=i(650151),r=i(444372),n=i(809796),o=i(672688),l=i(517336),a=i(31712);const c=new n.TranslatedString("erase level line",r.t(null,void 0,i(812962)));class u extends o.LineToolFibWedgeBase{constructor(e,t,s,r){super(e,null!=t?t:u.createProperties(),s,r),Promise.all([i.e(39232),i.e(33193),i.e(99898),i.e(76792),i.e(77028),i.e(51583)]).then(i.bind(i,257760)).then((e=>{this._setPaneViews([new e.FibWedgePaneView(this,this._model)])}))}levelsCount(){return 11}isSynchronizable(){return!1}name(){return"Fib Wedge"}processErase(e,t){const i=(0,s.ensureDefined)(this.properties().child(`level${t}`));e.setProperty(i.childs().visible,!1,c)}static createProperties(e){const t=new l.LevelsProperty({defaultName:"linetoolfibwedge",state:e,map:{range:[1,11]}});return this._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(96461),i.e(24770),i.e(30154),i.e(82375),i.e(18537)]).then(i.bind(i,444191))).FibWedgeDefinitionsViewModel}static _configureProperties(e){super._configureProperties(e);const t=[e.childs().trendline.childs().linewidth],i=[e.childs().trendline.childs().color];for(let r=1;r<=11;r++){const n=(0,s.ensureDefined)(e.child(`level${r}`));t.push(n.childs().linewidth),i.push(n.childs().color)}e.addChild("linesColors",new a.LineToolColorsProperty(i)),e.addChild("linesWidths",new a.LineToolWidthsProperty(t))}}},218032:(e,t,i)=>{i.d(t,{LineToolFlagMark:()=>l});var s=i(86441),r=i(821979),n=i(853965),o=i(31712);class l extends r.LineDataSource{constructor(e,t,r,n){super(e,t||l.createProperties(),r,n),Promise.all([i.e(39232),i.e(33193),i.e(99898),i.e(76792),i.e(77028),i.e(51583)]).then(i.bind(i,812318)).then((({FlagMarkPaneView:e})=>{const t=new e(this,this.model());t.setAnchors(new s.Point(0,0)),this._setPaneViews([t])}))}pointsCount(){return 1}name(){return"Flag Mark"}static createProperties(e){e&&void 0===e.flagColor&&(e.flagColor="#318757");const t=new n.DefaultProperty({defaultName:"linetoolflagmark",state:e});return this._configureProperties(t),t}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(96461),i.e(24770),i.e(30154),i.e(82375),i.e(18537)]).then(i.bind(i,268987)).then((e=>e.FlagMarkDefinitionsViewModel))}static _configureProperties(e){super._configureProperties(e),e.addChild("backgroundsColors",new o.LineToolColorsProperty([e.childs().flagColor])),e.addExcludedKey("backgroundsColors",3)}}l.version=2},634659:(e,t,i)=>{i.d(t,{LineToolFlatBottom:()=>l});var s=i(821979),r=i(853965),n=i(389137),o=i(354950);class l extends s.LineDataSource{constructor(e,t,s,r){super(e,null!=t?t:l.createProperties(),s,r),this.version=1,Promise.all([i.e(39232),i.e(33193),i.e(99898),i.e(76792),i.e(77028),i.e(51583)]).then(i.bind(i,767345)).then((e=>{this._setPaneViews([new e.FlatBottomPaneView(this,this._model)])}))}pointsCount(){ return 3}name(){return"Flat Bottom"}hasEditableCoordinates(){return!1}addPoint(e,t,i){return t&&t.shift()&&2===this.points().length&&this._snapPoint45Degree(e,this.points()[this.points().length-2]),super.addPoint(e)}setLastPoint(e,t){return t&&t.shift()&&2===this.points().length&&this._snapPoint45Degree(e,this.points()[this.points().length-2]),super.setLastPoint(e)}setPoint(e,t,i,s){if(i&&i.shift()&&1===e){const e=0;this._snapPoint45Degree(t,this.points()[e])}if(2===e)this._points[1].index=t.index;else if(3===e)return this._points[0].index=t.index,this._points[2].price=t.price,void this._normalizePoints();super.setPoint(e,t)}getPoint(e){return e<3?super.getPoint(e):3===e?{index:this._points[0].index,price:this._points[2].price}:null}canHasAlert(){return!0}template(){const e=super.template();return e.labelText=this.properties().childs().labelText.value(),e}static createProperties(e){const t=new r.DefaultProperty({defaultName:"linetoolflatbottom",state:e});return this._configureProperties(t),t}_applyTemplateImpl(e){var t;super._applyTemplateImpl(e),this.properties().childs().labelText.setValue(null!==(t=e.labelText)&&void 0!==t?t:"")}_getAlertPlots(){const e=this._points[0],t=this._points[1],i=[];e.index<=t.index?(i.push(e),i.push(t)):(i.push(t),i.push(e));const s=this._points[2];s.time=t.time,s.index=t.index;const r={price:s.price,time:e.time,index:e.index},o=[];let l,a,c,u;s.index<=r.index?(o.push(s),o.push(r)):(o.push(r),o.push(s)),i[0].price>o[0].price?(l=i,a=o):o[0].price>i[0].price||o[1].price>i[1].price?(l=o,a=i):(l=i,a=o);const h=this.properties().childs().extendLeft.value(),d=this.properties().childs().extendRight.value();return e.index<=t.index?(c=h,u=d):(c=d,u=h),[this._linePointsToAlertPlot(l,"Upper",c,u),this._linePointsToAlertPlot(a,"Lower",h,u)].filter(n.notNull)}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(96461),i.e(24770),i.e(30154),i.e(82375),i.e(18537)]).then(i.bind(i,872077))).GeneralTrendFiguresDefinitionsViewModel}static _configureProperties(e){super._configureProperties(e),e.hasChild("labelText")||e.addChild("labelText",new o.Property("")),e.addExcludedKey("labelText",1)}}},406182:(e,t,i)=>{i.d(t,{createPropertiesObject:()=>l});var s=i(389137),r=i(517336);function n(e,t,i){var r;for(const n of Object.keys(null!==(r=e.levels)&&void 0!==r?r:{}))if(e.levels[n]&&(0,s.isSameType)(e.levels[n],t.typecheck())){let s=t.tpl();i.names.forEach(((i,r)=>{s=t.fill(""+r,i,e.levels[n],s)})),e.levels[n]=s}return e}class o extends r.LevelsProperty{constructor(e,t){super({defaultName:e,state:t,map:{names:["width","color","visible"]},levelsIterator:n})}}function l(e,t){return new o(e,t)}},833762:(e,t,i)=>{i.d(t,{LineToolGannComplex:()=>h});var s=i(86441),r=i(650151),n=i(327453),o=i(821979),l=i(915179),a=i(406182),c=i(31712),u=i(422333);class h extends o.LineDataSource{constructor(e,t,s,r){super(e,t||h.createProperties(),s,r),this.version=2,this._scaleRatioFormatter=new n.LimitedPrecisionNumericFormatter(7),this.version=2, Promise.all([i.e(39232),i.e(33193),i.e(99898),i.e(76792),i.e(77028),i.e(51583)]).then(i.bind(i,726868)).then((({GannComplexPaneView:e})=>{this._setPaneViews([new e(this,this.model())])}));const o=this.properties();this._adjustScaleRatio(o),o.subscribe(this,this._adjustScaleRatio),o.childs().scaleRatio.subscribe(this,this._correctFirstPoint),this._syncStateExclusions=["scaleRatio"],o.onRestoreFactoryDefaults().subscribe(this,this._handleRestoringFactoryDefaults),this._onTemplateApplying.subscribe(this,this._handleTemplateApplying),this._onTemplateApplied.subscribe(this,this._correctFirstPoint)}migrateVersion(e,t,i){1===e&&(this._points.length>=this.pointsCount()?setTimeout((()=>this._migratePoint())):this._timePoint.length>=this.pointsCount()&&this._pointAdded.subscribe(this,this._migratePoint))}destroy(){const e=this.properties();e.unsubscribe(this,this._adjustScaleRatio),e.childs().scaleRatio.unsubscribe(this,this._correctFirstPoint),e.onRestoreFactoryDefaults().unsubscribe(this,this._handleRestoringFactoryDefaults),this._onTemplateApplying.unsubscribe(this,this._handleTemplateApplying),this._onTemplateApplied.unsubscribe(this,this._correctFirstPoint),super.destroy()}pointsCount(){return 2}name(){return"Gann Square"}addPoint(e,t,i){this._points.length>1&&this._points.pop();const s=super.addPoint(e,t,i),n=this.priceScale();return!(0,r.ensureNotNull)(n).isLog()&&s&&this._correctFirstPoint(),s}setPoint(e,t,i){super.setPoint(e,t,i),void 0!==i&&i.shift()?this._correctPoint(e):this._correctScaleRatio()}setLastPoint(e,t){const i=this.priceScale();return(0,r.ensureNotNull)(i).isLog()||(this._points[1]=e,this._correctPoint(1)),super.setLastPoint(e,t)}isReversed(){return this.properties().childs().reverse.value()}levelsCount(){return this.properties().childs().levels.childCount()}levels(){const e=[],t=this.properties().childs(),i=t.levels.childCount();for(let s=0;s<i;s++){const i=t.levels.childs()[s].childs();e.push({index:s,visible:i.visible.value(),color:i.color.value(),width:i.width.value()})}return e}fanLinesCount(){return this.properties().childs().fanlines.childCount()}fanLines(){const e=[],t=this.properties().childs(),i=t.fanlines.childCount();for(let s=0;s<i;s++){const i=t.fanlines.childs()[s].childs();e.push({index:s,visible:i.visible.value(),x:i.x.value(),y:i.y.value(),color:i.color.value(),width:i.width.value()})}return e}arcsCount(){return this.properties().childs().arcs.childCount()}arcs(){const e=[],t=this.properties().childs(),i=t.arcs.childCount();for(let s=0;s<i;s++){const i=t.arcs.childs()[s].childs();e.push({index:s,visible:i.visible.value(),x:i.x.value(),y:i.y.value(),color:i.color.value(),width:i.width.value()})}return e}arcsBackgroundTransparency(){return this.properties().childs().arcsBackground.childs().transparency.value()}isArcsBackgroundFilled(){return this.properties().childs().arcsBackground.childs().fillBackground.value()}isLabelsVisible(){return this.properties().childs().showLabels.value()}getLabelsStyle(){ const e=this.properties().childs(),{fontSize:t,bold:i,italic:s}=e.labelsStyle.childs(),r=e.levels.childCount();return{textColor:e.levels.childs()[r-1].childs().color.value(),font:u.CHART_FONT_FAMILY,fontSize:t.value(),bold:i.value(),italic:s.value()}}getScaleRatioStep(){return 1e-7}getScaleRatioFormatter(){return this._scaleRatioFormatter}getPriceDiff(){const e=this.points();if(e.length<2)return null;const[t,i]=e;return i.price-t.price}getIndexDiff(){const e=this.points();if(e.length<2)return null;const[t,i]=e;return i.index-t.index}getScaleRatio(){const e=this.getPriceDiff(),t=this.getIndexDiff();return null!==e&&null!==t&&0!==t?Math.abs(e/t):null}static createProperties(e){const t=(0,a.createPropertiesObject)("linetoolganncomplex",e);return this._configureProperties(t),t}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(96461),i.e(24770),i.e(30154),i.e(82375),i.e(18537)]).then(i.bind(i,108927)).then((e=>e.GannComplexAndFixedDefinitionsViewModel))}static _configureProperties(e){super._configureProperties(e),e.addExcludedKey("scaleRatio",1);const t=[],i=[],s=e.childs();{const e=s.levels.childCount();for(let r=0;r<e;r++){const e=s.levels.childs()[r].childs();t.push(e.width),i.push(e.color)}}{const e=s.fanlines.childCount();for(let r=0;r<e;r++){const e=s.fanlines.childs()[r].childs();t.push(e.width),i.push(e.color)}}{const e=s.arcs.childCount();for(let r=0;r<e;r++){const e=s.arcs.childs()[r].childs();t.push(e.width),i.push(e.color)}}e.addChild("linesColors",new c.LineToolColorsProperty(i)),e.addChild("linesWidths",new c.LineToolWidthsProperty(t))}_correctScaleRatio(){const e=this.properties().childs(),t=this.getScaleRatio();e.scaleRatio.setValue(t)}_getAdjustedScaleRatio(){const e=this.model().mainSeries().priceScale(),t=this.model().timeScale();return(0,l.scaleRatio)(t,e)}_adjustScaleRatio(e){const t=e.scaleRatio.value();""!==t&&null!==t||e.scaleRatio.setValue(this._getAdjustedScaleRatio())}_correctPoint(e){if(this._points.length<2)return;const t=this.getIndexDiff();if(null===t)return;const i=this.properties().childs().scaleRatio.value();if(null!==i){const s=this._points[e],r=0===e?this._points[1]:this._points[0],n=s.price-r.price>0,o=s.index-r.index>0;let l=n&&!o||!n&&o?-1:1;0===e&&(l=-l),s.price=r.price+l*t*i,this._pointChanged.fire(e)}this._normalizePoints()}_correctFirstPoint(){this._correctPoint(this.isReversed()?0:1)}_handleRestoringFactoryDefaults(){this.properties().childs().scaleRatio.setValue(this._getAdjustedScaleRatio())}_handleTemplateApplying(e){""===e.scaleRatio&&(e.scaleRatio=this._getAdjustedScaleRatio())}_migratePoint(){if(this.points().length<this.pointsCount())return;const e=this._getScreenPoints();if(null===e)return;const t=(0,r.ensureNotNull)(this.screenPointToPoint(e[1]));this.setPoint(1,t),this._pointAdded.unsubscribe(this,this._migratePoint)}_getScreenPoints(){const e=this._calcAngle();if(null===e)return null;let[t,i]=this.points();this.isReversed()&&([t,i]=[i,t]);const n=(0,r.ensureNotNull)(this.pointToScreenPoint(t)),o=(0, r.ensureNotNull)(this.pointToScreenPoint(i)),l=Math.sqrt(Math.pow(n.x-o.x,2)+Math.pow(n.y-o.y,2)),a=new s.Point(Math.cos(e),-Math.sin(e)),c=a.normalized(),u=c.x<0?-1:1,h=c.y<0?-1:1;return[n.addScaled(a,l),n.add(new s.Point(5*l*u,5*l*h))]}_calcAngle(){const[e,t]=this.points(),i=(0,r.ensureNotNull)(this.pointToScreenPoint(e));let s=(0,r.ensureNotNull)(this.pointToScreenPoint(t)).subtract(i);if(s.length()>0){s=s.normalized();let e=Math.acos(s.x);return s.y>0&&(e=-e),e}return null}}},643442:(e,t,i)=>{var s=i(809796).TranslatedString,r=i(821979).LineDataSource,n=i(517336).LevelsProperty,o=i(31712),l=o.LineToolWidthsProperty,a=o.LineToolColorsProperty,c=new s("erase level line",i.tf(null,void 0,i(812962)));class u extends r{constructor(e,t,s,r){super(e,t||u.createProperties(),s,r),Promise.all([i.e(39232),i.e(33193),i.e(99898),i.e(76792),i.e(77028),i.e(51583)]).then(i.bind(i,33877)).then((({GannFanPaneView:e})=>{this._setPaneViews([new e(this,this._model)])}))}levelsCount(){return u.LevelsCount}pointsCount(){return 2}name(){return"Gann Fan"}processErase(e,t){var i="level"+t,s=this.properties()[i].visible;e.setProperty(s,!1,c)}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(96461),i.e(24770),i.e(30154),i.e(82375),i.e(18537)]).then(i.bind(i,903951))).GannFanDefinitionsViewModel}static createProperties(e){var t=new n({defaultName:"linetoolgannfan",state:e,map:{range:[1,9]}});return this._configureProperties(t),t}static _configureProperties(e){super._configureProperties(e);for(var t=[],i=[],s=1;s<=this.LevelsCount;s++)t.push(e.child("level"+s).child("linewidth")),i.push(e.child("level"+s).child("color"));e.addChild("linesColors",new a(i)),e.addChild("linesWidths",new l(t))}}u.LevelsCount=9,t.LineToolGannFan=u},839386:(e,t,i)=>{i.d(t,{LineToolGannFixed:()=>a});var s=i(86441),r=i(650151),n=i(821979),o=i(31712),l=i(406182);class a extends n.LineDataSource{constructor(e,t,s,r){super(e,t||a.createProperties(),s,r),this._constructor="LineToolGannFixed",Promise.all([i.e(39232),i.e(33193),i.e(99898),i.e(76792),i.e(77028),i.e(51583)]).then(i.bind(i,14986)).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,r.ensureNotNull)(this.screenPointToPoint(t[1]))]}getScreenPoints(){const e=this.points();if(e.length<2)return[];const t=this._calcAngle();if(null===t)return[];const[i,n]=e,o=(0,r.ensureNotNull)(this.pointToScreenPoint(i)),l=(0,r.ensureNotNull)(this.pointToScreenPoint(n)),a=Math.sqrt(Math.pow(o.x-l.x,2)+Math.pow(o.y-l.y,2)),c=new s.Point(Math.cos(t),-Math.sin(t)),u=c.normalized(),h=u.x<0?-1:1,d=u.y<0?-1:1;return[o.addScaled(c,a),o.add(new s.Point(5*a*h,5*a*d))]}levelsCount(){return this.properties().childs().levels.childCount()}levels(){const e=[],t=this.properties().childs(),i=t.levels.childCount();for(let s=0;s<i;s++){ const i=t.levels.childs()[s].childs();e.push({index:s,visible:i.visible.value(),color:i.color.value(),width:i.width.value()})}return e}fanLinesCount(){return this.properties().childs().fanlines.childCount()}fanLines(){const e=[],t=this.properties().childs(),i=t.fanlines.childCount();for(let s=0;s<i;s++){const i=t.fanlines.childs()[s].childs();e.push({index:s,visible:i.visible.value(),x:i.x.value(),y:i.y.value(),color:i.color.value(),width:i.width.value()})}return e}arcsCount(){return this.properties().childs().arcs.childCount()}arcs(){const e=[],t=this.properties().childs(),i=t.arcs.childCount();for(let s=0;s<i;s++){const i=t.arcs.childs()[s].childs();e.push({index:s,visible:i.visible.value(),x:i.x.value(),y:i.y.value(),color:i.color.value(),width:i.width.value()})}return e}arcsBackgroundTransparency(){return this.properties().childs().arcsBackground.childs().transparency.value()}isArcsBackgroundFilled(){return this.properties().childs().arcsBackground.childs().fillBackground.value()}static createProperties(e){const t=(0,l.createPropertiesObject)("linetoolgannfixed",e);return this._configureProperties(t),t}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(96461),i.e(24770),i.e(30154),i.e(82375),i.e(18537)]).then(i.bind(i,108927)).then((e=>e.GannComplexAndFixedDefinitionsViewModel))}static _configureProperties(e){super._configureProperties(e);const t=[],i=[],s=e.childs();{const e=s.levels.childCount();for(let r=0;r<e;r++){const e=s.levels.childs()[r].childs();t.push(e.width),i.push(e.color)}}{const e=s.fanlines.childCount();for(let r=0;r<e;r++){const e=s.fanlines.childs()[r].childs();t.push(e.width),i.push(e.color)}}{const e=s.arcs.childCount();for(let r=0;r<e;r++){const e=s.arcs.childs()[r].childs();t.push(e.width),i.push(e.color)}}e.addChild("linesColors",new o.LineToolColorsProperty(i)),e.addChild("linesWidths",new o.LineToolWidthsProperty(t))}_calcAngle(){const e=this.points();if(e.length<2)return null;const[t,i]=e,s=this.pointToScreenPoint(t),r=this.pointToScreenPoint(i);if(null===s||null===r)return null;let n=r.subtract(s);if(n.length()<=0)return null;n=n.normalized();let o=Math.acos(n.x);return n.y>0&&(o=-o),o}_reversePoints(){const[e,t]=this._points;this._points[0]=t,this._points[1]=e,this._normalizePoints(),this.restart()}}},168853:(e,t,i)=>{var s=i(821979).LineDataSource,r=i(517336).LevelsProperty,n=i(31712).LineToolColorsProperty,o=[4.5,9,11.25,18,22.5,36,45],l=function(){for(var e=[],t=o.length-1,i=1,s=0,r=0;r<1e10;)r=o[s]*i,e.push(Math.round(r)),e.push(Math.ceil(-r)),s===t-1&&(i*=10),s=(s+1)%t;return e.sort((function(e,t){return e<t?-1:e>t?1:0})),e}();class a extends s{constructor(e,t,s,r){super(e,t||a.createProperties(),s,r),Promise.all([i.e(39232),i.e(33193),i.e(99898),i.e(76792),i.e(77028),i.e(51583)]).then(i.t.bind(i,257794,19)).then((({GannSquarePaneView:e})=>{this._setPaneViews([new e(this,this._model)])}))}hLevelsCount(){return a.HLevelsCount}vLevelsCount(){return a.VLevelsCount}pointsCount(){return 2}name(){return"Gann Box"}_alignPriceOnPattern(e,t){ var i=Math.round(1e6*(e.price-t.price))/1e6;if(0===i)return t.price;for(var s=o[0],r=o[o.length-1],n=1,l=Math.abs(i);l<s*n||r*n<l;)l<s*n?n*=.1:r*n<l&&(n*=10);for(var a=r*n,c=o.length-2;c>=0&&!(o[c]*n<l);--c)a=o[c]*n;return e.price=t.price+(i>=0?a:-a),e}_alignTimeOnPattern(e,t){var i=e.index-t.index;if(0===i)return 0;for(var s=l.length-2;s>=0&&!(l[s]<i);--s);return s+=i>0?1:0,e.index=t.index+l[s],e}_alignPointsFixedIncrement(e,t){return this._alignTimeOnPattern(e,t),this._alignPriceOnPattern(e,t),e}_preparePoint(e,t){return t&&t.shift()&&0!==this._points.length&&this._alignPointsFixedIncrement(e,this._points[0]),super._preparePoint(e,t)}getPoint(e){if(e<2)return super.getPoint(e);var t=null;switch(e){case 2:case 3:var i=this.points();if(i.length===this.pointsCount()){var s=i[0].index,r=i[1].price;3===e&&(s=i[1].index,r=i[0].price),t={index:s,price:r}}}return t}setPoint(e,t,i){if(i&&i.shift()){var s=e%2==0?this._points[1]:this._points[0];this._alignPointsFixedIncrement(t,s)}switch(e){case 2:this._points[0].index=t.index,this._points[1].price=t.price;break;case 3:this._points[1].index=t.index,this._points[0].price=t.price;break;default:super.setPoint(e,t,i)}}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(96461),i.e(24770),i.e(30154),i.e(82375),i.e(18537)]).then(i.bind(i,114388))).GannSquareDefinitionsViewModel}static createProperties(e){var t=new r({defaultName:"linetoolgannsquare",state:e,map:{range:[1,7],prefixes:["h","v"],names:["coeff","color","visible"]}});return this._configureProperties(t),t}static _configureProperties(e){super._configureProperties(e);for(var t=[e.child("color"),e.child("fans").child("color")],i=1;i<=this.HLevelsCount;i++)t.push(e.child("hlevel"+i).child("color"));for(i=1;i<=this.VLevelsCount;i++)t.push(e.child("vlevel"+i).child("color"));e.addChild("linesColors",new n(t)),e.addExcludedKey("linesColors",3)}}a.HLevelsCount=7,a.VLevelsCount=7,t.LineToolGannSquare=a},711755:(e,t,i)=>{i.d(t,{LineToolGhostFeed:()=>c});var s=i(853965),r=i(821979),n=i(650151),o=i(389137);class l{constructor(e,t,i){this._source=e,this._segmentIndex=t,this._bars=null!=i?i:[]}setBars(e){this._bars=e}clone(e){return new l(e,this._segmentIndex,(0,o.clone)(this._bars))}generate(){this._bars=[];const e=this._source.points(),t=e[this._segmentIndex],i=e[this._segmentIndex+1];if(!t||!i||t.index===i.index)return;const s=this._segmentIndex?t.index+1:t.index,r=Math.sign(i.index-t.index);for(let e=s;e!==i.index;e+=r)this._bars.push(this._createBar())}bars(){return this._bars}setSize(e){if(e<this._bars.length)this._bars.splice(e,this._bars.length-e);else for(;this._bars.length<e;)this._bars.push(this._createBar())}_createBar(){const e=this._source.properties().averageHL.value(),t=this._source.properties().variance.value()/100,i=(0,n.ensureNotNull)(this._source.ownerSource()).base();let s=Math.random();const r=e*(1-2*s)*t;s=Math.random();const o=e*(1+(.5-s)*t),l=r-o/2,a=l+o;return{o:(l+Math.random()*o)/i,h:a/i,l:l/i,c:(l+Math.random()*o)/i}}}var a=i(964824);class c extends r.LineDataSource{ constructor(e,t,s,r){const n=t||c.createProperties();if(super(e,n,s,r),this._segments=[],this._finished=!1,this._segmentsPixelsWhileMoving=null,!s){const e=Math.round(this._calculateATR());n.childs().averageHL.setValue(e)}n.childs().averageHL.listeners().subscribe(this,this._regenerate),n.childs().variance.listeners().subscribe(this,this._regenerate),this._currentAverageHL=n.childs().averageHL.value(),this._currentVariance=n.childs().variance.value(),this._currentInterval=e.mainSeries().interval(),this.properties().onRestoreFactoryDefaults().subscribe(this,this._handleRestoringFactoryDefaults),Promise.all([i.e(39232),i.e(33193),i.e(99898),i.e(76792),i.e(77028),i.e(51583)]).then(i.bind(i,626219)).then((t=>{this._setPaneViews([new t.GhostFeedPaneView(this,e)])}))}isSynchronizable(){return!1}destroy(){this.properties().onRestoreFactoryDefaults().unsubscribe(this,this._handleRestoringFactoryDefaults),super.destroy()}propertiesChanged(){super.propertiesChanged(),this._currentAverageHL===this.properties().childs().averageHL.value()&&this._currentVariance===this.properties().childs().variance.value()||this._regenerate()}pointsCount(){return-1}name(){return"Ghost Feed"}segmentBars(e){return this._segments[e].bars()}segments(){return this._segments}generateBars(e){this._segments.length<=e&&this._segments.push(new l(this,e)),this._segments[e].generate()}addPoint(e,t,i){if(this._finished)return!0;if(this._points.length>0){const i=this._points[this._points.length-1];if(!(null==t?void 0:t.isApiEvent())&&i.index===e.index){this._lastPoint=null,this._normalizePoints(),this.createServerPoints();for(let e=0;e<this._points.length;e++)this._createPointProperty(e);return!0}}const s=super.addPoint(e,t,i);return this._points.length>1&&this.generateBars(this._points.length-2),s}finish(){this._finished=!0,this._lastPoint=null,this._normalizePoints(),this.createServerPoints()}setPoint(e,t,i,s){if(super.setPoint(e,t,i),e>0){const i=this.points()[e-1],s=t.index-i.index;this._segments[e-1].setSize(Math.abs(s))}if(e<this.points().length-1){const i=this.points()[e+1].index-t.index;this._segments[e].setSize(Math.abs(i))}}state(e){const t=super.state(e);return t.segments=this._segments.map((e=>({bars:[...e.bars()]}))),t}restoreData(e){e.segments&&(this._segments=e.segments.map(((e,t)=>new l(this,t,e.bars)))),this._currentAverageHL=this.properties().childs().averageHL.value(),this._currentVariance=this.properties().childs().variance.value()}onData(e){super.onData(e);if(!this.pointsProperty().childs().points.child("0"))for(let e=0;e<this._points.length;e++)this._createPointProperty(e);this._currentInterval!==this._model.mainSeries().interval()&&(this._regenerate(),this._currentInterval=this._model.mainSeries().interval())}cloneData(e){this._segments=e._segments.map((e=>e.clone(this)))}startMoving(e,t,i,s){super.startMoving(e,t,i,s),this._preparePixelSegments()}move(e,t,i,s){super.move(e,t,i,s),this._restoreSegmentsFromPixels()}endMoving(e,t){return this._segmentsPixelsWhileMoving=null,super.endMoving(e,t)}static createProperties(e){ const t=new s.DefaultProperty({defaultName:"linetoolghostfeed",state:e});return this._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(96461),i.e(24770),i.e(30154),i.e(82375),i.e(18537)]).then(i.bind(i,743836))).GhostFeedDefinitionsViewModel}_handleRestoringFactoryDefaults(){const e=Math.round(this._calculateATR());this.properties().childs().averageHL.setValue(e)}_regenerate(){this._currentAverageHL=this.properties().childs().averageHL.value(),this._currentVariance=this.properties().childs().variance.value(),this._segments.forEach((e=>e.generate())),this.updateAllViews((0,a.sourceChangeEvent)(this.id())),this._model.updateSource(this)}_calculateATR(){const e=this._model.mainSeries(),t=[];e.bars().each(((e,i)=>{const s=i[2],r=i[3];return null!=s&&null!=r&&t.push(s-r),!1}));let i=0===t.length?0:t.reduce(((e,t)=>e+t),0)/t.length;return i*=e.base(),i}_preparePixelSegments(){var e,t;const i=this.priceScale(),s=null!==(t=null===(e=this.ownerSource())||void 0===e?void 0:e.firstValue())&&void 0!==t?t:null;if(null===i||null===s||i.isEmpty()||!i.isLog())return;const r=this.points();this._segmentsPixelsWhileMoving=this._segments.map(((e,t)=>{const n=r[t].price,o=r[t+1].price,l=i.priceToCoordinate(n,s),a=(i.priceToCoordinate(o,s)-l)/(e.bars().length-1);return{bars:e.bars().map(((e,t)=>{const r=l+t*a,n=i.coordinateToPrice(r,s);return{open:i.priceToCoordinate(n+e.o,s)-r,high:i.priceToCoordinate(n+e.h,s)-r,low:i.priceToCoordinate(n+e.l,s)-r,close:i.priceToCoordinate(n+e.c,s)-r}}))}}))}_restoreSegmentsFromPixels(){var e,t;const i=this.priceScale(),s=null!==(t=null===(e=this.ownerSource())||void 0===e?void 0:e.firstValue())&&void 0!==t?t:null;if(null===i||null===s||null===this._segmentsPixelsWhileMoving)return;const r=this.points();this._segmentsPixelsWhileMoving.forEach(((e,t)=>{const n=this._segments[t],o=r[t].price,l=r[t+1].price,a=i.priceToCoordinate(o,s),c=(i.priceToCoordinate(l,s)-a)/(e.bars.length-1),u=n.bars().map(((t,r)=>{const n=e.bars[r],o=a+r*c,l=i.coordinateToPrice(o,s);return{...t,o:i.coordinateToPrice(n.open+o,s)-l,h:i.coordinateToPrice(n.high+o,s)-l,l:i.coordinateToPrice(n.low+o,s)-l,c:i.coordinateToPrice(n.close+o,s)-l}}));n.setBars(u)}))}}},336471:(e,t,i)=>{i.d(t,{LineToolHeadAndShoulders:()=>o});var s=i(853965),r=i(821979),n=i(31712);class o extends r.LineDataSource{constructor(e,t,s,r){const n=t||o.createProperties();super(e,n,s,r),Promise.all([i.e(39232),i.e(33193),i.e(99898),i.e(76792),i.e(77028),i.e(51583)]).then(i.bind(i,726360)).then((t=>{this._setPaneViews([new t.LineToolHeadAndShouldersPaneView(this,e)])}))}pointsCount(){return 7}name(){return"Head and Shoulders"}static createProperties(e){const t=new s.DefaultProperty({defaultName:"linetoolheadandshoulders",state:e});return this._configureProperties(t),t}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(96461),i.e(24770),i.e(30154),i.e(82375),i.e(18537)]).then(i.bind(i,63124)).then((e=>e.PatternWithBackgroundDefinitionViewModel))}static _configureProperties(e){super._configureProperties(e), e.addChild("linesColors",new n.LineToolColorsProperty([e.childs().color])),e.addChild("textsColors",new n.LineToolColorsProperty([e.childs().textcolor]))}}},680330:(e,t,i)=>{i.d(t,{LineToolHighlighter:()=>n});var s=i(853965),r=i(168504);class n extends r.LineToolBrushBase{constructor(e,t,i,s){super(e,t||n.createProperties(),i,s),this._loadPaneViews(e)}smooth(){return this.properties().childs().smooth.value()}name(){return"Highlighter"}static createProperties(e){const t=new s.DefaultProperty({defaultName:"linetoolhighlighter",state:e});return this._configureProperties(t),t}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(96461),i.e(24770),i.e(30154),i.e(82375),i.e(18537)]).then(i.bind(i,48462)).then((e=>e.HighlighterDefinitionsViewModel))}_loadPaneViews(e){Promise.all([i.e(39232),i.e(33193),i.e(99898),i.e(76792),i.e(77028),i.e(51583)]).then(i.bind(i,898471)).then((t=>{this._setPaneViews([new t.HighlighterPaneView(this,e)])}))}}},682912:(e,t,i)=>{i.d(t,{LineToolHorzLinePriceAxisView:()=>n});var s=i(229765),r=i(246733);class n extends s.PriceAxisView{constructor(e){super(),this._source=e}_updateRendererData(e,t,i){e.visible=!1;const s=this._source.points(),n=this._source.priceScale();if(0===s.length||null===n||n.isEmpty())return;const o=s[0];if(!isFinite(o.price))return;const l=this._source.ownerSource(),a=null!==l?l.firstValue():null;if(null===a)return;const c=(0,r.resetTransparency)(this._source.properties().linecolor.value());i.background=c,i.textColor=this.generateTextColor(c),i.coordinate=n.priceToCoordinate(o.price,a),e.text=n.formatPrice(o.price,a),e.visible=!0}}},994761:(e,t,i)=>{i.d(t,{LineToolHorzLine:()=>l});var s=i(354950),r=i(853965),n=i(821979),o=i(682912);class l extends n.LineDataSource{constructor(e,t,s,r){super(e,t||l.createProperties(),s,r),this._priceAxisView=new o.LineToolHorzLinePriceAxisView(this),Promise.all([i.e(39232),i.e(33193),i.e(99898),i.e(76792),i.e(77028),i.e(51583)]).then(i.bind(i,254896)).then((({HorzLinePaneView:e})=>{this._setPaneViews([new e(this,this._model)])}))}state(e){const t=super.state(e);return t.points&&0!==t.points.length&&(t.points[0].offset=0),t}pointsCount(){return 1}name(){return"Horizontal Line"}priceAxisViews(e,t){return this.isSourceHidden()||t!==this.priceScale()||!this._model.selection().isSelected(this)&&!this.properties().childs().showPrice.value()||e!==this._model.paneForSource(this)?null:[this._priceAxisView]}timeAxisViews(){return null}timeAxisPoints(){return[]}updateAllViews(e){super.updateAllViews(e),this._priceAxisView.update(e)}canHasAlert(){return!0}template(){const e=super.template();return e.text=this.properties().childs().text.value(),e}denormalizeTimePoints(){this._points=[],this._timePoint.length>0&&this._points.push({price:this._timePoint[0].price,index:0})}clearData(){const e=this._points;super.clearData(),this._points=e}static createProperties(e){const t=new r.DefaultProperty({defaultName:"linetoolhorzline",state:e});return this._configureProperties(t),t}_getAlertPlots(){return[this.points()[0].price]}_pointsForPointset(){return[]} _getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(96461),i.e(24770),i.e(30154),i.e(82375),i.e(18537)]).then(i.bind(i,51646)).then((e=>e.HorizontalLineDefinitionsViewModel))}_applyTemplateImpl(e){super._applyTemplateImpl(e),this.properties().childs().text.setValue(e.text||"")}static _configureProperties(e){super._configureProperties(e),e.hasChild("text")||e.addChild("text",new s.Property("")),e.addExcludedKey("text",1)}}},867716:(e,t,i)=>{i.d(t,{LineToolHorzRay:()=>l});var s=i(853965),r=i(354950),n=i(682912),o=i(821979);class l extends o.LineDataSource{constructor(e,t,s,r){super(e,null!=t?t:l.createProperties(),s,r),this._priceAxisView=new n.LineToolHorzLinePriceAxisView(this),Promise.all([i.e(39232),i.e(33193),i.e(99898),i.e(76792),i.e(77028),i.e(51583)]).then(i.bind(i,658622)).then((({HorzRayPaneView:e})=>{this._setPaneViews([new e(this,this._model)])}))}pointsCount(){return 1}name(){return"Horizontal Ray"}priceAxisViews(e,t){return this.isSourceHidden()||t!==this.priceScale()||!this._model.selection().isSelected(this)&&!this.properties().childs().showPrice.value()||e!==this._model.paneForSource(this)?null:[this._priceAxisView]}updateAllViews(e){super.updateAllViews(e),this._priceAxisView.update(e)}template(){const e=super.template();return e.text=this.properties().childs().text.value(),e}canHasAlert(){return!0}static createProperties(e){const t=new s.DefaultProperty({defaultName:"linetoolhorzray",state:e});return this._configureProperties(t),t}_getAlertPlots(){const e=this._points[0],t={index:e.index+1,price:e.price},i=this._linePointsToAlertPlot([e,t],null,!1,!0);return null!==i?[i]:[]}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(96461),i.e(24770),i.e(30154),i.e(82375),i.e(18537)]).then(i.bind(i,852440))).HorizontalRayDefinitionsViewModel}_applyTemplateImpl(e){super._applyTemplateImpl(e),this.properties().childs().text.setValue(e.text||"")}static _configureProperties(e){super._configureProperties(e),e.hasChild("text")||e.addChild("text",new r.Property("")),e.addExcludedKey("text",1)}}},618117:(e,t,i)=>{i.d(t,{LineToolIcon:()=>x});var s=i(885482),r=i(500477),n=i(760184),o=i(201089),l=i(822914),a=i(852290),c=i(790188),u=i(33249),h=i(808068),d=i(853965),p=i(923237),_=i(31712);const f=(0,c.getHexColorByName)("color-tv-blue-500"),m={intervalsVisibilities:{...h.intervalsVisibilitiesDefaults},color:f,size:40},v={icon:61720,angle:.5*Math.PI},g=(0,d.extractAllPropertiesKeys)(m),P=(0,d.extractAllPropertiesKeys)(v),y=[...g,...P,...p.commonLineToolPropertiesStateKeys];class S extends u.LineDataSourceProperty{constructor(e){super(e),this.addChild("backgroundsColors",new _.LineToolColorsProperty([this.childs().color]))}static create(e,t){return new this({defaultName:"linetoolicon",factoryDefaultsSupplier:()=>(0,l.default)(m),nonThemedDefaultsKeys:g,themedDefaultsKeys:[],state:(0,a.default)({},v,{icon:t},null!=e?e:{}),allStateKeys:y})}}const b=(0,o.getLogger)("Chart.LineToolIcon");class x extends n.LineToolSvgIconBase{constructor(e,t,i,s){super(e,t||x.createProperties(),i,s), this.version=1,this._loadViews()}name(){return"Icon"}template(){return this._properties.template()}static createProperties(e){const t=S.create(e,s.iconTool.value());return this._configureProperties(t),t}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(96461),i.e(24770),i.e(30154),i.e(82375),i.e(18537)]).then(i.bind(i,681791)).then((e=>e.IconsDefinitionsViewModel))}async _loadViews(){const[{getSvgContentForCharCode:e,getSvgRenderer:t},{IconPaneView:s}]=await Promise.all([i.e(27987).then(i.bind(i,728996)),Promise.all([i.e(39232),i.e(33193),i.e(99898),i.e(76792),i.e(77028),i.e(51583)]).then(i.bind(i,23728))]);if(!this._isDestroyed){const i=this._properties.childs().icon.value();this._svgContent=e(i),this._onIconChanged.fire();const n=t(r.svgRenderer,i);null===n&&b.logWarn(`Couldn't create svg renderer for icon ${i}`),this._setPaneViews([new s(this,this._model,n)])}}}},953639:(e,t,i)=>{i.d(t,{createIdeaLineToolByUrl:()=>p,isIdeaAuthorProfileImageUrl:()=>h,isIdeaUrl:()=>u});var s=i(650151),r=i(62802),n=i(66974),o=i(541558),l=i(461794),a=i(900569);const c=/^\/chart\/.+?\/([0-9a-zA-Z]{8})(-[-\w]+)?\/?$/;function u(e){try{const t=new URL(e);return((e=>"https:"===e.protocol&&e.hostname.endsWith(".tradingview.com"))(t)||(e=>!(0,n.isProd)()&&e.hostname.endsWith(window.location.hostname))(t))&&c.test(t.pathname)}catch(e){return!1}}function h(e){if(e.startsWith("data:image/svg+xml,"))return!0;try{const t=new URL(e),i=new URL(window.AWS_S3_CDN);return t.protocol===i.protocol&&t.hostname===i.hostname&&t.pathname.includes("/userpics/")}catch(e){return!1}}async function d(e){const t=new URL(`/api/v1/ideas/${i=e,(0,s.ensureNotNull)(c.exec(new URL(i).pathname))[1]}/`,location.href);var i;return fetch(t.toString()).then((e=>{if(!e.ok)throw new Error(`Error processing idea: ${e.statusText}`);return e.json()}))}function p(e,t,i=!1){return d(e).then((e=>{const n=function(e,t){var i;const r=(0,s.ensureDefined)(e.user);let n;r.avatars&&h(r.avatars.small)&&(n=r.avatars.small.startsWith("data:image/svg+xml,")?r.avatars.small:`${r.avatars.small.replace(window.AWS_S3_CDN,"")}?resetCache=true`);const o={avatarUrl:n,badges:null===(i=r.badges)||void 0===i?void 0:i.map((e=>e.name)),username:r.username};return{createdAt:e.created_timestamp,direction:e.direction,name:(0,l.clean)(e.name,!0),author:o,uuid:e.uuid}}(e),c={price:0,time_t:n.createdAt,offset:0},u=t.mainSeries(),d=(0,s.ensureNotNull)(t.model().paneForSource(u)),p=d.newLineToolZOrder(!0),_={type:"drawing",source:{id:(0,o.randomHashN)(6),zorder:p,type:"LineToolIdea",position:50,state:{interval:"1",...a.LineToolIdea.createProperties().state()},ideaData:n,symbol:u.symbol(),ownerSource:u.id(),points:[c]},geometry:[],modelId:t.model().id()},f=t.pasteLineTool(d,_,!0,!0);return i&&r.setValue("hint.pasteIdea",!0,{forceFlush:!0}),f.pointAdded().subscribe(null,(()=>t.scrollToLineTool(f)),!0),f}))}},900569:(e,t,i)=>{i.d(t,{LineToolIdea:()=>w});var s=i(853965),r=i(821979),n=i(444372),o=i(62802),l=i(345848),a=i(201089),c=i(167222),u=i(846778),h=i(270294),d=i(885482),p=i(543373),_=i(953639) ;const f=(0,a.getLogger)("Chart.IdeaDialog"),m=n.t(null,void 0,i(241246)),v=n.t(null,void 0,i(467466));let g=null;function P(e){"LineToolIdea"===e?(window.is_authenticated||(0,d.resetToCursor)(!0),(0,c.runOrSigninWithFeature)((()=>{d.tool.setValue("LineToolIdea"),g=(0,p.showCustomUrlEventDialog)({onConfirm:y,onClose:()=>{g=null,"LineToolIdea"===d.tool.value()&&(0,d.resetToCursor)(!0)},title:m,placeholderText:v}),(0,l.trackEvent)("Idea","Open idea dialog")}),{feature:"drawings",source:"Change drawing tool state"})):null!==g&&g.then((e=>e()))}function y(e){const t=(0,h.chartWidgetCollectionService)();if(null===t)return;if(!(0,_.isIdeaUrl)(e))return void f.logWarn(`Invalid idea url: ${e}`);const i=!Boolean(o.getBool("hint.pasteIdea")),s=t.activeChartWidget.value();(0,_.createIdeaLineToolByUrl)(e,s.model()).then((()=>{i&&(0,u.showPasteLineToolHint)(t.getContainer(),"hint.pasteIdea")}))}var S=i(354950),b=i(70726);class x extends b.CustomEventItem{constructor(e,t){super(t),this._data=e}ideaData(){return this._data}index(){return this._source.eventTimePointIndex()}time(){return this._data.createdAt}avatar(){var e;return null===(e=this._data.author)||void 0===e?void 0:e.avatarUrl}}class w extends b.LineToolCustomUrlEvent{constructor(e,t,s,r){super(e,t||w.createProperties(),s,r),Promise.all([i.e(39232),i.e(33193),i.e(99898),i.e(76792),i.e(77028),i.e(51583)]).then(i.bind(i,320593)).then((t=>{this._setPaneViews([new t.IdeaPaneView(this,e)])}))}name(){return"Idea"}state(e){const t=super.state(e);return this._item&&(t.ideaData=this._item.ideaData()),e&&(t.eventTimePointIndex=this._eventTimePointIndex),t}restoreData(e){e.ideaData&&(this._item=new x(e.ideaData,this)),void 0!==e.eventTimePointIndex&&(this._eventTimePointIndex=e.eventTimePointIndex)}static createProperties(e){const t=new s.DefaultProperty({defaultName:"linetoolIdea",state:e});return this._configureProperties(t),t}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(96461),i.e(24770),i.e(30154),i.e(82375),i.e(18537)]).then(i.bind(i,325232)).then((e=>e.IdeaDefinitionsViewModel))}static _configureProperties(e){r.LineDataSource._configureProperties(e),e.hasChild("position")||e.addChild("position",new S.Property(50)),e.addExcludedKey("position",1)}}(0,d.runOnDrawingStateReady)((()=>{d.tool.subscribe(P)}))},923237:(e,t,i)=>{i.d(t,{commonLineToolPropertiesStateKeys:()=>s});const s=["symbolStateVersion","zOrderVersion","frozen","title","symbolInfo","interval","symbol","currencyId","unitId","visible"]},17329:(e,t,i)=>{i.d(t,{LineToolImage:()=>w,buildAbsoluteUserImageUrl:()=>x});var s=i(650151),r=i(86441),n=i(201089),o=i(853965),l=i(354950),a=i(821979),c=i(964824),u=i(62802),h=i(345848),d=i(167222),p=i(846778),_=i(270294),f=i(885482);async function m(e,t){return async function(e){return(await Promise.all([i.e(67681),i.e(1893),i.e(42381),i.e(38697),i.e(86282),i.e(47821),i.e(89589),i.e(8191),i.e(72456),i.e(42629),i.e(95543),i.e(20845),i.e(27616),i.e(236),i.e(90385),i.e(28019),i.e(62526),i.e(77038)]).then(i.bind(i,595470))).renderImageDialog(e)}({onConfirm:e,onClose:t })}let v=null;function g(e){if("LineToolImage"!==e)return null==v||v.then((e=>e())),void(v=null);window.is_authenticated||(0,f.resetToCursor)(!0),(0,d.runOrSigninWithFeature)((()=>{f.tool.setValue("LineToolImage"),v=m(P,(()=>{null==v||v.then((e=>e())),v=null,"LineToolImage"===f.tool.value()&&(0,f.resetToCursor)(!0)})),(0,h.trackEvent)("Image","Open image dialog")}),{feature:"drawings",source:"Change drawing tool state"})}function P(e){const t=(0,_.chartWidgetCollectionService)();if(null===t)return;const i=!Boolean(u.getBool("hint.pasteImage")),r=t.activeChartWidget.value();r.model().pasteImageAsLineTool(e.url,e.blobUrl,(0,s.ensureNotNull)(r.model().model().paneForSource(r.model().mainSeries())),e.transparency),i&&(0,p.showPasteLineToolHint)(t.getContainer(),"hint.pasteImage")}const y=(0,n.getLogger)("Chart.LineToolImage");function S(e){return e.toLowerCase().startsWith("blob:")}const b=window.AWS_BBS3_DOMAIN;function x(e){if(S(e))return e;const t=new URL(e,b),i=new URL(t.pathname,b);if("/"===i.pathname)return null;const s=i.toString();return t.toString()!==s?null:s}class w extends a.LineDataSource{constructor(e,t,s,r){var n;super(e,t||w.createProperties(),s,r),this._image=null,this._originPoint=4;const o=this.properties().childs().url;this._absoluteUserImageUrl=new l.Property(null!==(n=x(this.properties().childs().url.value()))&&void 0!==n?n:""),this._absoluteUserImageUrl.subscribe(this,(e=>{const t=e.value();if(S(t))return;const i=x(t);null!==i&&o.setValue(new URL(i).pathname)})),o.subscribe(this,(()=>{const e=x(o.value());null!==e&&this._absoluteUserImageUrl.setValue(e)})),this._loadImage(),Promise.all([i.e(39232),i.e(33193),i.e(99898),i.e(76792),i.e(77028),i.e(51583)]).then(i.bind(i,102380)).then((({ImagePaneView:t})=>{this._setPaneViews([new t(this,e)])})),this.properties().childs().url.subscribe(this,(()=>{this._loadImage()}))}absoluteUserImageUrl(){return this._absoluteUserImageUrl}cssWidth(){return this.properties().childs().cssWidth.value()}cssHeight(){return this.properties().childs().cssHeight.value()}angle(){return this.properties().childs().angle.value()}originPoint(){return this._originPoint}dOffsetX(){return this._dOffsetX||0}pointsCount(){return 1}name(){return"Image"}image(){return this._image}setBlobImageUrl(e){this._image||(this._createImage(e),this._blobUrl=e)}getChangePointForSync(e){return null}hasEditableCoordinates(){return!1}pointToScreenPoint({index:e,price:t},i=0){const n=this._model.timeScale(),o=(0,s.ensureNotNull)(this.priceScale()),l=(0,s.ensureNotNull)((0,s.ensureNotNull)(this.ownerSource()).firstValue()),a=n.indexToCoordinate(e)+i,c=o.priceToCoordinate(t,l);return new r.Point(a,c)}setPoint(e,t,i){if(null===this._image)return;const{width:r,height:n}=this._image,o=(0,s.ensureNotNull)(this.pointToScreenPoint(t)),l=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[0],this.dOffsetX())),a=Math.max(Math.abs(l.x-o.x)/r,Math.abs(l.y-o.y)/n),c=Math.round(r*a),u=Math.round(n*a),h=this.properties().childs();h.cssWidth.setValue(c),h.cssHeight.setValue(u),this.propertiesChanged()} startChanging(e,t){super.startChanging(e,t),this._changeOriginPoint(w._oppositePoints[e])}endChanging(e,t){return this._changeOriginPoint(4),super.endChanging(e,t)}getPoint(){return null}syncLineStyleState(){const e=super.syncLineStyleState();return!e.url&&this._blobUrl&&(e.blobUrl=this._blobUrl),e}restoreExternalState(e){const{blobUrl:t,...i}=e;t&&this.setBlobImageUrl(t),super.restoreExternalState(i)}isSavedInChart(){return super.isSavedInChart()&&""!==this.absoluteUserImageUrl().value()}static createProperties(e){const t=new o.DefaultProperty({defaultName:"linetoolimage",state:e});return this._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(96461),i.e(24770),i.e(30154),i.e(82375),i.e(18537)]).then(i.bind(i,69487))).ImageDefinitionsViewModel}static _configureProperties(e){super._configureProperties(e),e.hasChild("url")||e.addChild("url",new l.Property("")),e.addExcludedKey("url",1),e.addExcludedKey("cssWidth",1),e.addExcludedKey("cssHeight",1),e.addExcludedKey("angle",1)}_loadImage(){const e=this.properties(),t=(0,s.ensureDefined)(e.child("url")).value();t&&this._createImage(t)}_changeOriginPoint(e){const t=this.originPoint(),i=4===t?w._correctOriginDirections[e]:w._correctOriginDirections[w._oppositePoints[t]],n=this.properties().childs().cssWidth.value()/2,o=this.properties().childs().cssHeight.value()/2,[l]=this._points,a=(0,s.ensureNotNull)(this.pointToScreenPoint(l)),c=new r.Point(a.x+n*i[0],a.y+o*i[1]),u=(0,s.ensureNotNull)(this.screenPointToPoint(c));this._dOffsetX=4===t?c.x-(0,s.ensureNotNull)(this.pointToScreenPoint(u)).x:void 0,l.index=u.index,l.price=u.price,this._originPoint=e}_createImage(e){var t;const i=S(e),r=x(e);if(null===r)return void y.logWarn(`Invalid image URL: ${e}`);if(r===(null===(t=this._image)||void 0===t?void 0:t.src))return;const n=document.createElement("img");n.crossOrigin="anonymous",n.src=r,n.addEventListener("load",(()=>{this._image=n;const e=this._model,t=this.properties().childs();if(!i){const e=new URL(r).pathname;t.url.setValue(e),this._blobUrl=void 0}if(t.cssWidth.value()&&t.cssHeight.value())return void this._model.updateSource(this);const o=e.timeScale().width()/4,l=(0,s.ensureNotNull)(this.priceScale()).height()/4,a=n.naturalWidth,u=n.naturalHeight,h=Math.min(1,o/a),d=Math.min(1,l/u),p=Math.min(h,d),_=Math.round(p*a),f=Math.round(p*u);t.cssWidth.setValue(_),t.cssHeight.setValue(f),this.updateAllViews((0,c.sourceChangeEvent)(this.id())),this._model.updateSource(this)})),n.addEventListener("error",(()=>{this.model().removeSource(this)}))}}w._correctOriginDirections=[[-1,-1],[1,-1],[-1,1],[1,1],[0,0]],w._oppositePoints=[3,2,1,0,4],(0,f.runOnDrawingStateReady)((()=>{f.tool.subscribe(g)}))},933513:(e,t,i)=>{i.d(t,{LineToolInfoLine:()=>r});var s=i(956268);class r extends s.LineToolTrendLine{constructor(e,t,i,s){super(e,t||r.createProperties(),i,s)}pointsCount(){return 2}name(){return"Info Line"}static createProperties(e){const t=s.LineToolTrendLine._createPropertiesImpl("linetoolinfoline",e);return r._configureProperties(t),t}} },653657:(e,t,i)=>{function s(e){return"setSelectionRange"in e}i.d(t,{isInplaceTextLineSourcePaneView:()=>s})},478760:(e,t,i)=>{var s=i(517336).LevelsProperty,r=i(9093).LineToolPitchfork;class n extends r{constructor(e,t,i,s){super(e,t||n.createProperties(),i,s)}name(){return"Inside Pitchfork"}static createProperties(e){var t=new s({defaultName:"linetoolinsidepitchfork",state:e,map:{range:[0,8]}});return this._configureProperties(t),t}}t.LineToolInsidePitchfork=n},616117:(e,t,i)=>{var s;i.d(t,{isImageToolName:()=>h,isLineDrawnWithPressedButton:()=>a,isLineToolDrawWithoutPoints:()=>u,isLineToolFinishRequiredWhenCreatedByApi:()=>c,isLineToolName:()=>l,isStudyLineToolName:()=>o,isTextToolName:()=>d});var r=i(968361);const n=new Set(["LineStudyMtpAnalysis","LineStudyMtpDecisionPoint","LineStudyMtpRiskReward","LineStudyMtpElliotWaveMain","LineStudyMtpElliotWaveMajor","LineStudyMtpElliotWaveMinor","LineStudyMtpDownWave1OrA","LineStudyMtpDownWave2OrB","LineStudyMtpDownWave3","LineStudyMtpDownWave4","LineStudyMtpDownWave5","LineStudyMtpDownWaveC","LineStudyMtpUpWave1OrA","LineStudyMtpUpWave2OrB","LineStudyMtpUpWave3","LineStudyMtpUpWave4","LineStudyMtpUpWave5","LineStudyMtpUpWaveC"]);function o(e){let t="LineToolRegressionTrend"===e||"LineToolVbPFixed"===e||"LineToolFixedRangeVolumeProfile"===e||"LineToolAnchoredVolumeProfile"===e||"LineToolAnchoredVWAP"===e;return t||(t=function(e){return n.has(e)}(e)),t}function l(e){return e in(s||(s=i.t(r,2)))||o(e)}function a(e){return"LineToolBrush"===e||"LineToolHighlighter"===e}function c(e){return a(e)||"LineToolPath"===e||"LineToolPolyline"===e||"LineToolGhostFeed"===e}function u(e){return"LineToolTweet"===e||"LineToolIdea"===e||"LineToolImage"===e}function h(e){return"LineToolImage"===e}function d(e){switch(e){case"LineToolBalloon":case"LineToolComment":case"LineToolText":case"LineToolTextAbsolute":case"LineToolCallout":case"LineToolNote":case"LineToolNoteAbsolute":case"LineToolSignpost":return!0}return!1}},68626:(e,t,i)=>{i.d(t,{LineDataSourcePointIndexProperty:()=>r});var s=i(354950);class r extends s.Property{constructor(e,t){super(),this._waitingPointsetUpdate=!1,this._lineSource=e,this._pointIndex=t,this._cachedIndex=this.value()}value(){const e=this._lineSource.points();return 0===e.length?this._cachedIndex:e[this._pointIndex].index}setValue(e){this._cachedIndex=e;const t=this._lineSource.points(),i=e=>{const t=this._lineSource.points()[this._pointIndex];if(t.index===e)return;t.index=e,this._lineSource.startChanging(this._pointIndex,t),this._setPointImpl(t),this._lineSource.model().updateSource(this._lineSource),this._listeners.fire(this,"");const i=this._lineSource.endChanging(!0,!1);this._lineSource.syncMultichartState(i)};if(0===t.length){const e=()=>{i(this._cachedIndex),this._waitingPointsetUpdate=!1};if(this._waitingPointsetUpdate)return;this._lineSource.pointsetUpdated().subscribe(this,e,!0),this._waitingPointsetUpdate=!0}else i(e)}_setPointImpl(e){this._lineSource.setPoint(this._pointIndex,e)}}},517067:(e,t,i)=>{i.d(t,{LineDataSourcePointPriceProperty:()=>n}) ;var s=i(650151),r=i(354950);class n extends r.Property{constructor(e,t){super(),this._lineSource=e,this._pointIndex=t,e.pointAdded().subscribe(this,(e=>{this._pointIndex===e&&this._listeners.fire(this,`${e}`)})),e.pointChanged().subscribe(this,(e=>{this._pointIndex===e&&this._listeners.fire(this,`${e}`)}))}value(){const e=this._lineSource.points()[this._pointIndex].price,t=(0,s.ensureNotNull)(this._lineSource.ownerSource()).formatter();if(t.parse){const i=t.format(e),s=t.parse(i);return s.res?s.value:e}return e}setValue(e){const t=this._lineSource.points()[this._pointIndex];t.price=parseFloat(""+e),this._lineSource.startChanging(this._pointIndex,t),this._lineSource.setPoint(this._pointIndex,t),this._lineSource.model().updateSource(this._lineSource),this._listeners.fire(this,"");const i=this._lineSource.endChanging(!0,!1);this._lineSource.syncMultichartState(i)}}},837202:(e,t,i)=>{i.d(t,{LineToolPriceAxisView:()=>o});var s=i(650151),r=i(229765),n=i(246733);class o extends r.PriceAxisView{constructor(e,t){super(),this._source=e,this._data=t,this._properties=e.model().properties().childs().scalesProperties}_updateRendererData(e,t,i){e.visible=!1;const s=this._source.model();if(!s.timeScale()||s.timeScale().isEmpty())return;const r=this._source.priceScale();if(null===r||r.isEmpty())return;if(!s.selection().isSelected(this._source)&&!this._source.isForcedDrawPriceAxisLabel())return;if(null===s.timeScale().visibleBarsStrictRange())return;const o=this._source.priceAxisPoints(),l=this._data.pointIndex;if(o.length<=l)return;const a=o[l];if(!isFinite(a.price))return;const c=this._source.ownerSource(),u=null!==c?c.firstValue():null;if(null===u)return;let h=this._data.backgroundPropertyGetter?this._data.backgroundPropertyGetter():null;null===h&&(h=this._getBgColor()),i.background=(0,n.resetTransparency)(h),i.borderColor="#2E84A6",i.textColor=this.generateTextColor(i.background),i.coordinate=r.priceToCoordinate(a.price,u),e.text=this._formatPrice(a.price,u),e.visible=!0}_getBgColor(){return this._active?this._properties.childs().axisLineToolLabelBackgroundColorActive.value():this._properties.childs().axisLineToolLabelBackgroundColorCommon.value()}_formatPrice(e,t){return(0,s.ensureNotNull)(this._source.priceScale()).formatPrice(e,t)}}},33249:(e,t,i)=>{i.d(t,{LineDataSourceProperty:()=>l});var s=i(822914),r=i(852290),n=i(650151),o=i(853965);class l extends o.DefaultProperty{constructor({templateKeys:e,...t}){super({ignoreAllowSavingDefaults:!0,saveNonDefaultUserPreferencesOnly:!0,...t}),this._templateKeys=(0,n.ensureDefined)(e||this._allDefaultsKeys)}template(){return(0,o.extractState)(this.state(),this._templateKeys,[])}applyTemplate(e){this.mergeAndFire((0,o.extractState)((0,r.default)((0,s.default)(this._factoryDefaultsSupplier()),e),this._templateKeys))}}},902214:(e,t,i)=>{i.d(t,{LineDataSourceTimeAxisView:()=>r});var s=i(161164);class r extends s.TimeAxisView{constructor(e,t){super(e.model()),this._active=!1,this._source=e,this._pointIndex=t,this._properties=e.model().properties().childs().scalesProperties}setActive(e){ this._active=e}_getBgColor(){return this._active?this._properties.childs().axisLineToolLabelBackgroundColorActive.value():this._properties.childs().axisLineToolLabelBackgroundColorCommon.value()}_getIndex(){if(!this._model.selection().isSelected(this._source))return null;const e=this._source.timeAxisPoints();return e.length<=this._pointIndex?null:e[this._pointIndex].index}_isVisible(){return!0}}},613053:(e,t,i)=>{i.d(t,{LineToolTradingPriceAxisView:()=>r});var s=i(837202);class r extends s.LineToolPriceAxisView{_formatPrice(e,t){return this._source.formatter().format(e)}}},776954:(e,t,i)=>{i.d(t,{LineToolWithRelativePriceCoordinate:()=>f,getNoDataPosition:()=>p,getSeriesPosition:()=>_,positionToCoordinate:()=>u});var s=i(650151),r=i(534741),n=i(821979),o=i(885482);function l(e,t,i){const s=e.barFunction();switch(e.style()){case 3:case 10:case 2:case 14:case 15:return s(t.value);default:return t.value[-1===i?3:2]}}function a(e){return e>=0?1:-1}function c(e,t){return-1===a(e)!==t?-1:1}function u(e,t,i,s){const r=Math.min(t,Math.max(0,1===s?i:t-i));return i-s*Math.abs(r*e/100)}function h(e,t,i){const s=e.index();return null===s?null:{index:s,price:t.coordinateToPrice(t.height()/2,i)}}function d(e,t){const i=e.data().bars(),s=i.first(),n=i.last();if(null===s||null===n)return null;let o;const c=t.index();if(null===c){if(void 0===t.time)return null;const e=t.time(),l=s.value[0],a=n.value[0];if(e<l-86400||e>a)return null;o=i.searchByTime(e,r.PlotRowSearchMode.NearestRight,4)}else o=i.search(c);return null===o?null:{index:o.index,price:l(e,o,a(t.position()))}}function p(e,t,i){const s=h(e,t,i);if(null===s)return null;const r=c(e.position(),t.isInverted());return{index:s.index,price:s.price,poleStartY:t.height(),visualDirection:1,positionPointDirection:r,startsOnSeriesData:!1}}function _(e,t,i=!0){const r=d(e,t),n=e.priceScale(),o=(0,s.ensureNotNull)(e.firstValue());if(null===r)return p(t,n,o);let l=0;const a=e.properties().childs(),u=e.model().timeScale(),h=n.priceToCoordinate(r.price,o),_=c(t.position(),n.isInverted());if(i)switch(e.style()){case 16:l=1===_?a.hlcAreaStyle.childs().highLineWidth.value()/2:a.hlcAreaStyle.childs().lowLineWidth.value()/2;break;case 3:l=a.areaStyle.childs().linewidth.value()/2;break;case 2:l=a.lineStyle.childs().linewidth.value()/2;break;case 14:l=a.lineWithMarkersStyle.childs().linewidth.value()/2;break;case 15:l=a.steplineStyle.childs().linewidth.value()/2;break;case 10:const e=Math.abs(100-a.baselineStyle.childs().baseLevelPercentage.value());l=n.height()*e/100>h?a.baselineStyle.childs().topLineWidth.value()/2:a.baselineStyle.childs().bottomLineWidth.value()/2;break;case 1:case 9:case 8:case 12:case 4:case 7:l=3;break;case 0:l=a.barStyle.childs().thinBars.value()?3:Math.max(3,.25*u.barSpacing());break;case 11:l=a.rangeStyle.childs().thinBars.value()?3:Math.max(3,.25*u.barSpacing());break;case 5:l=Math.max(4,.25*u.barSpacing());break;case 6:l=Math.max(5,.25*u.barSpacing())}const f=h-_*l;return{index:r.index,price:r.price,poleStartY:f,visualDirection:_,positionPointDirection:_, startsOnSeriesData:!0}}class f extends n.LineDataSource{constructor(){super(...arguments),this._startMovingAnchorY=NaN}priceSource(){return this.ownerSource()}addPoint(e,t,i){return super.addPoint(this._updatePositionAndCorrectPoint(e),t,i)}setPoint(e,t,i){super.setPoint(e,this._updatePositionAndCorrectPoint(t,!this.isPhantom()&&!this._allowChangeAnchorHorizontally()),i),this._syncPosition()}setPointAndChangeIndex(e,t,i){super.setPoint(e,this._updatePositionAndCorrectPoint(t,!1),i),this._syncPosition()}startMoving(e,t,i,r){r||(this._startMovingAnchorY=(0,s.ensureNotNull)(this._anchorYCoordinate())),super.startMoving(e,t,i)}move(e,t,i,r){var n;const o=(0,s.ensureDefined)((0,s.ensureNotNull)(this.startMovingPoint()).logical),l=(0,s.ensureDefined)(e.logical);if(!r&&0===t){const e=this._points[0],t=l.index-o.index,i=(0,s.ensureNotNull)(this.priceScale()),r=(0,s.ensure)(null===(n=this.ownerSource())||void 0===n?void 0:n.firstValue()),a=i.priceToCoordinate(l.price,r)-i.priceToCoordinate(o.price,r),c=this._startMovingAnchorY+a,u=i.coordinateToPrice(c,r);this._updatePositionAndCorrectPoint({index:e.index+t,price:u})}super.move(e,t,i),r||this._syncPosition()}_allowChangeAnchorHorizontally(){return!1}_updatePositionAndCorrectPoint(e,t){t&&(e.index=this._points[0].index);const i=this.priceSource();if(null===i)return e;const s=i.priceScale(),r=i.firstValue();if(null===s||s.isEmpty()||null===r)return e;const n=s.height();let o=n/2,a=e.price>=s.coordinateToPrice(o,r)?1:-1;const c=this._model.mainSeries();if(i===c){const t=c.data().search(this._baseSeriesIndexForPoint(e));if(null!==t){const i=l(c,t,-1),n=l(c,t,1);a=e.price>=i?1:-1,o=s.priceToCoordinate(1===a?n:i,r),e.price=1===a?Math.max(n,e.price):e.price}}const u=1===(-1===a!==s.isInverted()?-1:1)?o:n-o,h=s.priceToCoordinate(e.price,r),d=Math.min(n,Math.abs(h-o)),p=Math.max(0,Math.min(100,100*d/u))*a;return this.properties().childs().position.setValue(p),e}_baseSeriesIndexForPoint(e){return e.index}_syncPosition(){const e=this.linkKey().value();if(null!==e){const t={position:this.properties().childs().position.value()};(0,o.changeLineStyle)({linkKey:e,state:t,model:this._model})}}_anchorYCoordinate(){const e=this.priceSource();if(null===e)return null;const t=e.priceScale(),i=e.firstValue();if(null===t||t.isEmpty()||null===i)return null;const s=this._model.mainSeries(),r=this.customEvent();if(null===r)return null;let n=null;if(e===s&&(n=d(s,r)),null===n&&(n=h(r,t,i)),null===n)return null;const o=r.position(),l=t.priceToCoordinate(n.price,i);return u(o,t.height(),l,c(o,t.isInverted()))}}},619540:(e,t,i)=>{var s=i(821979).LineDataSource,r=i(354950).Property,n=i(853965).DefaultProperty;class o extends s{constructor(e,t,s,r){super(e,t||o.createProperties(),s,r),this.version=o.version,Promise.all([i.e(39232),i.e(33193),i.e(99898),i.e(76792),i.e(77028),i.e(51583)]).then(i.bind(i,6360)).then((({NotePaneView:e})=>{this._setPaneViews([new e(this,this._model)])}))}pointsCount(){return 1}name(){return"Note"}getTooltipWidth(){return o.TOOLTIP_WIDTH}getTooltipPadding(){return o.TOOLTIP_PADDING }getTooltipLineSpacing(){return o.TOOLTIP_LINESPACING}template(){var e=super.template();return e.text=this.properties().childs().text.value(),e}_applyTemplateImpl(e){super._applyTemplateImpl(e),this.properties().childs().text.setValue(e.text)}static createProperties(e){void 0!==e&&void 0!==e.markerColor&&void 0===e.borderColor&&(e.borderColor=e.markerColor);var t=new n({defaultName:"linetoolnote",state:e});return this._configureProperties(t),t}state(e){var t=super.state(e);return e&&(t.state.fixedSize=!1),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(96461),i.e(24770),i.e(30154),i.e(82375),i.e(18537)]).then(i.bind(i,193397))).NoteDefinitionsViewModel}static _configureProperties(e){super._configureProperties(e),e.hasChild("text")||e.addChild("text",new r(i.tf(null,void 0,i(37229)))),e.addExcludedKey("text",1)}}o.TOOLTIP_WIDTH=300,o.TOOLTIP_PADDING=10,o.TOOLTIP_LINESPACING=5,o.version=1;class l extends o{constructor(e,t){super(e,t||l.createProperties())}title(){return i.tf(null,void 0,i(366828))}name(){return"Anchored Note"}isFixed(){return!0}hasEditableCoordinates(){return!1}static createProperties(e){var t=new n({defaultName:"linetoolnoteabsolute",state:e});return this._configureProperties(t),t}}t.LineToolNote=o,t.LineToolNoteAbsolute=l},778737:(e,t,i)=>{var s=i(477227).LineToolTrading,r=i(613053).LineToolTradingPriceAxisView,n=i(586784),o=i(821979).LineDataSource,l=i(853965).DefaultProperty;const a=i(244842);var c=i(888929).sortSourcesPreOrdered.LineToolOrder;function u(e){return null==e?e="":e+="",e}class h{constructor(e){this._line=e,this._data={bodyText:"order",quantityText:"0"},this._editable=!0,this._cancellable=!0,this._mode="",this._direction="buy",this._active=!0}setMode(e){return this._mode=e,this._line.updateAllViewsAndRedraw(),this}setDirection(e){return this._direction=e,this._line.updateAllViewsAndRedraw(),this}setActive(e){return this._active=e,this._line.updateAllViewsAndRedraw(),this}setEditable(e){return this._editable=e,this._line.updateAllViewsAndRedraw(),this}getEditable(){return this._editable}setCancellable(e){return this._cancellable=e,this._line.updateAllViewsAndRedraw(),this}getCancellable(){return this._cancellable}hasMoveCallback(){return this.isFunction(this._onMoveCallback)}hasModifyCallback(){return this.isFunction(this._onModifyCallback)}getPrice(){return this._line.points().length>0?this._line.points()[0].price:this._line._timePoint.length>0?this._line._timePoint[0].price:void 0}setPrice(e){if(this._line.points().length>0){var t=this._line.points()[0];t.price=e,this._line.setPoint(0,t),this._line.updateAllViewsAndRedraw()}return this._line._timePoint.length>0&&(this._line._timePoint[0].price=e),this}getText(){return this._data.bodyText}setText(e){return this._data.bodyText=e||"",this._line.updateAllViewsAndRedraw(),this}setTooltip(e){return this._line.properties().tooltip.setValue(u(e)),this}getTooltip(){return this._line.properties().tooltip.value()}setModifyTooltip(e){return this._line.properties().modifyTooltip.setValue(u(e)),this}getModifyTooltip(){ return this._line.properties().modifyTooltip.value()}setCancelTooltip(e){return this._line.properties().cancelTooltip.setValue(u(e)),this}getCancelTooltip(){return this._line.properties().cancelTooltip.value()}getQuantity(){return this._data.quantityText}setQuantity(e){return this._data.quantityText=e||"",this._line.updateAllViewsAndRedraw(),this}getExtendLeft(){var e=this._line.properties().extendLeft.value();return"inherit"===e?this._line._model.properties().tradingProperties.extendLeft.value():e}setExtendLeft(e){return this._line.properties().extendLeft.setValue(e),this}getLineLength(){var e=this._line.properties().lineLength.value();return"inherit"===e?this._line._model.properties().tradingProperties.lineLength.value():e}setLineLength(e,t="percentage"){const i=t&&"pixel"===t?e:Math.max(0,Math.min(e,100));return this._line.properties().lineLength.setValue(i),this._line.properties().lineLengthUnit.setValue(t),this}getLineLengthUnit(){return this._line.properties().lineLengthUnit.value()}getLineColor(){var e=this._line.properties();return"buy"===this._direction?this._active?e.lineActiveBuyColor.value():e.lineInactiveBuyColor.value():this._active?e.lineActiveSellColor.value():e.lineInactiveSellColor.value()}setLineColor(e){return"buy"===this._direction?this._active?this.setLineActiveBuyColor(e):this.setLineInactiveBuyColor(e):this._active?this.setLineActiveSellColor(e):this.setLineInactiveSellColor(e),this}setLineActiveBuyColor(e){return this._line.properties().lineActiveBuyColor.setValue(e),this}setLineInactiveBuyColor(e){return this._line.properties().lineInactiveBuyColor.setValue(e),this}setLineActiveSellColor(e){return this._line.properties().lineActiveSellColor.setValue(e),this}setLineInactiveSellColor(e){return this._line.properties().lineInactiveSellColor.setValue(e),this}getLineStyle(){var e=this._line.properties().lineStyle.value();return"inherit"===e?this._line._model.properties().tradingProperties.lineStyle.value():e}setLineStyle(e){return this._line.properties().lineStyle.setValue(e),this}getLineWidth(){var e=this._line.properties().lineWidth.value();return"inherit"===e?this._line._model.properties().tradingProperties.lineWidth.value():e}setLineWidth(e){return this._line.properties().lineWidth.setValue(e),this}getBodyBorderColor(){var e=this._line.properties();return"buy"===this._direction?this._active?e.bodyBorderActiveBuyColor.value():e.bodyBorderInactiveBuyColor.value():this._active?e.bodyBorderActiveSellColor.value():e.bodyBorderInactiveSellColor.value()}setBodyBorderColor(e){return"buy"===this._direction?this._active?this.setBodyBorderActiveBuyColor(e):this.setBodyBorderInactiveBuyColor(e):this._active?this.setBodyBorderActiveSellColor(e):this.setBodyBorderInactiveSellColor(e),this}setBodyBorderActiveBuyColor(e){return this._line.properties().bodyBorderActiveBuyColor.setValue(e),this}setBodyBorderInactiveBuyColor(e){return this._line.properties().bodyBorderInactiveBuyColor.setValue(e),this}setBodyBorderActiveSellColor(e){return this._line.properties().bodyBorderActiveSellColor.setValue(e),this} setBodyBorderInactiveSellColor(e){return this._line.properties().bodyBorderInactiveSellColor.setValue(e),this}getBodyBackgroundColor(){return n.getColorFromProperties(this._line.properties().bodyBackgroundColor,this._line.properties().bodyBackgroundTransparency)}setBodyBackgroundColor(e){return n.setColorToProperties(e,this._line.properties().bodyBackgroundColor,this._line.properties().bodyBackgroundTransparency),this}getBodyTextColor(){var e=this._line.properties();return"limit"===this._mode?this._active?e.bodyTextActiveLimitColor.value():e.bodyTextInactiveLimitColor.value():"stop"===this._mode?this._active?e.bodyTextActiveStopColor.value():e.bodyTextInactiveStopColor.value():"buy"===this._direction?this._active?e.bodyTextActiveBuyColor.value():e.bodyTextInactiveBuyColor.value():this._active?e.bodyTextActiveSellColor.value():e.bodyTextInactiveSellColor.value()}setBodyTextColor(e){return"limit"===this._mode?this._active?this.setBodyTextActiveLimitColor(e):this.setBodyTextInactiveLimitColor(e):"stop"===this._mode?this._active?this.setBodyTextActiveStopColor(e):this.setBodyTextInactiveStopColor(e):"buy"===this._direction?this._active?this.setBodyTextActiveBuyColor(e):this.setBodyTextInactiveBuyColor(e):this._active?this.setBodyTextActiveSellColor(e):this.setBodyTextInactiveSellColor(e),this}setBodyTextInactiveLimitColor(e){return this._line.properties().bodyTextInactiveLimitColor.setValue(e),this}setBodyTextActiveLimitColor(e){return this._line.properties().bodyTextActiveLimitColor.setValue(e),this}setBodyTextInactiveStopColor(e){return this._line.properties().bodyTextInactiveStopColor.setValue(e),this}setBodyTextActiveStopColor(e){return this._line.properties().bodyTextActiveStopColor.setValue(e),this}setBodyTextInactiveBuyColor(e){return this._line.properties().bodyTextInactiveBuyColor.setValue(e),this}setBodyTextActiveBuyColor(e){return this._line.properties().bodyTextActiveBuyColor.setValue(e),this}setBodyTextInactiveSellColor(e){return this._line.properties().bodyTextInactiveSellColor.setValue(e),this}setBodyTextActiveSellColor(e){return this._line.properties().bodyTextActiveSellColor.setValue(e),this}getBodyFont(){return n.getFontFromProperties(this._line.properties().bodyFontFamily,this._line.properties().bodyFontSize,this._line.properties().bodyFontBold,this._line.properties().bodyFontItalic)}setBodyFont(e){return n.setFontToProperties(e,this._line.properties().bodyFontFamily,this._line.properties().bodyFontSize,this._line.properties().bodyFontBold,this._line.properties().bodyFontItalic),this}getQuantityBorderColor(){var e=this._line.properties();return"buy"===this._direction?this._active?e.quantityBorderActiveBuyColor.value():e.quantityBorderInactiveBuyColor.value():this._active?e.quantityBorderActiveSellColor.value():e.quantityBorderInactiveSellColor.value()}setQuantityBorderColor(e){return"buy"===this._direction?this._active?this.setQuantityBorderActiveBuyColor(e):this.setQuantityBorderInactiveBuyColor(e):this._active?this.setQuantityBorderActiveSellColor(e):this.setQuantityBorderInactiveSellColor(e),this} setQuantityBorderActiveBuyColor(e){return this._line.properties().quantityBorderActiveBuyColor.setValue(e),this}setQuantityBorderInactiveBuyColor(e){return this._line.properties().quantityBorderInactiveBuyColor.setValue(e),this}setQuantityBorderActiveSellColor(e){return this._line.properties().quantityBorderActiveSellColor.setValue(e),this}setQuantityBorderInactiveSellColor(e){return this._line.properties().quantityBorderInactiveSellColor.setValue(e),this}getQuantityBackgroundColor(){var e=this._line.properties();return"buy"===this._direction?this._active?e.quantityBackgroundActiveBuyColor.value():e.quantityBackgroundInactiveBuyColor.value():this._active?e.quantityBackgroundActiveSellColor.value():e.quantityBackgroundInactiveSellColor.value()}setQuantityBackgroundColor(e){return"buy"===this._direction?this._active?this.setQuantityBackgroundActiveBuyColor(e):this.setQuantityBackgroundInactiveBuyColor(e):this._active?this.setQuantityBackgroundActiveSellColor(e):this.setQuantityBackgroundInactiveSellColor(e),this}setQuantityBackgroundActiveBuyColor(e){return this._line.properties().quantityBackgroundActiveBuyColor.setValue(e),this}setQuantityBackgroundInactiveBuyColor(e){return this._line.properties().quantityBackgroundInactiveBuyColor.setValue(e),this}setQuantityBackgroundActiveSellColor(e){return this._line.properties().quantityBackgroundActiveSellColor.setValue(e),this}setQuantityBackgroundInactiveSellColor(e){return this._line.properties().quantityBackgroundInactiveSellColor.setValue(e),this}getQuantityTextColor(){return n.getColorFromProperties(this._line.properties().quantityTextColor,this._line.properties().quantityTextTransparency)}setQuantityTextColor(e){return n.setColorToProperties(e,this._line.properties().quantityTextColor,this._line.properties().quantityTextTransparency),this}getQuantityFont(){return n.getFontFromProperties(this._line.properties().quantityFontFamily,this._line.properties().quantityFontSize,this._line.properties().quantityFontBold,this._line.properties().quantityFontItalic)}setQuantityFont(e){return n.setFontToProperties(e,this._line.properties().quantityFontFamily,this._line.properties().quantityFontSize,this._line.properties().quantityFontBold,this._line.properties().quantityFontItalic),this}getCancelButtonBorderColor(){var e=this._line.properties();return"buy"===this._direction?this._active?e.cancelButtonBorderActiveBuyColor.value():e.cancelButtonBorderInactiveBuyColor.value():this._active?e.cancelButtonBorderActiveSellColor.value():e.cancelButtonBorderInactiveSellColor.value()}setCancelButtonBorderColor(e){return"buy"===this._direction?this._active?this.setCancelButtonBorderActiveBuyColor(e):this.setCancelButtonBorderInactiveBuyColor(e):this._active?this.setCancelButtonBorderActiveSellColor(e):this.setCancelButtonBorderInactiveSellColor(e),this}setCancelButtonBorderActiveBuyColor(e){return this._line.properties().cancelButtonBorderActiveBuyColor.setValue(e),this}setCancelButtonBorderInactiveBuyColor(e){return this._line.properties().cancelButtonBorderInactiveBuyColor.setValue(e),this} setCancelButtonBorderActiveSellColor(e){return this._line.properties().cancelButtonBorderActiveSellColor.setValue(e),this}setCancelButtonBorderInactiveSellColor(e){return this._line.properties().cancelButtonBorderInactiveSellColor.setValue(e),this}getCancelButtonBackgroundColor(){return n.getColorFromProperties(this._line.properties().cancelButtonBackgroundColor,this._line.properties().cancelButtonBackgroundTransparency)}setCancelButtonBackgroundColor(e){return n.setColorToProperties(e,this._line.properties().cancelButtonBackgroundColor,this._line.properties().cancelButtonBackgroundTransparency),this}getCancelButtonIconColor(){var e=this._line.properties();return"buy"===this._direction?this._active?e.cancelButtonIconActiveBuyColor.value():e.cancelButtonIconInactiveBuyColor.value():this._active?e.cancelButtonIconActiveSellColor.value():e.cancelButtonIconInactiveSellColor.value()}setCancelButtonIconColor(e){return"buy"===this._direction?this._active?this.setCancelButtonIconActiveBuyColor(e):this.setCancelButtonIconInactiveBuyColor(e):this._active?this.setCancelButtonIconActiveSellColor(e):this.setCancelButtonIconInactiveSellColor(e),this}setCancelButtonIconActiveBuyColor(e){return this._line.properties().cancelButtonIconActiveBuyColor.setValue(e),this}setCancelButtonIconInactiveBuyColor(e){return this._line.properties().cancelButtonIconInactiveBuyColor.setValue(e),this}setCancelButtonIconActiveSellColor(e){return this._line.properties().cancelButtonIconActiveSellColor.setValue(e),this}setCancelButtonIconInactiveSellColor(e){return this._line.properties().cancelButtonIconInactiveSellColor.setValue(e),this}block(){this._blocked=!0,this._line.updateAllViewsAndRedraw()}unblock(){this._blocked=!1,this._line.updateAllViewsAndRedraw()}getBlocked(){return this._blocked}isFunction(e){return"function"==typeof e}onCancel(e,t){return t?this.isFunction(t)&&(this._onCancelData=e,this._onCancelCallback=t):this.isFunction(e)&&(this._onCancelCallback=e),this}callOnCancel(){this.isFunction(this._onCancelCallback)&&this._onCancelCallback.call(this,this._onCancelData)}isOnCancelCallbackPresent(){return this.isFunction(this._onCancelCallback)}onModify(e,t){return t?this.isFunction(t)&&(this._onModifyData=e,this._onModifyCallback=t):this.isFunction(e)&&(this._onModifyCallback=e),this}callOnModify(){this.isFunction(this._onModifyCallback)&&this._onModifyCallback.call(this,this._onModifyData)}onMove(e,t){return t?this.isFunction(t)&&(this._onMoveData=e,this._onMoveCallback=t):this.isFunction(e)&&(this._onMoveCallback=e),this}callOnMove(){this.isFunction(this._onMoveCallback)&&this._onMoveCallback.call(this,this._onMoveData)}onMoving(e,t){return t?this.isFunction(t)&&(this._onMovingData=e,this._onMovingCallback=t):this.isFunction(e)&&(this._onMovingCallback=e),this}callOnMoving(){this.isFunction(this._onMovingCallback)&&this._onMovingCallback.call(this,this._onMovingData)}onContextMenu(e,t){return t?this.isFunction(t)&&(this._onContextMenuData=e,this._onContextMenuCallback=t):this.isFunction(e)&&(this._onContextMenuCallback=e),this} shouldShowContextMenu(){return this.isFunction(this._onContextMenuCallback)}callOnContextMenu(){if(this.isFunction(this._onContextMenuCallback))return this._onContextMenuCallback.call(this,this._onContextMenuData)}remove(){this._line._model.removeSource(this._line),delete this._line}}class d extends s{constructor(e,t){super(e,t||d.createProperties()),this._adapter=new h(this),this.setSelectionEnabled(!0),Promise.all([i.e(39232),i.e(33193),i.e(99898),i.e(76792),i.e(77028),i.e(51583)]).then(i.bind(i,198918)).then((({OrderPaneView:e})=>{this._setPaneViews([new e(this,this._model)])}))}zorder(){return c}isSpeciallyZOrderedSource(){return!0}setPoint(e,t){this._points[e]=t,this._normalizePoints()}addPoint(e,t){return this._points.push(e),this._lastPoint=null,this._normalizePoints(),this.createServerPoints(),!0}name(){return"Order"}move(e,t,i,s){var r=this._startMovingPoint&&this._currentMovingPoint&&this._startMovingPoint.logical.price!==this._currentMovingPoint.logical.price;super.move(e,t,i,s),r&&this._adapter.callOnMoving()}endMoving(e){var t=this._startMovingPoint&&this._currentMovingPoint&&this._startMovingPoint.logical.price!==this._currentMovingPoint.logical.price;super.endMoving(),!e&&t&&this._adapter.callOnMove()}createPriceAxisView(e){var t={pointIndex:e,backgroundPropertyGetter:()=>this._adapter.getLineColor()};return this._priceAxisView=new r(this,t),this._priceAxisView}paneViews(){return TradingView.printing&&!a.enabled("snapshot_trading_drawings")?null:this._model.properties().tradingProperties.showOrders.value()?o.prototype.paneViews.call(this):null}priceAxisViews(e,t){return TradingView.printing&&!a.enabled("snapshot_trading_drawings")?null:this._model.properties().tradingProperties.showOrders.value()?o.prototype.priceAxisViews.call(this,e,t):null}adapter(){return this._adapter}hasContextMenu(){return this._adapter.shouldShowContextMenu()}contextMenuItems(){return this._adapter.callOnContextMenu()}movable(){return Boolean(this._adapter._onMoveCallback)}formatter(){return this._formatter}static createProperties(e){var t=new l({defaultName:"linetoolorder",state:e,useUserPreferences:!1});return this._configureProperties(t),t}}t.LineToolOrder=d},247035:(e,t,i)=>{i.d(t,{LineToolParallelChannel:()=>h});var s=i(650151),r=i(86441),n=i(811630),o=i(853965),l=i(885482),a=i(821979),c=i(389137),u=i(354950);class h extends a.LineDataSource{constructor(e,t,s,r){super(e,t||h.createProperties(),s,r),this._priceAxisViews.push(this.createPriceAxisView(3)),this._coordOffsetWhileMovingOrChanging=null,this._pendingPriceOffset=null,Promise.all([i.e(39232),i.e(33193),i.e(99898),i.e(76792),i.e(77028),i.e(51583)]).then(i.bind(i,570404)).then((({ParallelChannelPaneView:e})=>{this._setPaneViews([new e(this,this._model)])})),n.alertsAvailable&&this._normalizedPointsChanged.subscribe(this,this._updateAlertCreationAvailable)}paneViews(e){return null!==this._pendingPriceOffset&&this._applyPendingPriceOffset(),super.paneViews(e)}setLastPoint(e,t){t&&t.shift()&&2===this.points().length&&this._snapPoint45Degree(e,this.points()[0]) ;const i=(0,c.clone)(e);return super.setLastPoint(e),i}startMoving(e,t,i,s){super.startMoving(e,t,i,s),this._coordOffsetWhileMovingOrChanging=this._findPixelsHeight()}endMoving(e,t,i){return this._coordOffsetWhileMovingOrChanging=null,super.endMoving(e,t,i)}startChanging(e,t){super.startChanging(e,t),this._coordOffsetWhileMovingOrChanging=this._findPixelsHeight()}endChanging(e,t,i){return this._coordOffsetWhileMovingOrChanging=null,super.endChanging(e,t,i)}restoreExternalPoints(e,t,i){const s=i?e.points:this._timePoint.map(((t,i)=>({price:t.price,offset:e.points[i].offset,time_t:e.points[i].time_t})));if(super.restoreExternalPoints({...e,points:s},t),t.pricesChanged&&this._points.length===s.length)for(let e=0;e<s.length;e++)this._points[e].price=s[e].price}restorePoints(e,t,i){super.restorePoints(e,t,i),this._alertCreationAvailable.setValue(super.alertCreationAvailable().value()&&this._isTimePointsValid())}setPoint(e,t,i,r){var n;if(this._points[0].index===this._points[1].index&&e>=4)return;this._snapPointBeforeChange(e,t,i);const o=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[0])),a=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[1])),c=(0,s.ensureNotNull)(this.pointToScreenPoint(t)),u=(0,s.ensureNotNull)(this._coordOffsetWhileMovingOrChanging),h=(0,s.ensureNotNull)(this.priceScale()),d=(0,s.ensure)(null===(n=this.ownerSource())||void 0===n?void 0:n.firstValue());switch(e){case 0:super.setPoint(e,t,i),this._points[2].price=h.coordinateToPrice(c.y+u,d);break;case 1:super.setPoint(e,t,i);break;case 2:super.setPoint(e,t,i),this._points[0].price=h.coordinateToPrice(c.y-u,d),this._points[0].index=t.index;break;case 3:this._points[1].price=h.coordinateToPrice(c.y-u,d),this._points[1].index=t.index;break;case 4:{const e=a.subtract(o),t=(c.x-o.x)/e.x,i=o.addScaled(e,t),s=c.y-i.y;this._points[2].price=h.coordinateToPrice(o.y+s,d);break}case 5:{const e=a.subtract(o),t=(c.x-o.x)/e.x,i=o.addScaled(e,t),s=c.y-i.y;this._points[0].price=h.coordinateToPrice(o.y+s,d),this._points[1].price=h.coordinateToPrice(a.y+s,d);break}}const p=this.linkKey().value();if(p&&!r&&e<4){const e=this._points.map((e=>e.price));(0,l.changeLineStyle)({model:this._model,linkKey:p,state:{prices:e}})}}state(e){const t=super.state(e);return this._pendingPriceOffset&&(t.priceOffset=this._pendingPriceOffset),t}restoreExternalState(e){const{prices:t,...i}=e;if(t&&this.isActualSymbol())for(let e=0;e<t.length;e++)this._points[e].price=this._timePoint[e].price=t[e];super.restoreExternalState(i)}restoreData(e){void 0!==e.priceOffset&&(this._pendingPriceOffset=e.priceOffset)}getPoint(e){if(e<3)return super.getPoint(e);const t=this.pointToScreenPoint(this._points[0]),i=this.pointToScreenPoint(this._points[1]),s=this.pointToScreenPoint(this._points[2]);if(!t||!i||!s)return null;switch(e){case 3:{const e=s.y-t.y,n=i.add(new r.Point(0,e));return this.screenPointToPoint(n)}case 4:{const e=s.y-t.y,n=i.add(new r.Point(0,e)),o=s.add(n).scaled(.5);return this.screenPointToPoint(o)}case 5:{const e=t.add(i).scaled(.5);return this.screenPointToPoint(e)}} return null}alignCrossHairToAnchor(e){return e<=3}pointsCount(){return 3}name(){return"Parallel Channel"}hasEditableCoordinates(){return!1}addPoint(e,t,i){const r=this.points().length;return t&&t.shift()&&2===r&&this._snapPoint45Degree(e,this.points()[0]),2===this._points.length&&(e=this._convertLastPointTo3rdPoint((0,s.ensureNotNull)(this._lastPoint))),super.addPoint(e,t)}timeAxisPoints(){return this._axisPoints()}priceAxisPoints(){return this._axisPoints()}canHasAlert(){return!0}template(){const e=super.template();return e.labelText=this.properties().childs().labelText.value(),e}hasStateForAlert(){return super.hasStateForAlert()&&this._isTimePointsValid()}static createProperties(e){const t=new o.DefaultProperty({defaultName:"linetoolparallelchannel",state:e});return this._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(96461),i.e(24770),i.e(30154),i.e(82375),i.e(18537)]).then(i.bind(i,761649))).ParallelChannelDefinitionsViewModel}_applyTemplateImpl(e){var t;super._applyTemplateImpl(e),this.properties().childs().labelText.setValue(null!==(t=e.labelText)&&void 0!==t?t:"")}_getAlertPlots(){const e=this.getPoint(3);if(!e)return[];const t=[this._points[0],this._points[1],this._points[2],e],i=(e,t)=>e.index<=t.index?[e,t]:[t,e],s=i(t[0],t[1]),r=i(t[2],t[3]);let n,o,l,a;t[2].price<t[0].price?(o=r,n=s):(o=s,n=r);const c=this.properties().childs().extendLeft.value(),u=this.properties().childs().extendRight.value();return t[0].index<=t[1].index?(l=c,a=u):(l=u,a=c),[this._linePointsToAlertPlot(n,"Upper",l,a),this._linePointsToAlertPlot(o,"Lower",l,a)].filter((e=>null!==e))}_correctLastPoint(e){if(this._points.length<2||this._points[1].index===this._points[0].index)return e;const t=(0,s.ensureNotNull)(this.pointToScreenPoint(e)),i=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[1])),n=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[0])),o=i.subtract(n),l=(t.x-n.x)/o.x,a=n.addScaled(o,l),c=t.y-a.y,u=n.add(new r.Point(0,c));return(0,s.ensureNotNull)(this.screenPointToPoint(u))}static _configureProperties(e){super._configureProperties(e),e.hasChild("labelText")||e.addChild("labelText",new u.Property("")),e.addExcludedKey("labelText",1)}_isTimePointsValid(){return this._timePoint.every((e=>Number.isFinite(e.price)))}_axisPoints(){const e=this.points(),t=this._points[0]?this.pointToScreenPoint(this._points[0]):null,i=this._points[1]?this.pointToScreenPoint(this._points[1]):null,n=this._points[2]?this.pointToScreenPoint(this._points[2]):null;if(t&&i&&n){const o=i.y-t.y,l=n.add(new r.Point(0,o));e.push((0,s.ensureNotNull)(this.screenPointToPoint(l)))}return e}_convertLastPointTo3rdPoint(e){const t=(0,s.ensureNotNull)(this.pointToScreenPoint(e)),i=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[1])),n=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[0])),o=i.subtract(n),l=(t.x-n.x)/o.x,a=n.addScaled(o,l),c=t.y-a.y,u=n.add(new r.Point(0,c));return(0,s.ensureNotNull)(this.screenPointToPoint(u))}_findPixelsHeight(){ const e=this.pointToScreenPoint(this._points[2]),t=this.pointToScreenPoint(this._points[0]);return e&&t?e.y-t.y:null}_applyPendingPriceOffset(){const e=this._pendingPriceOffset;if(null===e||this._points.length<3)return;const t=this.priceScale(),i=(0,s.ensureNotNull)(this.ownerSource()).firstValue();if(!t||t.isEmpty()||null===i)return;const r=e+this._points[0].price,n=e+this._points[1].price,o=.5*(r+n)-e,l=.5*(r+n),a=t.priceToCoordinate(o,i),c=t.priceToCoordinate(l,i)-a,u=t.priceToCoordinate(this._points[0].price,i)+c,h=t.coordinateToPrice(u,i);this._points[2].price=h,this._timePoint[2].price=h,this._points[2].index=this._points[0].index,this._timePoint[2].time_t=this._timePoint[0].time_t,this._timePoint[2].offset=this._timePoint[0].offset,this._pendingPriceOffset=null}_snapPointBeforeChange(e,t,i){if(i&&i.shift())switch(e){case 0:case 1:this._snapPoint45Degree(t,this._points[1-e]);break;case 2:case 3:const i=(0,s.ensureNotNull)(this.getPoint(5-e));this._snapPoint45Degree(t,i)}}}},999432:(e,t,i)=>{i.d(t,{LineToolPath:()=>c});var s=i(650151),r=i(86441),n=i(853965),o=i(9640),l=i(821979),a=i(31712);class c extends l.LineDataSource{constructor(e,t,s,r){const n=t||c.createProperties();super(e,n,s,r),this._finished=!1,Promise.all([i.e(39232),i.e(33193),i.e(99898),i.e(76792),i.e(77028),i.e(51583)]).then(i.bind(i,310981)).then((t=>{this._setPaneViews([new t.PathPaneView(this,e)])}))}pointsCount(){return-1}name(){return"Path"}hasEditableCoordinates(){return!1}finish(){this._finished=!0,this._lastPoint=null,this._normalizePoints(),this.createServerPoints()}addPoint(e,t,i){var n;if(this._finished)return!0;const l=(0,s.ensureNotNull)(this.priceScale()),a=this._model.timeScale().indexToCoordinate(e.index),c=e.price,u=(0,s.ensure)(null===(n=this.ownerSource())||void 0===n?void 0:n.firstValue()),h=l.priceToCoordinate(c,u);if(this._points.length>0){const e=this._points[this._points.length-1],i=this._model.timeScale().indexToCoordinate(e.index),s=e.price,n=l.priceToCoordinate(s,u),c=new r.Point(a,h).subtract(new r.Point(i,n)).length();if(!(null==t?void 0:t.isApiEvent())&&c<(0,o.interactionTolerance)().minDistanceBetweenPoints)return this._lastPoint=null,this._normalizePoints(),this.createServerPoints(),!0}return super.addPoint(e,t,i)}static createProperties(e){const t=new n.DefaultProperty({defaultName:"linetoolpath",state:e});return this._configureProperties(t),t}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(96461),i.e(24770),i.e(30154),i.e(82375),i.e(18537)]).then(i.bind(i,317115)).then((e=>e.PathDefinitionsViewModel))}static _configureProperties(e){super._configureProperties(e),e.addChild("linesWidths",new a.LineToolWidthsProperty([(0,s.ensureDefined)(e.child("lineWidth"))])),e.addChild("linesColors",new a.LineToolColorsProperty([e.childs().lineColor]))}}},932732:(e,t,i)=>{var s=i(809796).TranslatedString,r=i(821979).LineDataSource,n=i(517336).LevelsProperty,o=i(31712),l=o.LineToolWidthsProperty,a=o.LineToolColorsProperty,c=new s("erase level line",i.tf(null,void 0,i(812962)));class u extends r{ constructor(e,t,s,r){super(e,t||u.createProperties(),s,r),Promise.all([i.e(39232),i.e(33193),i.e(99898),i.e(76792),i.e(77028),i.e(51583)]).then(i.bind(i,443454)).then((({PitchfanLinePaneView:e})=>{this._setPaneViews([new e(this,this._model)])}))}levelsCount(){return u.LevelsCount}pointsCount(){return 3}name(){return"Pitchfan"}processErase(e,t){var i="level"+t,s=this.properties()[i].visible;e.setProperty(s,!1,c)}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(96461),i.e(24770),i.e(30154),i.e(82375),i.e(18537)]).then(i.bind(i,315340))).PitchBaseDefinitionsViewModel}static createProperties(e){var t=new n({defaultName:"linetoolpitchfan",state:e,map:{range:[0,8]}});return this._configureProperties(t),t}static _configureProperties(e){super._configureProperties(e);for(var t=[e.child("median").child("linewidth")],i=[e.child("median").child("color")],s=0;s<=this.LevelsCount;s++)t.push(e.child("level"+s).child("linewidth")),i.push(e.child("level"+s).child("color"));e.addChild("linesColors",new a(i)),e.addChild("linesWidths",new l(t))}}u.LevelsCount=8,t.LineToolPitchfan=u},9093:(e,t,i)=>{var s=i(809796).TranslatedString,r=i(821979).LineDataSource,n=i(517336).LevelsProperty,o=i(373571).Action,l=i(607509).ACTION_ID,a=i(642346).LineToolPitchforkStyle,c=null,u=i(31712),h=u.LineToolWidthsProperty,d=u.LineToolColorsProperty,p=new s("erase level line",i.tf(null,void 0,i(812962))),_=new s("change {title} style",i.tf(null,void 0,i(474428)));class f extends r{constructor(e,t,i,s){super(e,t||f.createProperties(),i,s),this._properties.style.listeners().subscribe(this,this._recreatePaneView),this._recreatePaneView()}levelsCount(){return f.LevelsCount}additionalActions(e){for(var t=[],r=[{title:i.tf(null,void 0,i(825595)),actionId:l.ChartLineToolPitchforkChangeTypeToOriginal},{title:i.tf(null,void 0,i(966276)),actionId:l.ChartLineToolPitchforkChangeTypeToModifiedSchiff},{title:i.tf(null,void 0,i(809114)),actionId:l.ChartLineToolPitchforkChangeTypeToInside},{title:i.tf(null,void 0,i(151464)),actionId:l.ChartLineToolPitchforkChangeTypeToSchiff}],n=0;n<4;n++){var a=new o({actionId:r[n].actionId,options:{checked:this.properties().style.value()===n,checkable:!0,label:r[n].title,payload:{target:this,value:n},onExecute:function(t){var i=t.getPayload(),r=i.target;e.setProperty(r.properties().style,i.value,_.format({title:new s(r.name(),r.title())})),r.updateAllViews(),r._model.updateSource(r)}}});t.push(a)}return[t[0],t[3],t[1],t[2]]}_recreatePaneView(){if(null!==c){var e=[];this._properties.style.value()===a.Original?e=[new c.PitchforkLinePaneView(this,this._model)]:this._properties.style.value()===a.Schiff?e=[new c.SchiffPitchforkLinePaneView(this,this._model)]:this._properties.style.value()===a.Schiff2?e=[new c.SchiffPitchfork2LinePaneView(this,this._model)]:this._properties.style.value()===a.Inside&&(e=[new c.InsidePitchforkLinePaneView(this,this._model)]),this._setPaneViews(e)}else Promise.all([i.e(39232),i.e(33193),i.e(99898),i.e(76792),i.e(77028),i.e(51583)]).then(i.bind(i,183415)).then((e=>{null===c&&(c=e), this._recreatePaneView()}))}pointsCount(){return 3}name(){return"Pitchfork"}processErase(e,t){var i="level"+t,s=this.properties()[i].visible;e.setProperty(s,!1,p)}static createProperties(e){var t=new n({defaultName:"linetoolpitchfork",state:e,map:{range:[0,8]}});return this._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(96461),i.e(24770),i.e(30154),i.e(82375),i.e(18537)]).then(i.bind(i,61107))).PitchForkDefinitionsViewModel}static _configureProperties(e){super._configureProperties(e);for(var t=[e.child("median").child("linewidth")],i=[e.child("median").child("color")],s=0;s<=this.LevelsCount;s++)t.push(e.child("level"+s).child("linewidth")),i.push(e.child("level"+s).child("color"));e.addChild("linesColors",new d(i)),e.addChild("linesWidths",new h(t))}}f.LevelsCount=8,t.LineToolPitchfork=f},527342:(e,t,i)=>{i.d(t,{LineToolPolyline:()=>a});var s=i(650151),r=i(86441),n=i(853965),o=i(9640),l=i(821979);class a extends l.LineDataSource{constructor(e,t,s,r){const n=t||a.createProperties();super(e,n,s,r),this._finished=!1,Promise.all([i.e(39232),i.e(33193),i.e(99898),i.e(76792),i.e(77028),i.e(51583)]).then(i.bind(i,623652)).then((t=>{this._setPaneViews([new t.PolylinePaneView(this,e)])}))}pointsCount(){return-1}name(){return"Polyline"}hasEditableCoordinates(){return!1}finish(){this._finished=!0,this._lastPoint=null,this._normalizePoints(),this.createServerPoints()}addPoint(e,t,i){var n;if(this._finished)return!0;const l=(0,s.ensureNotNull)(this.priceScale()),a=this._model.timeScale().indexToCoordinate(e.index),c=e.price,u=(0,s.ensure)(null===(n=this.ownerSource())||void 0===n?void 0:n.firstValue()),h=l.priceToCoordinate(c,u),d=(0,o.interactionTolerance)().minDistanceBetweenPoints;if(this._points.length>0){const e=this._points[this._points.length-1],i=this._model.timeScale().indexToCoordinate(e.index),s=e.price,n=l.priceToCoordinate(s,u),o=new r.Point(a,h).subtract(new r.Point(i,n)).length();if(!(null==t?void 0:t.isApiEvent())&&o<d)return this._lastPoint=null,this._normalizePoints(),this.createServerPoints(),!0;const c=this._points[0],p=this._model.timeScale().indexToCoordinate(c.index),_=l.priceToCoordinate(c.price,u),f=new r.Point(a,h).subtract(new r.Point(p,_)).length();if(!(null==t?void 0:t.isApiEvent())&&f<d)return this.properties().childs().filled.setValue(!0),this._lastPoint=null,this._normalizePoints(),this.createServerPoints(),!0}return super.addPoint(e,t,i)}setPoint(e,t,i){var n;super.setPoint(e,t,i);const l=this.priceScale();if(!(this._model.timeScale().isEmpty()||null===l||l.isEmpty()||e!==this._points.length-1&&0!==e)){const i=(0,s.ensure)(null===(n=this.ownerSource())||void 0===n?void 0:n.firstValue()),a=this._model.timeScale().indexToCoordinate(t.index),c=l.priceToCoordinate(t.price,i),u=e===this._points.length-1?this._points[0]:this._points[this._points.length-1],h=this._model.timeScale().indexToCoordinate(u.index),d=l.priceToCoordinate(u.price,i);new r.Point(a,c).subtract(new r.Point(h,d)).length()<(0, o.interactionTolerance)().minDistanceBetweenPoints&&this.properties().childs().filled.setValue(!0)}}static createProperties(e){const t=new n.DefaultProperty({defaultName:"linetoolpolyline",state:e});return this._configureProperties(t),t}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(96461),i.e(24770),i.e(30154),i.e(82375),i.e(18537)]).then(i.bind(i,371227)).then((e=>e.PolylinesDefinitionsViewModel))}static _configureProperties(e){super._configureProperties(e),e.addExcludedKey("filled",1)}}},674053:(e,t,i)=>{var s=i(477227).LineToolTrading,r=i(821979).LineDataSource,n=i(613053).LineToolTradingPriceAxisView,o=i(586784),l=i(853965).DefaultProperty;const a=i(244842);var c=i(888929).sortSourcesPreOrdered.LineToolPosition;function u(e){return null==e?e="":e+="",e}class h{constructor(e){this._line=e,this._data={bodyText:"position",quantityText:"0"},this._closeEnabled=!0,this._direction="buy",this._profitState="neutral"}setDirection(e){return this._direction=e,this._line.updateAllViewsAndRedraw(),this}setProfitState(e){return this._profitState=e,this._line.updateAllViewsAndRedraw(),this}getPrice(){return this._line.points().length>0?this._line.points()[0].price:this._line._timePoint.length>0?this._line._timePoint[0].price:void 0}setPrice(e){if(this._line.points().length>0){var t=this._line.points()[0];t.price=e,this._line.setPoint(0,t),this._line.updateAllViewsAndRedraw()}return this._line._timePoint.length>0&&(this._line._timePoint[0].price=e),this}getText(){return this._data.bodyText}setText(e){return this._data.bodyText=e||"",this._line.updateAllViewsAndRedraw(),this}setTooltip(e){return this._line.properties().tooltip.setValue(u(e)),this}getTooltip(){return this._line.properties().tooltip.value()}setProtectTooltip(e){return this._line.properties().protectTooltip.setValue(u(e)),this}getProtectTooltip(){return this._line.properties().protectTooltip.value()}setCloseTooltip(e){return this._line.properties().closeTooltip.setValue(u(e)),this}getCloseTooltip(){return this._line.properties().closeTooltip.value()}setReverseTooltip(e){return this._line.properties().reverseTooltip.setValue(u(e)),this}getReverseTooltip(){return this._line.properties().reverseTooltip.value()}getQuantity(){return this._data.quantityText}setQuantity(e){return this._data.quantityText=e||"",this._line.updateAllViewsAndRedraw(),this}getExtendLeft(){var e=this._line.properties().extendLeft.value();return"inherit"===e?this._line._model.properties().tradingProperties.extendLeft.value():e}setExtendLeft(e){return this._line.properties().extendLeft.setValue(e),this}getLineLength(){var e=this._line.properties().lineLength.value();return"inherit"===e?this._line._model.properties().tradingProperties.lineLength.value():e}getLineLengthUnit(){return this._line.properties().lineLengthUnit.value()}setLineLength(e,t="percentage"){const i=t&&"pixel"===t?e:Math.max(0,Math.min(e,100));return this._line.properties().lineLength.setValue(i),this._line.properties().lineLengthUnit.setValue(t),this}getLineColor(){var e=this._line.properties() ;return("buy"===this._direction?e.lineBuyColor:e.lineSellColor).value()}setLineColor(e){return"buy"===this._direction?this.setLineBuyColor(e):this.setLineSellColor(e),this}setLineBuyColor(e){return this._line.properties().lineBuyColor.setValue(e),this}setLineSellColor(e){return this._line.properties().lineSellColor.setValue(e),this}getLineStyle(){var e=this._line.properties().lineStyle.value();return"inherit"===e?this._line._model.properties().tradingProperties.lineStyle.value():e}setLineStyle(e){return this._line.properties().lineStyle.setValue(e),this}getLineWidth(){var e=this._line.properties().lineWidth.value();return"inherit"===e?this._line._model.properties().tradingProperties.lineWidth.value():e}setLineWidth(e){return this._line.properties().lineWidth.setValue(e),this}getBodyBorderColor(){var e=this._line.properties();return("buy"===this._direction?e.bodyBorderBuyColor:e.bodyBorderSellColor).value()}setBodyBorderColor(e){return"buy"===this._direction?this.setBodyBorderBuyColor(e):this.setBodyBorderSellColor(e),this}setBodyBorderBuyColor(e){return this._line.properties().bodyBorderBuyColor.setValue(e),this}setBodyBorderSellColor(e){return this._line.properties().bodyBorderSellColor.setValue(e),this}getBodyBackgroundColor(){return o.getColorFromProperties(this._line.properties().bodyBackgroundColor,this._line.properties().bodyBackgroundTransparency)}setBodyBackgroundColor(e){return o.setColorToProperties(e,this._line.properties().bodyBackgroundColor,this._line.properties().bodyBackgroundTransparency),this}getBodyTextColor(){var e=this._line.properties();return("positive"===this._profitState?e.bodyTextPositiveColor:"negative"===this._profitState?e.bodyTextNegativeColor:e.bodyTextNeutralColor).value()}setBodyTextColor(e){return"positive"===this._profitState?this.setBodyTextPositiveColor(e):"negative"===this._profitState?this.setBodyTextNegativeColor(e):this.setBodyTextNeutralColor(e),this}setBodyTextPositiveColor(e){return this._line.properties().bodyTextPositiveColor.setValue(e),this}setBodyTextNegativeColor(e){return this._line.properties().bodyTextNegativeColor.setValue(e),this}setBodyTextNeutralColor(e){return this._line.properties().bodyTextNeutralColor.setValue(e),this}getBodyFont(){return o.getFontFromProperties(this._line.properties().bodyFontFamily,this._line.properties().bodyFontSize,this._line.properties().bodyFontBold,this._line.properties().bodyFontItalic)}setBodyFont(e){return o.setFontToProperties(e,this._line.properties().bodyFontFamily,this._line.properties().bodyFontSize,this._line.properties().bodyFontBold,this._line.properties().bodyFontItalic),this}getQuantityBorderColor(){var e=this._line.properties();return("buy"===this._direction?e.quantityBorderBuyColor:e.quantityBorderSellColor).value()}setQuantityBorderColor(e){return"buy"===this._direction?this.setQuantityBorderBuyColor(e):this.setQuantityBorderSellColor(e),this}setQuantityBorderBuyColor(e){return this._line.properties().quantityBorderBuyColor.setValue(e),this}setQuantityBorderSellColor(e){ return this._line.properties().quantityBorderSellColor.setValue(e),this}getQuantityBackgroundColor(){var e=this._line.properties();return("buy"===this._direction?e.quantityBackgroundBuyColor:e.quantityBackgroundSellColor).value()}setQuantityBackgroundColor(e){return"buy"===this._direction?this.setQuantityBackgroundBuyColor(e):this.setQuantityBackgroundSellColor(e),this}setQuantityBackgroundBuyColor(e){return this._line.properties().quantityBackgroundBuyColor.setValue(e),this}setQuantityBackgroundSellColor(e){return this._line.properties().quantityBackgroundSellColor.setValue(e),this}getQuantityTextColor(){return o.getColorFromProperties(this._line.properties().quantityTextColor,this._line.properties().quantityTextTransparency)}setQuantityTextColor(e){return o.setColorToProperties(e,this._line.properties().quantityTextColor,this._line.properties().quantityTextTransparency),this}getQuantityFont(){return o.getFontFromProperties(this._line.properties().quantityFontFamily,this._line.properties().quantityFontSize,this._line.properties().quantityFontBold,this._line.properties().quantityFontItalic)}setQuantityFont(e){return o.setFontToProperties(e,this._line.properties().quantityFontFamily,this._line.properties().quantityFontSize,this._line.properties().quantityFontBold,this._line.properties().quantityFontItalic),this}getReverseButtonBorderColor(){var e=this._line.properties();return("buy"===this._direction?e.reverseButtonBorderBuyColor:e.reverseButtonBorderSellColor).value()}setReverseButtonBorderColor(e){return"buy"===this._direction?this.setReverseButtonBorderBuyColor(e):this.setReverseButtonBorderSellColor(e),this}setReverseButtonBorderBuyColor(e){return this._line.properties().reverseButtonBorderBuyColor.setValue(e),this}setReverseButtonBorderSellColor(e){return this._line.properties().reverseButtonBorderSellColor.setValue(e),this}getReverseButtonBackgroundColor(){return o.getColorFromProperties(this._line.properties().reverseButtonBackgroundColor,this._line.properties().reverseButtonBackgroundTransparency)}setReverseButtonBackgroundColor(e){return o.setColorToProperties(e,this._line.properties().reverseButtonBackgroundColor,this._line.properties().reverseButtonBackgroundTransparency),this}getReverseButtonIconColor(){var e=this._line.properties();return("buy"===this._direction?e.reverseButtonIconBuyColor:e.reverseButtonIconSellColor).value()}setReverseButtonIconColor(e){return"buy"===this._direction?this.setReverseButtonIconBuyColor(e):this.setReverseButtonIconSellColor(e),this}setReverseButtonIconBuyColor(e){return this._line.properties().reverseButtonIconBuyColor.setValue(e),this}setReverseButtonIconSellColor(e){return this._line.properties().reverseButtonIconSellColor.setValue(e),this}getCloseButtonBorderColor(){var e=this._line.properties();return("buy"===this._direction?e.closeButtonBorderBuyColor:e.closeButtonBorderSellColor).value()}setCloseButtonBorderColor(e){return"buy"===this._direction?this.setCloseButtonBorderBuyColor(e):this.setCloseButtonBorderSellColor(e),this}setCloseButtonBorderBuyColor(e){ return this._line.properties().closeButtonBorderBuyColor.setValue(e),this}setCloseButtonBorderSellColor(e){return this._line.properties().closeButtonBorderSellColor.setValue(e),this}getCloseButtonBackgroundColor(){return o.getColorFromProperties(this._line.properties().closeButtonBackgroundColor,this._line.properties().closeButtonBackgroundTransparency)}setCloseButtonBackgroundColor(e){return o.setColorToProperties(e,this._line.properties().closeButtonBackgroundColor,this._line.properties().closeButtonBackgroundTransparency),this}getCloseButtonIconColor(){var e=this._line.properties();return("buy"===this._direction?e.closeButtonIconBuyColor:e.closeButtonIconSellColor).value()}setCloseButtonIconColor(e){return"buy"===this._direction?this.setCloseButtonIconBuyColor(e):this.setCloseButtonIconSellColor(e),this}setCloseButtonIconBuyColor(e){return this._line.properties().closeButtonIconBuyColor.setValue(e),this}setCloseButtonIconSellColor(e){return this._line.properties().closeButtonIconSellColor.setValue(e),this}block(){this._blocked=!0,this._line.updateAllViewsAndRedraw()}unblock(){this._blocked=!1,this._line.updateAllViewsAndRedraw()}isFunction(e){return"function"==typeof e}onReverse(e,t){return t?this.isFunction(t)&&(this._onReverseData=e,this._onReverseCallback=t):this.isFunction(e)&&(this._onReverseCallback=e),this}callOnReverse(){this.isFunction(this._onReverseCallback)&&this._onReverseCallback.call(this,this._onReverseData)}isOnReverseCallbackPresent(){return this.isFunction(this._onReverseCallback)}onClose(e,t){return t?this.isFunction(t)&&(this._onCloseData=e,this._onCloseCallback=t):this.isFunction(e)&&(this._onCloseCallback=e),this}setCloseEnabled(e){return this._closeEnabled===e||(this._closeEnabled=e,this._onCloseCallback&&this._line.updateAllViewsAndRedraw()),this}isCloseEnabled(){return this._closeEnabled}callOnClose(){this.isFunction(this._onCloseCallback)&&this._closeEnabled&&this._onCloseCallback.call(this,this._onCloseData)}isOnCloseCallbackPresent(){return this._closeEnabled&&this.isFunction(this._onCloseCallback)}onModify(e,t){return t?this.isFunction(t)&&(this._onModifyData=e,this._onModifyCallback=t):this.isFunction(e)&&(this._onModifyCallback=e),this}callOnModify(){this.isFunction(this._onModifyCallback)&&this._onModifyCallback.call(this,this._onModifyData)}onContextMenu(e,t){return t?this.isFunction(t)&&(this._onContextMenuData=e,this._onContextMenuCallback=t):this.isFunction(e)&&(this._onContextMenuCallback=e),this}shouldShowContextMenu(){return this.isFunction(this._onContextMenuCallback)}callOnContextMenu(){if(this.isFunction(this._onContextMenuCallback))return this._onContextMenuCallback.call(this,this._onContextMenuData)}remove(){this._line._model.removeSource(this._line),delete this._line}}class d extends s{constructor(e,t){super(e,t||d.createProperties()),this._adapter=new h(this),Promise.all([i.e(39232),i.e(33193),i.e(99898),i.e(76792),i.e(77028),i.e(51583)]).then(i.t.bind(i,221759,19)).then((({PositionPaneView:e})=>{this._setPaneViews([new e(this,this._model)])}))}zorder(){return c} isSpeciallyZOrderedSource(){return!0}setPoint(e,t){this._points[e]=t,this._normalizePoints()}addPoint(e,t){return this._points.push(e),this._lastPoint=null,this._normalizePoints(),this.createServerPoints(),!0}name(){return"Position"}createPriceAxisView(e){return this._priceAxisView=new n(this,{pointIndex:e,backgroundPropertyGetter:()=>this._adapter.getLineColor()}),this._priceAxisView}paneViews(){return TradingView.printing&&!a.enabled("snapshot_trading_drawings")?null:this._model.properties().tradingProperties.showPositions.value()?r.prototype.paneViews.call(this):null}priceAxisViews(e,t){return TradingView.printing&&!a.enabled("snapshot_trading_drawings")?null:this._model.properties().tradingProperties.showPositions.value()?r.prototype.priceAxisViews.call(this,e,t):null}hasContextMenu(){return this._adapter.shouldShowContextMenu()}contextMenuItems(){return this._adapter.callOnContextMenu()}formatter(){return this._formatter}static createProperties(e){var t=new l({defaultName:"linetoolposition",state:e,useUserPreferences:!1});return this._configureProperties(t),t}}t.LineToolPosition=d},917004:(e,t,i)=>{var s,r;i.d(t,{AlertStatus:()=>s,Direction:()=>r}),function(e){e[e.Waiting=0]="Waiting",e[e.Success=1]="Success",e[e.Failure=2]="Failure"}(s||(s={})),function(e){e[e.Up=1]="Up",e[e.Down=2]="Down"}(r||(r={}))},240569:(e,t,i)=>{i.d(t,{LineToolPrediction:()=>a});var s=i(650151),r=i(853965),n=i(354950),o=i(821979),l=i(917004);class a extends o.LineDataSource{constructor(e,t,s,r){const n=t||a.createProperties();super(e,n,s,r),this._predictionPaneView=null;const o=this._model.mainSeries();o.properties().childs().interval.subscribe(this,(()=>{this.setStatus(l.AlertStatus.Waiting)})),o.dataEvents().dataUpdated().subscribe(this,this.recalculateStateByData),Promise.all([i.e(39232),i.e(33193),i.e(99898),i.e(76792),i.e(77028),i.e(51583)]).then(i.bind(i,964858)).then((t=>{this._predictionPaneView=new t.PredictionPaneView(this,e),this._setPaneViews([this._predictionPaneView])}))}destroy(){const e=this._model.mainSeries();e.properties().childs().interval.unsubscribeAll(this),e.dataEvents().dataUpdated().unsubscribeAll(this),super.destroy()}dataAndViewsReady(){return super.dataAndViewsReady()&&Boolean(this._predictionPaneView&&this._predictionPaneView.iconsReady())}cloneable(){return!1}isSynchronizable(){return!1}status(){return this._properties.childs().status.value()}setStatus(e){return this._properties.childs().status.setValue(e)}pointsCount(){return 2}name(){return"Forecast"}restorePoints(e,t,i){super.restorePoints(e,t,i),this.recalculateStateByData()}recalculateStateByData(){if(this.isSourceHidden())return;if(this._points.length<2)return;if(this._model.mainSeries().bars().isEmpty())return;const e=this._points[1];if(this.status())return void(e.index>this._model.timeScale().baseIndex()&&this.setStatus(l.AlertStatus.Waiting));const t=this._model.mainSeries().bars().valueAt(e.index);if(null===t)return;const i=this.direction();if(i===l.Direction.Up&&(0, s.ensure)(t[2])>=e.price)this.setStatus(l.AlertStatus.Success);else if(i===l.Direction.Down&&(0,s.ensure)(t[3])<=e.price)this.setStatus(l.AlertStatus.Success);else{const t=(0,s.ensureNotNull)(this._model.mainSeries().bars().lastIndex());e.index!==t&&this.setStatus(l.AlertStatus.Failure)}}addPoint(e,t,i){const s=super.addPoint(e,t,i);return s&&this.recalculateStateByData(),s}endChanging(e,t){const i=super.endChanging(e,t);return this.setStatus(l.AlertStatus.Waiting),this.recalculateStateByData(),i}onData(e){super.onData(e),this.recalculateStateByData()}endMoving(e,t,i){const s=super.endMoving(e,t,i);return this.setStatus(l.AlertStatus.Waiting),this.recalculateStateByData(),s}direction(){if(this._points.length<2)return l.Direction.Up;const e=this._points[0];return this._points[1].price>e.price?l.Direction.Up:l.Direction.Down}static createProperties(e){const t=new r.DefaultProperty({defaultName:"linetoolprediction",state:e});return this._configureProperties(t),t}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(96461),i.e(24770),i.e(30154),i.e(82375),i.e(18537)]).then(i.bind(i,87069)).then((e=>e.PredictionDefinitionsViewModel))}static _configureProperties(e){super._configureProperties(e),e.hasChild("status")||e.addChild("status",new n.Property(l.AlertStatus.Waiting))}}},729443:(e,t,i)=>{var s=i(821979).LineDataSource,r=i(853965).DefaultProperty,n=i(31712).LineToolColorsProperty;class o extends s{constructor(e,t,s,r){super(e,t||o.createProperties(),s,r),Promise.all([i.e(39232),i.e(33193),i.e(99898),i.e(76792),i.e(77028),i.e(51583)]).then(i.t.bind(i,473612,19)).then((({PriceLabelPaneView:e})=>{this._setPaneViews([new e(this,this._model)])}))}pointsCount(){return 1}name(){return"Price Label"}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(96461),i.e(24770),i.e(30154),i.e(82375),i.e(18537)]).then(i.bind(i,732887))).PriceLabelDefinitionsViewModel}static createProperties(e){var t=new r({defaultName:"linetoolpricelabel",state:e});return this._configureProperties(t),t}static _configureProperties(e){super._configureProperties(e),e.addChild("linesColors",new n([e.childs().borderColor])),e.addChild("textsColors",new n([e.childs().color]))}}t.LineToolPriceLabel=o},830695:(e,t,i)=>{i.d(t,{LineToolPriceRange:()=>m});var s=i(821979),r=i(650151),n=i(61499),o=i(853965),l=i(738232),a=i(941883),c=i(923237);const u={...a.nonThemedFactoryDefaultsBase,extendLeft:!1,extendRight:!1},h=a.themedFactoryDefaultsBase,d=(0,o.extractAllPropertiesKeys)((0,r.ensureDefined)(h.get(n.StdTheme.Light))),p=(0,o.extractAllPropertiesKeys)(u),_=[...d,...p,...c.commonLineToolPropertiesStateKeys,...a.allPropertiesStateKeysBase];class f extends a.DateAndPriceBaseProperties{static create(e){return new this({defaultName:"linetoolpricerange",factoryDefaultsSupplier:()=>(0,l.factoryDefaultsForCurrentTheme)(u,h),nonThemedDefaultsKeys:p,themedDefaultsKeys:d,allStateKeys:_,state:e})}}class m extends s.LineDataSource{constructor(e,t,s,r){super(e,t||m.createProperties(),s,r), Promise.all([i.e(39232),i.e(33193),i.e(99898),i.e(76792),i.e(77028),i.e(51583)]).then(i.bind(i,425784)).then((e=>{this._setPaneViews([new e.PriceRangePaneView(this,this._model)])}))}pointsCount(){return 2}name(){return"Price Range"}template(){return this._properties.template()}static createProperties(e){const t=f.create(e);return this._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(96461),i.e(24770),i.e(30154),i.e(82375),i.e(18537)]).then(i.bind(i,133954))).GeneralDatePriceRangeDefinitionsViewModel}}},506416:(e,t,i)=>{i.d(t,{LineToolProjection:()=>o});var s=i(672688),r=i(517336),n=i(31712);class o extends s.LineToolFibWedgeBase{constructor(e,t,s,r){super(e,null!=t?t:o.createProperties(),s,r),Promise.all([i.e(39232),i.e(33193),i.e(99898),i.e(76792),i.e(77028),i.e(51583)]).then(i.bind(i,678175)).then((e=>{this._setPaneViews([new e.ProjectionLinePaneView(this,this._model)])}))}levelsCount(){return 1}name(){return"Projection"}static createProperties(e){const t=new r.LevelsProperty({defaultName:"linetoolprojection",state:e,map:{range:[1,1]}});return this._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(96461),i.e(24770),i.e(30154),i.e(82375),i.e(18537)]).then(i.bind(i,758221))).ProjectionDefinitionsViewModel}static _configureProperties(e){super._configureProperties(e),e.addChild("linesColors",new n.LineToolColorsProperty([e.childs().trendline.childs().color]))}}},352747:(e,t,i)=>{i.d(t,{LineToolRay:()=>r});var s=i(956268);class r extends s.LineToolTrendLine{constructor(e,t,i,s){super(e,null!=t?t:r.createProperties(),i,s)}name(){return"Ray"}static createProperties(e){const t=s.LineToolTrendLine._createPropertiesImpl("linetoolray",e);return r._configureProperties(t),t}}},442724:(e,t,i)=>{i.d(t,{LineToolRectangle:()=>c});var s=i(650151),r=i(86441),n=i(853965),o=i(354950),l=i(821979),a=i(31712);class c extends l.LineDataSource{constructor(e,t,s,r){const n=t||c.createProperties();super(e,n,s,r),Promise.all([i.e(39232),i.e(33193),i.e(99898),i.e(76792),i.e(77028),i.e(51583)]).then(i.bind(i,239631)).then((({RectanglePaneView:t})=>{const i=[new t(this,e)];this._setPaneViews(i)}))}pointsCount(){return 2}textColorsProperty(){return this.properties().childs().showLabel.value()?super.textColorsProperty():null}name(){return"Rectangle"}setPoint(e,t,i){if(e<2&&super.setPoint(e,t,i),i&&i.shift()){const i=this._getAnchorPointForIndex(e);if(e>=4)return this._correctMiddlePoints(e,t,i),void this._normalizePoints();this._snapPoint45Degree(t,i)}switch(e){case 2:this._points[1].price=t.price,this._points[0].index=t.index;break;case 3:this._points[0].price=t.price,this._points[1].index=t.index;break;case 4:this._points[0].index=t.index;break;case 5:this._points[1].index=t.index;break;case 6:this._points[0].price=t.price;break;case 7:this._points[1].price=t.price}this._normalizePoints()}getPoint(e){return e<2?super.getPoint(e):this._getAnchorPointForIndex(e)}template(){const e=super.template() ;return e.text=this.properties().childs().text.value(),e}static createProperties(e,t){const i=new n.DefaultProperty({defaultName:"linetoolrectangle",state:e,useUserPreferences:t});return this._configureProperties(i),i}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(96461),i.e(24770),i.e(30154),i.e(82375),i.e(18537)]).then(i.bind(i,261145)).then((e=>e.RectangleDefinitionsViewModel))}_applyTemplateImpl(e){super._applyTemplateImpl(e),this.properties().childs().text.setValue(e.text)}_snapPoint45Degree(e,t,i){const r=this._priceScale,n=this.ownerSource();if(null===r||null===n)return;const o=n.firstValue();if(null===o)return;const l=this._model.timeScale(),a=(0,s.ensureNotNull)(this.pointToScreenPoint(e)),c=(0,s.ensureNotNull)(this.pointToScreenPoint(t)),u=a.x-c.x,h=a.y-c.y,d=u<0?-1:1,p=h<0?-1:1,_=Math.max(Math.abs(u),Math.abs(h)),f=Math.round(l.coordinateToIndex(c.x+_*d)),m=Math.abs(l.indexToCoordinate(f)-c.x),v=r.coordinateToPrice(c.y+m*p,o);e.index=f,e.price=v}_correctMiddlePoints(e,t,i){e<6?this._correctRightLeftMiddlePoint(e,t,i):this._correctTopBottomMiddlePoint(e,t,i)}_correctRightLeftMiddlePoint(e,t,i){const n=(0,s.ensureNotNull)(this.pointToScreenPoint(t)),o=(0,s.ensureNotNull)(this.pointToScreenPoint(i)),l=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[0])),a=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[1]));let c=n.x-o.x;if(0===c)return;const u=l.x<a.x?1:-1,h=l.y<a.y?1:-1;switch(c*=u,e){case 4:{const e=a.y-h*c/2,t=(0,s.ensureNotNull)(this.screenPointToPoint(new r.Point(a.x,e)));this._points[1].price=t.price;const i=(0,s.ensureNotNull)(this.screenPointToPoint(new r.Point(l.x+u*c,l.y+h*c/2)));this._points[0].price=i.price,this._points[0].index=i.index;break}case 5:{const e=l.y-h*c/2,t=(0,s.ensureNotNull)(this.screenPointToPoint(new r.Point(l.x,e)));this._points[0].price=t.price;const i=(0,s.ensureNotNull)(this.screenPointToPoint(new r.Point(a.x+u*c,a.y+h*c/2)));this._points[1].price=i.price,this._points[1].index=i.index;break}}}_correctTopBottomMiddlePoint(e,t,i){const n=this._priceScale,o=this.ownerSource();if(null===n||null===o)return;const l=this._model.timeScale(),a=o.firstValue();if(null===a)return;const c=(0,s.ensureNotNull)(this.pointToScreenPoint(t)),u=(0,s.ensureNotNull)(this.pointToScreenPoint(i)),h=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[0])),d=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[1])),p=c.y-u.y,_=p<0?-1:1,f=h.x<d.x?1:-1,m=h.y<d.y?1:-1;switch(e){case 6:{const e=Math.floor(d.x-f*p/2),t=(0,s.ensureNotNull)(this.screenPointToPoint(new r.Point(e,d.y))),i=Math.abs(this._points[1].index-t.index),o=f*m*_*Math.ceil(i/2);if(0===o)return;this._points[1].index=this._points[1].index-o;const c=_*Math.abs(l.indexToCoordinate(this._points[1].index)-d.x);this._points[0].price=n.coordinateToPrice(h.y+c,a),this._points[0].index=this._points[0].index+o;break}case 7:{const e=Math.floor(h.x-f*p/2),t=(0,s.ensureNotNull)(this.screenPointToPoint(new r.Point(e,h.y))),i=Math.abs(this._points[0].index-t.index),o=f*m*_*Math.ceil(i/2);if(0===o)return ;this._points[0].index=this._points[0].index-o;const c=_*Math.abs(l.indexToCoordinate(this._points[0].index)-h.x);this._points[1].price=n.coordinateToPrice(d.y+c,a),this._points[1].index=this._points[1].index+o;break}}}_snapTo45DegreesAvailable(){return!0}static _configureProperties(e){super._configureProperties(e),e.hasChild("text")||e.addChild("text",new o.Property("")),e.addChild("linesColors",new a.LineToolColorsProperty([e.childs().color])),e.addChild("textsColors",new a.LineToolColorsProperty([e.childs().textColor],e.childs().showLabel)),e.addExcludedKey("text",1),e.addExcludedKey("linesColors",1),e.addExcludedKey("textsColors",1)}_getAnchorPointForIndex(e){const t=this.points(),i=t[0],s=t[1];let r=0,n=0;switch(e){case 0:r=i.price,n=i.index;break;case 1:r=s.price,n=s.index;break;case 2:r=s.price,n=i.index;break;case 3:r=i.price,n=s.index;break;case 4:r=(s.price+i.price)/2,n=i.index;break;case 5:r=(s.price+i.price)/2,n=s.index;break;case 6:r=i.price,n=(s.index+i.index)/2;break;case 7:r=s.price,n=(s.index+i.index)/2}return{index:n,price:r}}}},264663:(e,t,i)=>{var s;i.d(t,{RiskDisplayMode:()=>s}),function(e){e.Percentage="percents",e.Money="money"}(s||(s={}))},514524:(e,t,i)=>{var s;i.d(t,{RiskRewardPointIndex:()=>s}),function(e){e[e.Entry=0]="Entry",e[e.Close=1]="Close",e[e.ActualEntry=2]="ActualEntry",e[e.ActualClose=3]="ActualClose"}(s||(s={}))},864555:(e,t,i)=>{i.d(t,{LineToolRiskRewardLong:()=>C,LineToolRiskRewardShort:()=>w});var s=i(650151),r=i(182436),n=i(534741),o=i(291784),l=i(821979),a=i(264663),c=i(514524),u=i(229765),h=i(246733);class d extends u.PriceAxisView{constructor(e,t){super(),this._source=e,this._data=t}_updateRendererData(e,t,i){if(e.visible=!1,!this._showAxisLabel())return;const s=this._source.priceScale();if(0===this._source.points().length||null===s||s.isEmpty())return;const r=this._source.ownerSource(),n=null!==r?r.firstValue():null;if(null===n)return;const o=this._data.priceProperty.value(),l=(0,h.resetTransparency)(this._data.colorProperty.value());i.background=l,i.textColor=this.generateTextColor(l),i.coordinate=s.priceToCoordinate(o,n),e.text=s.formatPrice(o,n),e.visible=!0}_showAxisLabel(){return this._source.properties().childs().showPriceLabels.value()||this._source.model().selection().isSelected(this._source)}}var p=i(354950);class _ extends p.Property{constructor(e,t){super(),this._lineSource=e,this._pointIndex=t}value(){const e=this._lineSource.points()[this._pointIndex].price;return this._formatAndParsePrice(e)}state(){return this.value()}merge(e,t){return this.setValue(e),t?[]:null}_formatAndParsePrice(e){var t;const i=(0,s.ensureNotNull)(this._lineSource.ownerSource()),r=(null===(t=i.defaultFormatter)||void 0===t?void 0:t.call(i))||i.formatter();if(r.parse){const t=r.format(e),i=r.parse(t);return i.res?i.value:e}return e}}class f extends _{constructor(e){super(e,0)}setValue(e){const t=this._lineSource.points()[this._pointIndex];this._lineSource.startChanging(this._pointIndex,t),t.price=parseFloat(""+e),this._lineSource.setPoint(this._pointIndex,t), this._lineSource.recalculate(),this._lineSource.model().updateSource(this._lineSource),this._listeners.fire(this,""),this._lineSource.endChanging(!1,!1),this._lineSource.syncPriceLevels()}}class m extends _{constructor(e){super(e,1)}value(){const e=this._lineSource.stopPrice();return this._formatAndParsePrice(e)}setValue(e){const t=Math.round(Math.abs(e-this._lineSource.entryPrice())*this._lineSource.ownerSourceBase());this._lineSource.properties().childs().stopLevel.setValue(t),this._lineSource.syncPriceLevels()}}class v extends _{constructor(e){super(e,2)}value(){const e=this._lineSource.profitPrice();return this._formatAndParsePrice(e)}setValue(e){const t=Math.round(Math.abs(e-this._lineSource.entryPrice())*this._lineSource.ownerSourceBase());this._lineSource.properties().childs().profitLevel.setValue(t),this._lineSource.syncPriceLevels()}}var g=i(389137),P=i(885482),y=i(964824);function S(e){return parseFloat(e.toFixed(2))}class b extends l.LineDataSource{constructor(e,t,n,l){super(e,t,n,l),this._syncStateExclusions=["points","entryPrice","stopPrice","targetPrice","stopLevel","profitLevel","riskSize","qty","amountTarget","amountStop"],this._riskInChange=!1,this.version=2,t.hasChild("stopLevel")||t.hasChild("profitLevel")||(t.addProperty("stopLevel",0),t.addProperty("profitLevel",0),this.ownerSourceChanged().subscribe(this,(()=>{const i=(0,s.ensureNotNull)(e.timeScale().visibleBarsStrictRange()),r=i.firstBar(),n=i.lastBar(),l=(0,s.ensureNotNull)(this.ownerSource()),a=l.priceScale();if(a){let e=(0,s.ensureNotNull)(l.priceRange(r,n,{targetPriceScale:a,scaleSeriesOnly:null==a?void 0:a.isScaleSeriesOnly()}));if(a.isLog()){const t=a.logicalToPrice(e.minValue()),i=a.logicalToPrice(e.maxValue());e=new o.PriceRange(t,i)}if(e&&!e.isEmpty()){const i=Math.round(.2*e.length()*this.ownerSourceBase());t.merge({stopLevel:i,profitLevel:i})}}}),!0));const u=t.childs();u.stopLevel.listeners().subscribe(this,this.recalculate),u.stopLevel.listeners().subscribe(null,(()=>{this.properties().childs().stopPrice.childChanged(null,"")})),u.profitLevel.listeners().subscribe(this,this.recalculate),u.profitLevel.listeners().subscribe(null,(()=>{this.properties().childs().targetPrice.childChanged(null,"")})),t.addChild("entryPrice",new f(this)),t.addChild("stopPrice",new m(this)),t.addChild("targetPrice",new v(this)),t.hasChild("riskSize")||t.addProperty("riskSize",0),t.hasChild("qty")||t.addProperty("qty",0),t.hasChild("amountTarget")||t.addProperty("amountTarget",u.accountSize.value()),t.hasChild("amountStop")||t.addProperty("amountStop",u.accountSize.value()),t.addExcludedKey("riskSize",1),t.addExcludedKey("qty",1),t.addExcludedKey("amountTarget",1),t.addExcludedKey("amountStop",1),this._riskInPercentsFormatter=new r.NumericFormatter(2),this._riskInMoneyFormatter=new r.NumericFormatter,u.risk.subscribe(this,this._recalculateRiskSize),u.accountSize.subscribe(this,this._recalculateRiskSize),u.riskDisplayMode.subscribe(this,this._recalculateRisk),u.riskDisplayMode.subscribe(this,this._recalculateRiskSize), u.entryPrice.subscribe(this,this._recalculateRiskSize),u.stopPrice.subscribe(this,this._recalculateRiskSize),u.profitLevel.subscribe(this,this._recalculateRiskSize),u.profitLevel.subscribe(this,this.syncPriceLevels.bind(this)),u.stopLevel.subscribe(this,this._recalculateRiskSize),u.stopLevel.subscribe(this,this.syncPriceLevels.bind(this)),u.qty.subscribe(this,this._recalculateRiskSize),this.ownerSourceChanged().subscribe(null,((e,t)=>{e&&e.barsProvider().dataUpdated().unsubscribeAll(this),t&&t.barsProvider().dataUpdated().subscribe(this,this._onSeriesUpdated)})),this.pointAdded().subscribe(this,(e=>{switch(e){case c.RiskRewardPointIndex.Entry:case c.RiskRewardPointIndex.Close:this._recalculateRiskSize(),this._recalculateQty()}})),this.pointChanged().subscribe(this,(e=>{switch(e){case c.RiskRewardPointIndex.Entry:case c.RiskRewardPointIndex.Close:this._recalculateRiskSize(),this._recalculateQty()}})),u.riskDisplayMode.value()===a.RiskDisplayMode.Percentage&&u.risk.value()>100&&u.riskDisplayMode.setValueSilently(a.RiskDisplayMode.Money),u.entryPrice.subscribe(this,this._recalculateQty),u.stopPrice.subscribe(this,this._recalculateQty),u.riskSize.subscribe(this,this._recalculateQty),u.entryPrice.subscribe(this,this._recalculateAmount),u.profitLevel.subscribe(this,this._recalculateAmount),u.stopLevel.subscribe(this,this._recalculateAmount),u.accountSize.subscribe(this,this._recalculateAmount),u.riskSize.subscribe(this,this._recalculateAmount),u.qty.subscribe(this,this._recalculateAmount),this._entryPriceAxisView=new d(this,{colorProperty:u.linecolor,priceProperty:u.entryPrice}),this._stopPriceAxisView=new d(this,{colorProperty:u.stopBackground,priceProperty:u.stopPrice}),this._profitPriceAxisView=new d(this,{colorProperty:u.profitBackground,priceProperty:u.targetPrice}),Promise.all([i.e(39232),i.e(33193),i.e(99898),i.e(76792),i.e(77028),i.e(51583)]).then(i.bind(i,7293)).then((({RiskRewardPaneView:t})=>{const i=[new t(this,e)];this._setPaneViews(i)}))}destroy(){var e;null===(e=this.ownerSource())||void 0===e||e.barsProvider().dataUpdated().unsubscribeAll(this),this.ownerSourceChanged().unsubscribeAll(this),super.destroy()}hasEditableCoordinates(){return!1}setOwnerSource(e){super.setOwnerSource(e);const t=this.ownerSource();t&&t.symbolSource().symbolInfo()&&(this._recalculateAmount(),this._recalculateRiskSize(),this._recalculateQty())}pointsCount(){return 2}priceAxisPoints(){const e=this._points[0],t=this._properties.childs();return[{...e,price:t.stopPrice.value()},{...e,price:t.entryPrice.value()},{...e,price:t.targetPrice.value()}]}priceAxisViews(e,t){return this.isSourceHidden()||t!==this.priceScale()||this._model.paneForSource(this)!==e?null:[this._entryPriceAxisView,this._stopPriceAxisView,this._profitPriceAxisView]}updateAllViews(e){this.isActualSymbol()&&this.properties().childs().visible.value()&&((0,P.hideAllDrawings)().value()&&this.userEditEnabled()||(super.updateAllViews(e),this._entryPriceAxisView.update(e),this._stopPriceAxisView.update(e),this._profitPriceAxisView.update(e)))}migrateVersion(e,t,i){ if(1===e&&this._points.length>=1){const e=[];e.push(this._points[0]);let t=this._points[0];if(t={price:t.price,index:this._getClosePointIndex(t.index)},e.push(t),this._points[1]&&e.push(this._points[1]),this._points[2]&&e.push(this._points[2]),this._points=e,this._timePoint.length>=1){const t=[],i=this._timePoint[0];t.push(i);const s={price:i.price,time_t:i.time_t,offset:this._getClosePointIndex(i.offset)};t.push(s),this._timePoint[1]&&e.push(this._points[1]),this._timePoint[2]&&e.push(this._points[2]),this._timePoint=t}}}restoreExternalState(e){if((0,g.isNumber)(e.entryPrice)){if(e=Object.assign({},e),!this.isActualSymbol()){this._timePoint[0].price=e.entryPrice,delete e.entryPrice}this.properties().merge(e)}else super.restoreExternalState(e)}addPoint(e,t,i){e.price=this._roundPrice(e.price),super.addPoint(e,void 0,!0);const s={price:e.price,index:this._getClosePointIndex(e.index)};super._addPointIntenal(s,void 0,!0);const r=this._calculateActualEntry(e,s);if(r){super._addPointIntenal(r,void 0,!0);const e=this._findClosePoint(r,s);e&&super._addPointIntenal(e,void 0,!0)}return this._lastPoint=null,this._normalizePoints(),this.createServerPoints(),!0}setPoint(e,t,i,s){if(!this.isActualSymbol())return;const r=this.properties().childs();switch(this._muteSyncLineStyle(),e){case 0:this._changeEntryPoint(t);break;case 2:r.stopPrice.setValue(this.prepareStopPrice(t.price));break;case 3:r.targetPrice.setValue(this.prepareProfitPrice(t.price));break;case 1:t.price=this._points[0].price,super.setPoint(1,t),this.recalculate()}this._unmuteSyncLineStyleWithoutApplyingChanges(),this.syncPriceLevels()}getPoint(e){switch(e){case 0:return this._points[0];case 1:return{index:this._points[1].index,price:this._points[0].price};case 2:return{index:this._points[0].index,price:this.stopPrice()};case 3:return{index:this._points[0].index,price:this.profitPrice()}}return null}setPoints(e){this._muteSyncLineStyle(),super.setPoints(e),this.recalculate(),this._unmuteSyncLineStyleWithoutApplyingChanges(),this.syncPriceLevels()}start(){super.start(),this.recalculate()}startMoving(e,t,i,r){const n=(0,s.ensureDefined)(e.logical);n.price=this._roundPrice(n.price),super.startMoving(e,t,i)}move(e,t,i,r){const n=(0,s.ensureDefined)(e.logical);n.price=this._roundPrice(n.price),super.move(e,t,i),this.recalculate(),this._entryPriceAxisView.update((0,y.sourceChangeEvent)(this.id()))}axisPoints(){if(!this._points[c.RiskRewardPointIndex.ActualEntry])return[];const e=this._points[c.RiskRewardPointIndex.ActualEntry];let t=null;if(4===this._points.length)t=this._points[c.RiskRewardPointIndex.ActualClose];else{const e=this.lastBarData();if(!e)return[];t={index:e.index,price:e.closePrice}}return[e,t]}recalculateStateByData(){this.recalculate()}recalculate(){if(0===this.points().length)return;const e=this.properties().childs(),t=e.targetPrice.value(),i=e.stopPrice.value(),s=[this._points[0],this._points[1]],r=this._calculateActualEntry(this.points()[0],this.points()[1]);if(r){s.push(r);const e=this._findClosePoint(r,this.points()[1]);e&&s.push(e)}this._points=s, t!==e.targetPrice.value()&&e.targetPrice.listeners().fire(e.targetPrice,""),i!==e.stopPrice.value()&&e.stopPrice.listeners().fire(e.stopPrice,"")}syncPriceLevels(){const e=this.linkKey().value();if(e){const t=this.properties().childs(),i={entryPrice:t.entryPrice.value(),stopLevel:t.stopLevel.value(),profitLevel:t.profitLevel.value()};(0,P.changeLineStyle)({linkKey:e,state:i,model:this._model})}}entryPrice(){return this.points()[0].price}lastBarData(){var e;const t=null===(e=this.ownerSource())||void 0===e?void 0:e.barsProvider();if(!t)return null;const i=t.bars().firstIndex(),r=t.bars().lastIndex();if(null===i||null===r||isNaN(i)||isNaN(r))return null;const o=this.points();if(4===o.length){const e=o[c.RiskRewardPointIndex.ActualClose];return e.index<i?null:{closePrice:e.price,index:Math.min(r,e.index)}}const l=o[c.RiskRewardPointIndex.Close];if(l.index<i)return null;const a=Math.min(r,l.index),u=t.bars().search(a,n.PlotRowSearchMode.NearestLeft);return null===u?null:{closePrice:(0,s.ensure)(u.value[4]),index:u.index}}ownerSourceBase(){var e;const t=null===(e=this.ownerSource())||void 0===e?void 0:e.symbolSource().symbolInfo();return t?t.pricescale/t.minmov:100}getOrderTemplate(){const e=this.ownerSource();if(null===e)return null;const t=this.properties().childs();return{symbol:e.symbolSource().symbol(),qty:t.qty.value()/t.lotSize.value(),limitPrice:t.entryPrice.value(),stopLoss:t.stopPrice.value(),takeProfit:t.targetPrice.value(),side:this._orderSide(),type:1,seenPrice:null}}template(){const e=this.properties().childs(),t=super.template();return t.stopLevel=e.stopLevel.value(),t.profitLevel=e.profitLevel.value(),t}_applyTemplateImpl(e){const{targetPrice:t,stopPrice:i,entryPrice:s,...r}=e;super._applyTemplateImpl(r);const n=this.properties().childs();void 0!==e.stopLevel&&n.stopLevel.setValue(e.stopLevel),void 0!==e.profitLevel&&n.profitLevel.setValue(e.profitLevel)}_propertiesStateExclusions(){return[...super._propertiesStateExclusions(),"entryPrice","stopPrice","targetPrice"]}_correctPoints(e,t){if(!this.isActualSymbol())return!1;const i=super._correctPoints([e[0],e[1]],t);for(let t=0;t<e.length;t++){const i=e[t];i.price=this._roundPrice(i.price)}return i}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(96461),i.e(24770),i.e(30154),i.e(82375),i.e(18537)]).then(i.bind(i,208393))).RiskRewardDefinitionsViewModel}_recalculateRiskSize(){if(this._riskInChange)return;const e=this.properties().childs(),t=e.risk.value(),i=e.riskDisplayMode.value(),s=e.accountSize.value();i===a.RiskDisplayMode.Percentage?e.riskSize.setValue(t/100*s):t>s?(e.risk.setValue(s),e.riskSize.setValue(s)):e.riskSize.setValue(t)}_roundPrice(e){const t=this.ownerSourceBase();return Math.round(e*t)/t}_ownerSourcePointValue(){var e,t,i;return null!==(i=null===(t=null===(e=this.ownerSource())||void 0===e?void 0:e.symbolSource().symbolInfo())||void 0===t?void 0:t.pointvalue)&&void 0!==i?i:1}static _configureProperties(e){l.LineDataSource._configureProperties(e),e.addExcludedKey("stopLevel",1),e.addExcludedKey("profitLevel",1), e.addExcludedKey("stopPrice",1),e.addExcludedKey("targetPrice",1),e.addExcludedKey("entryPrice",1)}_onSeriesUpdated(e,t,i){this.isSourceHidden()||this._points.length<2||null!==i&&i.index>Math.max(this._points[0].index,this._points[1].index)||this.recalculateStateByData()}_recalculateRisk(){const e=this.properties().childs(),t=e.riskDisplayMode.value(),i=e.riskSize.value(),s=e.accountSize.value();let r=e.risk.value();r=t===a.RiskDisplayMode.Percentage?S(i/s*100):S(s/100*r),this._riskInChange=!0,e.risk.setValue(+this._riskFormatter(t).format(r)),this._riskInChange=!1}_recalculateAmount(){if(0===this.points().length)return;const e=this.properties().childs(),t=e.accountSize.value(),i=e.entryPrice.value(),s=e.qty.value(),r=e.stopPrice.value(),n=e.targetPrice.value(),o=this._ownerSourcePointValue();e.amountTarget.setValue(this._amountTarget(t,n,i,s,o)),e.amountStop.setValue(this._amountStop(t,r,i,s,o))}_recalculateQty(){if(0===this.points().length)return;const e=this.properties().childs(),t=e.entryPrice.value(),i=e.stopPrice.value(),s=e.riskSize.value()/(Math.abs(t-i)*this._ownerSourcePointValue());e.qty.setValue(s)}_calculateActualEntry(e,t){const i=this.ownerSource();if(!i)return null;const r=i.barsProvider().bars();if(r.isEmpty())return null;const n=(0,s.ensureNotNull)(r.firstIndex()),o=Math.max(e.index,n),l=e.price,a=(0,s.ensureNotNull)(r.lastIndex()),c=Math.min(a,t.index);for(const e of r.rangeIterator(o,c+1)){const t=e.value;if(null!==t&&(0,s.ensure)(t[2])>=l&&(0,s.ensure)(t[3])<=l)return{index:e.index,price:l}}return null}_riskFormatter(e){return e===a.RiskDisplayMode.Percentage?this._riskInPercentsFormatter:this._riskInMoneyFormatter}_getClosePointIndex(e){const t=this._model.timeScale(),i=Math.round(t.width()/t.barSpacing());return e+Math.max(3,Math.round(.15*i))}_findClosePoint(e,t){const i=this.ownerSource();if(!i)return null;const r=i.barsProvider().bars(),n=(0,s.ensureNotNull)(r.firstIndex()),o=Math.max(e.index,n),l=(0,s.ensureNotNull)(r.lastIndex()),a=Math.min(l,t.index);for(const e of r.rangeIterator(o,a+1)){const t=e.value;if(null===t)continue;const i=this._checkStopPrice(t);if(null!=i)return{index:e.index,price:i}}return null}_changeEntryPoint(e){const t=this.properties().childs(),i=t.stopPrice.value(),s=t.targetPrice.value(),r=1/this.ownerSourceBase(),n=Math.min(i,s)+r,o=Math.max(i,s)-r;e.price=Math.max(n,Math.min(o,this._roundPrice(e.price))),this.setPoints([e,{...this._points[1],price:e.price}]),t.stopPrice.setValue(i),t.targetPrice.setValue(s)}}var x=i(853965);class w extends b{constructor(e,t,i,s){super(e,null!=t?t:w.createProperties(),i,s)}name(){return"Risk/Reward short"}stopPrice(){return this.entryPrice()+this.properties().childs().stopLevel.value()/this.ownerSourceBase()}calculatePL(e){return this.entryPrice()-e}profitPrice(){return this.entryPrice()-this.properties().childs().profitLevel.value()/this.ownerSourceBase()}prepareStopPrice(e){e=this._roundPrice(e);const t=this.entryPrice()+1/this.ownerSourceBase();return Math.max(e,t)}prepareProfitPrice(e){e=this._roundPrice(e) ;const t=this.entryPrice()-1/this.ownerSourceBase();return Math.min(e,t)}static createProperties(e){const t=new x.DefaultProperty({defaultName:"linetoolriskrewardshort",state:e});return this._configureProperties(t),t}_amountTarget(e,t,i,s,r){return S(e+(i-t)*s*r)}_amountStop(e,t,i,s,r){return S(e-(t-i)*s*r)}_checkStopPrice(e){const t=this.stopPrice(),i=this.profitPrice();return(0,s.ensure)(e[2])>=t?this.stopPrice():(0,s.ensure)(e[3])<=i?this.profitPrice():null}_orderSide(){return-1}}class C extends b{constructor(e,t,i,s){super(e,null!=t?t:C.createProperties(),i,s)}name(){return"Risk/Reward long"}stopPrice(){return this.entryPrice()-this.properties().childs().stopLevel.value()/this.ownerSourceBase()}profitPrice(){return this.entryPrice()+this.properties().childs().profitLevel.value()/this.ownerSourceBase()}calculatePL(e){return e-this.entryPrice()}prepareStopPrice(e){e=this._roundPrice(e);const t=this.entryPrice()-1/this.ownerSourceBase();return Math.min(e,t)}prepareProfitPrice(e){e=this._roundPrice(e);const t=this.entryPrice()+1/this.ownerSourceBase();return Math.max(e,t)}static createProperties(e){const t=new x.DefaultProperty({defaultName:"linetoolriskrewardlong",state:e});return this._configureProperties(t),t}_amountTarget(e,t,i,s,r){return S(e+(t-i)*s*r)}_amountStop(e,t,i,s,r){return S(e-(i-t)*s*r)}_checkStopPrice(e){const t=this.stopPrice(),i=this.profitPrice();return(0,s.ensure)(e[3])<=t?this.stopPrice():(0,s.ensure)(e[2])>=i?this.profitPrice():null}_orderSide(){return 1}}},605703:(e,t,i)=>{var s=i(86441).Point,r=i(204652).distanceToLine,n=i(821979).LineDataSource,o=i(853965).DefaultProperty,l=i(31712).LineToolColorsProperty;class a extends n{constructor(e,t,s,r){super(e,t||a.createProperties(),s,r),Promise.all([i.e(39232),i.e(33193),i.e(99898),i.e(76792),i.e(77028),i.e(51583)]).then(i.t.bind(i,642366,19)).then((({RotatedRectanglePaneView:e})=>{this._setPaneViews([new e(this,this._model)])}))}startChanging(e,t){if(super.startChanging(e,t),0===e||1===e){var i=this._getPaneViews()[0],s=i._points[0],n=i._points[1],o=i._points[2];this._distance=r(s,n,o).distance}}setPoint(e,t,i){if(super.setPoint(e,t,i),0===e||1===e){var r=this._getPaneViews()[0];r.update();var n=r._points[0],o=r._points[1].subtract(n),l=new s(o.y,-o.x).normalized().scaled(this._distance),a=n.add(l),c=this.screenPointToPoint(a);this._points[2]=c}}endChanging(e,t){delete this._distance,super.endChanging(e,t)}pointsCount(){return 3}name(){return"Rotated Rectangle"}hasEditableCoordinates(){return!1}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(96461),i.e(24770),i.e(30154),i.e(82375),i.e(18537)]).then(i.bind(i,967382))).GeneralFiguresDefinitionsViewModel}_snapTo45DegreesAvailable(){return!0}static createProperties(e){var t=new o({defaultName:"linetoolrotatedrectangle",state:e});return this._configureProperties(t),t}static _configureProperties(e){super._configureProperties(e),e.addChild("linesColors",new l([e.color]))}}t.LineToolRotatedRectangle=a},115137:(e,t,i)=>{var s=i(517336).LevelsProperty,r=i(9093).LineToolPitchfork ;class n extends r{constructor(e,t,i,s){super(e,t||n.createProperties(),i,s)}name(){return"Modified Schiff Pitchfork"}static createProperties(e){var t=new s({defaultName:"linetoolschiffpitchfork",state:e,map:{range:[0,8]}});return this._configureProperties(t),t}}t.LineToolSchiffPitchfork=n},126144:(e,t,i)=>{var s=i(517336).LevelsProperty,r=i(9093).LineToolPitchfork;class n extends r{constructor(e,t,i,s){super(e,t||n.createProperties(),i,s)}name(){return"Schiff Pitchfork"}static createProperties(e){var t=new s({defaultName:"linetoolschiffpitchfork2",state:e,map:{range:[0,8]}});return this._configureProperties(t),t}}t.LineToolSchiffPitchfork2=n},812788:(e,t,i)=>{i.d(t,{LineToolSignpost:()=>d});var s=i(444372),r=i(853965),n=i(821979),o=i(354950);class l extends o.Property{constructor(e){super(),this._source=e,e.pointAdded().subscribe(this,(()=>this.listeners().fire(this,""))),e.pointChanged().subscribe(this,(()=>this.listeners().fire(this,"")))}value(){const e=this._source.properties().childs().position.value();return parseFloat(e.toFixed(2))}setValue(e){this._source.properties().childs().position.setValue(e),this._source.model().updateSource(this._source),this.listeners().fire(this,""),this._source.syncMultichartState({pricesChanged:!1,indexesChanged:!1})}}var a=i(68626);class c extends a.LineDataSourcePointIndexProperty{constructor(e,t){super(e,t),this._source=e}_setPointImpl(e){this._source.setPointAndChangeIndex(this._pointIndex,e)}}var u=i(31712),h=i(776954);class d extends h.LineToolWithRelativePriceCoordinate{constructor(e,t,s,r){super(e,null!=t?t:d.createProperties(),s,r),Promise.all([i.e(39232),i.e(33193),i.e(99898),i.e(76792),i.e(77028),i.e(51583)]).then(i.bind(i,944581)).then((t=>{this._setPaneViews([new t.SignpostPaneView(this,e)])}))}pointsCount(){return 1}name(){return"Signpost"}customEvent(){return{index:()=>{var e,t;return null!==(t=null===(e=this.points()[0])||void 0===e?void 0:e.index)&&void 0!==t?t:null},position:()=>this.properties().childs().position.value()}}showInObjectTree(){return!this.isPhantom()&&super.showInObjectTree()}isPhantom(){return this._model.isPhantomLine(this)}clonePositionOffset(){return{barOffset:1,xCoordOffset:0,yCoordOffset:0}}template(){const e=super.template(),t=this.properties().childs();return e.text=t.text.value(),e.position=t.position.value(),e}shouldBeRemovedOnDeselect(){const e=this._properties.childs();if(e.showImage.value())return!1;return""===e.text.value().trim()}static createProperties(e){const t=new r.DefaultProperty({defaultName:"linetoolsignpost",state:e});return this._configureProperties(t),t}_createPointProperty(e){super._createPointProperty(e);const t=this._pointsProperty.childs().points[e];t.removeProperty("price"),t.removeProperty("bar"),t.addChild("price",new l(this)),t.addChild("bar",new c(this,0))}_applyTemplateImpl(e){super._applyTemplateImpl(e),this.properties().childs().text.setValue(e.text),this.properties().childs().position.setValue(e.position)}_getPropertyDefinitionsViewModelClass(){ return Promise.all([i.e(96461),i.e(24770),i.e(30154),i.e(82375),i.e(18537)]).then(i.bind(i,611989)).then((e=>e.SignpostDefinitionsViewModel))}static _configureProperties(e){n.LineDataSource._configureProperties(e),e.hasChild("text")||e.addChild("text",new o.Property(s.t(null,void 0,i(37229)))),e.hasChild("position")||e.addChild("position",new o.Property(50)),e.addExcludedKey("text",1),e.addExcludedKey("position",1),e.addChild("backgroundsColors",new u.LineToolColorsProperty([e.childs().plateColor]))}}d.supportPhantomMode=!0},305480:(e,t,i)=>{i.d(t,{LineToolSineLine:()=>n});var s=i(853965),r=i(821979);class n extends r.LineDataSource{constructor(e,t,s,r){super(e,t||n.createProperties(),s,r),Promise.all([i.e(39232),i.e(33193),i.e(99898),i.e(76792),i.e(77028),i.e(51583)]).then(i.bind(i,435977)).then((e=>{this._setPaneViews([new e.SineLinePaneView(this,this._model)])}))}pointsCount(){return 2}name(){return"Sine Line"}static createProperties(e){const t=new s.DefaultProperty({defaultName:"linetoolsineline",state:e});return this._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(96461),i.e(24770),i.e(30154),i.e(82375),i.e(18537)]).then(i.bind(i,925293))).CyclicAndSineLinesPatternDefinitionsViewModel}}},882626:(e,t,i)=>{i.d(t,{LineToolSticker:()=>y});var s=i(885482),r=i(500477),n=i(760184),o=i(201089),l=i(822914),a=i(852290),c=i(33249),u=i(808068),h=i(853965),d=i(923237);const p={intervalsVisibilities:{...u.intervalsVisibilitiesDefaults},size:110},_={sticker:"bitcoin",angle:.5*Math.PI},f=(0,h.extractAllPropertiesKeys)(p),m=(0,h.extractAllPropertiesKeys)(_),v=[...f,...m,...d.commonLineToolPropertiesStateKeys];class g extends c.LineDataSourceProperty{constructor(e){super(e)}static create(e,t){return new this({defaultName:"linetoolsticker",factoryDefaultsSupplier:()=>(0,l.default)(p),nonThemedDefaultsKeys:f,themedDefaultsKeys:[],allStateKeys:v,state:(0,a.default)({},_,{sticker:t},null!=e?e:{})})}}const P=(0,o.getLogger)("Chart.LineToolSticker");class y extends n.LineToolSvgIconBase{constructor(e,t,i,s){super(e,t||y.createProperties(),i,s),this.version=1,this._loadViews()}name(){return"Sticker"}static createProperties(e){const t=g.create(e,s.stickerTool.value());return y._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(96461),i.e(24770),i.e(30154),i.e(82375),i.e(18537)]).then(i.bind(i,282375))).LineDataSourceDefinitionsViewModel}async _loadViews(){const[{getSvgContentForSticker:e,getSvgRenderer:t},{StickerPaneView:s}]=await Promise.all([i.e(25598).then(i.bind(i,40038)),Promise.all([i.e(39232),i.e(33193),i.e(99898),i.e(76792),i.e(77028),i.e(51583)]).then(i.bind(i,434576))]);if(!this._isDestroyed){const i=this._properties.childs().sticker.value();this._svgContent=e(i),this._onIconChanged.fire();const n=t(r.svgRenderer,i);null===n&&P.logWarn(`Couldn't create svg renderer for sticker ${i}`),this._setPaneViews([new s(this,this._model,n)])}}}},760184:(e,t,i)=>{i.d(t,{LineToolSvgIconBase:()=>a}) ;var s=i(650151),r=i(86441),n=i(625422),o=i(707957),l=i(821979);class a extends l.LineDataSource{constructor(e,t,i,s){super(e,t,i,s),this._onIconChanged=new o.Delegate,this._svgContent=null,this._changePointData=null,this._loadViews()}pointsCount(){return 1}hasEditableCoordinates(){return!1}getAnchorLimit(){return 80}getChangePointForSync(e){return null}startChanging(e,t){const i=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[0])),o=this.properties().childs(),l=o.size.value();let a;if(t)a=(0,s.ensureNotNull)(this.pointToScreenPoint(t));else{let e=new r.Point(0,Math.max(80,l)/2);const t=(0,n.rotationMatrix)(o.angle.value());e=(0,n.transformPoint)(t,e),a=i.add(e)}const c=i.subtract(a).length();this._changePointData={centerPoint:i,initialLength:c,initialSize:l},super.startChanging(e,t)}setPoint(e,t,i){const{centerPoint:r,initialLength:n,initialSize:o}=(0,s.ensureNotNull)(this._changePointData),l=(0,s.ensureNotNull)(this.pointToScreenPoint(t)),a=this.properties().childs();if(0===e||1===e){const t=l.subtract(r).normalized();let i=Math.acos(-t.x);Math.asin(t.y)>0&&(i=2*Math.PI-i),0===e&&(i+=Math.PI),a.angle.setValue(i)}else{const e=o*(r.subtract(l).length()/n);a.size.setValue(e)}}getSourceIcon(){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)}}},520259:(e,t,i)=>{i.d(t,{LineToolText:()=>p,LineToolTextAbsolute:()=>_});var s=i(650151),r=i(86441),n=i(790188),o=i(354950),l=i(853965),a=i(31712),c=i(964824),u=i(138886);const h={selectionColor:(0,n.getHexColorByName)("color-tv-blue-500"),cursorColor:(0,n.getHexColorByName)("color-black")},d={selectionColor:(0,n.getHexColorByName)("color-white"),cursorColor:(0,n.getHexColorByName)("color-white")};class p extends u.InplaceTextLineDataSource{constructor(e,t,s,r){const n=t||p.createProperties();super(e,n,s,r),this._barSpacing=e.timeScale().barSpacing(),this._recalculatePointsOnCenter=!1,Promise.all([i.e(39232),i.e(33193),i.e(99898),i.e(76792),i.e(77028),i.e(51583)]).then(i.bind(i,998074)).then((({TextPaneView:t})=>{const i=this._recalculatePointsOnCenter?(e,t)=>{this._recalculatePointsOnCenter&&this._recalculateCenterPosition(e,t)}:void 0;this._setPaneViews([new t(this,e,void 0,void 0,void 0,void 0,void 0,i,this._openTextEditor.bind(this),this._closeTextEditor.bind(this),this.onSelectionChange.bind(this))])}))}centerPosition(){this._recalculatePointsOnCenter=!0}setPoint(e,t,i){const r=this.properties().childs();let n;if(1===e&&r.wordWrapWidth.value()){const e=this.model().timeScale();n=this.isFixed()?(0,s.ensureDefined)(this.fixedPoint()).x:e.indexToCoordinate(this.points()[0].index);const i=e.indexToCoordinate(t.index)-n-~~(r.fontsize.value()/6);if(!isFinite(i))return;r.wordWrapWidth.setValue(Math.max(100,i))}}pointsCount(){return 1}name(){return"Text"}getStyle(){return this._model.dark().value()?d:h}setPriceScale(e){super.setPriceScale(e), e&&e.priceRange()&&(this._priceDencity=e.height()/(0,s.ensureNotNull)(e.priceRange()).length(),this._isPriceDencityLog=e.isLog())}restoreSize(){const e=(0,s.ensureNotNull)(this.priceScale());this._barSpacing=this.model().timeScale().barSpacing(),this._priceDencity=e.height()/(0,s.ensureNotNull)(e.priceRange()).length(),this.updateAllViewsAndRedraw((0,c.sourceChangeEvent)(this.id()))}template(){const e=super.template();return e.text=this.properties().childs().text.value(),e}state(e){const t=super.state(e);return e&&(t.state.fixedSize=!1),t}barSpacing(){return this._barSpacing}priceDencity(){return this._priceDencity}isPriceDencityLog(){return this._isPriceDencityLog}hasEditableCoordinates(){return!1}shouldBeRemovedOnDeselect(){return""===this._properties.childs().text.value().trim()}static createProperties(e){const t=new l.DefaultProperty({defaultName:"linetooltext",state:e});return this._configureProperties(t),t}_applyTemplateImpl(e){super._applyTemplateImpl(e),this.properties().childs().text.setValue(e.text)}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(96461),i.e(24770),i.e(30154),i.e(82375),i.e(18537)]).then(i.bind(i,941117)).then((e=>e.TextDefinitionsViewModel))}static _configureProperties(e){super._configureProperties(e),e.hasChild("text")||e.addChild("text",new o.Property("")),e.addChild("linesColors",new a.LineToolColorsProperty([e.childs().borderColor])),e.addChild("textsColors",new a.LineToolColorsProperty([e.childs().color])),e.addExcludedKey("text",1),e.addExcludedKey("linesColors",3),e.addExcludedKey("textsColors",3)}_recalculateCenterPosition(e,t){const i=this.isFixed()?(0,s.ensureDefined)(this.fixedPoint()):(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[0])),n=new r.Point(i.x-e/2,i.y-t/2),o=(0,s.ensureNotNull)(this.screenPointToPoint(n));this.setPoints([o]),this._normalizePoints(),this.createServerPoints(),this.updateAllViewsAndRedraw((0,c.sourceChangeEvent)(this.id()))}}class _ extends p{constructor(e,t){super(e,t||_.createProperties())}name(){return"Anchored Text"}hasEditableCoordinates(){return!1}isFixed(){return!0}static createProperties(e){const t=new l.DefaultProperty({defaultName:"linetooltextabsolute",state:e});return this._configureProperties(t),t}}},521600:(e,t,i)=>{i.d(t,{LineToolThreeDrivers:()=>o});var s=i(853965),r=i(821979),n=i(31712);class o extends r.LineDataSource{constructor(e,t,s,r){const n=t||o.createProperties();super(e,n,s,r),Promise.all([i.e(39232),i.e(33193),i.e(99898),i.e(76792),i.e(77028),i.e(51583)]).then(i.bind(i,927913)).then((t=>{this._setPaneViews([new t.LineToolThreeDrivesPaneView(this,e)])}))}pointsCount(){return 7}name(){return"Three Drives Pattern"}static createProperties(e){const t=new s.DefaultProperty({defaultName:"linetoolthreedrivers",state:e});return this._configureProperties(t),t}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(96461),i.e(24770),i.e(30154),i.e(82375),i.e(18537)]).then(i.bind(i,669403)).then((e=>e.PatternWithoutBackgroundDefinitionsViewModel))}static _configureProperties(e){ super._configureProperties(e),e.addChild("linesColors",new n.LineToolColorsProperty([e.childs().color])),e.addChild("textsColors",new n.LineToolColorsProperty([e.childs().textcolor])),e.addChild("linesWidths",new n.LineToolWidthsProperty([e.childs().linewidth])),e.hasChild("backgroundsColors")&&e.removeProperty("backgroundsColors")}}},36459:(e,t,i)=>{i.d(t,{LineToolTimeCycles:()=>o});var s=i(822914),r=i(853965),n=i(821979);class o extends n.LineDataSource{constructor(e,t,s,r){super(e,null!=t?t:o.createProperties(),s,r),Promise.all([i.e(39232),i.e(33193),i.e(99898),i.e(76792),i.e(77028),i.e(51583)]).then(i.bind(i,764389)).then((e=>{this._setPaneViews([new e.TimeCyclesPaneView(this,this._model)])}))}pointsCount(){return 2}name(){return"Time Cycles"}setPoint(e,t){const i=(0,s.default)(t),r=this._points[0],n=this._points[1];r.price=i.price,n.price=i.price,this._points[e]=i,this._normalizePoints()}addPoint(e,t,i){const s=super.addPoint(e,t,!0);if(s){const e=this._points[0];this._points[1].price=e.price,i||(this._normalizePoints(),this.createServerPoints())}return s}static createProperties(e){const t=new r.DefaultProperty({defaultName:"linetooltimecycles",state:e});return this._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(96461),i.e(24770),i.e(30154),i.e(82375),i.e(18537)]).then(i.bind(i,73900))).TimeCyclesPatternDefinitionsViewModel}}},167723:(e,t,i)=>{i.d(t,{LineToolTrendAngle:()=>u});var s=i(86441),r=i(650151),n=i(853965),o=i(821979),l=i(354950),a=i(964824);class c extends l.Property{constructor(e){super(),this._lineSource=e}value(){return Math.round(180*this._lineSource.angle()/Math.PI)}setValue(e){const t=e*Math.PI/180,i=(0,r.ensureNotNull)(this._lineSource.pointToScreenPoint(this._lineSource.points()[0])),n=Math.cos(t),o=-Math.sin(t),l=new s.Point(n,o),c=i.addScaled(l,this._lineSource.distance()),u=(0,r.ensureNotNull)(this._lineSource.screenPointToPoint(c));this._lineSource.setPoint(1,u);const h=this._lineSource.model();h.updateSource(this._lineSource),this._lineSource.updateAllViews((0,a.sourceChangeEvent)(this._lineSource.id())),h.updateSource(this._lineSource)}notifyChanged(){this._listeners.fire(this,"")}}class u extends o.LineDataSource{constructor(e,t,s,r){const n=t||u.createProperties();super(e,n,s,r),this._angle=0,this._distance=0,n.addChild("angle",new c(this)),Promise.all([i.e(39232),i.e(33193),i.e(99898),i.e(76792),i.e(77028),i.e(51583)]).then(i.bind(i,528123)).then((({TrendAnglePaneView:t})=>{const i=[new t(this,e)];this._setPaneViews(i)}))}isSynchronizable(){return!1}pointsCount(){return 2}name(){return"Trend Angle"}angle(){return this._angle}distance(){return this._distance}addPoint(e,t){const i=super.addPoint(e,t);return i&&this._calculateAngle(),i}setLastPoint(e,t){const i=super.setLastPoint(e,t);return this.points().length>1&&this._calculateAngle(),i}axisPoints(){if(this.points().length<2)return[];const e=[this.points()[0]],t=(0, r.ensureNotNull)(this.pointToScreenPoint(this.points()[0])),i=Math.cos(this._angle)*this._distance,n=-Math.sin(this._angle)*this._distance,o=t.add(new s.Point(i,n)),l=(0,r.ensureNotNull)(this.screenPointToPoint(o));return e.push(l),e}timeAxisPoints(){return this.axisPoints()}priceAxisPoints(){return this.axisPoints()}setPoint(e,t,i){super.setPoint(e,t,i),this.points().length>1&&1===e&&this._calculateAngle()}restoreData(e){var t,i;this._angle=null!==(t=e.angle)&&void 0!==t?t:0,this._distance=null!==(i=e.distance)&&void 0!==i?i:0}state(e){const t=super.state(e);return t.angle=this._angle,t.distance=this._distance,t}cloneData(e){this._angle=e.angle(),this._distance=e.distance()}canHasAlert(){return!0}static createProperties(e){e&&void 0===e.showPercentPriceRange&&(e.showPercentPriceRange=e.showPriceRange,e.showPipsPriceRange=e.showPriceRange);const t=new n.DefaultProperty({defaultName:"linetooltrendangle",state:e});return this._configureProperties(t),t}_snapTo45DegreesAvailable(){return!0}_getAlertPlots(){const e=this._linePointsToAlertPlot(this._points,null,this._properties.childs().extendLeft.value(),this._properties.childs().extendRight.value());return null===e?[]:[e]}_calculateAngle(){const e=(0,r.ensureNotNull)(this.pointToScreenPoint(this.points()[0]));let t=(0,r.ensureNotNull)(this.pointToScreenPoint(this.points()[1])).subtract(e);const i=t.length();i>0?(t=t.normalized(),this._angle=Math.acos(t.x),t.y>0&&(this._angle=-this._angle),this._distance=i):this._angle=0;this.properties().childs().angle.notifyChanged()}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(96461),i.e(24770),i.e(30154),i.e(82375),i.e(18537)]).then(i.bind(i,476535)).then((e=>e.TrendAngleDefinitionsViewModel))}}},882980:(e,t,i)=>{i.d(t,{LineToolTrendBasedFibExtension:()=>c});var s=i(444372),r=i(809796),n=i(517336),o=i(31712),l=i(821979);const a=new r.TranslatedString("erase level line",s.t(null,void 0,i(812962)));class c extends l.LineDataSource{constructor(e,t,s,r){super(e,t||c.createProperties(),s,r),this.version=2,Promise.all([i.e(39232),i.e(33193),i.e(99898),i.e(76792),i.e(77028),i.e(51583)]).then(i.bind(i,242128)).then((({TrendBasedFibExtensionPaneView:e})=>{this._setPaneViews([new e(this,this._model)])}))}levelsCount(){return 24}pointsCount(){return 3}name(){return"Trend-Based Fib Extension"}migrateVersion(e,t){1===e&&this.properties().childs().extendLines.setValue(!0)}processErase(e,t){const i="level"+t,s=this.properties().childs()[i].childs().visible;e.setProperty(s,!1,a)}fibLevelsBasedOnLogScale(){var e;return this.properties().childs().fibLevelsBasedOnLogScale.value()&&Boolean(null===(e=this.priceScale())||void 0===e?void 0:e.isLog())}static createProperties(e){const t=new n.LevelsProperty({defaultName:"linetooltrendbasedfibextension",state:e,map:{range:[0,8]}});return this._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(96461),i.e(24770),i.e(30154),i.e(82375),i.e(18537)]).then(i.bind(i,866406))).FibDrawingsWith24LevelsDefinitionsViewModel} static _configureProperties(e){const t=e.childs();super._configureProperties(e);const i=[t.trendline.childs().color];for(let e=1;e<=24;e++){const s=t["level"+e].childs().color;i.push(s)}e.addChild("linesColors",new o.LineToolColorsProperty(i));const s=[t.trendline.childs().linewidth,t.levelsStyle.childs().linewidth];e.addChild("linesWidths",new o.LineToolWidthsProperty(s))}}},418219:(e,t,i)=>{i.d(t,{LineToolTrendBasedFibTime:()=>c});var s=i(444372),r=i(809796),n=i(821979),o=i(517336),l=i(31712);const a=new r.TranslatedString("erase level line",s.t(null,void 0,i(812962)));class c extends n.LineDataSource{constructor(e,t,s,r){super(e,t||c.createProperties(),s,r),this.version=1,Promise.all([i.e(39232),i.e(33193),i.e(99898),i.e(76792),i.e(77028),i.e(51583)]).then(i.bind(i,61304)).then((({TrendBasedFibTimePaneView:e})=>{this._setPaneViews([new e(this,this._model)])}))}levelsCount(){return 11}pointsCount(){return 3}name(){return"Trend-Based Fib Time"}processErase(e,t){const i="level"+t,s=this.properties().childs()[i].childs().visible;e.setProperty(s,!1,a)}static createProperties(e){const t=new o.LevelsProperty({defaultName:"linetooltrendbasedfibtime",state:e,map:{range:[1,11]}});return this._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(96461),i.e(24770),i.e(30154),i.e(82375),i.e(18537)]).then(i.bind(i,663394))).TrendBasedFibTimeDefinitionsViewModel}static _configureProperties(e){super._configureProperties(e);const t=e.childs(),i=[t.trendline.childs().linewidth],s=[t.trendline.childs().color];for(let e=1;e<=11;e++)i.push(t["level"+e].childs().linewidth),s.push(t["level"+e].childs().color);e.addChild("linesColors",new l.LineToolColorsProperty(s)),e.addChild("linesWidths",new l.LineToolWidthsProperty(i))}}},956268:(e,t,i)=>{i.d(t,{LineToolTrendLine:()=>l});var s=i(853965),r=i(821979),n=i(837202),o=i(354950);class l extends r.LineDataSource{constructor(e,t,s,r){super(e,t||l.createProperties(),s,r),this._trendLinePaneView=null,Promise.all([i.e(39232),i.e(33193),i.e(99898),i.e(76792),i.e(77028),i.e(51583)]).then(i.bind(i,982446)).then((({TrendLinePaneView:e})=>{this._trendLinePaneView=new e(this,this._model),this._setPaneViews([this._trendLinePaneView])}))}dataAndViewsReady(){return super.dataAndViewsReady()&&null!==this._trendLinePaneView&&this._trendLinePaneView.iconsReady()}pointsCount(){return 2}name(){return"Trend Line"}canHasAlert(){return!0}showPriceLabels(){return this._properties.childs().showPriceLabels.value()}createPriceAxisView(e){return new n.LineToolPriceAxisView(this,{pointIndex:e,backgroundPropertyGetter:()=>this.showPriceLabels()?this._properties.childs().linecolor.value():null})}isForcedDrawPriceAxisLabel(){return this.showPriceLabels()}template(){const e=super.template();return e.text=this.properties().childs().text.value(),e}static createProperties(e,t){return l._createPropertiesImpl("linetooltrendline",e,t)}_getAlertPlots(){ const e=this._linePointsToAlertPlot(this._points,null,this._properties.childs().extendLeft.value(),this._properties.childs().extendRight.value());return null===e?[]:[e]}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(96461),i.e(24770),i.e(30154),i.e(82375),i.e(18537)]).then(i.bind(i,167738))).TrendLineDefinitionsViewModel}_applyTemplateImpl(e){super._applyTemplateImpl(e),this.properties().childs().text.setValue(e.text||"")}_snapTo45DegreesAvailable(){return!0}static _createPropertiesImpl(e,t,i){t&&void 0===t.showPercentPriceRange&&(t.showPercentPriceRange=t.showPriceRange,t.showPipsPriceRange=t.showPriceRange);const r=new s.DefaultProperty({defaultName:e,state:t,useUserPreferences:i});return this._configureProperties(r),r}static _configureProperties(e){super._configureProperties(e),e.hasChild("text")||e.addChild("text",new o.Property("")),e.addExcludedKey("text",1)}}},948653:(e,t,i)=>{i.d(t,{LineToolTrianglePattern:()=>o});var s=i(853965),r=i(821979),n=i(31712);class o extends r.LineDataSource{constructor(e,t,s,r){const n=t||o.createProperties();super(e,n,s,r),Promise.all([i.e(39232),i.e(33193),i.e(99898),i.e(76792),i.e(77028),i.e(51583)]).then(i.bind(i,658539)).then((t=>{this._setPaneViews([new t.LineToolTrianglePatternPaneView(this,e)])}))}pointsCount(){return 4}name(){return"Triangle Pattern"}static createProperties(e){const t=new s.DefaultProperty({defaultName:"linetooltrianglepattern",state:e});return this._configureProperties(t),t}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(96461),i.e(24770),i.e(30154),i.e(82375),i.e(18537)]).then(i.bind(i,63124)).then((e=>e.PatternWithBackgroundDefinitionViewModel))}static _configureProperties(e){super._configureProperties(e),e.addChild("linesColors",new n.LineToolColorsProperty([e.childs().color])),e.addChild("textsColors",new n.LineToolColorsProperty([e.childs().textcolor])),e.addChild("backgroundsColors",new n.LineToolColorsProperty([e.childs().backgroundColor]))}}},287743:(e,t,i)=>{var s=i(821979).LineDataSource,r=i(853965).DefaultProperty,n=i(31712).LineToolColorsProperty;class o extends s{constructor(e,t,s,r){super(e,t||o.createProperties(),s,r),Promise.all([i.e(39232),i.e(33193),i.e(99898),i.e(76792),i.e(77028),i.e(51583)]).then(i.t.bind(i,560001,19)).then((({TrianglePaneView:e})=>{this._setPaneViews([new e(this,this._model)])}))}pointsCount(){return 3}name(){return"Triangle"}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(96461),i.e(24770),i.e(30154),i.e(82375),i.e(18537)]).then(i.bind(i,967382))).GeneralFiguresDefinitionsViewModel}static createProperties(e){var t=new r({defaultName:"linetooltriangle",state:e});return this._configureProperties(t),t}static _configureProperties(e){super._configureProperties(e),e.addChild("linesColors",new n([e.childs().color]))}}t.LineToolTriangle=o},972375:(e,t,i)=>{i.d(t,{createTweetLineToolByUrl:()=>h,isTwitterProfileImageUrl:()=>u,isTwitterUrl:()=>c});var s=i(650151),r=i(62802),n=i(541558),o=i(461794),l=i(623336);const a=(0, i(125226).isFeatureEnabled)("mock_tweet_data_for_tests");function c(e){try{const t=new URL(e);return("twitter.com"===t.hostname||t.hostname.endsWith(".twitter.com")||"x.com"===t.hostname||t.hostname.endsWith(".x.com"))&&"https:"===t.protocol}catch(e){return!1}}function u(e){try{const t=new URL(e);return"pbs.twimg.com"===t.hostname&&"https:"===t.protocol&&t.pathname.startsWith("/profile_images/")}catch(e){return!1}}function h(e,t,i=!1){return async function(e){if(a)return{id:0x853cb08cfe8b,created_at:1638107940,text:"ð“ð“ªð“²ð“µð”‚ ð“»ð“®ð“¶ð“²ð“·ð“ð“®ð“»\r\rAlways do your own research.",username:"tradingview",user:"TradingView",profile_image_url:"https://pbs.twimg.com/profile_images/1598328471729704963/D7slFVZN_400x400.jpg",tweet_url:"https://twitter.com/tradingview/status/1464957065621872641?s=20"};const t=new URL("/api/v1/get-tweet-data/",location.href);return t.searchParams.append("tweet_url",e),fetch(t.toString()).then((e=>{if(!e.ok)throw new Error(`Error processing tweet: ${e.statusText}`);return e.json()}))}(e).then((a=>{const c=function(e,t){var i;return{id:e.id,createdAt:e.created_at,text:(0,o.clean)(e.text,!0),username:`@${e.username}`,user:e.user,profileImageUrl:e.profile_image_url,tweetUrl:null!==(i=e.tweet_url)&&void 0!==i?i:t}}(a,e),u={price:0,time_t:c.createdAt,offset:0},h=t.mainSeries(),d=(0,s.ensureNotNull)(t.model().paneForSource(h)),p=d.newLineToolZOrder(!0),_={type:"drawing",source:{id:(0,n.randomHashN)(6),zorder:p,type:"LineToolTweet",position:50,state:{interval:"1",...l.LineToolTweet.createProperties().state()},tweetData:c,symbol:h.symbol(),ownerSource:h.id(),points:[u]},geometry:[],modelId:t.model().id()},f=t.pasteLineTool(d,_,!0,!0);return i&&r.setValue("hint.pasteTweet",!0,{forceFlush:!0}),f.pointAdded().subscribe(null,(()=>t.scrollToLineTool(f)),!0),f}))}},623336:(e,t,i)=>{i.d(t,{LineToolTweet:()=>x});var s=i(853965),r=i(444372),n=i(62802),o=i(345848),l=i(201089),a=i(167222),c=i(846778),u=i(270294),h=i(885482),d=i(543373),p=i(972375);const _=(0,l.getLogger)("Chart.TweetDialog"),f=r.t(null,void 0,i(100970)),m=r.t(null,void 0,i(735415));let v=null;function g(e){"LineToolTweet"===e?(window.is_authenticated||(0,h.resetToCursor)(!0),(0,a.runOrSigninWithFeature)((()=>{h.tool.setValue("LineToolTweet"),v=(0,d.showCustomUrlEventDialog)({onConfirm:P,onClose:()=>{v=null,"LineToolTweet"===h.tool.value()&&(0,h.resetToCursor)(!0)},title:f,placeholderText:m}),(0,o.trackEvent)("Tweet","Open tweet dialog")}),{feature:"drawings",source:"Change drawing tool state"})):null!==v&&v.then((e=>e()))}function P(e){const t=(0,u.chartWidgetCollectionService)();if(null===t)return;if(!(0,p.isTwitterUrl)(e))return void _.logWarn(`Invalid tweet url: ${e}`);const i=!Boolean(n.getBool("hint.pasteTweet")),s=t.activeChartWidget.value();(0,p.createTweetLineToolByUrl)(e,s.model()).then((()=>{i&&(0,c.showPasteLineToolHint)(t.getContainer(),"hint.pasteTweet")}))}var y=i(354950),S=i(70726);class b extends S.CustomEventItem{constructor(e,t){super(t),this._data=e}tweetData(){return this._data}index(){return this._source.eventTimePointIndex()} time(){return this._data.createdAt}avatar(){return this._data.profileImageUrl}}class x extends S.LineToolCustomUrlEvent{constructor(e,t,s,r){super(e,t||x.createProperties(),s,r),Promise.all([i.e(39232),i.e(33193),i.e(99898),i.e(76792),i.e(77028),i.e(51583)]).then(i.bind(i,123896)).then((t=>{this._setPaneViews([new t.TweetPaneView(this,e)])}))}name(){return"Tweet"}state(e){const t=super.state(e);return this._item&&(t.tweetData=this._item.tweetData()),e&&(t.eventTimePointIndex=this._eventTimePointIndex),t}restoreData(e){if(e.tweetData){if(!(0,p.isTwitterUrl)(e.tweetData.tweetUrl))throw new Error(`Invalid url for tweet line tool: ${e.tweetData.tweetUrl}`);this._item=new b(e.tweetData,this)}void 0!==e.eventTimePointIndex&&(this._eventTimePointIndex=e.eventTimePointIndex)}static createProperties(e){const t=new s.DefaultProperty({defaultName:"linetoolTweet",state:e});return this._configureProperties(t),t}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(96461),i.e(24770),i.e(30154),i.e(82375),i.e(18537)]).then(i.bind(i,427491)).then((e=>e.TweetDefinitionsViewModel))}static _configureProperties(e){super._configureProperties(e),e.hasChild("position")||e.addChild("position",new y.Property(50)),e.addExcludedKey("position",1)}}(0,h.runOnDrawingStateReady)((()=>{h.tool.subscribe(g)}))},421644:(e,t,i)=>{i.d(t,{LineToolVertLineTimeAxisView:()=>r});var s=i(902214);class r extends s.LineDataSourceTimeAxisView{constructor(e){super(e,0)}_getBgColor(){return this._source.properties().linecolor.value()}_getAlwaysInViewPort(){return!1}_getIndex(){const e=this._source.points();return 0===e.length?null:e[0].index}}},43653:(e,t,i)=>{i.d(t,{LineToolVertLine:()=>c});var s=i(650151),r=i(86441),n=i(853965),o=i(354950),l=i(821979),a=i(421644);class c extends l.LineDataSource{constructor(e,t,s,r){const n=t||c.createProperties();super(e,n,s,r),this._timeAxisView=new a.LineToolVertLineTimeAxisView(this),this._paneViewFactory=null,this.properties().childs().extendLine.subscribe(this,(()=>e.lightUpdate())),Promise.all([i.e(39232),i.e(33193),i.e(99898),i.e(76792),i.e(77028),i.e(51583)]).then(i.bind(i,590810)).then((t=>{this._paneViewFactory=i=>new t.VertLinePaneView(this,e,i),this._model.lightUpdate()}))}destroy(){this.properties().childs().extendLine.unsubscribeAll(this),super.destroy()}pointsCount(){return 1}name(){return"Vertical Line"}timeAxisViews(){return this.isSourceHidden()?null:this.properties().childs().showTime.value()?[this._timeAxisView]:null}updateAllViews(e){super.updateAllViews(e),this._timeAxisView.update(e)}canHasAlert(){return!0}template(){const e=super.template();return e.text=this.properties().childs().text.value(),e}isMultiPaneAvailable(){return!0}isMultiPaneEnabled(){return this.properties().childs().extendLine.value()}paneViews(e){return e=(0,s.ensureDefined)(e),this.isMultiPaneEnabled()||this._model.paneForSource(this)===e?(null===this._getPaneViews(e)&&null!==this._paneViewFactory&&this._setPaneViews([this._paneViewFactory(e)],e,!0),super.paneViews(e)):null}priceAxisViews(){return null}priceAxisPoints(){ return[]}pointToScreenPoint(e){const t=this._model.timeScale();if(t.isEmpty())return null;const i=t.indexToCoordinate(e.index);return new r.Point(i,0)}convertYCoordinateToPriceForMoving(e){return 0}static createProperties(e){null!=e&&(void 0===e.textOrientation&&(e.textOrientation="horizontal"),void 0===e.extendLine&&(e.extendLine=!1));const t=new n.DefaultProperty({defaultName:"linetoolvertline",state:e});return this._configureProperties(t),t}_normalizePoint(e){var t;const i=null!==(t=this._model.timeScale().indexToTimePoint(e.index))&&void 0!==t?t:this._utcTimeInCurrentResolution(e);return null!==i?{price:e.price,time_t:i,offset:0}:super._normalizePoint(e)}_getAlertPlots(){const e=this._points[0],t={index:e.index,price:e.price+1},i=this._linePointsToAlertPlot([e,t],null,!0,!0);return null===i?[]:[i]}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(96461),i.e(24770),i.e(30154),i.e(82375),i.e(18537)]).then(i.bind(i,480262)).then((e=>e.VerticalLineDefinitionsViewModel))}_applyTemplateImpl(e){super._applyTemplateImpl(e),this.properties().childs().text.setValue(e.text||"")}static _configureProperties(e){super._configureProperties(e),e.hasChild("text")||e.addChild("text",new o.Property("")),e.addExcludedKey("text",1)}}},964824:(e,t,i)=>{i.r(t),i.d(t,{globalChangeEvent:()=>o,selectionChangeEvent:()=>u,sourceChangeEvent:()=>r,viewportChangeEvent:()=>a});var s=i(827147);function r(e){return(0,s.default)(e)?{type:"data-source-change",sourceId:e}:{type:"data-source-change",...e}}const n={type:"global-change"};function o(){return n}const l={type:"viewport-change"};function a(){return l}const c={type:"selection-change"};function u(){return c}},60897:(e,t,i)=>{i.d(t,{notAvailable:()=>s});i(444372),i(244842);const s="∅"},742391:(e,t,i)=>{i.d(t,{PanePriceAxisView:()=>n});var s=i(294162);class r{constructor(e){this._priceAxisViewRenderer=null,this._rendererOptions=null,this._align="right",this._textWidthCache=e}setParams(e,t,i,s,r){this._priceAxisViewRenderer=e,this._rendererOptions=t,this._align=r}draw(e,t){null!==this._rendererOptions&&null!==this._priceAxisViewRenderer&&this._priceAxisViewRenderer.draw(e,t,this._rendererOptions,this._textWidthCache,this._align)}hitTest(e,t){var i,s;return void 0===(null===(i=this._priceAxisViewRenderer)||void 0===i?void 0:i.hitTest)?null:null===(s=this._priceAxisViewRenderer)||void 0===s?void 0:s.hitTest(e,t,this._align)}}class n{constructor(e,t,i){this._renderer=null,this._invalidated=!0,this._priceAxisView=e,this._textWidthCache=new s.TextWidthCache(100),this._dataSource=t,this._chartModel=i,this._fontSize=-1,this._panePriceAxisViewRenderer=new r(this._textWidthCache)}update(e){this._invalidated=!0}renderer(e){return this._invalidated&&this._updateImpl(e),this._renderer}_position(){const e=this._chartModel.crossHairSource(),t=this._dataSource===e?e.pane:this._chartModel.paneForSource(this._dataSource);if(null===t)return null;const i=this._priceScale();if(null===i)return null;let s=t.priceScalePosition(i);return"overlay"===s&&(s=t.priceScalePosition(t.defaultPriceScale())), "overlay"===s?null:s}_updateImpl(e){this._renderer=null;const t=this._position();if(null===t)return;const i=this._chartModel.priceAxisRendererOptions();i.fontSize!==this._fontSize&&(this._fontSize=i.fontSize,this._textWidthCache.reset()),this._panePriceAxisViewRenderer.setParams(this._priceAxisView.paneRenderer(),i,e.mediaSize.width,e.mediaSize.height,t),this._renderer=this._panePriceAxisViewRenderer,this._invalidated=!1}_priceScale(){return this._dataSource.priceScale()}}},57372:(e,t,i)=>{i.d(t,{AreaBackgroundItem:()=>a,AreaBackgroundItemsGroup:()=>o,AreaBackgroundRenderer:()=>c,CachedMap:()=>l});var s=i(650151),r=i(43192),n=i(632739);class o extends n.CachedContainer{constructor(e){super(),this.color=e}}class l{constructor(){this._map=new Map,this._usedKeys=new Set,this._invalidations=0}invalidateCache(){this._invalidations+=1,50===this._invalidations&&(this._deleteUnused(),this._invalidations=0),this._usedKeys.clear(),this._map.forEach(((e,t)=>e.invalidateCache()))}get(e){const t=this._map.get(e);return void 0!==t&&this._usedKeys.add(e),t}set(e,t){this._usedKeys.add(e),this._map.set(e,t)}[Symbol.iterator](){const e=Array.from(this._usedKeys)[Symbol.iterator]();return{[Symbol.iterator](){return this},next:()=>{const t=e.next();return t.value?{value:[t.value,(0,s.ensureDefined)(this._map.get(t.value))],done:!1}:{value:void 0,done:!0}}}}forEach(e){this._map.forEach(((t,i)=>{this._usedKeys.has(i)&&e(t,i)}))}delete(e){const t=this._map.get(e);void 0!==t&&t.invalidateCache(),this._usedKeys.delete(e)}_deleteUnused(){const e=[];this._map.forEach(((t,i)=>{this._usedKeys.has(i)||e.push(i)}));for(const t of e)this._map.delete(t)}}class a extends n.CachedContainer{constructor(){super(),this.points1=new n.CachedContainer,this.points2=new n.CachedContainer,this.push(this.points1),this.push(this.points2)}addPoints1Point(e,t){let i=this.points1.newItem();null!==i?(i.x=e,i.y=t):i={x:e,y:t},this.points1.push(i)}addPoints2Point(e,t){let i=this.points2.newItem();null!==i?(i.x=e,i.y=t):i={x:e,y:t},this.points2.push(i)}invalidateCache(){this.points1.invalidateCache(),this.points2.invalidateCache()}}class c extends r.BitmapCoordinatesPaneRenderer{constructor(e){super(),this._data=null,this._data=null!=e?e:null}setData(e){this._data=e}hitTest(e){return null}_drawImpl(e){var t,i;if(null===this._data)return;const{context:s,horizontalPixelRatio:r,verticalPixelRatio:n}=e,o=.25*this._data.barSpacing;for(const[,e]of this._data.colorAreas){s.beginPath();for(let t=0;t<e.length();t++){const i=e.at(t);if(i.points1.isEmpty()||i.points2.isEmpty())continue;const l=i.points1.at(0).x,a=i.points1.at(0).y;if(s.moveTo(Math.round(l*r),a*n),1!==i.points1.length()&&1!==i.points2.length()){for(const e of i.points1.iterator(1))s.lineTo(Math.round(e.x*r),e.y*n);for(const e of i.points2.iterator(i.points2.length()-1,!0))s.lineTo(Math.round(e.x*r),e.y*n)}else{const e=i.points2.at(0).x,t=i.points2.at(0).y;s.lineTo(Math.round((l+o)*r),a*n),s.lineTo(Math.round((e+o)*r),t*n),s.lineTo(Math.round((e-o)*r),t*n),s.lineTo(Math.round((l-o)*r),a*n)}}if(s.closePath(), 0===e.color.type)s.fillStyle=e.color.color;else{const r=s.createLinearGradient(0,e.color.coordinate1*n,0,e.color.coordinate2*n);r.addColorStop(0,null!==(t=e.color.color1)&&void 0!==t?t:"transparent"),r.addColorStop(1,null!==(i=e.color.color2)&&void 0!==i?i:"transparent"),s.fillStyle=r}s.fill()}}}},413225:(e,t,i)=>{i.d(t,{PaneRendererArea:()=>o});var s=i(879617),r=i(9640),n=i(787123);class o extends s.PaneRendererLine{constructor(e){e.forceLineColor=!1,super(e)}_drawImpl(e){var t,i,o,l,a;const c=this._data;if(0===c.items.length)return;let u=null!==(i=null===(t=this._data.visibleItemsRange)||void 0===t?void 0:t.startItemIndex)&&void 0!==i?i:0,h=(null!==(l=null===(o=this._data.visibleItemsRange)||void 0===o?void 0:o.endItemIndex)&&void 0!==l?l:this._data.items.length)-1;for(;u<h&&!(0,r.coordinateIsValid)(c.items[u].y);)u++;for(;h>=0&&!(0,r.coordinateIsValid)(c.items[h].y);)h--;if(u>h)return;const{context:d,horizontalPixelRatio:p,verticalPixelRatio:_}=e;d.save(),d.scale(p,_),d.lineCap="round",d.strokeStyle=c.lineColor,d.lineWidth=c.lineWidth,(0,n.setLineStyle)(d,c.lineStyle),d.lineWidth=1;const f={},m=new s.PaneRendererLineItemsIterator(this._data.items,u,h+1,this._data.skipHoles);for(;m.next();){const e=m.currentValue();let t;t=(0,s.isValidPoint)(e)&&e.style?e.style.color:c.lineColor;const i=m.nextValue();if((0,s.isValidPoint)(i)&&(null==i?void 0:i.style)){const s=i.style.color;if(t!==s){const t=f[s]||[];t.push(e),f[s]=t}}const r=f[t]||[];r.push(e),f[t]=r}for(const e of Object.keys(f)){const t=f[e];d.beginPath();let i=0;for(let r=0;r<t.length;r++){const n=t[r];(0,s.isValidPoint)(n)&&(n.style&&(null===(a=n.style)||void 0===a?void 0:a.color)!==e&&(d.moveTo(Math.round(t[i].center),c.bottom),this._walkLine(d,t.slice(i,r),!0,c.bottom,!0),i=r))}if(d.moveTo(Math.round(t[i].center),c.bottom),this._walkLine(d,t.slice(i,t.length),!0,c.bottom,!0),d.closePath(),c.isSeries){const e=d.createLinearGradient(0,0,0,c.bottom);e.addColorStop(0,c.color1),e.addColorStop(1,c.color2),d.fillStyle=e,c.simpleMode=!0}else d.fillStyle=e;d.fill()}d.lineWidth=c.lineWidth,d.restore(),super._drawImpl(e)}}},43192:(e,t,i)=>{i.d(t,{BitmapCoordinatesPaneRenderer:()=>r});var s=i(871934);class r{draw(e,t){new s.CanvasRenderingTarget2D(e,t.mediaSize,t.bitmapSize).useBitmapCoordinateSpace((e=>this._drawImpl(e)))}drawBackground(e,t){new s.CanvasRenderingTarget2D(e,t.mediaSize,t.bitmapSize).useBitmapCoordinateSpace((e=>this._drawBackgroundImpl(e)))}_drawBackgroundImpl(e){}}},142119:(e,t,i)=>{i.d(t,{CompositeRenderer:()=>s});class s{constructor(){this._renderers=[],this._globalAlpha=1}setGlobalAlpha(e){this._globalAlpha=e}append(e){this._renderers.push(e)}insert(e,t){this._renderers.splice(t,0,e)}clear(){this._renderers.length=0}isEmpty(){return 0===this._renderers.length}draw(e,t){for(let i=0;i<this._renderers.length;i++)e.save(),e.globalAlpha=this._globalAlpha,this._renderers[i].draw(e,t),e.restore()}drawBackground(e,t){e.save(),e.globalAlpha=this._globalAlpha;for(let i=0;i<this._renderers.length;i++){const s=this._renderers[i] ;s.drawBackground&&s.drawBackground(e,t)}e.restore()}hitTest(e,t){let i=null;for(let s=this._renderers.length-1;s>=0;s--){const r=this._renderers[s].hitTest(e,t);null!==r&&(null===i||r.target()>i.target())&&(i=r)}return i}doesIntersectWithBox(e,t){return this._renderers.some((i=>!!i.doesIntersectWithBox&&i.doesIntersectWithBox(e,t)))}}},787123:(e,t,i)=>{i.r(t),i.d(t,{addHorizontalLineToPath:()=>h,addLineToPath:()=>C,addPixelPerfectLineToPath:()=>T,addVerticalLineToPath:()=>p,clearRectWithGradient:()=>c,clipPolygonByEdge:()=>M,computeDashPattern:()=>w,createCircle:()=>S,drawHorizontalLine:()=>d,drawLine:()=>I,drawPixelPerfectLine:()=>V,drawPoly:()=>b,drawRoundRect:()=>v,drawRoundRectWithInnerBorder:()=>g,drawVerticalLine:()=>_,fillRectInnerBorder:()=>u,fillRectWithBorder:()=>y,scaleDrawRoundRectRadii:()=>f,scaledDashPattern:()=>P,setLineStyle:()=>x});var s=i(86441),r=i(5531),n=i(458963),o=i(379048),l=i(199471),a=i(510147);function c(e,t,i,s,r,n,o){e.save(),e.globalCompositeOperation="copy";const l=e.createLinearGradient(0,0,0,r);l.addColorStop(0,n),l.addColorStop(1,o),e.fillStyle=l,e.fillRect(t,i,s,r),e.restore()}function u(e,t,i,s,r,n){e.fillRect(t+n,i,s-2*n,n),e.fillRect(t+n,i+r-n,s-2*n,n),e.fillRect(t,i,n,r),e.fillRect(t+s-n,i,n,r)}function h(e,t,i,s){const r=e.lineWidth%2?.5:0;e.moveTo(i,t+r),e.lineTo(s,t+r)}function d(e,t,i,s){e.beginPath(),h(e,t,i,s),e.stroke()}function p(e,t,i,s){const r=e.lineWidth%2?.5:0;e.moveTo(t+r,i),e.lineTo(t+r,s)}function _(e,t,i,s){e.beginPath(),p(e,t,i,s),e.stroke()}function f(e,t){return Array.isArray(e)?e.map((e=>Math.round(e*t))):Math.round(e*t)}function m(e,t){return Array.isArray(e)?e.map((e=>0===e?e:e+t)):e+t}function v(e,t,i,s,r,n,o){let l,a,c,u;if(Array.isArray(n))if(2===n.length){const e=Math.max(0,n[0]),t=Math.max(0,n[1]);l=e,a=e,c=t,u=t}else{if(4!==n.length)throw new Error("Wrong border radius - it should be like css border radius");l=Math.max(0,n[0]),a=Math.max(0,n[1]),c=Math.max(0,n[2]),u=Math.max(0,n[3])}else{const e=Math.max(0,n);l=e,a=e,c=e,u=e}o||e.beginPath(),e.moveTo(t+l,i),e.lineTo(t+s-a,i),0!==a&&e.arcTo(t+s,i,t+s,i+a,a),e.lineTo(t+s,i+r-c),0!==c&&e.arcTo(t+s,i+r,t+s-c,i+r,c),e.lineTo(t+u,i+r),0!==u&&e.arcTo(t,i+r,t,i+r-u,u),e.lineTo(t,i+l),0!==l&&e.arcTo(t,i,t+l,i,l)}function g(e,t,i,s,r,n,l=0,a=0,c="",u=o.LineStyle.Solid){if(e.save(),!a||!c||c===n)return v(e,t,i,s,r,l),e.fillStyle=n,e.fill(),void e.restore();const h=a/2;if("transparent"!==n){const h="transparent"!==c&&u!==o.LineStyle.Solid;v(e,h?t:t+a,h?i:i+a,h?s:s-2*a,h?r:r-2*a,h?l:m(l,-a)),e.fillStyle=n,e.fill()}if("transparent"!==c){v(e,t+h,i+h,s-a,r-a,m(l,-h)),e.lineWidth=a,e.strokeStyle=c,x(e,u),e.closePath(),e.stroke()}e.restore()}function P(e,t){return t=Math.max(1,t),e.map((e=>e*t))}function y(e,t,i,s,r,o,a,c,u){const{context:h}=e,p=o%2/2,_=t+p,f=s+p;let m,v;if(c){const{borderMode:e,borderWidth:l,color:a,dashPattern:u,lineStyle:d}=c;switch(e){case"outer":{const e=-o/2-l/2,t=-l/2;v={left:_+e,right:f-e,top:i+t,bottom:r-t};break}case"center":{const e=l%2/2;v={left:t+e,right:s+e,top:i+e,bottom:r+e};break} case"inner":{const e=-o/2+l/2,t=l/2;v={left:_+e,right:f-e,top:i+t,bottom:r-t}}}h.strokeStyle=a,h.lineWidth=l;let p=-1;u?h.setLineDash(P(u,l)):void 0!==d&&(x(h,d),d===n.LINESTYLE_SOLID&&(p=1)),m={left:v.left+p*l/2,top:v.top+p*l/2,right:v.right-p*l/2,bottom:v.bottom-p*l/2}}if(a&&(h.fillStyle=a.color,m||(m={left:_-o/2,right:f+o/2,top:i,bottom:r}),h.fillRect(m.left,m.top,m.right-m.left,m.bottom-m.top)),u){const{lineWidth:n,lineColor:o,lineStyle:a,excludeBoundaries:c}=u;h.save(),h.lineCap="butt",h.lineWidth=n,h.strokeStyle=o,x(h,a);const p=()=>d(h,Math.floor((i+r)/2),t,s);c?(0,l.drawWithExclusionAreaByScope)(e,c,p):p(),h.restore()}v&&h.strokeRect(v.left,v.top,v.right-v.left,v.bottom-v.top)}function S(e,t,i,s){e.beginPath(),e.arc(t,i,s,0,2*Math.PI,!1),e.closePath()}function b(e,t,i){e.beginPath(),e.moveTo(t[0].x,t[0].y);for(const i of t)e.lineTo(i.x,i.y);e.closePath(),e.stroke(),i&&e.fill()}function x(e,t){let i=[];t!==n.LINESTYLE_SOLID&&(i=w(e.lineWidth,t)),e.setLineDash(i)}function w(e,t){return[[e,2*e],[5*e,6*e],[6*e,6*e],[e,4*e],[2*e,e]][t-1]}function C(e,t,i,s,r){e.moveTo(t,i),e.lineTo(s,r)}function I(e,t,i,s,r){isFinite(t)&&isFinite(s)&&isFinite(i)&&isFinite(r)&&(e.beginPath(),C(e,t,i,s,r),e.stroke())}function T(e,t,i,s,r,n){const{horizontalPixelRatio:o,verticalPixelRatio:l}=n;t===s?p(e,Math.round(t*o),i*l,r*l):i===r?h(e,Math.round(i*l),t*o,s*o):C(e,t*o,i*l,s*o,r*l)}function V(e,t,i,s,r,n=a.dpr1PixelRatioInfo){e.beginPath(),T(e,t,i,s,r,n),e.stroke()}function M(e,t,i,n){const o=(0,s.equalPoints)(i,n[0])?(0,s.equalPoints)(i,n[1])?null:n[1]:n[0];return null!==e&&null!==o?(0,r.intersectPolygonAndHalfplane)(e,(0,s.halfplaneThroughPoint)((0,s.lineThroughPoints)(t,i),o)):null}},9640:(e,t,i)=>{i.d(t,{coordinateIsValid:()=>m,extendAndClipLineSegment:()=>u,fillScaledRadius:()=>g,getArrowPoints:()=>h,interactionTolerance:()=>f,optimalBarWidth:()=>d,optimalCandlestickWidth:()=>p,optimalHiLoWidth:()=>_,setValidLineStyle:()=>v,strokeScaledRadius:()=>P});var s=i(86441),r=i(5531),n=i(86121),o=i(389137),l=i(787123);const a={common:13,line:13,minDistanceBetweenPoints:10,series:14,curve:10,anchor:13,esd:4},c={common:3,line:3,minDistanceBetweenPoints:5,series:2,curve:3,anchor:2,esd:0};function u(e,t,i,n,o,l){if((0,s.equalPoints)(e,t))return null;const a=new s.Point(0,0),c=new s.Point(i,n);if(o){if(l){const i=(0,r.intersectLineAndBox)((0,s.lineThroughPoints)(e,t),(0,s.box)(a,c));return Array.isArray(i)?i:null}{const i=(0,r.intersectRayAndBox)(t,e,(0,s.box)(a,c));return null===i||(0,s.equalPoints)(t,i)?null:(0,s.lineSegment)(t,i)}}if(l){const i=(0,r.intersectRayAndBox)(e,t,(0,s.box)(a,c));return null===i||(0,s.equalPoints)(e,i)?null:(0,s.lineSegment)(e,i)}{const i=(0,r.intersectLineSegmentAndBox)((0,s.lineSegment)(e,t),(0,s.box)(a,c));return Array.isArray(i)?i:null}}function h(e,t,i,s,r){const n=.5*i,o=Math.sqrt(2),l=t.subtract(e),a=l.normalized();let c=5*i;s&&(c=Math.min(c,.35*l.length()));const u=1*n;if(c*o*.2<=u)return[] ;const h=a.scaled(c),d=t.subtract(h),p=a.transposed(),_=1*c,f=p.scaled(_),m=d.add(f),v=d.subtract(f),g=m.subtract(t).normalized().scaled(u),P=v.subtract(t).normalized().scaled(u),y=r?t:t.add(g),S=r?t:t.add(P),b=n*(o-1),x=p.scaled(b),w=Math.min(c-1*n/o,n*o*1),C=a.scaled(w),I=t.subtract(x),T=t.add(x),V=t.subtract(C);return[[m,y],[S,v],[I,V.subtract(x)],[T,V.add(x)]]}function d(e,t){return t=t||1,Math.floor(.3*e*t)}function p(e,t){if(e>=2.5&&e<=4)return Math.floor(3*t);const i=1-.2*Math.atan(Math.max(4,e)-4)/(.5*Math.PI),s=Math.floor(e*i*t),r=Math.floor(e*t),n=Math.min(s,r);return Math.max(Math.floor(t),n)}function _(e){return.4*e}function f(){return(0,n.lastMouseOrTouchEventInfo)().isTouch?a:c}function m(e){return null!=e&&!(0,o.isNaN)(e)}function v(e,t){void 0!==t&&(0,l.setLineStyle)(e,t)}function g(e,t){const i=Math.max(1,Math.floor(t))%2?.5:0;return Math.round(e*t)+i}function P(e,t,i){const s=Math.max(1,Math.floor(t))%2?.5:0;return Math.round(e*t)+(s!==i%2?.5:0)}},9524:(e,t,i)=>{i.d(t,{HorizontalLineRenderer:()=>a});var s=i(315801),r=i(787123),n=i(9640),o=i(43192),l=i(199471);class a extends o.BitmapCoordinatesPaneRenderer{constructor(){super(...arguments),this._data=null,this._hitTest=new s.HitTestResult(s.HitTarget.Regular)}setData(e){this._data=e}setHitTest(e){this._hitTest=e}hitTest(e){if(null===this._data||!1===this._data.visible||null===this._hitTest)return null;const t=(0,n.interactionTolerance)().line,i=Math.abs(e.y-this._data.y)<=t+this._data.linewidth/2,s=void 0===this._data.left||this._data.left-e.x<=t,r=void 0===this._data.right||e.x-this._data.right<=t;return i&&s&&r?this._hitTest:null}_drawImpl(e){if(null===this._data||!1===this._data.visible)return;const{context:t,horizontalPixelRatio:i,verticalPixelRatio:s,mediaSize:n}=e;if(this._data.y<-this._data.linewidth/2||this._data.y>n.height+this._data.linewidth/2)return;t.lineCap="butt",t.strokeStyle=this._data.color,t.lineWidth=Math.max(1,Math.floor(this._data.linewidth*i)),void 0!==this._data.linestyle&&(0,r.setLineStyle)(t,this._data.linestyle);const o=void 0!==this._data.left?Math.max(this._data.left,0):0,a=void 0!==this._data.right?Math.min(this._data.right,n.width):n.width,c=Math.round(this._data.y*s),u=Math.round(o*i),h=Math.round(a*i),d=this._data.excludeBoundaries;void 0!==d&&(0,l.addExclusionAreaByScope)(e,d),(0,r.drawHorizontalLine)(t,c,u,h)}}},879617:(e,t,i)=>{i.d(t,{PaneRendererLine:()=>p,PaneRendererLineItemsIterator:()=>d,isValidPoint:()=>h});var s=i(650151),r=i(86441),n=i(204652),o=i(315801),l=i(9640),a=i(787123),c=i(43192);const u={y:NaN};function h(e){return null!==e&&!isNaN(e.y)}class d{constructor(e,t,i,r){this._calculatedPrev={index:null,currentBreakProcessed:!1,value:null},this._calculatedCurrent={index:null,currentBreakProcessed:!1,value:null},this._calculatedNext={index:null,currentBreakProcessed:!1,value:null},this._preallocatedVariable={index:null,currentBreakProcessed:!1,value:null},e.length&&((0,s.assert)(t<=i,"First index must be less or equal to last index"),(0,s.assert)(t<e.length,"First index must be less then array length"), (0,s.assert)(i<=e.length,"Last index must be less or equal to array length")),this._items=e,this._firstIndexWithRange=t,this._lastIndexWithRange=i,this._skipHoles=r}next(){if(0===this._items.length)return!1;if(null!==this._calculatedNext.index)return null!==this._calculatedNext.value&&(this._calculatedPrev=this._calculatedCurrent,this._calculatedCurrent=this._calculatedNext,this._calculatedNext={index:null,currentBreakProcessed:!1,value:null},!0);let e;this._preallocatedVariable={...this._calculatedCurrent};do{null===this._preallocatedVariable.index?(this._preallocatedVariable.index=this._firstIndexWithRange,this._preallocatedVariable.currentBreakProcessed=!1,e=this._preallocatedVariable.index<this._lastIndexWithRange):(this._incrementPointer(this._preallocatedVariable),e=this._isValidPointer(this._preallocatedVariable)),e&&this._calcVaue(this._preallocatedVariable)}while(e&&this._skipHoles&&!h(this._preallocatedVariable.value));return e&&(this._calculatedPrev=this._calculatedCurrent,this._calculatedCurrent=this._preallocatedVariable,this._calculatedNext={index:null,currentBreakProcessed:!1,value:null}),e}prevValue(){return this._calculatedPrev.value}currentValue(){return(0,s.ensureNotNull)(this._calculatedCurrent.value)}currentValueIsLast(){return(0,s.ensureNotNull)(this._calculatedCurrent.index)===this._items.length-1}currentValueIsFirst(){return 0===(0,s.ensureNotNull)(this._calculatedCurrent.index)}nextValue(){if(null!==this._calculatedNext.index)return this._calculatedNext.value;let e;this._calculatedNext={...this._calculatedCurrent,value:null};do{this._incrementPointer(this._calculatedNext),e=this._isValidPointer(this._calculatedNext),e?this._calcVaue(this._calculatedNext):this._calculatedNext.value=null}while(e&&this._skipHoles&&!h(this._calculatedNext.value));return this._calculatedNext.value}atStart(){return this._calculatedCurrent.index===this._firstIndexWithRange&&!this._calculatedCurrent.currentBreakProcessed}atEnd(){const e=(0,s.ensureNotNull)(this._calculatedCurrent.index);return e<this._lastIndexWithRange&&(this._calculatedCurrent.currentBreakProcessed||!this._needBreakBefore(e))}_needBreakBefore(e){return!!this._items[e].breakBefore&&!this._skipHoles}_calcVaue(e){const t=(0,s.ensureNotNull)(e.index);this._needBreakBefore(t)&&!e.currentBreakProcessed?e.value=u:e.value=this._items[t]}_incrementPointer(e){const t=(0,s.ensureNotNull)(e.index);this._needBreakBefore(t)&&!this._calculatedCurrent.currentBreakProcessed?e.currentBreakProcessed=!0:(e.index=t+1,e.currentBreakProcessed=!1)}_isValidPointer(e){const t=(0,s.ensureNotNull)(e.index);return t<this._lastIndexWithRange||t===this._lastIndexWithRange-1&&this._needBreakBefore(t)&&e.currentBreakProcessed}}class p extends c.BitmapCoordinatesPaneRenderer{constructor(e){super(),this._data=e}hitTest(e){var t,i,s,a;const c=(0,l.interactionTolerance)().series+this._data.lineWidth/2 ;let u=null!==(i=null===(t=this._data.visibleItemsRange)||void 0===t?void 0:t.startItemIndex)&&void 0!==i?i:0,h=(null!==(a=null===(s=this._data.visibleItemsRange)||void 0===s?void 0:s.endItemIndex)&&void 0!==a?a:this._data.items.length)-1;for(;h-u>2;){const t=Math.round((h+u)/2);this._data.items[t].center<=e.x?u=t:h=t}u=Math.max(1,u-1),h=Math.min(this._data.items.length-1,h+1);for(let t=u;t<=h;++t){const i=this._data.items[t-1],s=this._data.items[t],l=i.center,a=s.center;if((0,n.distanceToSegment)(new r.Point(l,i.y),new r.Point(a,s.y),new r.Point(e.x,e.y)).distance<=c)return this._data.hittest?this._data.hittest:new o.HitTestResult(o.HitTarget.Regular)}return null}_drawImpl(e){const{context:t,horizontalPixelRatio:i,verticalPixelRatio:s}=e;t.scale(i,s),t.lineCap="round",t.lineJoin="round",t.strokeStyle=this._data.lineColor,t.fillStyle=this._data.lineColor,t.lineWidth=this._data.lineWidth,(0,a.setLineStyle)(t,this._data.lineStyle),(0,l.setValidLineStyle)(t,this._data.lineStyle),this._data.simpleMode?this._drawSimpleMode(t,i,s):this._drawLines(t)}_drawSimpleMode(e,t,i){var s,r,n,o;e.beginPath(),this._walkLine(e,this._data.items,!1,NaN),e.stroke();const l=this._data.lineWidth+2;if(this._data.withMarkers&&2*l<this._data.barSpacing){e.scale(1/t,1/i);const a=Math.max(1,Math.floor(t))%2/2,c=l*i+a,u=2*Math.PI;e.beginPath();const h=null!==(r=null===(s=this._data.visibleItemsRange)||void 0===s?void 0:s.startItemIndex)&&void 0!==r?r:0;for(let s=(null!==(o=null===(n=this._data.visibleItemsRange)||void 0===n?void 0:n.endItemIndex)&&void 0!==o?o:this._data.items.length)-1+1;s-- >=h;){const r=this._data.items[s];if(r){const s=Math.round(r.center*t)+a,n=r.y*i;e.moveTo(s,n),e.arc(s,n,c,0,u)}}e.fill()}}_walkLine(e,t,i,s,r){var n,o,l,a;if(!t)return;const c=.25*this._data.barSpacing;let u,p,_=null;const f=r?0:null!==(o=null===(n=this._data.visibleItemsRange)||void 0===n?void 0:n.startItemIndex)&&void 0!==o?o:0,m=r?t.length:Math.min(null!==(a=null===(l=this._data.visibleItemsRange)||void 0===l?void 0:l.endItemIndex)&&void 0!==a?a:t.length,t.length);if(f>m||f>=t.length)return;const v=new d(t,f,m,this._data.skipHoles);for(;v.next();){if(u=v.currentValue(),p=v.nextValue(),h(u)){const t=Math.round(u.center);_&&h(_)?(e.lineTo(t,u.y),i&&!h(p)&&e.lineTo(t,s)):p&&h(p)?i?(v.atStart()||e.lineTo(t,s),e.lineTo(t,u.y)):e.moveTo(t,u.y):i?(v.atStart()||e.lineTo(t-c,s),e.lineTo(t-c,u.y),e.lineTo(t+c,u.y),e.lineTo(t+c,s)):(e.moveTo(t-c,u.y),e.lineTo(t+c,u.y))}_=u}}_drawLines(e){var t,i,s,r;if(!this._data.items.length)return;let n,o,a=null;const c=.25*this._data.barSpacing;e.beginPath();const u=null!==(i=null===(t=this._data.visibleItemsRange)||void 0===t?void 0:t.startItemIndex)&&void 0!==i?i:0,p=null!==(r=null===(s=this._data.visibleItemsRange)||void 0===s?void 0:s.endItemIndex)&&void 0!==r?r:this._data.items.length;if(u>p||u>=this._data.items.length)return;const _=this._data.items[u];_&&e.moveTo(_.center,_.y);let f,m=e.strokeStyle,v=e.lineWidth;const g=new d(this._data.items,u,p,this._data.skipHoles);for(;g.next();){let t,i,s;a=g.prevValue(), n=g.currentValue(),o=g.nextValue();let r=!1;if(h(n)&&(n.style&&!this._data.forceLineColor?(t=n.style.color,i=n.style.width,s=n.style.style):(t=this._data.lineColor,i=this._data.lineWidth,s=this._data.lineStyle),this._data.ignorePaletteLineWidth&&(i=this._data.lineWidth),r=t!==m||i!==v||s!==f),r)if(m=t,v=i,f=s,e.stroke(),e.beginPath(),e.strokeStyle=t,e.lineWidth=i,(0,l.setValidLineStyle)(e,s),h(a))e.moveTo(a.center,a.y);else{const t=n;e.moveTo(t.center,t.y)}P=a,S=o,h(y=n)&&(h(P)?e.lineTo(y.center,y.y):S&&h(S)?e.moveTo(y.center,y.y):(e.moveTo(y.center-c,y.y),e.lineTo(y.center+c,y.y)))}var P,y,S;e.stroke()}}},710455:(e,t,i)=>{i.d(t,{MediaCoordinatesPaneRenderer:()=>r});var s=i(871934);class r{draw(e,t){new s.CanvasRenderingTarget2D(e,t.mediaSize,t.bitmapSize).useMediaCoordinateSpace((e=>this._drawImpl(e)))}drawBackground(e,t){new s.CanvasRenderingTarget2D(e,t.mediaSize,t.bitmapSize).useMediaCoordinateSpace((e=>this._drawBackgroundImpl(e)))}_drawBackgroundImpl(e){}}},632739:(e,t,i)=>{i.d(t,{CachedContainer:()=>r,ObjectValuesCache:()=>n});class s{constructor(e,t,i,s){this._items=e,this._actualLength=t,this._step=s?-1:1,this._currentIndex=i-this._step}[Symbol.iterator](){return this}next(){return this._currentIndex+=this._step,this._currentIndex>=this._actualLength||this._currentIndex<0?{value:void 0,done:!0}:{done:!1,value:this._items[this._currentIndex]}}}class r{constructor(){this._items=[],this._actualLength=0,this._invalidations=0}push(e){this._items.length===this._actualLength?this._items.push(e):this._items[this._actualLength]!==e&&(this._items[this._actualLength]=e),this._actualLength+=1}newItem(){const e=this._items.length>this._actualLength?this._items[this._actualLength]:null;return null!==e&&Boolean(e.invalidateCache)&&e.invalidateCache(),e}invalidateCache(){this._invalidations+=1,3e3===this._invalidations&&(this._items.splice(this._actualLength),this._invalidations=0),this._actualLength=0}at(e){return this._items[e]}data(){return this._items}length(){return this._actualLength}isEmpty(){return 0===this._actualLength}iterator(e,t){return new s(this._items,this._actualLength,e,t)}}class n extends r{constructor(){super(...arguments),this._startIndex=0}setStartIndex(e){this._startIndex=e}isValidIndex(e){return e>=this._startIndex}at(e){const t=e-this._startIndex;for(;t>=this._actualLength;)this._items.length<=t?this._items.push(this._newObject()):this._clearObject(this._items[this._actualLength]),this._actualLength+=1;return this._items[t]}}},500477:(e,t,i)=>{i.d(t,{svgRenderer:()=>I});var s=i(650151),r=i(201089);const n=(0,r.getLogger)("Chart.SvgParser");function o(e,t){const i=e.split(/[,\s]/).map((e=>parseFloat(e.trim())));let s=0;for(const e of i){if(!Number.isFinite(e)&&s<t)return null;s+=1}return i}const l=/([a-zA-Z]+)\((.*)\)/g;function a(e){var t;const i=null===(t=e.getAttribute("transform"))||void 0===t?void 0:t.toLowerCase();if(void 0===i)return null;const s=[];let r;l.lastIndex=0;do{if(r=l.exec(i),null!==r){const e=r[1],t=r[2];switch(e){case"matrix":const i=o(t,6);null!==i&&s.push({type:e,a:i[0],b:i[1], c:i[2],d:i[3],e:i[4],f:i[5]});break;case"rotate":const r=o(t,1);null!==r&&s.push({type:e,a:r[0],x:r[1],y:r[2]});break;case"translate":const l=o(t,1);null!==l&&s.push({type:e,x:l[0],y:l[1]});break;case"scale":const a=o(t,1);null!==a&&s.push({type:e,x:a[0],y:a[1]});break;default:n.logWarn(`Unsupported transform operation: ${e}`)}}}while(null!==r);return 0===s.length?null:s}function c(e,t){var i,s;for(const r of t)switch(r.type){case"matrix":e.transform(r.a,r.b,r.c,r.d,r.e,r.f);break;case"rotate":void 0!==r.x&&void 0!==r.y&&e.translate(r.x,r.y),e.rotate(r.a*Math.PI/180),void 0!==r.x&&void 0!==r.y&&e.translate(-r.x,-r.y);break;case"scale":e.scale(r.x,null!==(i=r.y)&&void 0!==i?i:r.x);break;case"translate":e.translate(r.x,null!==(s=r.y)&&void 0!==s?s:0)}}function u(e,t){var i;return parseFloat(null!==(i=e.getAttribute(t))&&void 0!==i?i:"")}const h=/^url\(#(.*)\)/;function d(e){var t,i;return null!==(i=null===(t=h.exec(e))||void 0===t?void 0:t[1])&&void 0!==i?i:null}function p(e,t,i){const r={},n=e.getAttribute("fill");if(null!==n){const e=d(n);r.getFillStyle=null!==e?i=>(0,s.ensureDefined)(t.getStyle(e,i)):e=>n}const o=e.getAttribute("stroke");if(null!==o){const e=d(o);r.getStrokeStyle=null!==e?i=>(0,s.ensureDefined)(t.getStyle(e,i)):e=>o}const l=u(e,"stroke-width");Number.isFinite(l)&&(r.strokeWidth=l);const c=u(e,"opacity");Number.isFinite(c)&&(r.fillOpacity=c,r.strokeOpacity=c);const h=u(e,"stroke-opacity");Number.isFinite(h)&&(r.strokeOpacity=h);const p=u(e,"fill-opacity");if(Number.isFinite(p)&&(r.fillOpacity=p),i){const t=a(e);null!==t&&(r.transform=t)}return r}class _{constructor(e){this._transformOperations=e}apply(e,t){null!==this._transformOperations?(e.save(),c(e,this._transformOperations)):e.restore()}}class f{constructor(e,t,i){this._styleData={...i,...p(e,t,!0)}}apply(e,t){if(!this._isValid())return;const{getFillStyle:i,getStrokeStyle:s,strokeWidth:r,transform:n,strokeOpacity:o,fillOpacity:l}=this._styleData,a=void 0!==n||void 0!==o||void 0!==l;a&&(e.save(),void 0!==n&&c(e,n)),this._render(e);const u=null==i?void 0:i(e);"none"!==u&&(t.doNotApplyColors||(void 0!==l&&(e.globalAlpha=l),e.fillStyle=null!=u?u:"black"),this._fill(e));const h=null==s?void 0:s(e);void 0!==h&&"none"!==h&&(void 0!==r&&(e.lineWidth=r),t.doNotApplyColors||(void 0!==l&&(e.globalAlpha=l),e.strokeStyle=h),this._stroke(e)),a&&e.restore()}_fill(e){e.fill()}_stroke(e){e.stroke()}}class m extends f{constructor(e,t,i){var s;super(e,t,i);const r=e.getAttribute("d");this._path=null!==r?new Path2D(r):null,this._fillRule=null!==(s=e.getAttribute("fill-rule"))&&void 0!==s?s:void 0}_fill(e){e.fill((0,s.ensureNotNull)(this._path),this._fillRule)}_stroke(e){e.stroke((0,s.ensureNotNull)(this._path))}_render(e){}_isValid(){return null!==this._path}}class v extends f{constructor(e,t,i){super(e,t,i),this._cx=u(e,"cx"),this._cy=u(e,"cy"),this._r=u(e,"r")}_render(e){e.beginPath(),e.arc(this._cx,this._cy,this._r,0,2*Math.PI)}_isValid(){return Number.isFinite(this._cx)&&Number.isFinite(this._cy)&&Number.isFinite(this._r)}}class g extends f{constructor(e,t,i){ super(e,t,i),this._cx=u(e,"cx"),this._cy=u(e,"cy"),this._rx=u(e,"rx"),this._ry=u(e,"ry")}_render(e){e.beginPath(),e.ellipse(this._cx,this._cy,this._rx,this._ry,0,0,2*Math.PI)}_isValid(){return Number.isFinite(this._cx)&&Number.isFinite(this._cy)&&Number.isFinite(this._rx)&&Number.isFinite(this._ry)}}class P{constructor(e){this._originalViewBox=e}apply(e,t){const i=t.targetViewBox;e.translate(i.x,i.y),e.scale(i.width/this._originalViewBox.width,i.height/this._originalViewBox.height),e.beginPath(),e.rect(0,0,this._originalViewBox.width,this._originalViewBox.height),e.clip(),e.translate(-this._originalViewBox.x,-this._originalViewBox.y)}}const y=(0,r.getLogger)("Chart.SvgParser");function S(e){const t=e.getAttribute("gradientUnits");if("objectBoundingBox"===t)return void y.logWarn(`Unsupported linearGradient gradientUnits: ${t}`);const i=[],s=e.getElementsByTagName("stop");for(let e=0;e<s.length;++e){const t=s[e],r=u(t,"offset"),n=t.getAttribute("stop-color");null!==n&&i.push([Number.isFinite(r)?r:0,n])}const r=u(e,"x1"),n=u(e,"y1"),o=u(e,"x2"),l=u(e,"y2");return e=>{const t=e.createLinearGradient(r,n,o,l);for(const e of i)t.addColorStop(e[0],e[1]);return t}}const b=(0,r.getLogger)("Chart.SvgParser");const x=new DOMParser,w=(0,r.getLogger)("Chart.SvgParser");function C(e,t,i,s){var r;const n=e.children;let o,l=s;"g"!==e.tagName&&"svg"!==e.tagName||(l={...l,...p(e,i,!1)},o=null!==(r=a(e))&&void 0!==r?r:void 0),void 0!==o&&t.push(new _(o));for(let e=0;e<n.length;++e){const s=n[e];"defs"!==s.tagName&&C(s,t,i,l)}switch(void 0!==o&&t.push(new _(null)),e.tagName){case"g":case"svg":case"defs":break;case"path":t.push(new m(e,i,s));break;case"circle":t.push(new v(e,i,s));break;case"ellipse":t.push(new g(e,i,s));break;default:w.logWarn(`Unsupported tag name: ${e.tagName}`)}}function I(e){const t=x.parseFromString(e,"application/xml"),i=[],r=t.getElementsByTagName("svg")[0],n=(0,s.ensureNotNull)(r.getAttribute("viewBox")).split(" ").map(parseFloat),o={x:n[0],y:n[1],width:n[2],height:n[3]};i.push(new P(o));let l={getStyle:()=>{}};const a=r.getElementsByTagName("defs");return a.length>0&&(l=function(e){const t={},i=e.children;for(let e=0;e<i.length;++e){const s=i[e],r=s.getAttribute("id");r&&("linearGradient"===s.tagName?t[r]=S(s):b.logWarn(`Unsupported defs tag: ${s.tagName}`))}const s=new WeakMap;return{getStyle:(e,i)=>{const r=t[e];if(!r)return;let n=s.get(i);void 0===n&&(n=new Map,s.set(i,n));const o=n.get(e);if(void 0!==o)return o;const l=r(i);return n.set(e,l),l}}}(a[0])),C(r,i,l),{viewBox:()=>o,render:(e,t)=>{e.save();for(const s of i)s.apply(e,t);e.restore()}}}},627172:(e,t,i)=>{i.d(t,{PaneRendererStepLine:()=>m,StepLineDecoration:()=>s});var s,r=i(204652),n=i(86441),o=i(246733),l=i(315801),a=i(9640),c=i(787123),u=i(43192),h=i(879617);!function(e){e[e.None=0]="None",e[e.Diamonds=1]="Diamonds"}(s||(s={}));class d{constructor(e){this._forceExtendFirstBar=!!e}initialize(e,t,i){var s,r,n,o;const{context:l,horizontalPixelRatio:a,verticalPixelRatio:u}=t,h=e.lineStyle;l.lineCap="butt",l.lineJoin="round" ;const d=Math.max(Math.floor(null!==(r=null===(s=i.style)||void 0===s?void 0:s.width)&&void 0!==r?r:e.lineWidth*a));void 0!==h&&(0,c.setLineStyle)(l,h);const p=d%2?.5:0;l.moveTo(Math.round(i.center*a)+p,Math.round(i.y*u)+p),l.strokeStyle=null!==(o=null===(n=i.style)||void 0===n?void 0:n.color)&&void 0!==o?o:e.lineColor,l.lineWidth=d}startFragment(e,t,i,s){e.beginPath();const r=i.firstItem&&i.extendToBarsEndings?t.center:t.left;e.moveTo(isNaN(r)?-50:r,t.y)}finishFragment(e,t,i){t&&i&&e.lineTo(t.left,i.y),e.stroke()}hitTest(e,t,i,s){var o,l;if(!(0,h.isValidPoint)(t))return!1;const c=null!==(l=null===(o=t.style)||void 0===o?void 0:o.width)&&void 0!==l?l:e.lineWidth,u=(0,a.interactionTolerance)().series+c/2,{left:d,y:p}=t,_=isNaN(d)?-50:d;let f,m;return i&&(0,h.isValidPoint)(i)?(f=i.left,m=i.y):(f=t.right,m=t.y),!(_<s.x-u&&f<s.x-u||_>s.x+u&&f>s.x+u)&&((0,r.distanceToSegment)((0,n.point)(_,p),(0,n.point)(f,p),s).distance<u||p!==m&&(0,r.distanceToSegment)((0,n.point)(f,p),(0,n.point)(f,m),s).distance<u)}applyColor(e,t){e.strokeStyle=t}applyLineWidth(e,t){e.lineWidth=t}drawItem(e,t,i,s){const r=e.context;void 0!==s&&r.lineTo(t.left,s.y),r.lineTo(!i.firstItem||i.extendToBarsEndings||this._forceExtendFirstBar?t.left:t.center,t.y),r.lineTo(i.lastItem&&!i.extendToBarsEndings?t.center:t.right,t.y)}}class p{constructor(){this._lineWidth=1}initialize(e,t,i){var s,r,n,o;const{context:l,horizontalPixelRatio:a}=t;this.applyColor(l,null!==(r=null===(s=i.style)||void 0===s?void 0:s.color)&&void 0!==r?r:e.lineColor),this._lineWidth=Math.max(Math.floor(null!==(o=null===(n=i.style)||void 0===n?void 0:n.width)&&void 0!==o?o:e.lineWidth*a))}startFragment(e,t,i,s){e.beginPath()}finishFragment(e){e.fill()}drawItem(e,t,i,s){if(i.valIsNotSameAsPrev&&!isNaN(t.left)){const i=e.context;i.save(),i.translate(t.left,t.y),i.rotate(Math.PI/4);const s=this._scaleByLineWidth(this._lineWidth);i.scale(s,s),this._drawItemRotatedAndTranslated(e),i.restore()}}applyLineWidth(e,t){this._lineWidth=t}hitTest(e,t,i,s){var r,o;if(!t.valIsNotSameAsPrev)return!1;const l=s.subtract((0,n.point)(t.left,t.y));return this._hitTestTranslated(l,null!==(o=null===(r=t.style)||void 0===r?void 0:r.width)&&void 0!==o?o:e.lineWidth)}_scaleByLineWidth(e){return Math.sqrt(e)}}class _ extends p{applyColor(e,t){e.fillStyle=t}_hitTestTranslated(e,t){return Math.abs(e.x)+Math.abs(e.y)<8*this._scaleByLineWidth(t)/2}_drawItemRotatedAndTranslated(e){(0,c.drawRoundRect)(e.context,-4,-4,8,8,2,!0)}}class f extends p{applyColor(e,t){e.fillStyle=(0,o.applyTransparency)(t,85)}_hitTestTranslated(e,t){return Math.abs(e.x)+Math.abs(e.y)<21*this._scaleByLineWidth(t)/2}_drawItemRotatedAndTranslated(e){(0,c.drawRoundRect)(e.context,-10.5,-10.5,21,21,5,!0)}}class m extends u.BitmapCoordinatesPaneRenderer{constructor(e){super(),this._data=null,this._data=null!=e?e:null}setData(e){this._data=e}hitTest(e){var t,i;const r=this._data;if(null===r||0===r.items.length)return null ;const{items:n,visibleItemsRange:o,skipHoles:a}=r,c=null!==(t=null==o?void 0:o.startItemIndex)&&void 0!==t?t:0,u=null!==(i=null==o?void 0:o.endItemIndex)&&void 0!==i?i:n.length;if(u<=c)return null;const p=r.decoration===s.Diamonds?[new d,new f]:[new d];const _=new h.PaneRendererLineItemsIterator(n,c,u,a);for(;_.next();){const t=_.currentValue(),i=_.nextValue();for(const s of p)if((0,h.isValidPoint)(t)&&s.hitTest(r,t,(0,h.isValidPoint)(i)?i:null,e))return new l.HitTestResult(l.HitTarget.Regular)}return null}_drawImpl(e){if(null===this._data||0===this._data.items.length)return;(this._data.decoration===s.Diamonds?[new d(!0),new _,new f]:[new d]).forEach((t=>this._drawDecorationItem(e,t)))}_drawDecorationItem(e,t){var i,s,r,n,o,l,a,c,u,d;if(null===this._data||0===this._data.items.length)return;const{lineWidth:p,lineColor:_,items:f,visibleItemsRange:m,skipHoles:v,extendToBarsEndings:g}=this._data,{context:P,horizontalPixelRatio:y,verticalPixelRatio:S}=e;let b=Math.max(Math.floor((null!==(s=null===(i=f[0].style)||void 0===i?void 0:i.width)&&void 0!==s?s:p)*y)),x=b%2?.5:0;t.initialize(this._data,e,f[0]);const w=null!==(r=null==m?void 0:m.startItemIndex)&&void 0!==r?r:0,C=null!==(n=null==m?void 0:m.endItemIndex)&&void 0!==n?n:f.length;if(C<=w)return;let I,T,V;P.beginPath(),t.applyColor(P,null!==(l=null===(o=f[w].style)||void 0===o?void 0:o.color)&&void 0!==l?l:_),t.applyLineWidth(P,b);let M=!1;const D=new h.PaneRendererLineItemsIterator(f,w,C,v);for(;D.next();){const i=D.currentValue();if(!(0,h.isValidPoint)(i)){I=void 0,M=!0;continue}const s=null!==(c=null===(a=i.style)||void 0===a?void 0:a.color)&&void 0!==c?c:_,r=null!==(d=null===(u=i.style)||void 0===u?void 0:u.width)&&void 0!==d?d:p,n=s!==T,o=r!==V,l={firstItem:D.currentValueIsFirst(),lastItem:D.currentValueIsLast(),extendToBarsEndings:g,valIsNotSameAsPrev:i.valIsNotSameAsPrev},f={y:Math.round(i.y*S)+x,left:Math.round(i.left*y)+x,center:Math.round(i.center*y)+x,right:Math.round(i.right*y)+x};(n||o||M)&&(T&&V&&t.finishFragment(P,f,I),n&&t.applyColor(P,s),o&&(b=Math.max(1,Math.floor(r*y)),x=b%2?.5:0,t.applyLineWidth(P,b)),t.startFragment(P,f,l,I),M=!1,T=s,V=r),t.drawItem(e,f,l,I),I=f}t.finishFragment(P)}}},888929:(e,t,i)=>{i.d(t,{sortSources:()=>r,sortSourcesPreOrdered:()=>s});const s={LatestUpdates:10000001,BarMarks:10000002,TimeScaleMarks:10000003,ChartEventsSource:10000004,Dividends:10000005,Splits:10000006,Earnings:10000007,RollDates:10000008,FutureContractExpiration:10000009,LineToolOrder:10000010,LineToolPosition:10000011,LineToolExecution:10000012,AlertLabelInactive:10000013,AlertLabel:10000014};function r(e,t){if(0===e.length)return[];if(!t)return[...e].sort(((e,t)=>e.zorder()-t.zorder()));if(!(t.model().mainPane()===t))return[...e].sort(((e,t)=>e.zorder()-t.zorder()));const i=t.model().panes(),s=i.indexOf(t),r=e=>i.findIndex((t=>t.hasDataSource(e)));return e.map((e=>{const i=!t.hasDataSource(e);return{source:e,isMultipane:i,aboveSeries:e.zorder()>t.model().mainSeries().zorder(),paneIndex:i?r(e):s} })).sort(((e,t)=>e.isMultipane||t.isMultipane?e.isMultipane&&!t.isMultipane?t.aboveSeries?-1:1:!e.isMultipane&&t.isMultipane?e.aboveSeries?1:-1:e.paneIndex-t.paneIndex:e.source.zorder()-t.source.zorder())).map((e=>e.source))}},601183:(e,t,i)=>{i.d(t,{PriceAxisViewRenderer:()=>d,hittestByData:()=>h});var s=i(86441),r=i(934026),n=i(86121),o=i(31341),l=i(199471),a=i(315801),c=i(787123);const u=new Path2D("M4.09.93c.4.16.75.4 1.02.73a5.47 5.47 0 0 0-3.78 3.27A2.5 2.5 0 0 1 3.2.77c.31 0 .61.06.89.16Zm8.24 3.35a2.5 2.5 0 0 0-3.27-3.23c-.38.16-.7.4-.97.7a5.47 5.47 0 0 1 3.56 3.5c.3-.26.53-.6.68-.97Zm-3.15-.84a4.5 4.5 0 1 0-5.5 7.12 4.5 4.5 0 0 0 5.5-7.12ZM6 4h1v4H4V7h2V4Z");function h(e,t){var i;const o=(0,n.lastMouseOrTouchEventInfo)().isTouch?10:0,l=e.hitTestData;if(void 0===l||!e.visible)return null;const{itemBox:c,clickHandler:u,tooltip:h}=l;if(c){const n=(0,s.box)(new s.Point(c.min.x-o,c.min.y-o),new s.Point(c.max.x+o,c.max.y+o));if((0,r.pointInBox)(t,n))return new a.HitTestResult(null!==(i=e.hitTarget)&&void 0!==i?i:a.HitTarget.Custom,{clickHandler:null==u?void 0:u.bind(null,t),tapHandler:null==u?void 0:u.bind(null,t),hoverModelFromAxis:l.hoverModelFromAxis,activeItem:l.activeItem,tooltip:h})}return null}class d{constructor(e,t){this._bodyBox=null,this.setData(e,t)}setData(e,t){this._data=e,this._commonData=t}lastDrawnBodyBox(){return this._bodyBox}draw(e,t,i,r,n){var a,u,h,d;const p=this._data,{mediaSize:_,bitmapSize:f,horizontalPixelRatio:m,verticalPixelRatio:v}=t;if(!p.visible||this._isOutOfScreen(i,_.height))return;const g=this._commonData,P=void 0!==p.labelIcon,y=i.borderSize,S=i.paddingTop+g.additionalPaddingTop,b=i.paddingBottom+g.additionalPaddingBottom,x=i.paddingInner,w=p.ignoreAdditionalPaddingInner?0:i.additionalPaddingInner,C=i.paddingOuter,I=i.fontSize;let T=p.text,V=p.textColor||g.textColor,M=p.secondLine||"",D=g.secondLineTextColor||V,A=p.thirdLine||"";const L=g.thirdLineTextColor||V;0===M.length&&(M=A,D=L,A=""),0===T.length&&(T=M,V=D,M=A,D=L,A=""),e.save(),void 0!==g.globalAlpha&&(e.globalAlpha*=g.globalAlpha),e.font=i.font;const B=r.yMidCorrection(e,T)*v,R=Math.ceil(r.measureText(e,T)),N=I+S+b,k=(null!==(a=p.labelIconMinWidth)&&void 0!==a?a:0)*m,E=Boolean(M),O=Boolean(A),F=E?Math.ceil(r.measureText(e,M)):0,W=O?Math.ceil(r.measureText(e,A)):0,z=y+x+C+R+w,H=F>0?y+x+C+F+w:0,U=W>0?y+x+C+W+w:0,K=Math.max(z,H,U),G=Math.max(1,Math.floor(v));let j=Math.round(N*v);j%2!=G%2&&(j+=1);const q=Math.round((I+i.lineSpacing)*v),$=Math.round(2*(I+i.lineSpacing)*v),Y=Math.max(1,Math.floor(y*m)),Q=p.separatorVisible?Y:0,X=p.borderVisible?Y:0,Z=P?Math.max(j,k):Math.round(K*m),J=Math.round(w*m),ee=f.width,te=Math.ceil(x*m),ie=Math.round((null!==(u=g.fixedCoordinate)&&void 0!==u?u:g.coordinate)*v)-Math.floor(.5*v),se=Math.floor(ie+G/2-j/2),re=se+j,ne="right"===n,oe=void 0!==p.xCoord?Math.round(p.xCoord*m)+(ne?1:-1)*Math.round(Z/2):ne?ee-Q:Q,le=ee;let ae,ce=oe;const ue=null!==(h=p.backgroung)&&void 0!==h?h:g.background;e.fillStyle=ue;const he=2*v;if(e.textAlign=ne?"right":"left",e.textBaseline="middle",ne?(ce=oe-Z, ae=oe-J-te-1):(ce=oe+Z,ae=oe+J+te),this._bodyBox=null,T||P){const r=O?j+$:E?j+q:j,n=null!==(d=g.borderColor)&&void 0!==d?d:ue,o=void 0!==p.xCoord?he:0;if(((t,i,n)=>{if(ne){(0,c.drawRoundRectWithInnerBorder)(e,ce,se,Z,r,t,p.overridenRadius?(0,c.scaleDrawRoundRectRadii)(p.overridenRadius,v):[he,o,o,he],X,i,n);const l=(0,s.point)(ce/m,se/v),a=l.add((0,s.point)(Z/m,r/v));this._bodyBox=(0,s.box)(l,a)}else{(0,c.drawRoundRectWithInnerBorder)(e,oe,se,Z,r,t,p.overridenRadius?(0,c.scaleDrawRoundRectRadii)(p.overridenRadius,v):[o,he,he,o],X,i,n);const l=(0,s.point)(oe/m,se/v),a=l.add((0,s.point)(Z/m,r/v));this._bodyBox=(0,s.box)(l,a)}})(ue,n,g.borderStyle),p.separatorVisible&&(e.fillStyle=i.paneBackgroundColor,e.fillRect(ne?le-Q:0,se,Q,re-se)),P){switch(p.labelIcon){case 0:this._drawPlusIcon(e,oe,ce,se,ie,re,G);break;case 1:this._drawClockExistingAlertIcon(e,oe,ce,t,se,r)}return void e.restore()}e.save(),e.translate(ae,(se+re)/2+B),(0,l.drawScaled)(e,m,v,(()=>{e.fillStyle=V,e.fillText(T,0,0)})),e.restore()}E&&(e.fillStyle=D,e.save(),e.translate(ae,(se+re)/2+B+q),(0,l.drawScaled)(e,m,v,(()=>{e.fillText((0,o.startWithLTR)(M),0,0)})),e.restore()),O&&(e.fillStyle=L,e.save(),e.translate(ae,(se+re)/2+B+$),(0,l.drawScaled)(e,m,v,(()=>{e.fillText((0,o.startWithLTR)(A),0,0)})),e.restore()),e.restore()}topBottomTotalHeight(e){const t=this._lines();if(!this._data.visible||0===t)return{top:0,bottom:0,total:0};const i=e.fontSize/2+e.paddingTop+this._commonData.additionalPaddingTop,s=(t-.5)*e.fontSize+(t-1)*e.lineSpacing+e.paddingBottom+this._commonData.additionalPaddingBottom;return{top:i,bottom:s,total:i+s}}hitTest(e){return h(this._data,e)}_drawPlusIcon(e,t,i,s,r,n,o){e.fillStyle=this._commonData.textColor,e.strokeStyle=this._commonData.textColor,e.lineWidth=o;const l=Math.abs(t-i);let a=Math.round(.35*l);a%2!=o%2&&(a+=1);let c=Math.round(.65*l);c%2!=o%2&&(c+=1);const u=Math.floor((l-a)/2),h=Math.min(t,i),d=h+Math.floor(l/2-o/2);e.fillRect(h+u,r,a,o),e.fillRect(d,s+u,o,a),e.beginPath(),e.arc(d+o/2,r+o/2,c/2,0,2*Math.PI,!1),e.stroke()}_drawClockExistingAlertIcon(e,t,i,s,r,n){e.fillStyle=this._commonData.textColor;const o=Math.abs(t-i),l=Math.min(t,i),{horizontalPixelRatio:a,verticalPixelRatio:c}=s,h=o/(23*a),d=o/(23*c),p=12*a*h,_=10.73*c*d,f=Math.floor((o-p)/2),m=Math.floor((n-_)/2)-1;e.save(),e.translate(l+f,r+m),e.scale(a*h,c*d),e.fill(u),e.restore()}_lines(){const e=this._data;return(e.text?1:0)+(e.secondLine?1:0)+(e.thirdLine?1:0)}_isOutOfScreen(e,t){var i;const s=this._commonData,r=null!==(i=s.fixedCoordinate)&&void 0!==i?i:s.coordinate,{total:n}=this.topBottomTotalHeight(e),o=n/this._lines();return r-o/2-3>t||r+(n-o/2)+3<0}}},229765:(e,t,i)=>{i.d(t,{PriceAxisView:()=>n});var s=i(601183),r=i(246733);class n{constructor(e){this._commonRendererData={coordinate:0,textColor:"#FFF",background:"#000",additionalPaddingBottom:0,additionalPaddingTop:0},this._axisRendererData={text:"",visible:!1,separatorVisible:!1,borderVisible:!1,ignoreAdditionalPaddingInner:!1},this._paneRendererData={text:"",visible:!1,separatorVisible:!0,borderVisible:!1, ignoreAdditionalPaddingInner:!0},this._invalidated=!0,this._active=!1,this._axisRenderer=new(e||s.PriceAxisViewRenderer)(this._axisRendererData,this._commonRendererData),this._paneRenderer=new(e||s.PriceAxisViewRenderer)(this._paneRendererData,this._commonRendererData)}setActive(e){this._active=e}text(){return this._updateRendererDataIfNeeded(),this._axisRendererData.text}secondLineText(){return this._updateRendererDataIfNeeded(),this._axisRendererData.secondLine}thirdLineText(){return this._updateRendererDataIfNeeded(),this._axisRendererData.thirdLine}background(){return this._updateRendererDataIfNeeded(),this._commonRendererData.background}color(){return this._updateRendererDataIfNeeded(),this.generateTextColor(this.background())}generateTextColor(e){return(0,r.colorFromBackground)(e)}coordinate(){return this._updateRendererDataIfNeeded(),this._commonRendererData.coordinate}floatCoordinate(){var e;return this._updateRendererDataIfNeeded(),null!==(e=this._commonRendererData.floatCoordinate)&&void 0!==e?e:this._commonRendererData.coordinate}update(e){this._invalidated=!0}topBottomTotalHeight(e){this._updateRendererDataIfNeeded();const{top:t,bottom:i,total:s}=this._axisRenderer.topBottomTotalHeight(e),{top:r,bottom:n,total:o}=this._paneRenderer.topBottomTotalHeight(e);return{top:Math.max(t,r),bottom:Math.max(i,n),total:Math.max(s,o)}}getFixedCoordinate(){return this._commonRendererData.fixedCoordinate||0}setFixedCoordinate(e){this._commonRendererData.fixedCoordinate=e}isVisible(){return this._updateRendererDataIfNeeded(),this._axisRendererData.visible||this._paneRendererData.visible}isAxisLabelVisible(){return this._updateRendererDataIfNeeded(),this._axisRendererData.visible}isPaneLabelVisible(){return this._updateRendererDataIfNeeded(),this._paneRendererData.visible}renderer(){return this._updateRendererDataIfNeeded(),this._axisRenderer}paneRenderer(){return this._updateRendererDataIfNeeded(),this._paneRenderer}setPaneRendererLabelIcon(e){this._paneRendererData.labelIcon=e}setPaneLabelVisible(e){this._paneRendererData.visible=e,this._invalidated=!0}ignoreAlignment(){return!1}_updateRendererDataIfNeeded(){this._invalidated&&(this._commonRendererData.fixedCoordinate=void 0,this._updateRendererData(this._axisRendererData,this._paneRendererData,this._commonRendererData),this._invalidated=!1)}}},974655:(e,t,i)=>{i.d(t,{PriceDataSource:()=>l,isPriceDataSource:()=>o});var s=i(996986),r=i(707957),n=i(981107);function o(e){return e instanceof l}class l extends s.DataSource{constructor(e,t){super(t),this._formatterChanged=new r.Delegate,this._priceStepChanged=new r.Delegate,this._currencyChanged=new r.Delegate,this._unitChanged=new r.Delegate,this._priceRangeReadyChanged=new r.Delegate,this._priceStep=null,this._priceRangeReady=!0,this._model=e}base(){return 0}model(){return this._model}currencyChanged(){return this._currencyChanged}isCurrencySource(){return!0}isDisplayedInLegend(){return!0}unitChanged(){return this._unitChanged}isUnitSource(){return!0}priceRange(e,t,i){return null}isDraggable(){return!0}priceLineColor(e){ return e}formatterChanged(){return this._formatterChanged}priceStep(e){return this._priceStep}priceStepChanged(){return this._priceStepChanged}isIncludedInAutoScale(){return!0}correctScaleMargins(e){return e}priceRangeReady(){return this._priceRangeReady}priceRangeReadyChanged(){return this._priceRangeReadyChanged}disablePriceRangeReady(){const e=this.priceScale();null===e||e.isAutoScale()||e.mainSource()!==this||(this._priceRangeReady=!1,e.recalculatePriceRangeOnce()),this._priceRangeReadyChanged.fire(!1)}statusView(){return null}legendView(){return null}marketStatusModel(){return null}dataUpdatedModeModel(){return null}dataProblemModel(){return null}canHasAlertOnLineTools(){return!0}_enablePriceRangeReady(){this._priceRangeReady=!0,this._priceRangeReadyChanged.fire(!0)}_onSourceCurrencyChanged(){(0,n.isActingAsSymbolSource)(this)||this._currencyChanged.fire()}_onSourceUnitChanged(){(0,n.isActingAsSymbolSource)(this)||this._unitChanged.fire()}_onSourcePriceRangeReadyChanged(e){(0,n.isActingAsSymbolSource)(this)||e||this.disablePriceRangeReady()}}},506387:(e,t,i)=>{i.d(t,{PriceLineAxisView:()=>a,SeriesPriceLineAxisView:()=>c,StudyPriceLineAxisView:()=>u});var s=i(229765),r=i(650151),n=i(458963),o=i(787123);class l{constructor(e,t){this.setData(e,t)}setData(e,t){this._data=e,this._commonData=t}draw(e,t,i,s,l){var a;if(!this._data.visible)return;const{bitmapSize:c,verticalPixelRatio:u}=t,h=null!==(a=this._commonData.fixedCoordinate)&&void 0!==a?a:this._commonData.coordinate;e.lineWidth=Math.max(1,Math.floor((0,r.ensureDefined)(this._data.linewidth)*u)),e.lineCap="butt",(0,o.setLineStyle)(e,void 0===this._data.linestyle?n.LINESTYLE_DOTTED:this._data.linestyle),e.strokeStyle=this._commonData.textColor,(0,o.drawHorizontalLine)(e,Math.round(h*u),0,c.width)}topBottomTotalHeight(e){return{top:0,bottom:0,total:0}}}class a extends s.PriceAxisView{constructor(e){super(e||l)}ignoreAlignment(){return!0}_updateRendererData(e,t,i){if(t.visible=!1,e.visible=!1,!this._isVisible())return;const s=this._value();s.noData||(i.background="",i.textColor=this._priceLineColor(s.color),i.coordinate=s.coordinate,i.floatCoordinate=s.floatCoordinate,e.linewidth=this._lineWidth(),e.linestyle=this._lineStyle(),e.backgroundAreaVisible=this._backgroundAreaVisible(),e.backgroundAreaColor=this._backgroundAreaColor(),e.backgroundAreaHeight=this._backgroundAreaHeight(),e.visible=!0)}_lineStyle(){return n.LINESTYLE_DOTTED}_backgroundAreaVisible(){return!1}_backgroundAreaColor(){return""}_backgroundAreaHeight(){return 0}}class c extends a{constructor(e){super(),this._series=e}_value(){return this._series.lastValueData(void 0,!0)}_priceLineColor(e){return this._series.priceLineColor(e)}_lineWidth(){return this._series.properties().childs().priceLineWidth.value()}_isVisible(){const e=this._series.model().properties().childs().scalesProperties.childs().showSeriesLastValue.value();return this._series.properties().childs().showPriceLine.value()&&e}}class u extends a{constructor(e,t){super(),this._study=e,this._plotname=t}_value(){ return this._study.lastValueData(this._plotname,!0)}_lineWidth(){return this._study.properties().childs().styles.childs()[this._plotname].childs().linewidth.value()}_lineStyle(){return n.LINESTYLE_DOTTED}_priceLineColor(e){return e}_isVisible(){const e=this._study.model().properties().childs().scalesProperties.childs().showStudyLastValue.value(),t=this._study.isPlotVisibleAt(this._plotname,1);return this._study.properties().childs().styles.childs()[this._plotname].childs().trackPrice.value()&&e&&t}}},291784:(e,t,i)=>{i.d(t,{PriceRange:()=>n,mergePriceRanges:()=>o});var s=i(389137);const r=(0,i(201089).getLogger)("Chart.PriceRange");class n{constructor(e,t){if(null!==e&&"object"==typeof e){const t=e;this._minValue=t.m_minValue,this._maxValue=t.m_maxValue}else{const i=e;this._minValue=i,void 0!==t&&(this._maxValue=t)}}equals(e){return this._minValue===e._minValue&&this._maxValue===e._maxValue}clone(){return new n(this._minValue,this._maxValue)}minValue(){return this._minValue}setMinValue(e){this._minValue=e}maxValue(){return this._maxValue}setMaxValue(e){this._maxValue=e}length(){return this._maxValue-this._minValue}isEmpty(){return this._maxValue===this._minValue||this._maxValue!=this._maxValue||this._minValue!=this._minValue}serialize(){return{m_maxValue:this._maxValue,m_minValue:this._minValue}}state(){return{max:this._maxValue,min:this._minValue}}merge(e){return new n(Math.min(this.minValue(),e.minValue()),Math.max(this.maxValue(),e.maxValue()))}apply(e,t){this._minValue=Math.min(this._minValue,e),this._maxValue=Math.max(this._maxValue,t)}set(e,t){this._minValue=e,this._maxValue=t}scaleAroundCenter(e){if(!(0,s.isNumber)(e))return void r.logDebug("PriceRange.scaleAroundCenter: invalid coeff");if(0===this._maxValue-this._minValue)return;const t=.5*(this._maxValue+this._minValue);let i=this._maxValue-t,n=this._minValue-t;i*=e,n*=e,this._maxValue=t+i,this._minValue=t+n}shift(e){(0,s.isNumber)(e)?(this._maxValue+=e,this._minValue+=e):r.logDebug("PriceRange.shift: invalid coeff")}containsStrictly(e){return e.minValue()>this._minValue&&e.maxValue()<this._maxValue}static compare(e,t){return null===e||null===t?e===t:e.equals(t)}}function o(e){return e.reduce(((e,t)=>e?t?e.merge(t):e:t),null)}},152633:(e,t,i)=>{i.d(t,{createPrimitiveProperty:()=>r});var s=i(354950);function r(e){return new s.Property(e)}},738232:(e,t,i)=>{i.d(t,{factoryDefaultsForCurrentTheme:()=>a});var s=i(852290),r=i(822914),n=i(650151),o=i(331633),l=i(86746);function a(e,t){var i;const a=null!==(i=o.watchedTheme.value())&&void 0!==i?i:l.StdTheme.Light,c=(0,r.default)(e);return(0,s.default)(c,(0,n.ensureDefined)(t.get(a))),c}},369689:(e,t,i)=>{i.d(t,{combineProperty:()=>r});var s=i(152633);function r(e,...t){const i=()=>e(...t.map((e=>e.value()))),r=(0,s.createPrimitiveProperty)(i()),n=()=>r.setValue(i()),o={};for(const e of t)e.subscribe(o,n);return r.destroy=()=>{t.forEach((e=>e.unsubscribeAll(o))),t.forEach((e=>e.release()))},r}},154718:(e,t,i)=>{i(152633)},197050:(e,t,i)=>{i.d(t,{combineProperty:()=>o.combineProperty, createWVFromGetterAndSubscription:()=>s.createWVFromGetterAndSubscription,createWVFromGetterAndSubscriptions:()=>r.createWVFromGetterAndSubscriptions,createWVFromProperty:()=>n.createWVFromProperty});var s=i(824837),r=i(784547),n=i(936515),o=(i(154718),i(369689))},784547:(e,t,i)=>{i.d(t,{createWVFromGetterAndSubscriptions:()=>r});var s=i(401580);function r(e,t){const i=new s.WatchedValue(e()),r={};t.forEach((t=>t.subscribe(r,(()=>{i.setValue(e())}))));return i.readonly().spawn((()=>t.forEach((e=>e.unsubscribeAll(r)))))}},936515:(e,t,i)=>{i.d(t,{createWVFromProperty:()=>r});var s=i(824837);function r(e){return(0,s.createWVFromGetterAndSubscription)((()=>e.value()),e)}},354950:(e,t,i)=>{i.d(t,{Property:()=>h});var s=i(203308),r=i(827147),n=i(368888),o=i(162942),l=i(650151),a=i(707957),c=i(428123);function u(e){return null===e||(0,s.default)(e)&&Number.isFinite(e)||(0,r.default)(e)||(0,n.default)(e)}class h{constructor(e){if(this._listeners=new a.Delegate,this._muteChildChanges=!1,this._childs=[],this._dependents=[],void 0!==e)if(u(e))this._value=e;else for(const[t,i]of Object.entries(e))this.addProperty(t,i)}destroy(){var e,t;this.listeners().destroy();for(const i of this._childs)null===(t=null===(e=this.child(i))||void 0===e?void 0:e.destroy)||void 0===t||t.call(e)}merge(e,t){let i=null,s=0;if(t&&(i=[],s=i.length),void 0===e)return i;if(u(e))return this._value!==e&&(null==i||i.push(this)),this._value=e,i;if(Array.isArray(e))for(let s=0;s<e.length;s++){const r=this.childs()[s];if(r){const n=r.merge(e[s],t);null==i||i.push(...n)}else{const t=this.addProperty(`${s}`,e[s]);null==i||i.push(t)}}else for(const[s,r]of Object.entries(e)){const e=this.childs()[s];if(e){const s=e.merge(r,t);null==i||i.push(...s)}else{const e=this.addProperty(s,r);null==i||i.push(e)}}return i&&i.length>s&&i.push(this),i}mergeAndFire(e){const t=(0,l.ensureNotNull)(this.merge(e,!0));this._muteChildChanges=!0;for(const e of t)e._muteChildChanges=!0;for(const e of t)e._muteChildChanges=!1,e.listeners().fire(e,"");this._muteChildChanges=!1,t.length>0&&this.listeners().fire(this,"")}state(e){let t=(0,o.default)(this.value)?this.value():void 0;void 0===t&&(t={});for(const i of this._childs){if(e&&-1!==e.indexOf(i))continue;const s=this.childs()[i];let r;if(e){const t=[];for(const s of e)s.startsWith(i+".")&&t.push(s.substring(i.length+1));r=null==s?void 0:s.state(t)}else r=null==s?void 0:s.state();(void 0!==r||(null==s?void 0:s.storeStateIfUndefined()))&&(t[i]=r)}return t}clone(){return new h(this.state())}value(){return this._value}listeners(){return this._listeners}childCount(){return this._childs.length}childNames(){return this._childs}child(e){return this.childs()[e]}childByPath(e){let t=this;for(const i of e.split(".")){if(void 0===t)break;t=t.child(i)}return t}hasChild(e){return this._childs.includes(e)}setValue(e,t){(this._value!==e||t)&&(this._value=e,this._listeners.fire(this,""))}setValueSilently(e){this._value=e}addProperty(e,t){const i=new h(t);return this[e]=i,this._childs.push(e), i.subscribe(this,((t,i)=>this.childChanged(t,i?`${e}.${i}`:e))),i}removeProperty(e){this[e].unsubscribeAll(this),delete this[e],this._childs=this._childs.filter((t=>t!==e))}addChild(e,t){const i=this;i[e]&&i[e].unsubscribeAll(this),i[e]=t,-1===this._childs.indexOf(e)&&this._childs.push(e),t.subscribe(this,((t,i)=>this.childChanged(t,i?`${e}.${i}`:e)))}childChanged(e,t){this._muteChildChanges||this._listeners.fire(this,t)}subscribe(e,t){this.listeners().subscribe(e,t,!1)}unsubscribe(e,t){this.listeners().unsubscribe(e,t)}unsubscribeAll(e){this.listeners().unsubscribeAll(e)}childs(){return this}storeStateIfUndefined(){return!0}ownership(){return(0,c.ownership)(this)}weakReference(){return(0,c.weakReference)(this)}addDependent(e){this._dependents.push(e)}removeDependent(e){const t=this._dependents.indexOf(e);t>=0&&this._dependents.splice(t,1)}dependents(){return this._dependents}}},915179:(e,t,i)=>{i.d(t,{barSpacingByScaleRatio:()=>o,priceRangeByScaleRatio:()=>n,scaleRatio:()=>r});var s=i(291784);function r(e,t){if(t.isLog()||e.isEmpty()||t.isEmpty())return null;const i=function(e){if(e.isEmpty())return null;const t=e.priceRange();if(null===t)return null;const i=t.length();return e.internalHeight()/i}(t);if(null===i)return null;return e.getValidBarSpacing()/Math.max(1e-10,i)}function n(e,t,i){if(e.isLog()||null===i||e.isEmpty())return null;const r=e.priceRange();if(null===r||r.isEmpty())return null;const n=e.internalHeight()/(t/i),o=r.length();if(n===o)return r;const l=(n-o)/2;return new s.PriceRange(r.minValue()-l,r.maxValue()+l)}function o(e,t){if(e.isLog()||null===t||e.isEmpty())return null;const i=e.priceRange();if(null===i)return null;const s=i.length();return e.internalHeight()/s*t}},662080:(e,t,i)=>{i.d(t,{iterateAndPatchObjectsByMap:()=>u,patchPropertiesAsync:()=>c});var s=i(650151),r=i(201089),n=i(345848),o=i(516684),l=i(957879);const a=(0,r.getLogger)("Pine.ScriptLib");function c(e,t,i,s){return a.logNormal("patchPropertiesAsync"),new Promise(((r,a)=>{if(!t.TVScriptMetaInfoExprs)return void r(e);const c=t.TVScriptMetaInfoExprs.tree,h=t.TVScriptMetaInfoExprs.patchMap;(function(e,t){(0,n.trackEvent)("Pine","ScriptLib.evalMetaInfoExprs");const i=l.Deferred(),s={username:window.user&&window.user.username,source:e,inputs:JSON.stringify(t||{})};return(0,o._pineFacadeAjax)("POST","/eval_pine_ex/",s).done(((e,t)=>{e.error?i.reject((0,o._readableError)(e.error,t)):e.success?i.resolve(e.result):i.reject((0,o.safetyGetReason)(e))})).fail((e=>{(0,o._anyRequestAsyncFail)(i,e)})),i.promise()})(c,i).done((i=>{if(!i)return void r(e);const n=i.rootValues;u([e,t.defaults,t],h,((e,t,i)=>{const r=n[i],o=e[0],l=e[1],a=e[2];(void 0===s||void 0!==s[i]&&s[i]!==r)&&(l.hasOwnProperty(t)?o[t].setValue(r):a[t]=r)})),void 0!==s&&Object.keys(n).forEach((e=>{void 0!==s[e]&&(s[e]=n[e])})),r(e)})).fail((e=>{a(e)}))}))}function u(e,t,i){const r=Object.keys(t);for(let n=0;n<r.length;n++){const o=r[n],l=t[o],a=o.split(".");"defaults"===a[0]&&a.splice(0,1),(0,s.assert)(a.length>1,"Unexpectedly short json path");let c=[...e] ;for(let e=0;e<a.length-1;++e){const t=a[e];c=c.map((e=>e?e[t]:null))}i(c,a[a.length-1],l)}}},63316:(e,t,i)=>{i.d(t,{SelectionIndexes:()=>r});var s=i(650151);class r{constructor(e){this._baseIndex=null,this._offsetInBar=null,this._offsetInTime=null,this._barsBetweenPoints=null,this._timescale=e}indexes(){const e=this._timescale.visibleBarsStrictRange();if(null===e)return[];const t=e.firstBar(),i=e.lastBar();if(null===this._offsetInTime||null===this._barsBetweenPoints){const e=this._timescale.barSpacing();this._barsBetweenPoints=Math.floor(120/e),this._offsetInBar=i%this._barsBetweenPoints,this._offsetInTime=this._timescale.indexToTimePoint(this._offsetInBar),this._baseIndex=this._timescale.baseIndex()}const r=this._timescale.baseIndex();this._baseIndex!==r&&(this._baseIndex=r,this._offsetInBar=(0,s.ensureNotNull)(this._timescale.timePointToIndex(this._offsetInTime)));const n=(0,s.ensureNotNull)(this._offsetInBar),o=[];let l=Math.floor((t-n)/this._barsBetweenPoints);const a=Math.floor((i-n)/this._barsBetweenPoints);for(;l<=a;l++)o.push(n+l*this._barsBetweenPoints);return o}clear(){this._offsetInBar=null,this._offsetInTime=null,this._baseIndex=null,this._barsBetweenPoints=null}}},230058:(e,t,i)=>{i.d(t,{SelectionRenderer:()=>c});var s=i(934026),r=i(790188),n=i(315801),o=i(147354),l=i(43192);const a=r.colorsPalette["color-tv-blue-600"];class c extends l.BitmapCoordinatesPaneRenderer{constructor(e){super(),this._data=e||null}setData(e){this._data=e}hitTest(e){if(!this._data||!this._data.visible)return null;for(let t=0;t<this._data.points.length;t++){const i=this._data.points[t];if(i.subtract(e).length()<=5.5){const e=void 0!==this._data.pointsCursorType?this._data.pointsCursorType[t]:o.PaneCursorType.Default;return new n.HitTestResult(this._data.hittestResult,{pointIndex:i.data,cursorType:e})}}return null}doesIntersectWithBox(e){return!!this._data&&this._data.points.some((t=>(0,s.pointInBox)(t,e)))}_drawImpl(e){if(null===this._data||!this._data.visible)return;const{context:t,horizontalPixelRatio:i}=e;t.strokeStyle=void 0!==this._data.color?this._data.color:a,t.lineCap="butt";const s=Math.max(1,Math.floor(i));t.lineWidth=s;const r=this._data.vertOffset||0;for(let i=0;i<this._data.points.length;++i){const o=this._data.points[i];(n=o,Number.isFinite(n.x)&&Number.isFinite(n.y))&&(t.fillStyle=this._data.bgColors[i],this._drawMarker(e,{center:o.x,y:o.y},r,s))}var n}_drawMarker(e,t,i,s){const{context:r,horizontalPixelRatio:n,verticalPixelRatio:o}=e;let l=Math.round(3.5*n*2);l%2!=s%2&&(l+=1);let a=Math.round(l+2*(.5*s+.75*n));a%2!=s%2&&(a+=1);const c=Math.round(t.center*n),u=Math.round((t.y+i)*o),h=s%2/2;r.beginPath(),r.arc(c+h,u+h,a/2,0,2*Math.PI,!0),r.closePath(),r.fill(),r.beginPath(),r.arc(c+h,u+h,l/2,0,2*Math.PI,!0),r.closePath(),r.stroke()}}},544421:(e,t,i)=>{i.d(t,{SeriesData:()=>p,barFunction:()=>u,seriesPlotFunctionMap:()=>c});var s,r=i(650151),n=i(195447),o=i(674981);!function(e){e[e.FromLeft=-1]="FromLeft",e[e.FromRight=1]="FromRight"}(s||(s={}));const l={open:e=>e[1],high:e=>e[2],low:e=>e[3],close:e=>e[4], hl2:e=>(e[2]+e[3])/2,hlc3:e=>(e[2]+e[3]+e[4])/3,ohlc4:e=>(e[1]+e[2]+e[3]+e[4])/4},a=["open","high","low","close","hl2","hlc3","ohlc4"];function c(){const e=new Map;return a.forEach(((t,i)=>{e.set(t,u(t))})),e}function u(e,t,i){const s=l[null!=t?t:e],r=l[e],n=l[null!=i?i:e];return(e,t)=>{switch(t){case 0:return s(e);case 2:return n(e);default:return r(e)}}}function h(e,t){return null==e[t]}const d=[{barsToMerge:10,forBarspacingLargerThen:.03},{barsToMerge:30,forBarspacingLargerThen:.01},{barsToMerge:100,forBarspacingLargerThen:.003},{barsToMerge:500,forBarspacingLargerThen:0}];class p{constructor(){this._pressedChunks={chunks:new Map,priceSource:"uninitialized"},this.m_bars=new n.PlotList(c(),h),this.m_nsBars=new n.PlotList(c(),h),this._clearPressedChunks()}bars(){return this.m_bars}nsBars(){return this.m_nsBars}pressedChunks(e,t){if(t!==this._pressedChunks.priceSource){this._pressedChunks.priceSource=t;const e=this.m_bars.first();e&&(this._clearPressedChunks(),this._rebuildPressedChunks(e))}const i=(0,r.ensureDefined)(d.find((t=>t.forBarspacingLargerThen<=e)));return(0,r.ensureDefined)(this._pressedChunks.chunks.get(i.barsToMerge))}mergeRegularBars(e){const t=this.m_bars.size(),i=this.m_bars.merge(e);return i&&"uninitialized"!==this._pressedChunks.priceSource&&(t===this.m_bars.size()&&i.index===this.m_bars.lastIndex()?this._updateLatestChunks():this._rebuildPressedChunks(i)),i}size(){return this.m_bars.size()+this.m_nsBars.size()}each(e){this.m_bars.each(e),this.m_nsBars.each(e)}clear(){this.m_bars.clear(),this.m_nsBars.clear(),this.lastProjectionPrice=void 0,this._clearPressedChunks()}clone(){const e=new p;return e.lastProjectionPrice=this.lastProjectionPrice,e.boxSize=this.boxSize,e.reversalAmount=this.reversalAmount,e.m_bars=this.m_bars.clone(),e.m_nsBars=this.m_bars.clone(),e}isEmpty(){return this.m_bars.isEmpty()&&this.m_nsBars.isEmpty()}first(){return this.m_bars.isEmpty()?this.m_nsBars.first():this.m_bars.first()}last(){return this.m_nsBars.isEmpty()?this.m_bars.last():this.m_nsBars.last()}search(e,t,i){return this.nsBars().isEmpty()?this.bars().search(e,t,i):this.bars().isEmpty()||(0,r.ensureNotNull)(this.nsBars().firstIndex())<=e?this.nsBars().search(e,t,i):this.bars().search(e,t,i)}valueAt(e){const t=this.search(e);return null!==t?t.value:null}plotValueToTimePointIndex(e,t,i){if(i===s.FromRight){const i=(i,s)=>{const r=s[t];return null!=r&&e>=r},s=this.m_bars.findLast(i);if(null!==s)return s.index;const r=this.m_nsBars.findLast(i);return null!==r?r.index:this.m_bars.firstIndex()}if(i===s.FromLeft){const i=(i,s)=>{const r=s[t];return null!=r&&e<=r},s=this.m_bars.findFirst(i);if(null!==s)return s.index;const r=this.m_nsBars.findFirst(i);return null!==r?r.index:this.m_bars.lastIndex()}throw new Error("plotValueToTimePointIndex: unsupported search mode")}moveData(e){this.m_bars.move(e),this.m_nsBars.move(e),this.m_bars.size()>0&&this._rebuildPressedChunks((0,r.ensureNotNull)(this.m_bars.first()))}_rebuildPressedChunks(e){const t=this._pressedChunks.priceSource;if("uninitialized"===t)return ;const i=e.index,s=l[t],n=(e,t,i)=>{let r=null;for(const n of e){const e=s(n.value);r&&n.index-r.startTime>=i.barsToMerge&&(t.push(r),r=null),r?(r.endTime=n.index,r.high=Math.max(r.high,e),r.low=Math.min(r.low,e),r.close=e):r={startTime:n.index,endTime:n.index,open:e,high:e,low:e,close:e}}r&&t.push(r)};d.forEach((e=>{const t=(0,r.ensureDefined)(this._pressedChunks.chunks.get(e.barsToMerge)),s=(0,o.lowerbound)(t,i,((e,t)=>e.endTime<t));if(0===s&&t.length>0){const i=t[0].startTime-1,s=(0,r.ensureNotNull)(this.m_bars.firstIndex()),o=this.m_bars.rangeIterator(s,i),l=[];n(o,l,e);const a=l.concat(t);this._pressedChunks.chunks.set(e.barsToMerge,a)}else{const i=(0,r.ensureNotNull)(this.m_bars.lastIndex());t.splice(s);let o=(0,r.ensureNotNull)(this.m_bars.firstIndex());t.length&&(o=t[t.length-1].endTime+1);const l=this.m_bars.rangeIterator(o,i);n(l,t,e)}}))}_updateLatestChunks(){const e=(0,r.ensureNotNull)(this.m_bars.last());d.forEach((t=>{const i=(0,r.ensureDefined)(this._pressedChunks.chunks.get(t.barsToMerge)),s=e.value[4],n=i[i.length-1];n.high=Math.max(n.high,s),n.low=Math.min(n.low,s),n.close=s,n.endTime=e.index}))}_clearPressedChunks(){d.forEach((e=>this._pressedChunks.chunks.set(e.barsToMerge,[])))}}},3140:(e,t,i)=>{i.d(t,{SeriesTimeRangeVolumeCalculator:()=>s});class s{constructor(e){this._value=null,this._series=e,this._series.dataEvents().dataUpdated().subscribe(this,this._onSeriesUpdated)}destroy(){this._series.dataEvents().dataUpdated().unsubscribeAll(this)}volume(e,t){if(null!==this._value&&this._value.from===e&&this._value.to===t)return this._value.value;let i=0;const s=this._series.data().bars(),r=s.firstIndex(),n=s.lastIndex();if(null!==r&&e<r&&t<r||null!==n&&e>n&&t>n)i=NaN;else{const s=this._series.data().bars().rangeIterator(Math.min(e,t),Math.max(e,t));for(const e of s){const t=e.value[5];if(void 0===t){i=NaN;break}i+=t}}return this._value={from:e,to:t,value:i},i}_onSeriesUpdated(e,t){if(null===this._value)return;if(t)return void(this._value=null);const i=this._series.data().bars().lastIndex();(null===i||i<=this._value.to)&&(this._value=null)}}},969419:(e,t,i)=>{i.d(t,{PaneRendererBars:()=>n});var s=i(9640),r=i(756930);class n extends r.PaneRendererSeriesBase{constructor(e){super(),this._bars=e.bars,this._dontDrawOpen=e.dontDrawOpen,this._thinBars=e.thinBars}_drawImpl(e){const{context:t,horizontalPixelRatio:i,verticalPixelRatio:s}=e;t.save();let r=null;for(const e of this._bars){let n=this._calcRealBarWidth(e.right-e.left,i);if(n>=2){Math.max(1,Math.floor(i))%2!=n%2&&n--}const o=this._thinBars?Math.min(n,Math.floor(i)):n,l=o<=n&&e.right-e.left>=Math.floor(1.5*i);r!==e.color&&(t.fillStyle=e.color,r=e.color);const a=Math.floor(.5*o),c=Math.round(e.center*i),u=c-a,h=o,d=u+h-1,p=Math.min(e.high,e.low),_=Math.max(e.high,e.low),f=Math.round(p*s)-a,m=Math.round(_*s)+a,v=Math.max(m-f,o);t.fillRect(u,f,h,v);const g=Math.ceil(1.5*n);if(l){const i=c-g,r=c+g,n=Math.min(u-i,r-d);if(!this._dontDrawOpen){let r=Math.max(f,Math.round(e.open*s)-a),o=r+h-1;o>f+v-1&&(o=f+v-1,r=o-h+1),t.fillRect(i,r,n,o-r+1)} let o=Math.max(f,Math.round(e.close*s)-a),l=o+h-1;l>f+v-1&&(l=f+v-1,o=l-h+1),t.fillRect(d+1,o,n,l-o+1)}}t.restore()}_getTolerance(){return(0,s.interactionTolerance)().series}_calcRealBarWidth(e,t){const i=Math.floor(t);return Math.max(i,Math.floor((0,s.optimalBarWidth)(e,t)))}}},756930:(e,t,i)=>{i.d(t,{PaneRendererSeriesBase:()=>n});var s=i(315801),r=i(43192);class n extends r.BitmapCoordinatesPaneRenderer{constructor(){super(...arguments),this._bars=[]}hitTest(e){const t=this._bars;if(0===t.length)return null;const i=this._getTolerance(),s=t[0],r=t[t.length-1];if(e.x<s.left-i)return null;if(e.x>r.right+i)return null;let n=0,o=t.length-1,l=-1;for(;n<=o;){const i=Math.floor((n+o)/2),s=t[i];if(e.x>=s.left&&e.x<=s.right){l=i;break}e.x>s.right?n=i+1:o=i-1}if(-1===l)return null;if(this._isPointAtBar(t[l],e.y,i))return this._getHitTest();let a=l;for(;a>=1&&e.x-t[a-1].right<i;)a--;let c=l;for(;c<=t.length-2&&t[c+1].left-e.x<i;)c++;const u=Math.max(0,a),h=Math.min(t.length-1,c);for(let s=u;s<=h;s++)if(s!==l&&this._isPointAtBar(t[s],e.y,i))return this._getHitTest();return null}_getHitTest(){return new s.HitTestResult(s.HitTarget.Regular)}_isPointAtBar(e,t,i){const s=Math.min(e.high,e.low),r=Math.max(e.high,e.low);return s-i<=t&&t<=r+i}}},956725:(e,t,i)=>{i.d(t,{PaneRendererCandles:()=>c});var s=i(650151),r=i(315801),n=i(787123),o=i(9640),l=i(756930);function a(e,t,i,s){const r=Math.floor(t);return e.map((e=>{let n=(0,o.optimalCandlestickWidth)((e.right-e.left)*s,t);n>=2&&r%2!=n%2&&n--;const l=Math.floor(.5*n),a=function(e,t){let i=Math.floor(1*t);e<=2*i&&(i=Math.floor(.5*(e-1)));const s=Math.max(Math.floor(t),i);if(e<=2*s)return Math.max(Math.floor(t),Math.floor(1*t));return s}(n,t),c=Math.round(e.center*t),u=c-l,h=u+n-1,d=Math.abs(Math.max(e.open,e.close)-Math.min(e.open,e.close))*i,p=Math.round(Math.min(e.open,e.close)*i),_=Math.round(Math.max(e.open,e.close)*i);let f=Math.min(Math.floor(t),Math.floor(n*t));f=Math.max(Math.floor(t),Math.min(f,n));const m=Math.floor(.5*f);return{rawBodyHeight:d,top:p,bottom:_,center:c,left:u,right:h,candleWidth:n,high:Math.round(e.high*i),low:Math.round(e.low*i),wickWidth:f,wickOffset:m,borderWidth:a}}))}class c extends l.PaneRendererSeriesBase{constructor(e){super(),this._scaleCoeff=1,this._borderVisible=!1,this._wickVisible=!1,this._bodyVisible=!0,this._borderColor=void 0,this._wickColor=void 0,this._hittest=void 0,this._isPriceScaleInverted=!1,e&&this.setData(e)}setData(e){var t;this._bars=e.bars,this._scaleCoeff=null!==(t=e.scaleCoeff)&&void 0!==t?t:1,this._borderVisible=e.borderVisible,this._bodyVisible=e.bodyVisible,this._wickVisible=e.wickVisible,this._borderColor=e.borderColor,this._wickColor=e.wickColor,this._hittest=e.hittest,this._isPriceScaleInverted=e.isPriceScaleInverted}hitTest(e){return this._wickVisible||this._borderVisible||this._bodyVisible?super.hitTest(e):null}_drawImpl(e){const{context:t,horizontalPixelRatio:i,verticalPixelRatio:s}=e;if(0===this._bars.length)return;const r=a(this._bars,i,s,this._scaleCoeff);this._wickVisible&&this._drawWicks(t,r), this._borderVisible&&this._drawBorder(t,r),this._bodyVisible&&this._drawCandles(t,r)}_getTolerance(){return(0,o.interactionTolerance)().series}_getHitTest(){return this._hittest||new r.HitTestResult(r.HitTarget.Regular)}_isPointAtBar(e,t,i){const s=this._bodyVisible||this._borderVisible,r=this._wickVisible;if(!s&&!r)return!1;if(s){const s=r?Math.min(e.high,e.low):Math.min(e.open,e.close),n=r?Math.max(e.high,e.low):Math.max(e.open,e.close);return s-i<=t&&t<=n+i}{const s=Math.min(e.open,e.close),r=Math.max(e.open,e.close);return e.high-i<=t&&t<=s+i||r-i<=t&&t<=e.low+i}}_drawWicks(e,t){let i="",r=null;this._bars.forEach(((n,o)=>{const l=n.wickColor?n.wickColor:(0,s.ensureDefined)(this._wickColor);l!==i&&(e.fillStyle=l,i=l);let{top:a,bottom:c}=t[o];const{rawBodyHeight:u,borderWidth:h,center:d,high:p,low:_,wickWidth:f,wickOffset:m}=t[o];this._isPriceScaleInverted&&([c,a]=[a,c]);let v=d-m;const g=v+f-1;null!==r&&(v=Math.max(r+1,v),v=Math.min(v,g));const P=g-v+1;u<=h&&(a!==p&&(a=Math.round(a-.5*h)),c=c!==_?Math.round(a-.5*h)+h-1:_-1),a!==p&&e.fillRect(v,p,P,a-p),_-c-1&&e.fillRect(v,c+1,P,_-c-1),r=g}))}_drawBorder(e,t){let i="",r=null;this._bars.forEach(((o,l)=>{if(o.borderColor!==i&&(e.fillStyle=o.borderColor?o.borderColor:(0,s.ensureDefined)(this._borderColor),i=o.borderColor),this._bodyVisible&&o.hollow)return;let{left:a}=t[l];const{rawBodyHeight:c,top:u,bottom:h,right:d,borderWidth:p}=t[l];null!==r&&(a=Math.max(r+1,a),a=Math.min(a,d));const _=d-a+1;c<=p?e.fillRect(a,Math.round(u-.5*p),_,p):_>2*p?(0,n.fillRectInnerBorder)(e,a,u,d-a+1,h-u+1,p):e.fillRect(a,u,_,h-u+1),r=d}))}_drawCandles(e,t){let i="";this._bars.forEach(((s,r)=>{let{top:o,bottom:l,left:a,right:c}=t[r];const{rawBodyHeight:u,borderWidth:h,candleWidth:d}=t[r];if(!(this._borderVisible&&d<=2*h)||s.hollow){if(s.color!==i){const t=s.color;e.fillStyle=t,i=t}if(s.hollow)e.fillStyle=s.color,u<=h?e.fillRect(a,Math.round(o-.5*h),d,h):(0,n.fillRectInnerBorder)(e,a,o,c-a+1,l-o+1,h);else{if(!this._borderVisible&&u<=h)return void e.fillRect(a,Math.round(o-.5*h),d,h);if(this._borderVisible&&(a+=h,o+=h,c-=h,l-=h),o>l)return;e.fillRect(a,o,c-a+1,l-o+1)}}}))}}},985715:(e,t,i)=>{i.d(t,{StatusProviderBase:()=>s});class s{size(){return"13px"}bold(){return!1}}},833642:(e,t,i)=>{i.d(t,{StatusView:()=>s});class s{constructor(e){this._text="",this._color="",this._size="13px",this._bold=!1,this._statusProvider=e}text(){return this._text}getSplitTitle(){return[this._text]}bold(){return this._bold}size(){return this._size}}},434294:(e,t,i)=>{i.d(t,{AbstractFilledAreaPaneView:()=>_});var s=i(650151),r=(i(86441),i(5531),i(674981)),n=i(448874),o=i(246733),l=i(407478);var a=i(57372),c=i(272933);function u(e,t){return Array.from({length:e},((e,i)=>({timePointIndex:i+t})))}function h(e,t,i){let s,r;const n=e.length;for(let o=t;o>=0&&o<n;o+=i){const t=e[o];if(void 0===s&&void 0!==t.plot1Value&&(s=o),void 0===r&&void 0!==t.plot2Value&&(r=o),void 0!==s&&void 0!==r)return o}return null}function d(e){return 0===e.type?`${e.color}`:`${e.color1}:${e.color2}:${e.coordinate1}:${e.coordinate2}`} const p={type:0,color:""};class _{constructor(e,t,i){this._isHlineFill=!1,this._bandAKey=null,this._bandBKey=null,this._colorPlotIndex=null,this._areaRenderer=new a.AreaBackgroundRenderer,this._dataInvalidated=null,this._viewportInvalidated=!1,this._plIndex1=null,this._plIndex2=null,this._items=[],this._colorAreas=new a.CachedMap,this._generateColor=function(e=1e3){const t=n.default.Cache;n.default.Cache=l.CircularCacheBuffer.bind(l.CircularCacheBuffer,e);const i=(0,n.default)(o.generateColor,((e,t,i)=>`${e}_${t}_${i}`));return n.default.Cache=t,i}(),this._source=e,this._model=t,this._fillGaps=!!(null==i?void 0:i.fillgaps),this._fillToIntersection=!!(null==i?void 0:i.fillToIntersection)}update(e){if("global-change"===e.type)return this._dataInvalidated=(0,c.mergeDataInvalidation)(this._dataInvalidated,{}),void(this._viewportInvalidated=!0);if("data-source-change"!==e.type)this._viewportInvalidated=!0;else{e.sourceId===this._source.id()&&(this._dataInvalidated=(0,c.mergeDataInvalidation)(this._dataInvalidated,{firstIndex:e.firstUpdatedTimePointIndex,clearData:e.clearData}))}}renderer(){return this._dataInvalidated?this._updateImplFull(this._dataInvalidated)&&(this._dataInvalidated=null,this._viewportInvalidated=!1):this._viewportInvalidated&&(this._updateImplLight(),this._viewportInvalidated=!1),this._areaRenderer}_minFirstBarIndex(){return-1/0}_priceScale(){return this._source.priceScale()}_plotNames(){return this._source.metaInfo().plots.map((e=>e.id))}_plotIndex1(){return null===this._plIndex1&&(this._plIndex1=this._plotNames().indexOf(this._plotAId())+1),this._plIndex1}_plotIndex2(){return null===this._plIndex2&&(this._plIndex2=this._plotNames().indexOf(this._plotBId())+1),this._plIndex2}_updateImplFull(e){var t,i,n,o;if(this._areaRenderer.setData(null),(null===(t=this._dataInvalidated)||void 0===t?void 0:t.clearData)&&(this._items=[]),!this._visible())return!1;if(null===this._priceScale())return!1;if(null===this._source.firstValue())return!1;const l=this._source.plots().plottableRange(),a=l.size();if(0===a)return!1;const c=this._source.offset(this._plotAId()),h=this._source.offset(this._plotBId()),d=Math.min(c,h),p=Math.max(c,h);let _=e.firstIndex;const f=a+(p-d)+1,m=this._plotIndex1(),v=this._plotIndex2();f!==this._items.length&&(void 0===_||0===this._items.length||_<this._items[0].timePointIndex+d?(_=void 0,this._items=u(f,1e10)):this._items=this._items.concat(u(f-this._items.length,1e10+this._items.length)));const g=this._colorPlotIndex,P=this._transparency(),y=void 0===_?l.fullRangeIterator():l.rangeIterator(_,(0,s.ensureNotNull)(l.lastIndex()));let S=void 0!==_?(0,r.lowerbound)(this._items,_+d,((e,t)=>e.timePointIndex<t))-d:-d;for(const e of y){const t=e.index+c,s=e.index+h,r=this._items[S+c],l=this._items[S+h];if(r.timePointIndex=t,l.timePointIndex=s,this._isHlineFill||(r.plot1Value=null!==(i=e.value[m])&&void 0!==i?i:void 0,l.plot2Value=null!==(n=e.value[v])&&void 0!==n?n:void 0),null!==g){const t=S+d-1;if(t>=0&&t<this._items.length){const i=this._items[t];let s;s=0===g.type?{type:0, colorIndexOrRgba:e.value[g.colorIndexOrRgba+1]}:{type:1,colorIndexOrRgba1:void 0===g.colorIndexOrRgba1?void 0:e.value[g.colorIndexOrRgba1+1],colorIndexOrRgba2:void 0===g.colorIndexOrRgba2?void 0:e.value[g.colorIndexOrRgba2+1],value1:void 0===g.valueIndex1?void 0:e.value[g.valueIndex1+1],value2:void 0===g.valueIndex2?void 0:e.value[g.valueIndex2+1]};const r=i.color=null!==(o=this._getColorByPlotValue(s))&&void 0!==o?o:void 0;void 0!==r&&(1===r.type?(r.color1=r.color1&&this._generateColor(r.color1,P),r.color2=r.color2&&this._generateColor(r.color2,P)):r.color=this._generateColor(r.color,P))}}S+=1}return this._updateImplLight(),!0}_updateImplLight(){var e,t,i,n;if(!this._visible())return;const o=this._priceScale();if(null===o)return;const l=this._source.firstValue();if(null===l)return;if(0===this._items.length)return;let c;if(this._isHlineFill){const e=this._source.properties().bands[(0,s.ensureNotNull)(this._bandAKey)],t=this._source.properties().bands[(0,s.ensureNotNull)(this._bandBKey)];c={level1:o.priceToCoordinate(e.value.value(),l),level2:o.priceToCoordinate(t.value.value(),l)}}const u=this._model.timeScale(),_=u.visibleBarsStrictRange();if(null===_)return;const f=o.priceToCoordinateFn(l),m=this._transparency(),v=this._minFirstBarIndex(),g=Math.max(v,_.firstBar()),P=(0,r.lowerbound)(this._items,g,((e,t)=>e.timePointIndex<t));if(P>=this._items.length)return;const y=Math.min(this._items.length-1,(0,r.lowerbound)(this._items,_.lastBar(),((e,t)=>e.timePointIndex<t)));let S,b;this._isHlineFill?(S=v===g?P:Math.max(0,P-1),b=Math.min(this._items.length-1,y+1)):(S=v===g?P:null!==(e=h(this._items,P-1,-1))&&void 0!==e?e:P,b=null!==(t=h(this._items,y+1,1))&&void 0!==t?t:y);const x=this._colorAreas;x.invalidateCache();let w,C=null,I=null,T=null;const V=this._commonColor();let M;1===V.type?(V.coordinate1=f(V.value1),V.coordinate2=f(V.value2),V.color1=V.color1&&this._generateColor(V.color1,m),V.color2=V.color2&&this._generateColor(V.color2,m)):V.color=this._generateColor(V.color,m);for(let e=S;e<=b;e+=1){const t=this._items[e],s=t.timePointIndex;let r,o;!this._fillGaps&&void 0!==M&&s-M>1&&(C=null),void 0!==c?(r=c.level1,o=c.level2):(r=t.plot1Coordinate=void 0===t.plot1Value?void 0:f(t.plot1Value),o=t.plot2Coordinate=void 0===t.plot2Value?void 0:f(t.plot2Value));const l=t.xCoordinate=u.indexToCoordinate(t.timePointIndex);if(t.color&&1===t.color.type&&(t.color.coordinate1=f(t.color.value1),t.color.coordinate2=f(t.color.value2)),this._fillGaps?void 0!==r||void 0!==o:void 0!==r&&void 0!==o){const s=null!==this._colorPlotIndex?t.color||p:V;if(A=s,!(null===(D=T)||null===A?D===A:0===D.type&&0===A.type?D.color===A.color:1===D.type&&1===A.type&&D.color1===A.color1&&D.color2===A.color2&&D.coordinate1===A.coordinate1&&D.coordinate2===A.coordinate2)||null===C){if(null!==C&&(void 0!==r&&C.addPoints1Point(l,r),void 0!==o&&C.addPoints2Point(l,o)),e===b)continue;T=s;const t=d(s),c=null!==(i=x.get(t))&&void 0!==i?i:new a.AreaBackgroundItemsGroup(s);I=C,C=null!==(n=c.newItem())&&void 0!==n?n:new a.AreaBackgroundItem,c.push(C),x.set(t,c)} void 0!==r&&C.addPoints1Point(l,r),void 0!==o&&C.addPoints2Point(l,o)}else this._fillGaps||(T=null,C=null,I=null);M=s,w=t}var D,A;x.delete(d(p));const L={barSpacing:this._model.timeScale().barSpacing(),colorAreas:x};this._areaRenderer.setData(L)}}},1584:(e,t,i)=>{i.d(t,{AreaBackgroundPaneView:()=>n});var s=i(650151),r=i(434294);class n extends r.AbstractFilledAreaPaneView{constructor(e,t){super(e,t)}_plotAId(){return(0,s.ensureDefined)(this._source.metaInfo().area)[0].name}_plotBId(){return(0,s.ensureDefined)(this._source.metaInfo().area)[1].name}_commonColor(){return{type:0,color:this._source.properties().areaBackground.backgroundColor.value()}}_transparency(){return this._source.properties().areaBackground.transparency.value()}_visible(){return this._source.properties().areaBackground.fillBackground.value()}_getColorByPlotValue(e){return this._commonColor()}}},539163:(e,t,i)=>{i.d(t,{DwgLabelPaneViewConstants:()=>s,calculateDwgLabelsMargins:()=>l,calculateLabelHeight:()=>o});var s,r=i(368135),n=i(294024);function o(e,t,i){let s=i;switch(t){case r.PlotSymbolSize.Tiny:s=.6*e;break;case r.PlotSymbolSize.Small:s=.8*e;break;case r.PlotSymbolSize.Normal:s=e;break;case r.PlotSymbolSize.Large:s=1.5*e;break;case r.PlotSymbolSize.Huge:s=2*e}return s}function l(e,t,i){const r=e.model().timeScale().barSpacing(),l=Math.round(r*s.AUTO_SIZE_MULT),a=o(s.NORMAL_SIZE,t.size,l)*s.SHAPE_HEIGHT_MULT,c=Math.round(a/2);switch(t.style){case n.DwgLabelStyle.LabelUp:case n.DwgLabelStyle.LabelLeftUp:case n.DwgLabelStyle.LabelRightUp:return{bottomPixelMargin:c,topPixelMargin:0};case n.DwgLabelStyle.LabelDown:case n.DwgLabelStyle.LabelLeftDown:case n.DwgLabelStyle.LabelRightDown:return{bottomPixelMargin:0,topPixelMargin:c};case n.DwgLabelStyle.LabelLeft:case n.DwgLabelStyle.LabelRight:case n.DwgLabelStyle.LabelCenter:return{bottomPixelMargin:c,topPixelMargin:c}}return{bottomPixelMargin:0,topPixelMargin:0}}!function(e){e.NORMAL_SIZE=50,e.AUTO_SIZE_MULT=1,e.SHAPE_HEIGHT_MULT=.5,e.SHAPE_WIDTH_MULT=.6,e.FONT_SIZE_MULT=.24}(s||(s={}))},934393:(e,t,i)=>{i.d(t,{containsDwgLineFillTimePointIndexes:()=>s,dematerializeDwgLineFill:()=>n,materializeDwgLineFill:()=>r});const s=!1;function r(e){return{id:e.id,line1:e.line1,line2:e.line2,colorIndex:e.ci}}function n(e,t){return{id:t,line1:e.line1,line2:e.line2,ci:e.colorIndex}}},229169:(e,t,i)=>{function s(e){return{lines:e.l,time:e.t,invocations:e.c}}i.d(t,{containsPerformanceTimePointIndexes:()=>r,materializePerformance:()=>n});const r=!1;function n(e){return{total:e.total,profile:e.profile.map(s)}}},878475:(e,t,i)=>{i.d(t,{containsPolygonTimePointIndexes:()=>n,dematerializePolygon:()=>l,isPolygonInBarsRange:()=>a,materializePolygon:()=>o});var s=i(732149),r=i(387963);const n=!0;function o(e,t){for(const i of e.points){if(i.index>=t.length)return null;if(t[i.index]===s.INVALID_TIME_POINT_INDEX)return null}return{points:e.points.map((e=>({index:t[e.index],offset:e.offset,level:e.level})))}}function l(e,t,i){return{id:t,points:e.points.map((e=>({...e,index:(0,r.ensureTimePointIndexIndex)(i.indexOf(e.index)) })))}}function a(e,t){var i;if(e.points.some((e=>{var i;return t.contains(e.index+(null!==(i=e.offset)&&void 0!==i?i:0))})))return!0;let s=!1,r=!1;const n=t.firstBar();for(const t of e.points)t.index+(null!==(i=t.offset)&&void 0!==i?i:0)<n?s=!0:r=!0;return s&&r}},735758:(e,t,i)=>{function s(e,t){return new r(e,t)}i.d(t,{setsByStyleIdAndKey:()=>s});class r{constructor(e,t){this._setsByStyleIdAndKey=new Map,this._observableCollections=e,this._keyGetter=t}get(e,t){const i=this._observableCollections.get(e);if(!i)return;let s=this._setsByStyleIdAndKey.get(e);if(!s){s=new Map,this._setsByStyleIdAndKey.set(e,s);for(const e of i)this._addPrimitiveToSet(s,e);"cleared"in i&&(i.cleared().subscribe(this,this._clearSetsByKey.bind(this,s)),i.changed().subscribe(this,this._handleCollectionChanges.bind(this,s)))}return s.get(t)}_addPrimitiveToSet(e,t){const i=this._keyGetter(t);let s=e.get(i);s||(s=new Set,e.set(i,s)),s.add(t)}_clearSetsByKey(e){e.clear()}_handleCollectionChanges(e,t){var i;for(const s of t.removed)null===(i=e.get(this._keyGetter(s)))||void 0===i||i.delete(s);for(const i of t.created)this._addPrimitiveToSet(e,i)}}},133822:(e,t,i)=>{i.d(t,{validateGraphicsCommands:()=>n});var s=i(130551),r=i(650151);function n(e){if(!(0,s.isObject)(e))throw new Error("Graphics commands should be wrapped in an object");if((0,s.hasProperty)(e,"create"),(0,s.hasProperty)(e,"erase")){const t=e.erase;(0,r.assert)(Array.isArray(t),"Collection of erase commands should be array");for(const e of t){if(!(0,s.isObject)(e)||!(0,s.hasProperty)(e,"action"))throw new Error("Command should be an object with 'action' property");(0,r.assert)("all"===e.action||"one"===e.action,"Erase command action should be 'all' or 'one'")}}return e}},329081:(e,t,i)=>{i.d(t,{containsVertLineTimePointIndexes:()=>n,dematerializeVertLine:()=>l,isVertLineInBarsRange:()=>a,materializeVertLine:()=>o});var s=i(732149),r=i(387963);const n=!0;function o(e,t){if(e.index>=t.length)return null;const i=t[e.index];return i===s.INVALID_TIME_POINT_INDEX?null:{startPrice:e.startPrice,endPrice:e.endPrice,index:i,extendTop:e.extendTop,extendBottom:e.extendBottom}}function l(e,t,i){const s=(0,r.ensureTimePointIndexIndex)(i.indexOf(e.index));return{id:t,...e,index:s}}function a(e,t){return t.contains(e.index)}},214798:(e,t,i)=>{i.d(t,{containsFootprintPriceLevelTimePointIndexes:()=>n,dematerializeVolumeFootprintPriceLevel:()=>l,isVolumeFootprintPriceLevelInBarsRange:()=>a,materializeVolumeFootprintPriceLevel:()=>o});var s=i(732149),r=i(387963);const n=!0;function o(e,t){if(e.startIndex>=t.length)return null;const i=t[e.startIndex],r=null===e.extendTo?null:t[e.extendTo];return i===s.INVALID_TIME_POINT_INDEX||r===s.INVALID_TIME_POINT_INDEX?null:{id:e.id,price:e.price,type:e.type,startIndex:i,extendTo:r}}function l(e,t,i){var n,o;const l=(0,r.ensureTimePointIndexIndex)(i.indexOf(null!==(n=e.startIndex)&&void 0!==n?n:s.INVALID_TIME_POINT_INDEX)),a=null===e.extendTo?null:(0,r.ensureTimePointIndexIndex)(i.indexOf(null!==(o=e.extendTo)&&void 0!==o?o:s.INVALID_TIME_POINT_INDEX));return{id:t, price:e.price,type:e.type,startIndex:l,extendTo:a}}function a(e,t){var i;const s=e.startIndex;return!((null!==(i=e.extendTo)&&void 0!==i?i:1/0)<t.firstBar()||s>t.lastBar())}},567467:(e,t,i)=>{i.d(t,{HHistBasedValuesProvider:()=>_});var s=i(150335),r=i(650151),n=i(638456),o=i(534741),l=i(885482),a=i(943994),c=i(396372),u=i(616117),h=i(60897);function d(e,t="",i=""){return{id:t,index:e,title:i,value:"",visible:!1}}const p=n.CheckMobile.any();class _{constructor(e,t){this._emptyValues=[],this._study=e,this._model=t,void 0!==this._study.metaInfo().graphics.hhists&&this._emptyValues.push(d(0),d(1),d(2))}getItems(){return this._emptyValues}getValues(e){var t,i;const n=this._emptyValues.map((e=>({...e})));n.forEach((e=>{e.visible=this._study.isVisible(),e.value=h.notAvailable}));const l=this._study.properties().childs().inputs.childs().volume.value();switch(l){case c.HHistVolumeMode.UpDown:n[0].title="Up",n[1].title="Down",n[2].title="Total";break;case c.HHistVolumeMode.Total:n[0].title="Total",n[1].visible=!1,n[2].visible=!1;break;case c.HHistVolumeMode.Delta:n[0].title="Delta",n[1].title="Max(Up, Down)",n[2].title="Total"}const u=this._study.priceScale(),d=this._model.timeScale();if(null===u||u.isEmpty()||d.isEmpty()||this._hideValues())return n;if(null===e||!isFinite(e)){const t=this._study.data().last();if(null===t)return n;e=t.index}const p=this._model.crossHairSource(),_=p.price;if(!isFinite(p.y)&&(e=function(e,t){var i;const s=null===(i=e.visibleBarsStrictRange())||void 0===i?void 0:i.lastBar();if(!s)return null;const r=t.data().search(s,o.PlotRowSearchMode.NearestLeft);return r?r.index:null}(this._model.timeScale(),this._model.mainSeries()),null===e))return n;const f=function(e,t,i,s){if(0===e.size)return null;if(!i){const e=(0,r.ensureNotNull)(s.data().valueAt(t));i=s.barFunction()(e)}const n=function(e,t){let i=null;return e.forEach(((e,s)=>{s<=t&&(null===i||s>i)&&(i=s)})),i}(e,t);if(null===n)return null;const o=e.get(n);if(!o||0===o.size)return null;return function(e,t){let i=null;return e.forEach((e=>{e.priceLow<=t&&t<e.priceHigh&&(i=e)})),i}(o,i)}(this._study.graphics().hhistsByTimePointIndex(),e,_,this._model.mainSeries());if(null===f)return n.forEach((e=>{e.value="0"})),n;const m=this._study.metaInfo().graphics.hhists;if(void 0===m)return n;if(void 0===m[f.styleId])return n;const v=null===(i=null===(t=this._study.properties().childs().graphics.childs().hhists)||void 0===t?void 0:t.childs()[f.styleId])||void 0===i?void 0:i.childs(),g=new a.VolumeFormatter,P=e=>(0,s.isNumber)(e)?g.format(e):"";if(l!==c.HHistVolumeMode.Delta){if(f.rate.forEach(((e,t)=>{n[t].value=P(e),n[t].color=(0,r.ensureDefined)(v).colors[t].value()})),l===c.HHistVolumeMode.UpDown){const e=f.rate[0]+f.rate[1];n[2].value=P(e),n[2].color=(0,r.ensureDefined)(v).valuesColor.value()}}else{const e=f.rate[0]>f.rate[1]?0:1,t=(0,r.ensureDefined)(v).colors[e].value(),i=f.rate[0]+f.rate[1];[2*f.rate[e]-i,f.rate[e],i].forEach(((e,i)=>{n[i].value=P(e),n[i].color=t}))}return n}_hideValues(){return p&&(null===this._model.crossHairSource().pane||(0, u.isLineToolName)(l.tool.value())||null!==this._model.lineBeingEdited())}}},173220:(e,t,i)=>{i.d(t,{makeNextStudyId:()=>o,makeNextSymbolId:()=>r});let s=0;function r(){return s++,"ss_"+s}let n=0;function o(){return n++,"st"+n}},272933:(e,t,i)=>{function s(e,t){if(null===e)return t;const i=e.firstIndex,s=t.firstIndex,r=e.clearData||t.clearData;return{firstIndex:r||void 0===i||void 0===s?void 0:Math.min(i,s),clearData:r}}i.d(t,{mergeDataInvalidation:()=>s})},574809:(e,t,i)=>{function s(e){e.lineWidth=void 0,e.lineStyle=void 0;for(let t=0;t<e.colors.length;t++)e.colors[t]=void 0;return e}function r(){return{colors:[void 0,void 0,void 0,void 0,void 0,void 0,void 0],lineWidth:void 0,lineStyle:void 0}}i.d(t,{clearStyle:()=>s,createEmptyStyle:()=>r})},793907:(e,t,i)=>{i.d(t,{PaneRendererColumns:()=>n});var s=i(43192),r=i(315801);class n extends s.BitmapCoordinatesPaneRenderer{constructor(e){super(),this._data=null,this._precalculatedCache=[],this.setData(e)}setData(e){this._data=e,this._precalculatedCache=[]}hitTest(e){var t,i,s,n;if(null===this._data)return null;const o=null!==(i=null===(t=this._data.visibleItemsRange)||void 0===t?void 0:t.startItemIndex)&&void 0!==i?i:0,l=(null!==(n=null===(s=this._data.visibleItemsRange)||void 0===s?void 0:s.endItemIndex)&&void 0!==n?n:this._data.items.length)-1;for(let t=o;t<=l;t++){const i=this._data.items[t];if(e.x>=i.left&&e.x<=i.right){const t=i.y;if(e.y>=Math.min(t,this._data.histogramBase)&&e.y<=Math.max(t,this._data.histogramBase))return new r.HitTestResult(r.HitTarget.Regular)}}return null}_drawImpl(e){var t,i,s,r;if(null===this._data||0===this._data.items.length)return;const{context:n,horizontalPixelRatio:o,verticalPixelRatio:l}=e;this._precalculatedCache.length||this._fillPrecalculatedCache(o);const a=Math.max(1,Math.floor(o)),c=Math.max(1,Math.floor(l)),u=Math.round(this._data.histogramBase*l)-Math.floor(a/2),h=u+a,d=this._data.lineColor,p=null!==(i=null===(t=this._data.visibleItemsRange)||void 0===t?void 0:t.startItemIndex)&&void 0!==i?i:0,_=(null!==(r=null===(s=this._data.visibleItemsRange)||void 0===s?void 0:s.endItemIndex)&&void 0!==r?r:this._data.items.length)-1;for(let e=p;e<=_;e++){const t=this._data.items[e],i=this._precalculatedCache[e-p],s=Math.round(t.y*l);let r,o;n.fillStyle=t.style?t.style.color:d,s<=u?(r=s,o=h):(r=u,o=s-Math.floor(c/2)+c),n.fillRect(i.left,r,i.right-i.left+1,o-r)}}_fillPrecalculatedCache(e){var t,i;if(null===this._data||0===this._data.items.length)return void(this._precalculatedCache=[]);const{barSpacing:s,visibleItemsRange:r,items:n}=this._data,o=Math.ceil(s*e)<=1?0:Math.max(1,Math.floor(e)),l=null!==(t=null==r?void 0:r.startItemIndex)&&void 0!==t?t:0,a=(null!==(i=null==r?void 0:r.endItemIndex)&&void 0!==i?i:n.length)-1,c=a-l+1;if(c<=0)return void(this._precalculatedCache=[]);this._precalculatedCache=new Array(c);for(let t=l;t<=a;t++){const i=n[t],s=Math.round(i.center*e);let r,a;const c=Math.round((i.right-i.left)*e)-o;if(c%2){const e=(c-1)/2;r=s-e,a=s+e}else{const e=c/2;r=s-e,a=s+e-1}this._precalculatedCache[t-l]={left:r,right:a, roundedCenter:s,center:i.center*e,time:i.timePointIndex}}for(let e=l+1;e<=a;e++){const t=this._precalculatedCache[e-l],i=this._precalculatedCache[e-l-1];t.time===i.time+1&&(t.left-i.right!==o+1&&(i.roundedCenter>i.center?i.right=t.left-o-1:t.left=i.right+o+1))}let u=Math.ceil(s*e);for(let e=l+1;e<=a;e++){const t=this._precalculatedCache[e-l];t.right<t.left&&(t.right=t.left);const i=t.right-t.left+1;u=Math.min(i,u)}if(o>0&&u<4)for(let e=l+1;e<=a;e++){const t=this._precalculatedCache[e-l];t.right-t.left+1>u&&(t.roundedCenter>t.center?t.right-=1:t.left+=1)}}}},268008:(e,t,i)=>{i.d(t,{StudyPlotPaneView:()=>N});var s=i(650151),r=i(724377),n=i(244842),o=i(678515),l=i(389137),a=i(246733),c=i(103221),u=i(755785),h=i(413225),d=i(142119),p=i(879617),_=i(627172),f=i(230058),m=i(574809),v=i(470130),g=i(86441),P=i(9640),y=i(315801),S=i(43192),b=i(638456);class x extends S.BitmapCoordinatesPaneRenderer{constructor(e){super(),this._data=e}hitTest(e){var t,i,s,r;const n=this._data,o=n.lineWidth,l=n.vertOffset||0,a=(0,P.interactionTolerance)().series+o,c=null!==(i=null===(t=n.visibleItemsRange)||void 0===t?void 0:t.startItemIndex)&&void 0!==i?i:0,u=null!==(r=null===(s=n.visibleItemsRange)||void 0===s?void 0:s.endItemIndex)&&void 0!==r?r:n.items.length;for(let t=c;t<u;t++){const i=n.items[t];if(new g.Point(i.center,i.y+l).subtract(e).length()+o<=a)return new y.HitTestResult(y.HitTarget.Regular)}return null}_drawImpl(e){var t,i,s,r;const n=this._data,{horizontalPixelRatio:o,verticalPixelRatio:a,context:c}=e,u=Math.max(1,Math.floor(o))%2?.5:0,h=n.vertOffset||0,d=n.lineColor,p=n.lineWidth;let _="",f=!1;const m=null!==(i=null===(t=n.visibleItemsRange)||void 0===t?void 0:t.startItemIndex)&&void 0!==i?i:0,v=null!==(r=null===(s=n.visibleItemsRange)||void 0===s?void 0:s.endItemIndex)&&void 0!==r?r:n.items.length;for(let e=m;e<v;e++){const t=n.items[e],i=t.center,s=t.y+h;if((0,l.isNaN)(i)||(0,l.isNaN)(s))continue;let r,m;null!=t.style?(r=t.style.color,m=t.style.width):(r=d,m=p),(r!==_||b.isSafari)&&(_=r,f&&c.fill(),c.beginPath(),c.fillStyle=r);const v=Math.round(i*o)+u,g=Math.round(s*a)+u,P=Math.round(m*o)+u;c.moveTo(v+P,g),c.arc(v,g,P,0,2*Math.PI,!1),f=!0}f&&c.fill()}}var w=i(793907),C=i(204652);class I extends S.BitmapCoordinatesPaneRenderer{constructor(e){super(),this._data=e}hitTest(e){const t=(0,P.interactionTolerance)().series+this._data.lineWidth/2;let i,s,r,n;for(let o=1;o<this._data.items.length;++o){i=this._data.items[o-1],s=this._data.items[o],r=i.center,n=s.center;if((0,C.distanceToSegment)(new g.Point(r,i.y),new g.Point(n,s.y),new g.Point(e.x,e.y)).distance<=t)return new y.HitTestResult(y.HitTarget.Regular)}return null}_drawImpl(e){var t,i,s,r,n,o,a,c;const{context:u,horizontalPixelRatio:h,verticalPixelRatio:d}=e;let p="",_=!1;const f=null!==(i=null===(t=this._data.visibleItemsRange)||void 0===t?void 0:t.startItemIndex)&&void 0!==i?i:0,m=(null!==(r=null===(s=this._data.visibleItemsRange)||void 0===s?void 0:s.endItemIndex)&&void 0!==r?r:this._data.items.length)-1;for(let e=f;e<=m;e++){const t=this._data.items[e];if((0, l.isNaN)(t.center)||(0,l.isNaN)(t.y))continue;const i=null!==(o=null===(n=t.style)||void 0===n?void 0:n.color)&&void 0!==o?o:this._data.lineColor,s=null!==(c=null===(a=t.style)||void 0===a?void 0:a.width)&&void 0!==c?c:this._data.lineWidth,r=Math.max(1,Math.floor(s*h)),f=Math.max(1,Math.floor(s*d));(i!==p||b.isSafari)&&(p=i,_&&u.fill(),u.beginPath(),u.fillStyle=i);let m=3*r;m%2!=r%2&&(m+=1);let v=3*f;v%2!=f%2&&(v+=1);const g=Math.round(Math.round(t.center*h)-m/2),P=Math.round(Math.round(t.y*d)-v/2),y=g+Math.floor(m/2-r/2),S=P+Math.floor(v/2-f/2);u.rect(g,S,m,f),u.rect(y,P,r,v),_=!0}_&&u.fill()}}class T extends S.BitmapCoordinatesPaneRenderer{constructor(e){super(),this._data=e}hitTest(e){const t=(0,P.interactionTolerance)().series+this._data.lineWidth/2,i=new Map;for(const r of this._data.items){const n=r.center,o=r.y;let l=t;r.style&&(i.has(r.style.width)?l=(0,s.ensureDefined)(i.get(r.style.width)):i.set(this._data.lineWidth,l));if((0,C.distanceToSegment)(new g.Point(n,o),new g.Point(n,this._data.histogramBase),new g.Point(e.x,e.y)).distance<=l)return new y.HitTestResult(y.HitTarget.Regular)}return null}_drawImpl(e){var t,i,s,r;if(0===this._data.items.length)return;const{context:n,horizontalPixelRatio:o,verticalPixelRatio:l}=e;n.fillStyle=this._data.lineColor;const a=Math.max(1,Math.floor(this._data.lineWidth*o)),c=a/2,u=Math.max(1,Math.floor(o)),h=Math.round(this._data.histogramBase*l)-Math.floor(u/2),d=h+u,p=null!==(i=null===(t=this._data.visibleItemsRange)||void 0===t?void 0:t.startItemIndex)&&void 0!==i?i:0,_=(null!==(r=null===(s=this._data.visibleItemsRange)||void 0===s?void 0:s.endItemIndex)&&void 0!==r?r:this._data.items.length)-1;for(let e=p;e<=_;e++){const t=this._data.items[e];let i=a,s=c;t.style?(n.fillStyle=t.style.color,i=Math.max(1,Math.floor(t.style.width*o)),s=i/2):n.fillStyle=this._data.lineColor;const r=i%2?.5:0,p=Math.round(t.center*o)+r,_=Math.round(t.y*l);let f,m;_<=h?(f=_,m=d):(f=h,m=_-Math.floor(u/2)+u),n.fillRect(Math.floor(p-s),f,i,m-f)}}}var V=i(368135),M=i(441212),D=i(674981),A=i(928483);const L=e=>{const t=(0,r.rgbToHsl)((0,r.parseRgb)(e)),i=t[0]+.05;return t[0]=i-Math.floor(i),(0,r.rgbToHexString)((0,r.hslToRgb)(t))},B=(0,u.memoize)(L),R=new Set([V.LineStudyPlotStyle.Line,V.LineStudyPlotStyle.Area,V.LineStudyPlotStyle.Circles,V.LineStudyPlotStyle.Cross,V.LineStudyPlotStyle.StepLine,V.LineStudyPlotStyle.StepLineWithDiamonds]);class N extends A.StudyPaneViewInplaceUpdatable{constructor(e,t,i,s,r=!1){super(t,i,s),this._histogramBase=null,this._lineColor="",this._lineWidth=1,this._color1="",this._color2="",this._renderer=new d.CompositeRenderer,this._isMarkersEnabled=n.enabled("source_selection_markers"),this._study=e,this._plotIndex=e.metaInfo().plots.findIndex((e=>e.id===s)),this._colorProvider=(0,M.createStudyPlotColorProvider)(e.metaInfo(),e.properties(),s),this._extendStepLineToBarsEndings=r,this._isFundamental=(0,v.isFundamentalStudyMetaInfo)(e.metaInfo());const o=this._study.properties().styles[this._plotName].plottype.value() ;this._isStepLinePlot=o===V.LineStudyPlotStyle.StepLine||o===V.LineStudyPlotStyle.StepLineWithBreaks||o===V.LineStudyPlotStyle.StepLineWithDiamonds}items(){return this._items}renderer(){return this._makeSureRendererIsValid(),this._renderer}_getTranspValue(){const e=this._study.properties(),t=e.styles[this._plotName];let i=0;const s=this._study.metaInfo();return"Volume@tv-basicstudies"===s.id&&s.version<=46&&"transparency"in e?(i=e.transparency.value(),i=(0,l.isNumber)(i)?i:0,i):(t.transparency&&(i=t.transparency.value(),i=(0,l.isNumber)(i)?i:0),i)}_updateImplFull(e){var t,i,r;if(this._renderer.clear(),(null===(t=this._dataInvalidated)||void 0===t?void 0:t.clearData)&&(this._items=[]),!this._study.isPlotVisibleAt(this._plotName,1))return!1;if(!this._study.priceScale())return!1;if(null===this._study.firstValue())return!1;if(null===this._study.priceScale())return!1;this._histogramBase=null;const n=this._study.properties().styles[this._plotName],l=n.plottype.value(),u=this._isFundamental&&this._isStepLinePlot,h=this._study.plots().plottableRange(u);if(0===h.size())return!1;const d=this._study.offset(this._plotName),p=R.has(l),_=this._preallocateItems(h,((e,t)=>({y:NaN,left:NaN,center:NaN,right:NaN,origPrices:{price:null!=t?t:NaN,timePointIndex:e+d},timePointIndex:e+d})));let f=NaN,v=NaN;const g=new Map,P=(e,t)=>{let i=g.get(e);void 0===i&&(i=new Map,g.set(e,i));let s=i.get(t);if(void 0===s){const r=!this._plotName||"vol"!==this._plotName;s=(0,a.generateColor)(e,t,r),i.set(t,s)}return s},y=(0,m.createEmptyStyle)(),S=(0,o.clamp)(this._getTranspValue(),0,100),b=this._model.timeScale().visibleBarsStrictRange();if(null===b)return!1;const{startBar:x,endBar:w}=this._calculateStartEnd(b);if(null===x||null===w||0===this._items.length)return!1;const C=null!=_?_:(0,s.ensureNotNull)(h.firstIndex()),I=(0,s.ensureNotNull)(h.lastIndex())+1,T=h.rangeIterator(C,I);let V,M=(0,D.lowerbound)(this._items,C+d,((e,t)=>e.timePointIndex<t));for(const e of T){let t=e.index;const s=e.value;t+=d,t=Math.floor(t);let o=s[this._plotIndex+1];const l=null==o;if(o=l?NaN:o,p&&l){v=o,f=t,M++;continue}const c=this._items[M];c.valIsNotSameAsPrev=o!==v||t-1!==f;if(this._colorProvider.isColorDefined()&&(c.style={color:P(n.color.value(),100),width:n.linewidth.value(),style:n.linestyle.value()},null!=o)){const e=this._colorProvider.getPlotPointStyle(s,y),t=e.colors[0];void 0!==t&&(c.style.color=(0,a.isHexColor)(t)?P(t,S):t),c.style.width=null!==(i=e.lineWidth)&&void 0!==i?i:c.style.width,c.style.style=null!==(r=e.lineStyle)&&void 0!==r?r:c.style.style}!p&&!isNaN(f)&&f!==t-1&&M>0&&(this._items[M].breakBefore=!0),v=o,f=t,M++,V=c}if(V&&this._isFundamental&&this._isStepLinePlot){const e=this._model.mainSeries().data().bars().lastIndex(),t=V;if(null!==e&&e>t.timePointIndex){const i=(0,c.deepCopy)(t);i.timePointIndex=e,i.valIsNotSameAsPrev=!1,this._items.length>M?this._items[M]=i:this._items.push(i)}}return this._updateImplLight(),!0}_correctVisibleItemIndexes(e,t){const i=super._correctVisibleItemIndexes(e,t) ;return this._isFundamental&&this._isStepLinePlot&&i.endItemIndex===this._items.length-1&&(i.endItemIndex+=1),i}_updateRenderer(e,t){var i,r;this._renderer.clear();const n=this._study.properties().styles.childs()[this._plotName].childs(),u=null===(i=this._study.metaInfo().styles)||void 0===i?void 0:i[this._plotName],d=(0,o.clamp)(this._getTranspValue(),0,100);this._lineColor=(0,a.generateColor)(n.color.value(),d),this._lineWidth=n.linewidth.value();let m=n.color.value();const v=this._colorProvider.getDefaultPlotPointStyle();v&&(m=v.colors[0]||m,this._lineWidth=null!==(r=v.lineWidth)&&void 0!==r?r:this._lineWidth,this._lineColor=m?(0,a.generateColor)(m,d):this._lineColor),this._color2=(0,a.generateColor)(m,d);const g=this._study.metaInfo().isRGB?L(m):B(m);this._color1=(0,a.generateColor)(g,d);const P=this._histogramBase?this._histogramBase:(0,s.ensureNotNull)(this._study.priceScale()).height(),y=n.plottype.value(),S={barSpacing:this._model.timeScale().barSpacing(),items:this._items,histogramBase:P,lineIndex:0,lineStyle:n.linestyle.value(),lineColor:this._lineColor,lineWidth:(0,l.isNumber)(this._lineWidth)?this._lineWidth:1,color1:this._color1,color2:this._color2,bottom:P,visibleItemsRange:{startItemIndex:e,endItemIndex:t},simpleMode:this._colorProvider.singleColor(),skipHoles:[V.LineStudyPlotStyle.Line,V.LineStudyPlotStyle.Area,V.LineStudyPlotStyle.Cross,V.LineStudyPlotStyle.Circles,V.LineStudyPlotStyle.StepLine,V.LineStudyPlotStyle.StepLineWithDiamonds].includes(y)},b=this._renderer,C=Boolean(null==u?void 0:u.joinPoints);switch(y){case V.LineStudyPlotStyle.Line:case V.LineStudyPlotStyle.LineWithBreaks:b.append(new p.PaneRendererLine(S));break;case V.LineStudyPlotStyle.Area:case V.LineStudyPlotStyle.AreaWithBreaks:b.append(new h.PaneRendererArea(S));break;case V.LineStudyPlotStyle.Histogram:b.append(new T(S));break;case V.LineStudyPlotStyle.Columns:b.append(new w.PaneRendererColumns(S));break;case V.LineStudyPlotStyle.Cross:b.append(new I(S)),C&&b.append(new p.PaneRendererLine({...(0,c.deepCopy)(S),lineWidth:1,forceLineWidth:!0}));break;case V.LineStudyPlotStyle.Circles:b.append(new x(S)),C&&b.append(new p.PaneRendererLine({...(0,c.deepCopy)(S),lineWidth:1,ignorePaletteLineWidth:!0}));break;case V.LineStudyPlotStyle.StepLine:case V.LineStudyPlotStyle.StepLineWithBreaks:case V.LineStudyPlotStyle.StepLineWithDiamonds:{const e=new _.PaneRendererStepLine;e.setData({...S,decoration:n.plottype.value()===V.LineStudyPlotStyle.StepLineWithDiamonds?_.StepLineDecoration.Diamonds:_.StepLineDecoration.None,extendToBarsEndings:this._extendStepLineToBarsEndings}),b.append(e);break}default:b.append(new p.PaneRendererLine(S))}this._model.selection().isSelected(this._study)&&this._isMarkersEnabled&&this._selectionData&&b.append(new f.SelectionRenderer(this._selectionData))}_updateAdditionalPrices(e,t){var i;const s=null===(i=this._study.metaInfo().styles)||void 0===i?void 0:i[this._plotName];void 0!==(null==s?void 0:s.histogramBase)&&(this._histogramBase=e.priceToCoordinate(s.histogramBase,t))}}},821885:(e,t,i)=>{i.d(t,{ PaneRendererAbstractFillStrokeShape:()=>m,PaneRendererAbstractShape:()=>_,PaneRendererAbstractStrokeShape:()=>f});var s=i(650151),r=i(86441),n=i(934026),o=i(150335),l=i(315801),a=i(318041),c=i(600642),u=i(422333),h=i(43192),d=i(199471),p=i(638456);class _ extends h.BitmapCoordinatesPaneRenderer{constructor(e,t={skipRenderingOptimizations:!1}){super(),this._items=[],this._barSpacing=0,this._vertOffset=0,this._textCache=t.textCache||new a.TextImageCachesContainer(5e3),this._drawOperation=t.skipRenderingOptimizations?this._drawWithoutOptimizations.bind(this):this._drawWithOptimizations.bind(this),null!==e&&this.setData(e)}hitTest(e){const t=l.HitTarget.Regular;let i=null;for(const s of this._items){if(!s)continue;const r=this._calcBoundingBox(s);if(r&&(0,n.pointInBox)(e,r)){const e={tooltip:this._getTooltip(s,r)};i=new l.HitTestResult(t,e)}}return i}setData(e){var t,i,s,r;if(this._height=void 0!==e.height?e.height:e.width,this._width=void 0!==e.width?e.width:e.height,this._color=e.color,this._borderColor=e.borderColor,this._vertOffset=e.vertOffset||0,e.text&&(this._text=e.text,this._fontSize=e.fontSize,this._lineSpacing=e.lineSpacing,this._textColor=e.textColor,this._textAlign=e.textAlign||"center"),void 0!==e.items&&void 0!==e.barSpacing){const n=null!==(i=null===(t=e.visibleItemsRange)||void 0===t?void 0:t.startItemIndex)&&void 0!==i?i:0,o=null!==(r=null===(s=e.visibleItemsRange)||void 0===s?void 0:s.endItemIndex)&&void 0!==r?r:e.items.length;this.setItems(o>n?e.items.slice(n,o):[],e.barSpacing)}}setItems(e,t){this._setBaseData(e,t)}_drawImpl(e){this._preDrawInit(),this._drawOperation(e)}_calcBoundingBox(e){const t=e.vertOffset,i=this._getTextCache(e);if(!i)return;const s=i.textImageWidth,n=i.textImageHeight,o=s/2,l=e.y+t+e.textVertOffset,a=t>0?0:-n,c=t>0?n:0,u=new r.Point(e.center-o,l+a),h=new r.Point(e.center+o,l+c);return(0,r.box)(u,h)}_unionBox(e,t){const i=Math.min(e.min.x,t.min.x),s=Math.max(e.max.x,t.max.x),n=Math.min(e.min.y,t.min.y),o=Math.max(e.max.y,t.max.y),l=new r.Point(i,n),a=new r.Point(s,o);return(0,r.box)(l,a)}_getTooltip(e,t){if(e.tooltip)return{content:{type:"text",data:e.tooltip},tooltipDelay:200,extendMargin:!0,rect:{x:t.min.x,y:t.min.y,w:Math.abs(t.max.x-t.min.x),h:Math.abs(t.max.y-t.min.y)}}}_setBaseData(e,t){this._items.length=0,this._barSpacing=t;for(const t of e){if((0,o.isNaN)(t.y))continue;const e=void 0===t.width?(0,s.ensureDefined)(this._width):t.width,i=void 0===t.height?(0,s.ensureDefined)(this._height):t.height,r=void 0===t.vertOffset?this._vertOffset:t.vertOffset,n=r>0?i:-i;this._items.push({width:e,height:i,vertOffset:r,textVertOffset:n,shapeWidth:0,shapeHeight:0,stepX:0,stepY:0,...t})}}_drawItemText(e,t){const i=this._getTextCache(t);if(null===i)return;const s=t.center,r=t.vertOffset,n=t.y+r+t.textVertOffset;let o;o=t.style&&void 0!==t.style.textColor?t.style.textColor:this._textColor;const l={style:{fillStyle:o},location:{x:s,y:n,horzAlign:c.HorizontalAlign.Center,vertAlign:r>0?c.VerticalAlign.Top:c.VerticalAlign.Bottom}};i.paintTo(e,l)}_drawWithOptimizations(e){let t,i,s=null,r=!1 ;for(const n of this._items)(0,o.isNaN)(n.y)||(n.style&&void 0!==n.style.color?(t=n.style.color||"rgba(0, 0, 0, 0)",i=n.style.borderColor||"rgba(0, 0, 0, 0)"):(t=this._color,i=this._borderColor),(s!==t||p.isSafari)&&(s=t,r&&this._endPath(e),this._startPath(e,t,i)),this._drawItemShape(e,n),r=!0);r&&this._endPath(e);for(const t of this._items)(0,o.isNaN)(t.y)||this._drawItemText(e,t)}_drawWithoutOptimizations(e){let t,i;for(const r of this._items){if((0,o.isNaN)(r.y))continue;const n=(0,s.ensureDefined)(r.style);t=n.color||"rgba(0, 0, 0, 0)",i=n.borderColor||"rgba(0, 0, 0, 0)",this._startPath(e,t,i),this._drawItemShape(e,r),this._endPath(e),this._drawItemText(e,r)}}_drawItemShape(e,t){const{context:i,horizontalPixelRatio:s,verticalPixelRatio:r}=e;(0,d.drawScaled)(i,s,r,(()=>this._drawItemShapeUsingCSSPixels(i,t)))}_drawItemShapeUsingCSSPixels(e,t){}_preDrawInit(){}_startPath(e,t,i){}_endPath(e){}_getTextCache(e){var t,i;const s=e.text||this._text,r=e.fontSize||this._fontSize,n=null!==(t=e.lineSpacing)&&void 0!==t?t:this._lineSpacing,o=e.textAlign||this._textAlign,l=null!==(i=e.font)&&void 0!==i?i:u.CHART_FONT_FAMILY;return this._textCache.get({text:s,bold:!1,italic:!1,font:l,fontSize:r,lineSpacing:n,align:o})}}class f extends _{_startPath(e,t,i){const s=e.context;s.beginPath(),s.lineWidth=this._lineWidth(e),s.lineCap="butt",s.strokeStyle=t}_endPath(e){e.context.stroke()}_lineWidth(e){return Math.max(1,Math.floor(2*e.horizontalPixelRatio))}}class m extends _{_startPath(e,t,i){const s=e.context;s.beginPath(),s.lineWidth=this._lineWidth(e),s.lineCap="butt",s.fillStyle=t,s.strokeStyle=i}_endPath(e){const t=e.context;t.fill(),t.stroke()}_lineWidth(e){return Math.max(1,Math.floor(e.horizontalPixelRatio))}}},111595:(e,t,i)=>{i.d(t,{PaneRendererArrowDown:()=>a,PaneRendererArrowUp:()=>l});var s=i(86441),r=i(821885),n=i(678515);class o extends r.PaneRendererAbstractFillStrokeShape{constructor(){super(...arguments),this._sign=0,this._thinArrow=!1,this._thinArrowLineWidth=0,this._headHeight=0,this._arrowWidth=0}setItems(e,t){this._setBaseData(e,t)}_drawItemShape(e,t){const{context:i,horizontalPixelRatio:s,verticalPixelRatio:r}=e,o=this._lineWidth(e)%2?.5:0,l=this._sign,a=this._arrowWidth,c=this._headHeight,u=Math.abs(t.height),h=Math.round(t.center*s)+o,d=t.vertOffset,p=Math.round((t.y+d+l*u/2)*r)+o,_=(0,n.ceiledEven)(a*s),f=_/2,m=Math.round(u*r),v=Math.round(c*r);i.translate(h,p),this._thinArrow?(i.moveTo(0,0),i.lineTo(-f,-f*l),i.moveTo(0,0),i.lineTo(f,-f*l),i.moveTo(0,0),i.lineTo(0,-m*l),i.moveTo(-f,-m*l),i.lineTo(f,-m*l)):(i.moveTo(0,0),m<v?(i.lineTo(_,-m*l),i.lineTo(-_,-m*l)):(i.lineTo(_,-v*l),i.lineTo(f,-v*l),i.lineTo(f,-m*l),i.lineTo(-f,-m*l),i.lineTo(-f,-v*l),i.lineTo(-_,-v*l)),i.lineTo(0,0)),i.translate(-h,-p)}_preDrawInit(){const e=this._calculateWidth();this._arrowWidth=e,this._sign=this._isUp()?-1:1,this._thinArrow=e<4,this._thinArrowLineWidth=Math.max(e/2,1),this._headHeight=Math.round(e)}_startPath(e,t,i){const s=e.context;s.beginPath(),s.fillStyle=t,s.strokeStyle=i,s.lineWidth=this._lineWidth(e)}_lineWidth(e){ return this._thinArrow?this._thinArrowLineWidth:super._lineWidth(e)}_calcBoundingBox(e){const t=e.vertOffset,i=this._sign,r=this._arrowWidth,n=this._headHeight,o=Math.abs(e.height),l=e.center-r,a=l+2*r,c=e.y+t+i*Math.round(o/2),u=c+(-o-n)*i,h=new s.Point(l,c),d=new s.Point(a,u);let p=(0,s.box)(h,d);const _=super._calcBoundingBox(e);return _&&(p=this._unionBox(p,_)),p}_calculateWidth(){return Math.round(this._barSpacing/4)}}class l extends o{_isUp(){return!0}}class a extends o{_isUp(){return!1}}},594931:(e,t,i)=>{i.d(t,{PaneRendererCircleShape:()=>o});var s=i(86441),r=i(821885);const n=2*Math.PI;class o extends r.PaneRendererAbstractFillStrokeShape{_drawItemShapeUsingCSSPixels(e,t){const i=Math.max(t.width,t.height)/2,s=t.center,r=t.vertOffset,o=t.y+r;e.moveTo(s+i,o),e.arc(s,o,i,0,n,!1)}_calcBoundingBox(e){const t=Math.max(e.width,e.height)/2,i=e.center,r=e.vertOffset,n=e.y+r,o=i-t,l=i+t,a=n-t,c=n+t,u=new s.Point(o,a),h=new s.Point(l,c);let d=(0,s.box)(u,h);const p=super._calcBoundingBox(e);return p&&(d=this._unionBox(d,p)),d}}},506366:(e,t,i)=>{i.d(t,{PaneRendererCrossShape:()=>n});var s=i(86441),r=i(821885);class n extends r.PaneRendererAbstractStrokeShape{_drawItemShape(e,t){const{context:i,horizontalPixelRatio:s,verticalPixelRatio:r}=e,n=t.width,o=t.height,l=t.center-n/2,a=t.vertOffset,c=t.y-o/2+a,u=this._lineWidth(e),h=u%2?.5:0,d=Math.round(l*s);let p=Math.round((l+n)*s);(p-d)%2!=u%2&&(p+=1);const _=Math.floor((d+p)/2)+h,f=Math.round(c*r);let m=Math.round((c+o)*r);(m-f)%2!=u%2&&(m+=1);const v=Math.floor((f+m)/2)+h;i.moveTo(_,f),i.lineTo(_,m),i.moveTo(d,v),i.lineTo(p,v)}_calcBoundingBox(e){const t=e.width,i=e.height,r=e.center-t/2,n=e.vertOffset,o=e.y-i/2+n,l=r,a=r+t,c=o,u=o+i,h=new s.Point(l,c),d=new s.Point(a,u);let p=(0,s.box)(h,d);const _=super._calcBoundingBox(e);return _&&(p=this._unionBox(p,_)),p}}},992885:(e,t,i)=>{i.d(t,{PaneRendererDiamond:()=>n});var s=i(86441),r=i(821885);class n extends r.PaneRendererAbstractFillStrokeShape{_drawItemShapeUsingCSSPixels(e,t){const i=Math.round(t.height/2),s=t.center,r=t.vertOffset,n=t.y+r;e.moveTo(s,n-i),e.lineTo(s+i,n),e.lineTo(s,n+i),e.lineTo(s-i,n),e.lineTo(s,n-i)}_calcBoundingBox(e){const t=Math.round(e.height/2),i=e.center,r=e.vertOffset,n=e.y+r,o=i-t,l=i+t,a=n-t,c=n+t,u=new s.Point(o,a),h=new s.Point(l,c);let d=(0,s.box)(u,h);const p=super._calcBoundingBox(e);return p&&(d=this._unionBox(d,p)),d}}},618241:(e,t,i)=>{i.d(t,{PaneRendererFlagShape:()=>n});var s=i(86441),r=i(821885);class n extends r.PaneRendererAbstractFillStrokeShape{_drawItemShapeUsingCSSPixels(e,t){const i=t.width,s=t.height,r=s/2,n=(i-3)/3,o=t.center-i/2,l=t.vertOffset,a=t.y-r+l;e.moveTo(o,a),e.lineTo(o+3,a),e.bezierCurveTo(o+n,a-n,o+2*n,a+n,o+i,a),e.lineTo(o+i,a+r),e.bezierCurveTo(o+i-n,a+r+n,o+i-2*n,a+r-n,o+3,a+r),e.lineTo(o+3,a+s),e.lineTo(o,a+s),e.lineTo(o,a)}_calcBoundingBox(e){const t=e.width,i=e.height,r=i/2,n=e.center-t/2,o=e.vertOffset,l=e.y-r+o,a=n,c=n+t,u=l,h=l+i,d=new s.Point(a,u),p=new s.Point(c,h);let _=(0,s.box)(d,p);const f=super._calcBoundingBox(e) ;return f&&(_=this._unionBox(_,f)),_}}},379730:(e,t,i)=>{i.d(t,{CornerVectorsClockwise:()=>s,PaneRendererLabelBase:()=>l});var s,r=i(650151),n=i(821885),o=i(600642);class l extends n.PaneRendererAbstractFillStrokeShape{setItems(e,t){this._setBaseData(e,t);for(const e of this._items){if(e.fontSize){const t=e.fontSize;e.stepX=Math.round(t/1.5),e.stepY=Math.round(t/2)-1}else{const t=e.height;e.stepX=Math.round(t/2*.65)+.5,e.stepY=e.stepX}e.vertOffset=this._calcVertOffset(e);const t=this._getTextCache(e);if(null===t){e.shapeWidth=2*e.stepX,e.shapeHeight=2.5*e.stepY;continue}const i=t.textImageWidth,s=t.textImageHeight;e.shapeWidth=i+2*e.stepX,e.shapeHeight=s+2*e.stepY,e.vertOffset=this._calcVertOffset(e),e.textHorizOffset=this._getHorizontalTextOffset(e),e.textVertOffset=this._getVerticalTextOffset(e)}}_calcVertOffset(e){return e.vertOffset}_drawCorner(e,t,i,s){const{context:r,horizontalPixelRatio:n}=e,o=Math.max(1,Math.floor(2*n));r.lineTo(t-o*s.prevPointSignX,i-o*s.prevPointSignY),r.arcTo(t,i,t+o*s.nextPointSignX,i+o*s.nextPointSignY,o)}_getArrowSize(e){return e.stepX}_getHorizontalTextOffset(e){return 0}_getVerticalTextOffset(e){return 0}_hasText(e){return Boolean(e.text)||Boolean(this._text)}_drawItemText(e,t){var i;const s=this._getTextCache(t);if(null===s)return;const n=t.textHorizOffset||0,l=t.center+n,a=t.vertOffset,c=t.y+a+t.textVertOffset,u=(null===(i=t.style)||void 0===i?void 0:i.textColor)||this._textColor,h={style:{fillStyle:(0,r.ensureDefined)(u)},location:{x:l,y:Math.floor(c),horzAlign:o.HorizontalAlign.Center,vertAlign:o.VerticalAlign.Middle}};s.paintTo(e,h)}}class a{constructor(e,t,i,s){this.prevPointSignX=e,this.prevPointSignY=t,this.nextPointSignX=i,this.nextPointSignY=s}}!function(e){e.rightUp=new a(1,0,0,1),e.rightDown=new a(0,1,-1,0),e.leftDown=new a(-1,0,0,-1),e.leftUp=new a(0,-1,1,0)}(s||(s={}))},778190:(e,t,i)=>{i.d(t,{PaneRendererLabelCenter:()=>c,PaneRendererLabelDown:()=>o,PaneRendererLabelLeft:()=>l,PaneRendererLabelRight:()=>a,PaneRendererLabelUp:()=>n});var s=i(86441),r=i(379730);class n extends r.PaneRendererLabelBase{_calcBoundingBox(e){const t=e.center-e.shapeWidth/2,i=e.center+e.shapeWidth/2,r=e.y+e.vertOffset,n=e.y+e.shapeHeight+e.vertOffset,o=new s.Point(t,r),l=new s.Point(i,n);return(0,s.box)(o,l)}_drawItemShape(e,t){const{context:i,horizontalPixelRatio:s,verticalPixelRatio:n}=e,o=this._lineWidth(e)%2?.5:0,l=Math.max(1,Math.floor(s))%2?.5:0,a=this._getArrowSize(t);let c=Math.round(a*s);(l+c)%1!=o%1&&(c+=.5);let u=Math.round(t.shapeWidth/2*s);(l+u)%1!=o%1&&(u+=.5);const h=Math.round(t.center*s)+l,d=Math.round((t.y+t.vertOffset)*n)+o,p=h-c,_=Math.round((t.y+t.vertOffset+a)*n)+o,f=h+c,m=h+u,v=Math.round((t.y+t.vertOffset+a+t.shapeHeight)*n)+o,g=h-u;i.moveTo(p,_),i.lineTo(h,d),i.lineTo(f,_),t.shapeWidth<=2*a?(i.lineTo(m,_),this._drawCorner(e,m,v,r.CornerVectorsClockwise.rightDown),this._drawCorner(e,g,v,r.CornerVectorsClockwise.leftDown),i.lineTo(g,_)):(this._drawCorner(e,m,_,r.CornerVectorsClockwise.rightUp),this._drawCorner(e,m,v,r.CornerVectorsClockwise.rightDown), this._drawCorner(e,g,v,r.CornerVectorsClockwise.leftDown),this._drawCorner(e,g,_,r.CornerVectorsClockwise.leftUp)),i.lineTo(p,_)}_getVerticalTextOffset(e){return e.shapeHeight/2+this._getArrowSize(e)}_calcVertOffset(e){return Math.sign(e.vertOffset)>=0?e.vertOffset:e.vertOffset-e.shapeHeight}}class o extends r.PaneRendererLabelBase{_calcBoundingBox(e){const t=e.center-e.shapeWidth/2,i=e.center+e.shapeWidth/2,r=e.y-e.shapeHeight+e.vertOffset,n=e.y+e.vertOffset,o=new s.Point(t,r),l=new s.Point(i,n);return(0,s.box)(o,l)}_drawItemShape(e,t){const{context:i,horizontalPixelRatio:s,verticalPixelRatio:n}=e,o=this._lineWidth(e)%2?.5:0,l=Math.max(1,Math.floor(s))%2?.5:0,a=this._getArrowSize(t);let c=Math.round(a*s);(l+c)%1!=o%1&&(c+=.5);let u=Math.round(t.shapeWidth/2*s);(l+u)%1!=o%1&&(u+=.5);const h=Math.round(t.center*s)+l,d=Math.round((t.y+t.vertOffset)*n)+o,p=h+c,_=Math.round((t.y+t.vertOffset-a)*n)+o,f=h-c,m=h+u,v=Math.round((t.y+t.vertOffset-t.shapeHeight-a)*n)+o,g=h-u;i.moveTo(p,_),i.lineTo(h,d),i.lineTo(f,_),t.shapeWidth<=2*a?(i.lineTo(g,_),this._drawCorner(e,g,v,r.CornerVectorsClockwise.leftUp),this._drawCorner(e,m,v,r.CornerVectorsClockwise.rightUp),i.lineTo(m,_)):(this._drawCorner(e,g,_,r.CornerVectorsClockwise.leftDown),this._drawCorner(e,g,v,r.CornerVectorsClockwise.leftUp),this._drawCorner(e,m,v,r.CornerVectorsClockwise.rightUp),this._drawCorner(e,m,_,r.CornerVectorsClockwise.rightDown)),i.lineTo(p,_)}_getVerticalTextOffset(e){return-e.shapeHeight/2-this._getArrowSize(e)}_calcVertOffset(e){return Math.sign(e.vertOffset)<=0?e.vertOffset:e.vertOffset+e.shapeHeight}}class l extends r.PaneRendererLabelBase{_calcBoundingBox(e){const t=e.center,i=e.center+e.shapeWidth,r=e.y-e.shapeHeight/2+e.vertOffset,n=e.y+e.shapeHeight/2+e.vertOffset,o=new s.Point(t,r),l=new s.Point(i,n);return(0,s.box)(o,l)}_drawItemShape(e,t){const{context:i,horizontalPixelRatio:s,verticalPixelRatio:n}=e,o=this._lineWidth(e)%2?.5:0,l=this._getArrowSize(t),a=this._hasText(t),c=a?t.shapeHeight/2:l,u=Math.round(t.center*s)+o,h=Math.round((t.y+t.vertOffset)*n)+o,d=Math.round((t.center+l)*s)+o,p=Math.round((t.y+t.vertOffset+l)*n)+o,_=Math.round((t.y+t.vertOffset-l)*n)+o,f=Math.round((t.y+t.vertOffset-c)*n)+o,m=Math.round((t.center+t.shapeWidth+l)*s)+o,v=Math.round((t.y+t.vertOffset+c)*n)+o;i.moveTo(d,p),i.lineTo(u,h),i.lineTo(d,_),a?this._drawCorner(e,d,f,r.CornerVectorsClockwise.leftUp):i.lineTo(d,f),this._drawCorner(e,m,f,r.CornerVectorsClockwise.rightUp),this._drawCorner(e,m,v,r.CornerVectorsClockwise.rightDown),a?this._drawCorner(e,d,v,r.CornerVectorsClockwise.leftDown):i.lineTo(d,v),i.lineTo(d,p)}_getHorizontalTextOffset(e){return e.shapeWidth/2+this._getArrowSize(e)}}class a extends r.PaneRendererLabelBase{_calcBoundingBox(e){const t=e.center-e.shapeWidth,i=e.center,r=e.y-e.shapeHeight/2+e.vertOffset,n=e.y+e.shapeHeight/2+e.vertOffset,o=new s.Point(t,r),l=new s.Point(i,n);return(0,s.box)(o,l)}_drawItemShape(e,t){ const{context:i,horizontalPixelRatio:s,verticalPixelRatio:n}=e,o=this._lineWidth(e)%2?.5:0,l=this._getArrowSize(t),a=this._hasText(t),c=a?t.shapeHeight/2:l,u=Math.round(t.center*s)+o,h=Math.round((t.y+t.vertOffset)*n)+o,d=Math.round((t.center-l)*s)+o,p=Math.round((t.y+t.vertOffset-l)*n)+o,_=Math.round((t.y+t.vertOffset+l)*n)+o,f=Math.round((t.y+t.vertOffset-c)*n)+o,m=Math.round((t.center-t.shapeWidth-l)*s)+o,v=Math.round((t.y+t.vertOffset+c)*n)+o;i.moveTo(d,p),i.lineTo(u,h),i.lineTo(d,_),a?this._drawCorner(e,d,v,r.CornerVectorsClockwise.rightDown):i.lineTo(d,v),this._drawCorner(e,m,v,r.CornerVectorsClockwise.leftDown),this._drawCorner(e,m,f,r.CornerVectorsClockwise.leftUp),a?this._drawCorner(e,d,f,r.CornerVectorsClockwise.rightUp):i.lineTo(d,f),i.lineTo(d,p)}_getHorizontalTextOffset(e){return-e.shapeWidth/2-this._getArrowSize(e)}}class c extends r.PaneRendererLabelBase{_calcBoundingBox(e){const t=e.center-e.shapeWidth/2,i=e.center+e.shapeWidth/2,r=e.y-e.shapeHeight/2+e.vertOffset,n=e.y+e.shapeHeight/2+e.vertOffset,o=new s.Point(t,r),l=new s.Point(i,n);return(0,s.box)(o,l)}_drawItemShape(e,t){const{context:i,horizontalPixelRatio:s,verticalPixelRatio:n}=e,o=this._lineWidth(e)%2?.5:0,l=t.shapeHeight/2,a=t.shapeWidth/2,c=Math.round(t.center*s)+o,u=Math.round((t.center-a)*s)+o,h=Math.round((t.center+a)*s)+o,d=Math.round((t.y+t.vertOffset-l)*n)+o,p=Math.round((t.y+t.vertOffset+l)*n)+o;i.moveTo(c,d),this._drawCorner(e,h,d,r.CornerVectorsClockwise.rightUp),this._drawCorner(e,h,p,r.CornerVectorsClockwise.rightDown),this._drawCorner(e,u,p,r.CornerVectorsClockwise.leftDown),this._drawCorner(e,u,d,r.CornerVectorsClockwise.leftUp),i.lineTo(c,d)}}},29164:(e,t,i)=>{i.d(t,{PaneRendererSquare:()=>n});var s=i(86441),r=i(821885);class n extends r.PaneRendererAbstractFillStrokeShape{_drawItemShape(e,t){const{context:i,horizontalPixelRatio:s,verticalPixelRatio:r}=e,n=Math.max(1,Math.floor(s))%2?.5:0,o=this._lineWidth(e)%2?.5:0;let l=Math.round(t.height/2*r);(n+l)%1!=o%1&&(l+=.5);const a=Math.round(t.center*s)+n,c=Math.round((t.y+t.vertOffset)*r)+n,u=a-l,h=c-l,d=a+l,p=c+l;i.rect(u,h,d-u,p-h)}_calcBoundingBox(e){const t=e.height,i=Math.round(t/2),r=e.center-i,n=e.vertOffset,o=e.y+n-i,l=r,a=r+t,c=o,u=o+t,h=new s.Point(l,c),d=new s.Point(a,u);let p=(0,s.box)(h,d);const _=super._calcBoundingBox(e);return _&&(p=this._unionBox(p,_)),p}}},119914:(e,t,i)=>{i.d(t,{PaneRendererTriangleApexDown:()=>l,PaneRendererTriangleApexUp:()=>o});var s=i(86441),r=i(821885);class n extends r.PaneRendererAbstractFillStrokeShape{_calcBoundingBox(e){const t=e.width,i=e.height,r=t/2,n=Math.round(i/3),o=e.center,l=e.vertOffset-2*n,a=e.y+l,c=o-r,u=o+r,h=a,d=a+i,p=new s.Point(c,h),_=new s.Point(u,d);let f=(0,s.box)(p,_);const m=super._calcBoundingBox(e);return m&&(f=this._unionBox(f,m)),f}}class o extends n{_drawItemShape(e,t){const{context:i,horizontalPixelRatio:s,verticalPixelRatio:r}=e,n=t.width,o=t.height,l=Math.round(o/3),a=t.vertOffset-2*l,c=this._lineWidth(e)%2?.5:0,u=Math.max(1,Math.floor(s)),h=u%2?.5:0;let d=Math.round(n*s);d%2!=u%2&&(d+=1) ;const p=Math.round(t.center*s)+h,_=Math.round((t.y+a)*r),f=p+d/2,m=Math.round((t.y+a+o)*r)+c,v=p-d/2;i.moveTo(p,_),i.lineTo(f,m),i.lineTo(v,m),i.lineTo(p,_)}}class l extends n{_drawItemShape(e,t){const{context:i,horizontalPixelRatio:s,verticalPixelRatio:r}=e,n=t.width,o=t.height,l=Math.round(o/3),a=t.vertOffset-l,c=this._lineWidth(e)%2?.5:0,u=Math.max(1,Math.floor(s)),h=u%2?.5:0;let d=Math.round(n*s);d%2!=u%2&&(d+=1);const p=Math.round(t.center*s)+h,_=Math.round((t.y+a)*r)+c,f=p+d/2,m=Math.round((t.y+a+o)*r),v=p-d/2;i.moveTo(v,_),i.lineTo(f,_),i.lineTo(p,m),i.lineTo(v,_)}}},815555:(e,t,i)=>{i.d(t,{PaneRendererXCross:()=>n});var s=i(86441),r=i(821885);class n extends r.PaneRendererAbstractStrokeShape{_drawItemShapeUsingCSSPixels(e,t){const i=t.width,s=t.height,r=t.center-i/2,n=t.vertOffset,o=t.y-s/2+n;e.moveTo(r,o),e.lineTo(r+i,o+s),e.moveTo(r,o+s),e.lineTo(r+i,o)}_calcBoundingBox(e){const t=e.width,i=e.height,r=e.center-t/2,n=e.vertOffset,o=e.y-i/2+n,l=r,a=r+t,c=o,u=o+i,h=new s.Point(l,c),d=new s.Point(a,u);let p=(0,s.box)(h,d);const _=super._calcBoundingBox(e);return _&&(p=this._unionBox(p,_)),p}}},106492:(e,t,i)=>{i.d(t,{StudyForceOverlayPlotView:()=>s});class s{constructor(e,t,i){this._series=e,this._model=t,this._plotName=i}isForceOverlay(){return!!this._study.metaInfo().isPlotForceOverlay(this._plotName)}_priceScale(){return this.isForceOverlay()?this._model.mainSeries().priceScale():this._study.priceScale()}}},928483:(e,t,i)=>{i.d(t,{StudyPaneViewInplaceUpdatable:()=>h});var s=i(650151),r=i(86441),n=i(272933),o=i(534741),l=i(674981),a=i(63316),c=i(315801),u=i(106492);class h extends u.StudyForceOverlayPlotView{constructor(e,t,i){super(e,t,i),this._selectionData=null,this._dataInvalidated=null,this._viewportInvalidated=!1,this._items=[],this._selectionIndexer=new a.SelectionIndexes(t.timeScale())}update(e){if("global-change"===e.type)return this._dataInvalidated=(0,n.mergeDataInvalidation)(this._dataInvalidated,{}),void(this._viewportInvalidated=!0);if("data-source-change"!==e.type)this._viewportInvalidated=!0;else{if((e.sourceId===this._study.id()||this._dependsOnSeriesData()&&e.sourceId===this._model.mainSeries().id())&&!e.nonSeriesOnly){const t=(0,n.mergeDataInvalidation)(this._dataInvalidated,{firstIndex:e.firstUpdatedTimePointIndex,clearData:e.clearData});this._dataInvalidated=t}}}_dependsOnSeriesData(){return!1}_makeSureRendererIsValid(){this._dataInvalidated?this._updateImplFull(this._viewportInvalidated)&&(this._dataInvalidated=null):this._viewportInvalidated&&this._updateImplLight(),this._viewportInvalidated=!1}_preallocateItems(e,t){var i,r;const n=e.size(),o=null===(i=this._dataInvalidated)||void 0===i?void 0:i.firstIndex;if(0===n)return o;const a=this._study.offset(this._plotName);if(n!==this._items.length){const i=void 0!==o?o+a:void 0;if(void 0===i||0===this._items.length||i<(0,s.ensureDefined)(this._items[0].timePointIndex))return this._items=[],e.each(((e,i)=>{const s=i[this._plotIndex+1];return this._items.push(t(e,s)),!1})),this._items.length?(0, s.ensureDefined)(this._items[0].timePointIndex)-a:void 0;{const i=(0,s.ensureDefined)(o),n=a>=0?0:a,c=a>=0?a:0;let u=(0,l.lowerbound)(this._items,i+n,((e,t)=>e.timePointIndex<t));const h=(0,s.ensureNotNull)(e.lastIndex()),d=e.rangeIterator(i-c,h);for(const e of d)if(void 0!==u&&(null===(r=this._items[u])||void 0===r?void 0:r.timePointIndex)===e.index+a)u=this._updateItem(e,u);else{const i=e.value[this._plotIndex+1];this._items.push(t(e.index,i))}}}else if(void 0!==o){const t=a>=0?0:a,i=a>=0?a:0;let r=(0,l.lowerbound)(this._items,o+t,((e,t)=>e.timePointIndex<t));const n=(0,s.ensureNotNull)(e.lastIndex())+1,c=e.rangeIterator(o-i,n);for(const e of c)r=this._updateItem(e,r)}return o}_updateItem(e,t){const i=this._getValueForUpdating(e);return this._items[t].origPrices.price=null!=i?i:NaN,t+1}_getValueForUpdating(e){return e.value[this._plotIndex+1]}_calculateStartEnd(e){const t=this._study.offset(this._plotName);let i=e.firstBar()-Math.abs(t)-1,r=e.lastBar()+Math.abs(t)+1;const n=this._study.getMinFirstBarIndexForPlot(this._plotName)+t;if(n>r+1)return{startBar:null,endBar:null};let l=this._study.plots();l=l.range(n,(0,s.ensureNotNull)(l.lastIndex())),i=Math.max(i,n),r=Math.max(r,n);const a=l.search(i,o.PlotRowSearchMode.NearestLeft,this._plotIndex+1),c=l.search(r,o.PlotRowSearchMode.NearestRight,this._plotIndex+1);return null!==a&&(i=a.index),null!==c&&(r=c.index),i=Math.max(n,i),{startBar:i,endBar:r}}_updateImplLight(){const e=this._study.firstValue();if(null===e)return this._selectionData=null,void this._updateRenderer(0,-1);const t=this._priceScale();if(null===t)return this._selectionData=null,void this._updateRenderer(0,-1);const i=this._model.timeScale().visibleBarsStrictRange();if(null===i)return this._selectionData=null,void this._updateRenderer(0,-1);const{startBar:s,endBar:r}=this._calculateStartEnd(i);if(null===s||null===r||0===this._items.length)return this._selectionData=null,void this._updateRenderer(0,-1);const{startItemIndex:n,endItemIndex:o}=this._correctVisibleItemIndexes(Math.max(0,(0,l.lowerbound)(this._items,s,((e,t)=>e.timePointIndex<t))),Math.min(this._items.length,(0,l.upperbound)(this._items,r,((e,t)=>e<t.timePointIndex))));if(n>=o)return this._selectionData=null,void this._updateRenderer(0,-1);this._convertItemsToCoordinates(t,e,n,o),this._createSelection(e),this._updateRenderer(n,o)}_correctVisibleItemIndexes(e,t){return{startItemIndex:e,endItemIndex:t}}_convertItemsToCoordinates(e,t,i,s){this._convertItemsToCoordinatesImpl(e,t,i,s)}_convertItemsToCoordinatesImpl(e,t,i,s){for(let e=i;e<s;e++){const t=this._items[e];t.y=t.origPrices.price}e.pointsArrayToCoordinates(this._items,t,{startItemIndex:i,endItemIndex:s}),this._model.timeScale().fillBarBorders(this._items,{startItemIndex:i,endItemIndex:s},!0),this._updateAdditionalPrices(e,t)}_updateAdditionalPrices(e,t){}_createSelection(e){const t=this._priceScale();if(null!==t)if(this._model.selection().isSelected(this._study)){const i=this._selectionIndexer.indexes(),n=(0,s.ensureNotNull)(this._model.paneForSource(this._study)).height() ;this._selectionData={points:[],bgColors:[],visible:!0,hittestResult:c.HitTarget.Regular,barSpacing:this._model.timeScale().barSpacing()};const o=this._study.offset(this._plotName);for(let s=0;s<i.length;s++){let l=i[s];const a=this._study.plots().valueAt(l);if(l+=o,null===a)continue;const c=a[this._plotIndex+1];if(null==c)continue;const u=this._model.timeScale().indexToCoordinate(Math.floor(l)),h=t.priceToCoordinate(c,e);this._selectionData.points.push(new r.Point(u,h)),this._selectionData.bgColors.push(this._model.backgroundColorAtYPercentFromTop(h/n))}}else this._selectionIndexer.clear()}}},441212:(e,t,i)=>{i.d(t,{createStudyPlotColorProvider:()=>p});var s=i(368135),r=i(650151),n=i(574809);const o=new Map([[0,"color"],[2,"textColor"],[3,"borderColor"],[4,"wickColor"],[5,"colorup"],[6,"colordown"]]);class l{constructor(e){this._plotStyle=e}getPlotPointStyle(e,t){const i=t?(0,n.clearStyle)(t):(0,n.createEmptyStyle)();return o.forEach(((e,t)=>{this._plotStyle[e]&&(i.colors[t]=this._plotStyle[e].value())})),i.lineWidth=this._plotStyle.linewidth?this._plotStyle.linewidth.value():void 0,i.lineStyle=this._plotStyle.linestyle?this._plotStyle.linestyle.value():void 0,i}isColorDefined(){return!0}singleColor(){return!0}getDefaultPlotPointStyle(){return null}}const a=[0,1,2,3,4,5,6];class c{constructor(e,t,i,s){this._palettesColors=new Map,this._defaultPlotColors=new Map,this._indexes=s;const n=t.styles[i];if(n)for(const[e,t]of o)this._defaultPlotColors.set(e,n[t]);const l=(0,r.ensureDefined)(e.palettes),a=e.plots;s.forEach(((e,i)=>{const s=a[e];if(s&&"palette"in s){const e=l[s.palette],r=t.palettes[s.palette];if(e&&r){const{valToIndex:t}=e,{colors:s}=r,n={...s};t&&Object.keys(t).forEach((e=>{const i=t[e];void 0!==i&&(n[e]=s[i])})),this._palettesColors.set(i,n)}}}))}getPlotPointStyle(e,t){const i=t?(0,n.clearStyle)(t):(0,n.createEmptyStyle)();return a.forEach((t=>{var s,n;if(this._palettesColors.has(t)){const n=e[(0,r.ensureDefined)(this._indexes.get(t))+1];if("number"==typeof n){const e=null===(s=this._palettesColors.get(t))||void 0===s?void 0:s[n];0===t&&e&&(i.lineWidth=e.width.value(),i.lineStyle=e.style.value()),i.colors[t]=null==e?void 0:e.color.value()}else i.colors[t]="transparent"}else i.colors[t]=null===(n=this._defaultPlotColors.get(t))||void 0===n?void 0:n.value()})),i}getDefaultPlotPointStyle(){var e;const t=null===(e=this._palettesColors.get(0))||void 0===e?void 0:e[0];if(void 0!==t){return{colors:[t.color.value(),void 0,void 0,void 0,void 0,void 0,void 0],lineStyle:void 0,lineWidth:t.width.value()}}return null}isColorDefined(){return!!this._palettesColors.size}singleColor(){return!1}}var u=i(151149);class h{constructor(e){this._rgbaFromInteger=(0,u.rgbaFromIntegerCached)(),this._indexes=e}getPlotPointStyle(e,t){const i=t?(0,n.clearStyle)(t):(0,n.createEmptyStyle)();return this._indexes.forEach(((t,s)=>{const r=e[t+1];if(null!=r){const e=this._rgbaFromInteger(r);i.colors[s]=e}else i.colors[s]="transparent"})),i}isColorDefined(){return!0}singleColor(){return!1}getDefaultPlotPointStyle(){return null}} const d=new Map([[0,function(e,t){const i=(0,s.isColorerPlot)(t)||(0,s.isOhlcColorerPlot)(t);return"target"in t&&t.target===e&&i}],[2,function(e,t){const i=(0,s.isTextColorerPlot)(t);return"target"in t&&t.target===e&&i}],[1,function(e,t){return(0,s.isBgColorerPlot)(t)&&t.id===e}],[3,function(e,t){const i=(0,s.isCandleBorderColorerPlot)(t);return"target"in t&&t.target===e&&i}],[4,function(e,t){const i=(0,s.isCandleWickColorerPlot)(t);return"target"in t&&t.target===e&&i}],[5,function(e,t){const i=(0,s.isUpColorerPlot)(t);return"target"in t&&t.target===e&&i}],[6,function(e,t){const i=(0,s.isDownColorerPlot)(t);return"target"in t&&t.target===e&&i}]]);function p(e,t,i){const{colorers:s}=function(e,t){const i=e.plots,s=i.findIndex((e=>e.id===t)),r=new Map;return i.forEach(((e,i)=>{d.forEach(((s,n)=>{s(t,e)&&r.set(n,i)}))})),{plotIndex:-1===s?null:s,colorers:r}}(e,i);if(s.size)return e.isRGB?new h(s):new c(e,t,i,s);{const e=t.ohlcPlots;if(e&&e[i])return new l(e[i]);const s=t.styles[i];return new l(s)}}},537919:(e,t,i)=>{function s(e,t="shift",i){return{studyConstructor:e,colorRotationMode:t,colorRotationComparator:i}}i.d(t,{addStudyInfoToMap:()=>n,createStudyInfo:()=>s,getStudyClassName:()=>l,getStudyInfoByName:()=>o});const r=new Map;function n(e,t){r.set(e,t)}function o(e){return r.get(e)}function l(e){for(const[t,i]of r.entries())if(i.studyConstructor===e)return t;return null}},260414:(e,t,i)=>{i.d(t,{StudyBaseWindowView:()=>n});var s=i(782086),r=i(982217);class n extends s.DataWindowView{constructor(e,t){super(),this._invalidated=!0,this._study=e,this._model=t,this._valueProvider=this._createValuesProvider(e,t),this._items=this._valueProvider.getItems().map((e=>new s.DataWindowItem(e.id,e.title,""))),this.update()}update(){this._invalidated=!0}items(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),this._items}study(){return this._study}_updateImpl(){this._header=this._study.title(r.TitleDisplayTarget.DataWindow,!0),this._title=this._study.title(r.TitleDisplayTarget.DataWindow);const e=this._valueProvider.getValues(this._currentIndex());for(let t=0;t<e.length;++t){const i=e[t],s=this._items[t];s.setValue(i.value),s.setVisible(i.visible),s.setColor(i.color),s.setTitle(i.title)}}_currentIndex(){const e=this._model.crossHairSource().appliedIndex();return isNaN(e)?null:e}}},544820:(e,t,i)=>{i.d(t,{StudyDataWindowView:()=>l});var s=i(260414),r=i(103055),n=i(567467);class o{constructor(e,t){this._study=e,this._model=t,this._hhistBasedStudy=void 0!==e.metaInfo().graphics.hhists,this._valuesProvider=this._createValuesProvider(e,t)}getItems(){return this._valuesProvider.getItems()}getValues(e){const t=this._valuesProvider.getValues(e),i=e=>!!this._hhistBasedStudy||this._study.isPlotVisibleAt(e,2);for(const e of t)e.visible=e.visible&&i(e.id);return t}_createValuesProvider(e,t){return this._hhistBasedStudy?new n.HHistBasedValuesProvider(e,t):new r.StudyValuesProvider(e,t)}}class l extends s.StudyBaseWindowView{_createValuesProvider(e,t){return new o(e,t)}}},989709:(e,t,i)=>{function s(e){const t=new Map ;return e.plots.forEach(((e,i)=>{t.set(e.id,(e=>e[i+1]))})),t}function r(e,t){return null==e[t]}i.d(t,{studyEmptyPlotValuePredicate:()=>r,studyPlotFunctionMap:()=>s})},347710:(e,t,i)=>{i.d(t,{emptyPineId:()=>_,isStudyDescriptor:()=>f,studyMetaInfoRepository:()=>P});var s=i(895171),r=i(444372),n=i(650151),o=i(526075),l=i(819021),a=i(854798),c=i(388545),u=i(520533),h=i(201089),d=i(268222);const p=(0,h.getLogger)("Chart.Studies.StudyMetaInfoRepository",{color:"#606"}),_="";function f(e){return"object"==typeof e&&null!==e&&"type"in e&&("java"===e.type&&"studyId"in e||"pine"===e.type&&"pineId"in e)}class m{constructor(e){this._isReady=!1,this._studyVersioning=null,this._rawStudiesMetaInfo=[],this._rawStudiesMetaInfoDeferredPromise=null,this._javaStudiesMetaInfo=[],this._pineMetaInfoCache=[],this._studiesMigrations=[],this._chartApi=e}async requestMetaInfo(){if(null===this._rawStudiesMetaInfoDeferredPromise){this._rawStudiesMetaInfoDeferredPromise=(0,d.createDeferredPromise)();const e=await this._chartApi.requestMetadata(),t=e.params[1].metainfo.slice();{const i=e.params[1].migrations.slice();this._processSiteMetaInfo(t,i)}this._studyVersioning=new c.StudyVersioning(this._javaStudiesMetaInfo,this._studiesMigrations),this._requestFinished(),this._rawStudiesMetaInfoDeferredPromise.resolve(this._rawStudiesMetaInfo)}return this._rawStudiesMetaInfoDeferredPromise.promise}async findById(e){this._isReady||await this.requestMetaInfo();const t=this._findStudyMetaInfo(e);return null!==t?Promise.resolve(t):"pine"===e.type?this._compilePine(e):Promise.reject(`unexpected study id=${e.studyId} with type=${e.type}`)}findByIdSync(e){return this._findStudyMetaInfo(e)}isReady(){return this._isReady}async findAllJavaStudies(){return this._isReady||await this.requestMetaInfo(),this._javaStudiesMetaInfo}studyVersioning(){return(0,n.ensureNotNull)(this._studyVersioning)}getInternalMetaInfoArray(){return this._javaStudiesMetaInfo}addPineMetaInfo(e){return g(this._pineMetaInfoCache,e)}async getLatestMetaInfoForPineStudy(e,t){const i=await(0,u.requestUserScripts)();let s;if(i){const r=i.find((t=>t.scriptIdPart===e));if(r){const e=a.Version.parse(t),i=a.Version.parse(r.version);e.isLess(i)&&(s=r.version)}}if(void 0!==s){const t={type:"pine",pineId:e,pineVersion:s};return this.findById(t)}return null}_processMigrations(e){this._studiesMigrations=[];for(let t=0;e&&t<e.length;t++)this._studiesMigrations.push(e[t])}_processSiteMetaInfo(e,t){for(const t of e)c.StudyVersioning._verifyInputsMaxValue(t),v(t);this._rawStudiesMetaInfo=e,this._processMigrations(t);for(const e of this._rawStudiesMetaInfo)g(this._javaStudiesMetaInfo,e);o.StudyMetaInfo.overrideDefaults(this._javaStudiesMetaInfo)}_processLibraryMetaInfo(e){}_requestFinished(){this._isReady=!0}_findStudyMetaInfo(e){return"java"===e.type?((0,n.assert)(0!==this._javaStudiesMetaInfo.length,"Java studies metainfo should be define here"),this._javaStudiesMetaInfo.find((t=>t.id===e.studyId))||null):this._pineMetaInfoCache.find((t=>t.scriptIdPart===e.pineId&&(void 0===e.pineVersion||(0, n.ensureDefined)(t.pine).version===e.pineVersion)))||null}_compilePine(e){p.logNormal(`Compiling ${e.pineId} script`);const t=(0,u.translateScriptAsync2)(e.pineId,e.pineVersion||"last").then((({metaInfo:t})=>(p.logNormal(`Compiling ${e.pineId} is successful`),this.addPineMetaInfo((0,n.ensureDefined)(t)))));return t.catch((()=>{p.logNormal(`Compiling ${e.pineId} is failed`)})),t}}function v(e){e.description_localized=r.t(e.description,{context:"study"},i(168716))}function g(e,t){const i=new o.StudyMetaInfo(t);(0,l.migrateMetaInfoAndPropState)(i);let s=!0;const r=e.findIndex((e=>e.id===i.id));if(-1===r)e.push(i);else{const t=e[r],n=void 0!==t.pine?a.Version.parse(t.pine.version):null,o=void 0!==i.pine?a.Version.parse(i.pine.version):null;null===o||null===n||o.isGreaterOrEqual(n)?(t.removeDefaults(),e[r]=i):s=!1}return s&&i.createDefaults(),i}const P=(0,s.default)((()=>new m(window.ChartApiInstance)))},470130:(e,t,i)=>{i.d(t,{fundamentalsPrefix:()=>s,isFundamentalStudyMetaInfo:()=>r,studyNameByMetaInfo:()=>n});const s="study_Internal$STD;Fund_";function r(e){return n(e)===s}function n(e){const t="study_"+(e.classId||e.shortId);return t.startsWith(s)?s:t}},414585:(e,t,i)=>{i.d(t,{StudyStatusProviderBase:()=>a});var s=i(985715),r=i(7288),n=i(982217);const o={NONE:"Default"},l=!0;class a extends s.StatusProviderBase{constructor(e){super(),this._source=e}getSplitTitle(){return this._source.titleInParts(n.TitleDisplayTarget.StatusLine,!0,o,void 0,l)}text(){return this._source.isActualInterval()?this._source.isFailed()?`${this._source.title(n.TitleDisplayTarget.StatusLine,!0,o,void 0,l)}: ${this.sourceStatusText()}`:`${this._source.title(n.TitleDisplayTarget.StatusLine,!0,o,void 0,l)} ${this.sourceStatusText()}`:this._source.title(n.TitleDisplayTarget.StatusLine,!0,o,void 0,l)}sourceStatusText(){return(0,r.convertStudyStatusToString)(this._source.status(),!0)}errorStatus(){if(!this._source.isActualInterval()||this._source.isSymbolInvalid())return null;const e=this._source.status();return e.type===r.StudyStatusType.Error?{error:this.sourceStatusText(),solutionId:(0,r.studyStatusSolutionId)(e),title:(0,r.studyStatusTitle)(e),studyFeature:(0,r.studyStatusFeature)(e),stackTrace:(0,r.studyErrorStatusStackTrace)(e.errorDescription.stack_trace)}:null}}},509550:(e,t,i)=>{i.d(t,{StudyStatusProvider:()=>a});var s=i(444372),r=i(7288),n=i(971417),o=i(414585);const l=s.t(null,void 0,i(947542));class a extends o.StudyStatusProviderBase{sourceStatusText(){const e=this._source;if(e.status().type===r.StudyStatusType.Error){const t=e.metaInfo(),i=(0,n.extractPineId)(t.fullId);if(t.scriptIdPart&&(0,n.isEdgrPineId)(t.scriptIdPart)||i&&(0,n.isEdgrPineId)(i))return l}return super.sourceStatusText()}}},555502:(e,t,i)=>{i.d(t,{StudyStatusView:()=>r});var s=i(833642);class r extends s.StatusView{constructor(e){super(e.statusProvider())}getSplitTitle(){return this._statusProvider.getSplitTitle()}update(){this._text=this._statusProvider.text()}}},103055:(e,t,i)=>{i.d(t,{StudyValuesProvider:()=>y}) ;var s=i(150335),r=i(638456),n=i(246733),o=i(244842),l=i(534741),a=i(616117),c=i(885482),u=i(368135),h=i(441212),d=i(470130),p=i(570226),_=i(650151),f=i(60897),m=i(982217);const v=r.CheckMobile.any(),g=o.enabled("hide_last_na_study_output"),P=o.enabled("always_show_legend_values_on_mobile");class y{constructor(e,t){this._emptyValues=[],this._colorProviders=new Map,this._study=e,this._model=t,this._studyMetaInfo=this._study.metaInfo(),this._studyProperties=this._study.properties().childs(),this._isFundamental=(0,d.isFundamentalStudyMetaInfo)(this._studyMetaInfo);const i=this._studyMetaInfo.plots;i&&i.forEach(((e,t)=>{if((0,u.isPlotWithTechnicalValues)(e))return;const i=e.id;this._emptyValues.push(function(e,t="",i=""){return{id:t,index:e,title:i,value:"",visible:!1}}(t,i,this._study.guiPlotName(m.TitleDisplayTarget.StatusLine,i)));const s=(0,u.isOhlcPlot)(e)?e.target:i;this._colorProviders.set(s,(0,h.createStudyPlotColorProvider)(this._studyMetaInfo,this._study.properties(),s))}))}getItems(){return this._emptyValues}getPlotColor(e,t){var i;const r=t[e+1];if(!(0,s.isNumber)(r))return"";const n=r>0;let o;const l=this._studyMetaInfo.plots[e];let a=l.id;const c=this._studyProperties;if((0,u.isOhlcPlot)(l))a=l.target||a,o=(0,_.ensureDefined)(c.ohlcPlots.childs()[a].childs().color).value();else if((0,u.isArrowsPlot)(l)){const e=(0,_.ensureDefined)(c.styles.childs()[a]);o=n?e.childs().colorup.value():e.childs().colordown.value()}else o=(0,_.ensureDefined)(null===(i=c.styles.childs()[a])||void 0===i?void 0:i.child("color")).value();let h=o;const d=this._colorProviders.get(a),p=d&&d.getPlotPointStyle(t);return p&&((0,u.isArrowsPlot)(l)?(n&&void 0!==p.colors[5]&&(h=p.colors[5]),n||void 0===p.colors[6]||(h=p.colors[6])):void 0!==p.colors[0]&&(h=p.colors[0])),"transparent"===h&&(h=o),h}getValues(e){var t,i;const r=this._emptyValues.map((e=>({...e})));let o=null;const a=this._study.data().lastIndex(),c=this._studyProperties;if(null!==a)for(const e of r){if(0===(null===(t=c.styles.childs()[e.id])||void 0===t?void 0:t.childs().display.value()))continue;const i=this._study.nearestIndex(a,l.PlotRowSearchMode.NearestLeft,e.index+1);if(void 0===i)continue;const s=i+this._study.offset(e.id);o=null!==o?Math.max(s,o):s}(null===e||null!==o&&e>o)&&(e=o);const h=this._hideValues(),d=this._study.isVisible()&&!h?f.notAvailable:"";for(const e of r)e.value=d;if(h)return r;g&&r.length&&(r[r.length-1].value="");const m=this._study.priceScale();if(!this._study.isVisible()||null===e||null===m||m.isEmpty()||this._model.timeScale().isEmpty())return r;const v={};for(const t of r){const r=t.id,o=(0,p.getPriceValueFormatterForStudy)(this._study,r),h=(0,_.ensureDefined)(c.styles.childs()[r]),d=h.childs().display.value();if(t.visible=0!==d,!t.visible)continue ;const f=h.hasChild("plottype")?null===(i=h.child("plottype"))||void 0===i?void 0:i.value():null,m=this._isFundamental&&(f===u.LineStudyPlotStyle.StepLine||f===u.LineStudyPlotStyle.StepLineWithDiamonds),g=t.index,P=e-this._study.offset(r),y=m||null!==a&&P>a?l.PlotRowSearchMode.NearestLeft:l.PlotRowSearchMode.Exact,S=this._study.nearestIndex(P,y);if(void 0===S)continue;let b=v[r];if(void 0===b&&(b=this._study.getMinFirstBarIndexForPlot(r),Number.isFinite(b)&&(v[r]=b)),b>S)continue;const x=this._study.data().last(),w=this._study.data().valueAt(S)||(null!==x?x.value:null);if(null===w)continue;const C=w[g+1];(0,s.isNumber)(C)&&(t.value=o(C),t.color=(0,n.resetTransparency)(this.getPlotColor(g,w)))}return r}_hideValues(){return P?(0,a.isLineToolName)(c.tool.value())||null!==this._model.lineBeingEdited():v&&(null===this._model.crossHairSource().pane||(0,a.isLineToolName)(c.tool.value())||null!==this._model.lineBeingEdited())}}},223284:(e,t,i)=>{i.d(t,{EXCLUDED_FOR_ALERT_ID_INPUTS:()=>_,collectDepsForAlert:()=>v,dependenciesForAlerts:()=>g,plotsForAlert:()=>m});var s=i(484156),r=i(650151),n=i(62745),o=i(201089),l=i(827523),a=i(526075),c=i(95452),u=i(368135);const h=(0,o.getLogger)("Chart.Study");function d(e,t,i){void 0!==i&&i.forEach((i=>{const s=e[i];"string"==typeof s?e[i]=p(s,t):(0,n.isExtendedInput)(s)&&(0,n.isExtendedInputSource)(s)?s.v=p((0,n.getInputValue)(s),t):h.logError(`Cannot patch source input, its type is not source: ${JSON.stringify(s)}`)}))}function p(e,t){const[i,s]=e.split("$"),r=t.get(i);return r?r+(void 0===s?"":"$"+s):e}const _=["text","pineFeatures"];function f(e){return(0,s.default)(e,_)}function m(e,t){const i=[u.isLinePlot,u.isShapesPlot,u.isCharsPlot,u.isArrowsPlot,u.isOhlcPlot,u.isAlertConditionPlot];return e.plots.map(((e,t)=>({...e,pinePlotIndex:t}))).filter((e=>i.some((t=>t(e))))).map((i=>{const s={id:i.id,type:i.type,pinePlotIndex:i.pinePlotIndex,offset:t(i.id)};if(e.styles&&void 0!==e.styles[i.id]){const t=(0,r.ensureDefined)((0,r.ensureDefined)(e.styles)[i.id]);s.title=t.title||"",s.text=t.text||""}return(0,u.isOhlcPlot)(i)&&i.target&&e.ohlcPlots&&e.ohlcPlots[i.target]&&(s.ohlcTitle=(0,r.ensureDefined)((0,r.ensureDefined)(e.ohlcPlots)[i.target]).title),s}))}function v(e,t){const i=[],s=new Map;let n;for(let r=e.length-1;r>=0;r--){const o=e[r],u=(0,l.extractStudyId)(o.metaInfo().id),h=a.StudyMetaInfo.getStudyIdWithLatestVersion(o.metaInfo());n=o.inputsForAlertState();d(n,s,o.metaInfo().inputs.filter((e=>"source"===e.type)).map((e=>e.id)));const p=o.metaInfo().isTVScript?f(n):n,_=(0,c.getStudyIdForAlert)(u,p,t);i.push({id:_,study:h,inputs:n}),s.set(o.id(),_)}const o=i.reverse();return{idForAlert:(0,r.ensureDefined)(o[0].id),inputsForAlert:(0,r.ensureDefined)(n),studyDependencies:o}}function g(e,t){return e.map((e=>{const i=e.inputs(),s=e.metaInfo();let r=a.StudyMetaInfo.cutDollarHash(s.fullId);if("tv-scripting"===s.productId){const e=t.findByIdSync({type:"java",studyId:"Script@tv-scripting"});null!==e&&(r=e.fullId)}const n={id:e.sourceId(),study:r,inputs:i,scriptIdPart:void 0, scriptVersion:void 0};return s.pine?{...n,scriptIdPart:s.scriptIdPart,scriptVersion:s.pine.version}:n}))}},932167:(e,t,i)=>{i.d(t,{StudyPriceAxisView:()=>o});var s=i(650151),r=i(229765),n=i(246733);class o extends r.PriceAxisView{constructor(e,t){super(),this._model=e.model(),this._source=e,this._data=t,this._isForceOverlay=!!this._source.metaInfo().isPlotForceOverlay(this._data.plotIndex)}_updateRendererData(e,t,i){e.visible=!1,t.visible=!1;const r=this._source.model(),o=this._isForceOverlay?r.mainSeries().priceScale():this._source.priceScale();if(null===o)return;if(!r.isPriceScaleVisible(o))return;const l=this._source.lastValueData(this._data.plotIndex,!1);if(l.noData)return;const a=r.timeScale().visibleBarsStrictRange(),c=r.mainSeries().bars().lastIndex();if(null!==a&&null!==c){if(c<=a.lastBar()){i.background=(0,n.resetTransparency)(l.color);let s=l.color;"transparent"===s&&(s=this._model.properties().childs().scalesProperties.childs().backgroundColor.value()),i.textColor=this.generateTextColor(s),i.borderColor=void 0,e.borderVisible=!1,t.borderVisible=!1}else{const o=r.backgroundColorAtYPercentFromTop(l.coordinate/(0,s.ensureNotNull)(r.paneForSource(this._source)).height());i.background=o,i.textColor=(0,n.resetTransparency)(l.color),i.borderColor=(0,n.resetTransparency)(i.textColor),e.borderVisible=!0,t.borderVisible=!0}i.coordinate=l.coordinate,i.floatCoordinate=l.floatCoordinate,this._showAxisLabel()&&(e.text=l.text,e.visible=!0),this._updatePaneRendererData(t)}}_showPaneLabel(){const e=this._model.properties().childs().scalesProperties.childs();return(e.showStudyPlotLabels.value()||e.showFundamentalNameLabel.value())&&this._source.properties().childs().showLabelsOnPriceScale.value()&&this._source.isPlotVisibleAt(this._data.plotIndex,4)}_showAxisLabel(){const e=this._model.properties().childs().scalesProperties.childs();return(e.showStudyLastValue.value()||e.showFundamentalLastValue.value())&&this._source.properties().childs().showLabelsOnPriceScale.value()&&this._source.isPlotVisibleAt(this._data.plotIndex,4)}_updatePaneRendererData(e){e.text="",this._showPaneLabel()&&(e.text=this._source.priceLabelText(this._data.plotIndex),e.visible=!0)}}},752928:(e,t,i)=>{i.d(t,{Study:()=>Vi,createStudyError:()=>wi,prepareStudyProperties:()=>vi,prepareStudyPropertiesForLoadChart:()=>Si});var s=i(316230),r=i(822914),n=i(852290),o=i(650151),l=i(130551),a=i(444372),c=i(201089),u=i(537919),h=i(461794),d=i(173948),p=i(168682),_=i(855611),f=i(782856),m=i(62745),v=i(298113);function g(e){const t=new Set;("historyCalculationMayChange"in e?e.historyCalculationMayChange():e.metaInfo().historyCalculationMayChange)&&t.add(f.DataSourceDangerReason.PineRepainting);for(const i of Object.values(e.inputs()))if((0,m.isExtendedInput)(i)&&"symbol"===i.t){const s=e.resolvedSymbolInfoBySymbol(i.v);"spread"===(null==s?void 0:s.type)&&t.add(f.DataSourceDangerReason.Spread),"CRYPTOCAP"===(null==s?void 0:s.exchange)&&t.add(f.DataSourceDangerReason.CryptoCap)}for(const i of e.parentSources())(0,v.addToSet)(t,g(i));const i=e.ownerSource() ;return e.isChildStudy()&&i&&(0,v.addToSet)(t,g(i)),t}function P(e){const[t]=g(e);return null!=t?t:null}var y=i(223284),S=i(662080),b=i(960337),x=i(371927),w=i(822122),C=i(397150),I=i(707957),T=i(246733),V=i(178389),M=i(974655),D=i(291784),A=i(195447),L=i(526075),B=i(484812),R=i(534741),N=i(379048),k=i(260414),E=i(103055),O=i(567467);class F{constructor(e,t){this._study=e,this._model=t,this._showStudyValues=t.properties().childs().paneProperties.childs().legendProperties.childs().showStudyValues,this._hhistBasedStudy=void 0!==e.metaInfo().graphics.hhists,this._valuesProvider=this._createValuesProvider(e,t)}getItems(){return this._valuesProvider.getItems()}getValues(e){const t=this._valuesProvider.getValues(e),i=this._study.properties(),s=this._showStudyValues.value()&&i.childs().showLegendValues.value(),r=e=>!!this._hhistBasedStudy||this._study.isPlotVisibleAt(e,8);for(const e of t)e.visible=e.visible&&s&&r(e.id);return t}_createValuesProvider(e,t){return this._hhistBasedStudy?new O.HHistBasedValuesProvider(e,t):new E.StudyValuesProvider(e,t)}}var W=i(368135);class z extends k.StudyBaseWindowView{constructor(e,t){super(e,t),this._showStudyValues=t.properties().childs().paneProperties.childs().legendProperties.childs().showStudyValues,this._showStudyValues.subscribe(this,this.update);const i=this._study.properties();i.childs().showLegendValues.subscribe(this,this.update);const s=this._study.metaInfo().plots,r=new Set;s.forEach((e=>{var t;if((0,W.isOhlcPlot)(e)){const t=e.target;if(r.has(t))return;r.add(t),i.childs().ohlcPlots.childs()[t].childs().display.subscribe(this,this.update)}else(0,W.isPlotSupportDisplay)(e)&&(null===(t=i.childs().styles.childs()[e.id])||void 0===t||t.childs().display.subscribe(this,this.update))}))}areValuesVisible(){return this._showStudyValues.value()}additional(){return null}destroy(){this._showStudyValues.unsubscribeAll(this);const e=this._study.properties();e.childs().showLegendValues.unsubscribeAll(this);const t=this._study.metaInfo().plots,i=new Set;t.forEach((t=>{var s;if((0,W.isOhlcPlot)(t)){const s=t.target;if(i.has(s))return;i.add(s),e.childs().ohlcPlots.childs()[s].childs().display.unsubscribe(this,this.update)}else(0,W.isPlotSupportDisplay)(t)&&(null===(s=e.childs().styles.childs()[t.id])||void 0===s||s.childs().display.unsubscribe(this,this.update))}))}_createValuesProvider(e,t){return new F(e,t)}}var H=i(885482),U=i(555502),K=i(919892),G=i(173220),j=i(826989),q=i(509550),$=i(389137),Y=i(182436),Q=i(982217),X=i(539163);class Z{constructor(e,t,i=!1){this.price=t,this.index=e,this.useMainSeriesForPriceRange=i}}var J=i(92245);function ee(e,t,i,s){if(e.y1===e.y2)return function(e,t,i){return(0,o.assert)(e.y1===e.y2),(0,J.doesItemAffectVisibleRange)(e.x1,e.x2,e.extend,t,i)?[new Z(t,e.y1,!1),new Z(i,e.y2,!1)]:[]}(e,i,s);const r=[];return null!==e.x1&&r.push(new Z(e.x1,e.y1,!1)),null!==e.x2&&r.push(new Z(e.x2,e.y2,!1)),r}function te(e,t,i,s){return e.points.filter((e=>e.x>=i&&e.x<=s)).map((e=>new Z(e.x,e.y,!1)))}function ie(e,t,i,s){return(0, J.doesItemAffectVisibleRange)(e.left,e.right,e.extend,i,s)?[new Z(i,e.top,!1),new Z(s,e.bottom,!1)]:[]}var se=i(294024);function re(e,t,i,s){let r;const n=e.yloc!==se.DwgLabelYloc.Price&&e.yloc!==se.DwgLabelYloc.Auto;if(n){const i=e.yloc===se.DwgLabelYloc.AboveBar?2:3,s=t.valueAt(e.x);null!==s&&(r=s[i])}else r=e.y;return null==r?null:[new Z(e.x,r,n)]}function ne(e,t,i,s,r,n){if(!(0,J.doesItemAffectVisibleRange)(e.firstBarTime,e.lastBarTime,J.DwgExtend.None,i,s))return[];let o=1/0,l=-1/0;for(const[t,i]of r.tpoBlockSets())if(n===t)for(const t of i)t.tpoId===e.id&&(o=Math.min(o,t.rowIndex*e.priceRange),l=Math.max(l,(t.rowIndex+1)*e.priceRange));return Number.isFinite(o)?[new Z(i,l,!1),new Z(s,o,!1)]:[]}class oe{constructor(e,t,i,s,r){this._mapGetter=e,this._study=t,this._bars=t.series().bars(),this._visibilityGetter=i,this._getPoints=s,this._getMargins=r}groupPriceRange(e,t){let i=null;const s=this._study.graphics();for(const[r,n]of this._mapGetter())if(this._visibilityGetter(r))for(const o of n){const n=this._getPoints(o,this._bars,e,t,s,r);if(null===n)continue;let l=1/0,a=-1/0,c=!1,u=!1,h=!1;for(const i of n){const s=i.index<=t,r=i.index>=e;c=c||s,u=u||r,h=h||s&&r;let n=i.price,o=i.price;if(i.useMainSeriesForPriceRange){const e=this._bars.valueAt(i.index);if(null===e)continue;const t=e[2];if(null==t)continue;const s=e[3];if(null==s)continue;n=s,o=t}n<l&&(l=n),o>a&&(a=o)}if(!(h||c&&u))continue;const d=new D.PriceRange(l,a);i=null===i?d:i.merge(d)}return i}firstValue(e,t){let i=1/0,s=1/0,r=-1/0,n=1/0,o=1/0,l=1/0;const a=this._study.graphics();for(const[c,u]of this._mapGetter())if(this._visibilityGetter(c))for(const h of u){const u=this._getPoints(h,this._bars,e,t,a,c);if(null!==u)for(const a of u){const c=a.index;c>=e&&c<=t&&c<i?(i=c,s=a.price):c<e&&c>r?(r=c,n=a.price):c>t&&c<o&&(o=c,l=a.price)}}return{firstVisible:i===1/0?null:new Z(i,s),leftClosest:r===-1/0?null:new Z(r,n),rightClosest:o===1/0?null:new Z(o,l)}}groupPixelMargins(e,t){if(!this._getMargins)return le();const i=le();if(null===this._study.priceScale())return i;if(null===this._study.firstValue())return i;const s=this._study.graphics();for(const[r,n]of this._mapGetter())if(this._visibilityGetter(r))for(const o of n){const n=this._getPoints(o,this._bars,e,t,s,r);if(null===n)continue;if(0===n.filter((i=>{const s=i.index;return s>=e&&s<=t})).length)continue;const l=this._getMargins(o,this._bars);i.bottomPixelMargin=Math.max(i.bottomPixelMargin,l.bottomPixelMargin),i.topPixelMargin=Math.max(i.topPixelMargin,l.topPixelMargin)}return i}}const le=()=>({bottomPixelMargin:0,topPixelMargin:0});function ae(e){const t=(0,o.ensureDefined)(e.properties().childs().graphics).childs();return[new oe((()=>e.graphics().tpos()),e,(e=>{const i=(0,o.ensureDefined)(t.tpoBlockSets).childs()[e].childs();return i.showLetters.value()||i.showBlocks.value()||(0,o.ensureDefined)(t.tpoVolumeRows).childs()[e].childs().visible.value()}),ne,le),new oe((()=>e.graphics().dwglabels()),e,(e=>(0, o.ensureDefined)(t.dwglabels).childs()[e].childs().visible.value()),re,X.calculateDwgLabelsMargins.bind(null,e)),new oe((()=>e.graphics().dwglines()),e,(e=>(0,o.ensureDefined)(t.dwglines).childs()[e].childs().visible.value()),ee,le),new oe((()=>e.graphics().dwgpolylines()),e,(e=>(0,o.ensureDefined)(t.dwgpolylines).childs()[e].childs().visible.value()),te,le),new oe((()=>e.graphics().dwgboxes()),e,(e=>(0,o.ensureDefined)(t.dwgboxes).childs()[e].childs().visible.value()),ie,le),new oe((()=>e.graphics().dwglinefills()),e,(e=>(0,o.ensureDefined)(t.dwglinefills).childs()[e].childs().visible.value()),((t,i,s,r)=>{const n=new Map;for(const[,t]of e.graphics().dwglines())for(const e of t)n.set(e.id,e);return function(e,t,i,s,r){const n=e.get(t.line1),o=e.get(t.line2);return void 0!==n&&void 0!==o&&((0,J.doesItemAffectVisibleRange)(n.x1,n.x2,n.extend,s,r)||(0,J.doesItemAffectVisibleRange)(o.x1,o.x2,o.extend,s,r))?[new Z(s,n.y1,!1),new Z(r,n.y2,!1),new Z(s,o.y1,!1),new Z(r,o.y2,!1)]:[]}(n,t,0,s,r)}),le)]}function ce(e,t,i){return null===t?e:null===e?t:e.index<t.index?i?t:e:i?e:t}class ue{constructor(){this.firstVisible=null,this.leftClosest=null,this.rightClosest=null}improve(e){this.firstVisible=ce(this.firstVisible,e.firstVisible,!0),this.leftClosest=ce(this.leftClosest,e.leftClosest,!0),this.rightClosest=ce(this.rightClosest,e.rightClosest,!1)}bestPrice(){return null!==this.firstVisible?this.firstVisible.price:null!==this.leftClosest?this.leftClosest.price:null!==this.rightClosest?this.rightClosest.price:null}}var he=i(1500),de=i(175203),pe=i(470130),_e=i(811630),fe=i(197050);function me(e,t){return e.studyId.localeCompare(t.studyId)}function ve(e){const t=new Set,i=[];return e.forEach((e=>{t.has(e.studyId)||(t.add(e.studyId),i.push(e))})),i}function ge(e){const t=e.model().mainSeries();return{studyId:(0,o.ensureNotNull)(e.sourceId()),turnaround:e.turnaround(),sourceStudies:e.parentSources().filter((e=>e!==t)).map((e=>ge(e)))}}var Pe=i(244842),ye=i(142119),Se=i(43192);class be extends Se.BitmapCoordinatesPaneRenderer{constructor(e){super(),this._data=e}hitTest(e){return null}_drawImpl(e){}_drawBackgroundImpl(e){const{context:t,horizontalPixelRatio:i,bitmapSize:s}=e,r=this._data;for(let e=0;e<r.items.length;++e){const n=r.items[e];if(null==n.color)continue;t.fillStyle=n.color;const o=Math.round(n.left*i)+1,l=Math.round(n.right*i);t.fillRect(o,0,l-o+1,s.height)}}}var xe=i(441212),we=i(106492);class Ce extends we.StudyForceOverlayPlotView{constructor(e,t,i,s){super(t,i,s),this._items=[],this._invalidated=!0,this._isMarkersEnabled=Pe.enabled("source_selection_markers"),this._study=e;const r=this._study.metaInfo().plots;for(let e=0;e<r.length;e++){const t=r[e];t.id===this._plotName&&(this._plotIndex=e,(0,o.assert)((0,W.isBgColorerPlot)(t),"Plot '"+this._plotName+"' is not a background colorer!"))}this._colorProvider=(0,xe.createStudyPlotColorProvider)(e.metaInfo(),e.properties(),s)}items(){return this._items}update(){this._invalidated=!0}renderer(){if(1!=(1&(0, o.ensureDefined)(this._study.properties().childs().styles.childs()[this._plotName]).childs().display.value()))return null;if(!this._scalesReady())return null;this._invalidated&&(this._updateImpl(),this._invalidated=!1);const e={items:this._items},t=new ye.CompositeRenderer;return t.append(new be(e)),t}_scalesReady(){const e=this._model.timeScale(),t=this._priceScale();return e&&!e.isEmpty()&&null!==t&&!t.isEmpty()}_getTranspValue(){const e=(0,o.ensureDefined)(this._study.properties().childs().styles.childs()[this._plotName]).childs();let t=0;return e.transparency&&(t=e.transparency.value(),t=(0,$.isNumber)(t)?t:40),t}_updateImpl(){this._items=[],(0,o.assert)(this._scalesReady(),"Scales must be ready!");const e=this._model.timeScale().visibleBarsStrictRange();if(null===e)return;const t=this._getTranspValue();let i=(0,o.ensureDefined)(this._series.nearestIndex(e.firstBar(),R.PlotRowSearchMode.NearestRight)),s=(0,o.ensureDefined)(this._series.nearestIndex(e.lastBar(),R.PlotRowSearchMode.NearestLeft));const r=this._study.offset(this._plotName);r>0?(i-=r,s+=r):(i+=r,s-=r);const n=this._study.getMinFirstBarIndexForPlot(this._plotName);if(n>s)return;i=Math.max(n,i);const l=this._study.data();for(const e of l.rangeIterator(i,s)){let i=e.index;const s=e.value;i+=r;const n={timePointIndex:Math.floor(i),left:NaN,center:NaN,right:NaN};let l=(0,$.isNumber)(t)?t:50;l=Math.min(l,100),l=Math.max(l,0);const a=this._colorProvider.getPlotPointStyle(s);void 0!==a.colors[1]&&(n.color=(0,T.generateColor)((0,o.ensureDefined)(a.colors[1]),l)),this._items.push(n)}this._model.timeScale().fillBarBorders(this._items)}}var Ie=i(230058),Te=i(466144),Ve=i(678515),Me=i(63316),De=i(544421),Ae=i(574809),Le=i(111595),Be=i(594931),Re=i(506366),Ne=i(992885),ke=i(618241),Ee=i(778190),Oe=i(29164),Fe=i(119914),We=i(815555),ze=i(674981),He=i(928483);const Ue=new Map;Ue.set("PaneRendererArrowUp",Le.PaneRendererArrowUp),Ue.set("PaneRendererArrowDown",Le.PaneRendererArrowDown),Ue.set("PaneRendererCircleShape",Be.PaneRendererCircleShape),Ue.set("PaneRendererCrossShape",Re.PaneRendererCrossShape),Ue.set("PaneRendererDiamond",Ne.PaneRendererDiamond),Ue.set("PaneRendererFlagShape",ke.PaneRendererFlagShape),Ue.set("PaneRendererLabelUp",Ee.PaneRendererLabelUp),Ue.set("PaneRendererLabelDown",Ee.PaneRendererLabelDown),Ue.set("PaneRendererSquare",Oe.PaneRendererSquare),Ue.set("PaneRendererTriangleApexUp",Fe.PaneRendererTriangleApexUp),Ue.set("PaneRendererTriangleApexDown",Fe.PaneRendererTriangleApexDown),Ue.set("PaneRendererXCross",We.PaneRendererXCross);class Ke extends He.StudyPaneViewInplaceUpdatable{constructor(e,t,i,s){var r;super(t,i,s),this._renderer=null,this._shapesRenderer=null,this._selectionRenderer=null,this._isMarkersEnabled=Pe.enabled("source_selection_markers"),this._study=e;const n=e.metaInfo().plots;for(let e=0;e<n.length;e++)if(n[e].id===this._plotName){this._plotIndex=e;break}this._plotStyleInfo=(0,o.ensureDefined)(null===(r=e.metaInfo().styles)||void 0===r?void 0:r[this._plotName]),this._colorProvider=(0, xe.createStudyPlotColorProvider)(e.metaInfo(),e.properties(),s),this._selectionIndexer=new Me.SelectionIndexes(i.timeScale())}items(){return this._items}renderer(){return this._isPlotVisible()&&this._scalesReady()?(this._makeSureRendererIsValid(),this._renderer):null}_isPlotVisible(){return this._study.isPlotVisibleAt(this._plotName,1)}_scalesReady(){const e=this._model.timeScale(),t=this._priceScale();return e&&null!==t&&!e.isEmpty()&&!t.isEmpty()}_updateImplFull(e){var t;if((null===(t=this._dataInvalidated)||void 0===t?void 0:t.clearData)&&(this._items=[],this._renderer=null),!this._scalesReady())return!1;const i=this._model.timeScale(),s=this._priceScale(),r=i.visibleBarsStrictRange();if(null===r||null===s)return!1;const n=this._study.plots().plottableRange(!1);if(0===n.size())return!1;const l=this._study.offset(this._plotName),a=this._study.firstValue();if(null===a)return!1;this._updateAdditionalPrices(s,a);const{hiPlot:c,loPlot:u}=this._hiLoPlots(),h=this._preallocateItems(n,((e,t)=>this._createItem(e,null!=t?t:null,c,u,l)));let d=this._series.nearestIndex(r.firstBar(),R.PlotRowSearchMode.NearestRight),p=this._series.nearestIndex(r.lastBar(),R.PlotRowSearchMode.NearestLeft);if(void 0===d||void 0===p)return!1;l>0?(d-=l,p+=l):(d+=l,p-=l);const _=this._study.getMinFirstBarIndexForPlot(this._plotName);if(_>p)return!0;d=Math.max(_,d);const f=this._getTranspValue(),m=this._study.properties().childs().styles.childs()[this._plotName].childs(),v=m.color.value(),g=m.textColor?m.textColor.value():void 0,P=v,y=v,S=void 0===g?void 0:g,b=(0,o.ensureNotNull)(this._plotIndex),x=(0,Ae.createEmptyStyle)(),w=null!=h?h:(0,o.ensureNotNull)(n.firstIndex()),C=n.rangeIterator(w,(0,o.ensureNotNull)(n.lastIndex())+1);let I=(0,ze.lowerbound)(this._items,w+l,((e,t)=>e.timePointIndex<t));for(const e of C){const t=e.value,i=t[b+1];if(null==i){I++;continue}const s=this._items[I];if(!isNaN(s.origPrices.price)){if(this._colorProvider.isColorDefined()){s.style={color:P,borderColor:y,textColor:S};const e=this._colorProvider.getPlotPointStyle(t,x);this._fillItemWithPointStyle(s,e,f)}}I++}return this._updateImplLight(),!0}_fillItemWithPointStyle(e,t,i){const s=(0,o.ensureDefined)(e.style);if(void 0!==t.colors[0]){s.color=(0,T.generateColor)((0,o.ensureDefined)(t.colors[0]),i);const e=i>9?i-10:0;s.borderColor=(0,T.generateColor)(s.color,e)}void 0!==t.colors[2]&&(s.textColor=(0,T.generateColor)((0,o.ensureDefined)(t.colors[2]),i))}_updateRenderer(e,t){this._makeSureRendererIsValid();const i=this._model.timeScale(),s={},r=this._getTranspValue(),n=i.barSpacing(),o=this._calculateShapeHeight(n),l=this._study.properties().childs().styles.childs()[this._plotName].childs(),a=l.location.value(),c=this._calculateVerticalOffset(a,o+o/2);s.barSpacing=n,s.items=this._items,s.color=(0,T.generateColor)(l.color.value(),r),s.height=o,s.vertOffset=c,s.visibleItemsRange={startItemIndex:e,endItemIndex:t};const u=l.plottype.value(),h=Te.plotShapesData[u],d=new ye.CompositeRenderer ;h&&(this._shapesRenderer?this._shapesRenderer.setData(s):(this._shapesRenderer=this._createRenderer(h.paneRendererClass,s),d.append(this._shapesRenderer))),this._model.selection().isSelected(this._study)&&this._isMarkersEnabled&&null!==this._selectionData&&(this._selectionData.vertOffset=c,d.append(new Ie.SelectionRenderer(this._selectionData))),this._renderer=d}_createRenderer(e,t){const i=Ue.get(e);return new((0,o.ensureDefined)(i))(t)}_getSeriesVal(e,t){const i=(0,De.barFunction)(e),s=this._series.data().valueAt(t);return null===s?null:i(s)}_getTranspValue(){let e=0;const t=this._study.properties().childs();t.transparency&&(e=t.transparency.value(),e=(0,$.isNumber)(e)?e:50);const i=t.styles.childs()[this._plotName].childs();return i.transparency&&(e=i.transparency.value(),e=(0,$.isNumber)(e)?e:50),(0,Ve.clamp)(e,0,100)}_createItem(e,t,i,s,r){const n=this._study.properties().childs().styles.childs()[this._plotName].childs().location.value(),l={origPrices:{price:NaN},timePointIndex:e+r};if((null===t||0===t)&&n!==N.MarkLocation.Absolute)return l;if(null==t)return l;let a=NaN;switch(n){case N.MarkLocation.AboveBar:{const t=this._getLocationPrice(e,i,r);if(null===t)return l;a=t;break}case N.MarkLocation.BelowBar:{const t=this._getLocationPrice(e,s,r);if(null===t)return l;a=t;break}case N.MarkLocation.Absolute:a=(0,o.ensureNotNull)(t);break;case N.MarkLocation.Top:case N.MarkLocation.Bottom:a=0;break;default:throw new Error("Bad value: "+n)}return{y:NaN,origPrices:{price:a},timePointIndex:e+r}}_dependsOnSeriesData(){const e=this._study.properties().childs().styles.childs()[this._plotName].childs().location.value();return e===N.MarkLocation.AboveBar||e===N.MarkLocation.BelowBar}_getValueForUpdating(e){const t=e.value[this._plotIndex+1];if(null==t)return null;const i=this._study.properties().childs().styles.childs()[this._plotName].childs().location.value();if(0===t&&i!==N.MarkLocation.Absolute)return null;const s=this._study.offset(this._plotName),{hiPlot:r,loPlot:n}=this._hiLoPlots();switch(i){case N.MarkLocation.AboveBar:return this._getLocationPrice(e.index,r,s);case N.MarkLocation.BelowBar:return this._getLocationPrice(e.index,n,s)}return super._getValueForUpdating(e)}_convertItemsToCoordinates(e,t,i,s){for(let e=i;e<s;e++){const t=this._items[e];t.y=t.origPrices.price}this._model.timeScale().fillBarBorders(this._items);const r=this._study.properties().childs().styles.childs()[this._plotName].childs().location.value(),n=e.height()*e.topMargin(),o=e.height()*(1-e.bottomMargin()),l=e.isInverted(),a=l?o:n,c=l?n:o,u=e=>{for(let t=i;t<s;t++)isNaN(this._items[t].y)||(this._items[t].y=e)};switch(r){case N.MarkLocation.Top:u(a);break;case N.MarkLocation.Bottom:u(c);break;default:e.pointsArrayToCoordinates(this._items,t,{startItemIndex:i,endItemIndex:s})}}_calculateVerticalOffset(e,t){let i=0;switch(e){case N.MarkLocation.AboveBar:case N.MarkLocation.Bottom:i=-t;break;case N.MarkLocation.BelowBar:case N.MarkLocation.Top:i=t}return(0,o.ensureNotNull)(this._priceScale()).isInverted()&&(i*=-1),i}_calculateShapeHeight(e,t){ let i=e;switch(t){case W.PlotSymbolSize.Tiny:i=.3*e;break;case W.PlotSymbolSize.Small:i=.6*e;break;case W.PlotSymbolSize.Normal:i=e;break;case W.PlotSymbolSize.Large:i=1.5*e;break;case W.PlotSymbolSize.Huge:i=2*e}return i}_hiLoPlots(){let e,t;let i=null;switch(this._series.properties().childs().style.value()){case 2:i="lineStyle";break;case 14:i="lineWithMarkersStyle";break;case 15:i="steplineStyle";break;case 3:i="areaStyle"}return i?(e=this._series.properties().childs()[i].childs().priceSource.value(),t=e):(e="high",t="low"),{hiPlot:e,loPlot:t}}_getLocationPrice(e,t,i){const s=Math.min(e+i,(0,o.ensureNotNull)(this._series.data().last()).index);return this._getSeriesVal(t,s)}}class Ge extends Ke{_updateRenderer(e,t){var i;const s=this._study.properties().childs().styles.childs()[this._plotName].childs(),r=this._model.timeScale(),n={},o=this._getTranspValue(),l=r.barSpacing();let a;a=this._plotStyleInfo.size?this._calculateShapeHeight(25,this._plotStyleInfo.size):Math.round(l/2),a=Math.max(a,1);const c=s.location.value(),u=(0,T.generateColor)(s.color.value(),o),d=o>19?o-10:0,p=this._calculateVerticalOffset(c,Math.round(1.5*a));n.barSpacing=l,n.items=this.items(),n.color=u,n.borderColor=(0,T.generateColor)(s.color.value(),d),n.height=a,n.vertOffset=p,n.visibleItemsRange={startItemIndex:e,endItemIndex:t};const _=s.plottype.value(),f=Te.plotShapesData[_],m=this._plotStyleInfo.text;if(void 0!==m&&""!==m.trim()){let e=m.trim().replace(/\\n/gm,"\n");e=(0,h.cleanButAmpersand)(e,!0),n.text=e,n.fontSize=12;const t=s.textColor?s.textColor.value():void 0;n.textColor=t?(0,T.generateColor)(t,o):u}if(this._renderer&&this._shapesRenderer&&this._selectionRenderer)this._shapesRenderer.setData(n),this._model.selection().isSelected(this._study)&&this._isMarkersEnabled&&null!==this._selectionData?(this._selectionData.vertOffset=p,this._selectionRenderer.setData(this._selectionData)):this._selectionRenderer.setData(null);else{const e=new ye.CompositeRenderer;this._shapesRenderer=super._createRenderer(f.paneRendererClass,n),e.append(this._shapesRenderer),this._selectionRenderer=new Ie.SelectionRenderer(null!==(i=this._selectionData)&&void 0!==i?i:void 0),this._model.selection().isSelected(this._study)&&this._isMarkersEnabled&&null!==this._selectionData?this._selectionData.vertOffset=p:this._selectionRenderer.setData(null),e.append(this._selectionRenderer),this._renderer=e}}}var je=i(687795),qe=i.n(je),$e=i(86441),Ye=i(821885),Qe=i(315801),Xe=i(9640),Ze=i(422333),Je=i(600642);class et extends Ye.PaneRendererAbstractShape{constructor(e,t){super(null,t),this._fontSizeEnsured=0,this._ch="",this._fontFamily=Ze.CHART_FONT_FAMILY,this._charCache=null,null!==e&&this.setData(e)}setData(e){super.setData(e),this._fontSizeEnsured=(0,o.ensureDefined)(this._height);const t=e.char.slice(0,40);this._ch=qe()(t)[0]||" ",this._fontFamily=e.fontFamily||Ze.CHART_FONT_FAMILY}hitTest(e){const t=(0,Xe.interactionTolerance)().series+this._fontSizeEnsured/2;for(const i of this._items){ if(new $e.Point(i.center,i.y+i.vertOffset).subtract(e).length()<=t)return new Qe.HitTestResult(Qe.HitTarget.Regular)}return null}_drawItemShape(e,t){const i=t.center,s=t.vertOffset>0?1:-1,r=t.y+t.vertOffset-s*Math.round(this._fontSizeEnsured/2);let n;n=t.style&&void 0!==t.style.color?t.style.color:this._color;const o=this._textImageCache(),{context:l,horizontalPixelRatio:a,verticalPixelRatio:c}=e;if(this._fontSizeEnsured<=4/a){l.save();const e=Math.max(1,Math.floor(a));let s=Math.max(1,Math.floor(o.textImageWidth*a));s%2!=e%2&&(s+=s>1?-1:1);const u=Math.round(r*c)+(t.vertOffset>=0?0:-s);return l.fillStyle=n,l.fillRect(Math.round(i*a)+(a%2?.5:0)-s/2,u,s,s),void l.restore()}const u={style:{fillStyle:n},location:{x:i,y:r,horzAlign:Je.HorizontalAlign.Center,vertAlign:t.vertOffset>0?Je.VerticalAlign.Top:Je.VerticalAlign.Bottom}};o.paintTo(e,u)}_startPath(e,t,i){}_endPath(e){}_textImageCache(){return null!==this._charCache&&this._charCache.fontFamily===this._fontFamily&&this._charCache.fontSize===this._fontSizeEnsured||(this._charCache={fontSize:this._fontSizeEnsured,fontFamily:this._fontFamily,cache:new Je.TextImageCache(this._ch,!1,!1,this._fontFamily,this._fontSizeEnsured,"center",0)}),this._charCache.cache}}class tt extends Ke{constructor(){super(...arguments),this._charRenderer=new et(null)}_updateRenderer(e,t){var i,s;const r=this._getTranspValue(),n=this._model.timeScale().barSpacing();let l;const a=this._study.properties().childs().styles.childs()[this._plotName].childs();l=this._plotStyleInfo.size?this._calculateShapeHeight(50,this._plotStyleInfo.size):Math.round(n);const c=a.location.value(),u=(0,T.generateColor)(a.color.value(),r),d=this._calculateVerticalOffset(c,l),p={items:this.items(),barSpacing:n,char:(0,o.ensureDefined)(null!==(s=null===(i=a.char)||void 0===i?void 0:i.value())&&void 0!==s?s:this._plotStyleInfo.char),height:l,vertOffset:d,color:u,visibleItemsRange:{startItemIndex:e,endItemIndex:t}},_=this._plotStyleInfo.text;if(void 0!==_&&""!==_.trim()){let e=_.trim().replace(/\\n/gm,"\n");e=(0,h.cleanButAmpersand)(e,!0),p.text=e,p.fontSize=12;const t=a.textColor?a.textColor.value():void 0;p.textColor=t?(0,T.generateColor)(t,r):u}this._charRenderer.setData(p);const f=new ye.CompositeRenderer;f.append(this._charRenderer),this._model.selection().isSelected(this._study)&&this._isMarkersEnabled&&null!==this._selectionData&&(this._selectionData.vertOffset=d,f.append(new Ie.SelectionRenderer(this._selectionData))),this._renderer=f}}var it=i(724377);class st{constructor(e,t,i,s,r){this.left=NaN,this.right=NaN,this.height=NaN,this.center=e,this.y=t,this.origHeight=i,this.isUp=s,this.origPrices=r,this.timePointIndex=e,this.style={}}}function rt(e){return Math.round(e/4)}function nt(e){return Math.round(e/2)}class ot extends Se.BitmapCoordinatesPaneRenderer{constructor(e){super(),this._data=e}hitTest(e){var t,i,s,r ;const n=this._data,o=nt(n.barSpacing),l=Math.round(o/2),a=Math.round(o),c=rt(n.barSpacing),u=null!==(i=null===(t=n.visibleItemsRange)||void 0===t?void 0:t.startItemIndex)&&void 0!==i?i:0,h=null!==(r=null===(s=n.visibleItemsRange)||void 0===s?void 0:s.endItemIndex)&&void 0!==r?r:n.items.length;if(u>=h)return null;for(const t of n.items.slice(u,h)){if(!t)continue;if(!Number.isFinite(t.center)||!Number.isFinite(t.y))continue;const i=Math.abs(t.height),s=t.isUp?-1:1,r=i+a,n=t.y-s*c,o=n-s*r,u=t.center-l,h=t.center+l;if(u<e.x&&e.x<h&&(t.isUp?n<e.y&&e.y<o:o<e.y&&e.y<n))return new Qe.HitTestResult(Qe.HitTarget.Regular)}return null}_drawImpl(e){var t,i,s,r,n;const{horizontalPixelRatio:o,verticalPixelRatio:l,context:a}=e,c=this._data,u=nt(c.barSpacing),h=rt(c.barSpacing),d=u<4,p=Math.max(u/2,1),_=(0,Ve.ceiledEven)(u*o),f=_/2,m=Math.round(u*l);a.lineCap="butt",a.lineWidth=Math.max(1,Math.floor(o));const v=a.lineWidth%2?.5:0,g=null!==(i=null===(t=c.visibleItemsRange)||void 0===t?void 0:t.startItemIndex)&&void 0!==i?i:0,P=null!==(r=null===(s=c.visibleItemsRange)||void 0===s?void 0:s.endItemIndex)&&void 0!==r?r:c.items.length;if(!(g>=P))for(const e of c.items.slice(g,P)){if(!Number.isFinite(e.center)||!Number.isFinite(e.y))continue;const t=e.isUp?-1:1,i=Math.round(Math.abs(e.height)*l),s=Math.round(e.center*o)+v,r=Math.round((e.y-t*h)*l)+v;a.beginPath(),a.translate(s,r);const u=null!==(n=e.style&&e.style.color)&&void 0!==n?n:e.isUp?c.colorup:c.colordown;d?(a.moveTo(0,0),a.lineTo(-f,-f*t),a.moveTo(0,0),a.lineTo(f,-f*t),a.moveTo(0,0),a.lineTo(0,-i*t),a.moveTo(-f,-i*t),a.lineTo(f,-i*t),a.lineWidth=p,a.strokeStyle=u,a.stroke()):(a.moveTo(0,0),i<m?(a.lineTo(_,-i*t),a.lineTo(-_,-i*t)):(a.lineTo(_,-m*t),a.lineTo(f,-m*t),a.lineTo(f,-i*t),a.lineTo(-f,-i*t),a.lineTo(-f,-m*t),a.lineTo(-_,-m*t)),a.lineTo(0,0),a.strokeStyle=e.isUp?c.colorBorderUp:c.colorBorderDown,a.stroke(),a.fillStyle=u,a.fill()),a.translate(-s,-r)}}}class lt extends Ie.SelectionRenderer{_drawMarker(e,t,i,s){const{context:r,horizontalPixelRatio:n,verticalPixelRatio:l}=e,a=(0,o.ensureNotNull)(this._data),c=t.isUp?1:-1;const u=i+c*rt(a.barSpacing)+c*nt(a.barSpacing);let h=Math.round(3.5*n*2);h%2!=s%2&&(h+=1);const d=s%2/2,p=Math.round(t.center*n)+d,_=Math.round((t.y+u)*l)+d;r.beginPath(),r.arc(p,_,h/2,0,2*Math.PI,!0),r.closePath(),r.fill(),r.stroke()}}class at extends Ke{_updateRenderer(e,t){const i=this._study.properties().childs().styles.childs()[this._plotName].childs(),s=(0,Ve.clamp)(this._getTranspValue(),0,100),r=this._model.timeScale().barSpacing(),n=(0,T.generateColor)(i.colorup.value(),s),o=(0,T.generateColor)(i.colordown.value(),s),l=(0,it.parseRgba)(n),a=l?100*(1-l[3]):0,c=(0,it.parseRgba)(o),u=c?100*(1-c[3]):0,h={items:this._items,barSpacing:r,colorup:n,colordown:o,colorBorderUp:(0,T.generateColor)("#000000",a),colorBorderDown:(0,T.generateColor)("#000000",u),minHeight:this._plotStyleInfo.minHeight,visibleItemsRange:{startItemIndex:e,endItemIndex:t}};this._updateItemsHeights(h);const d=new ye.CompositeRenderer;if(d.append(new ot(h)), this._model.selection().isSelected(this._study)&&null!==this._selectionData){const e=this._selectionData;e.barSpacing=r,d.append(new lt(e))}this._renderer=d}_fillItemWithPointStyle(e,t,i){const s=(0,o.ensureDefined)(e.style);e.isUp?void 0!==t.colors[5]?s.color=(0,T.generateColor)((0,o.ensureDefined)(t.colors[5]),i):s.color=(0,T.generateColor)(this._study.properties().childs().styles.childs()[this._plotName].childs().colorup.value(),i):void 0!==t.colors[6]?s.color=(0,T.generateColor)((0,o.ensureDefined)(t.colors[6]),i):s.color=(0,T.generateColor)(this._study.properties().childs().styles.childs()[this._plotName].childs().colordown.value(),i)}_getValueForUpdating(e){const t=e.value[this._plotIndex+1];if(!t)return null;const i=e.index,s=t>0,{hiPlot:r,loPlot:n}=this._hiLoPlots(),l=this._study.offset(this._plotName),a=Math.min(i+l,(0,o.ensureNotNull)(this._series.data().last()).index);if(s){const e=this._getSeriesVal(n,a);if(null!==e)return e}else{const e=this._getSeriesVal(r,a);if(null!==e)return e}return null}_updateItem(e,t){const i=this._getValueForUpdating(e),s=e.value[this._plotIndex+1]>0;return this._items[t].origPrices.price=null!=i?i:NaN,this._items[t].isUp=s,t+1}_createItem(e,t,i,s,r){const n={center:NaN,y:NaN,origPrices:{price:NaN,timePointIndex:NaN},origHeight:NaN};if(n.timePointIndex=e+r,!t)return n;const l=Math.min(e+r,(0,o.ensureNotNull)(this._series.data().last()).index),a=t>0;let c;if(a){const e=this._getSeriesVal(s,l);if(null===e)return n;c=e}else{const e=this._getSeriesVal(i,l);if(null===e)return n;c=e}return new st(e+r,c,t,a,{price:c,timePointIndex:e+r})}_dependsOnSeriesData(){return!0}_convertItemsToCoordinates(e,t,i,s){this._convertItemsToCoordinatesImpl(e,t,i,s)}_updateItemsHeights(e){var t,i,s,r,n,l,a,c;const u=this._study.properties().childs().styles.childs();let h=Math.abs((0,o.ensureDefined)(null!==(i=null===(t=u[this._plotName].childs().minHeight)||void 0===t?void 0:t.value())&&void 0!==i?i:this._plotStyleInfo.minHeight)),d=Math.abs((0,o.ensureDefined)(null!==(r=null===(s=u[this._plotName].childs().maxHeight)||void 0===s?void 0:s.value())&&void 0!==r?r:this._plotStyleInfo.maxHeight));if(h>d){const e=h;h=d,d=e}const p=this._items,_=null!==(l=null===(n=e.visibleItemsRange)||void 0===n?void 0:n.startItemIndex)&&void 0!==l?l:0,f=(null!==(c=null===(a=e.visibleItemsRange)||void 0===a?void 0:a.endItemIndex)&&void 0!==c?c:p.length)-1;let m=0;for(let e=_;e<=f;e++){const t=p[e],i=Math.abs(t.origHeight);i>m&&(m=i)}const v=(d-h)/m;for(let e=_;e<=f;e++){const t=p[e],i=Math.abs(t.origHeight);t.height=i*v+h}}}var ct=i(969419);class ut extends we.StudyForceOverlayPlotView{constructor(e,t,i,s){super(t,i,s),this._bars=[],this._invalidated=!1,this._isMarkersEnabled=Pe.enabled("source_selection_markers"),this._selectionData=null,this._ohlcPlotIndexes=new Map,this._study=e,this._isMarkersEnabled=Pe.enabled("source_selection_markers"),this._colorProvider=(0,xe.createStudyPlotColorProvider)(e.metaInfo(),e.properties(),s),this._selectionIndexer=new Me.SelectionIndexes(i.timeScale());const r=this._study.metaInfo().plots ;for(let e=0;e<r.length;e++){const t=r[e];"target"in t&&(t.target===this._plotName&&((0,W.isOhlcOpenPlot)(t)&&this._ohlcPlotIndexes.set(1,e),(0,W.isOhlcHighPlot)(t)&&this._ohlcPlotIndexes.set(2,e),(0,W.isOhlcLowPlot)(t)&&this._ohlcPlotIndexes.set(3,e),(0,W.isOhlcClosePlot)(t)&&this._ohlcPlotIndexes.set(4,e)))}}update(){this._invalidated=!0}items(){return this._bars}_updateImpl(){this._bars.length=0;const e=this._priceScale();if(this._model.timeScale().isEmpty()||null===e||e.isEmpty())return;const t=this._model.timeScale().visibleBarsStrictRange();if(null===t)return;let i=this._series.nearestIndex(t.firstBar(),R.PlotRowSearchMode.NearestRight);const s=this._series.nearestIndex(t.lastBar(),R.PlotRowSearchMode.NearestLeft);if(void 0===i||void 0===s)return;const r=this._study.getMinFirstBarIndexForPlot(this._plotName);if(r>s)return;i=Math.max(r,i);const n=this._study.data(),l=this._study.firstValue();if(null===l)return;const a=n.rangeIterator(i,s),c=(0,o.ensureDefined)(this._study.properties().childs().ohlcPlots).childs()[this._plotName].childs(),u=new Map,h=(e,t)=>{const i=e+"@"+t;if(!u.has(i)){const s=(0,T.generateColor)(e,t);return u.set(i,s),s}return u.get(i)},d=(0,Ae.createEmptyStyle)();for(const e of a){let t=e.index;const i=e.value;t=Math.floor(t);let s=!0;const r=new Map;for(let e=1;e<=4;++e){const t=this._ohlcPlotIndexes.get(e);if(void 0===t){s=!1;break}const n=i[t+1];if(null==n){s=!1;break}r.set(e,n)}if(!s)continue;const n=(0,o.ensureDefined)(r.get(1)),l=(0,o.ensureDefined)(r.get(4)),a=(0,o.ensureDefined)(r.get(2)),u=(0,o.ensureDefined)(r.get(3)),p=Math.max(n,a,u,l),_=Math.min(n,a,u,l);let f=(0,o.ensureDefined)(h(c.color.value(),0));const m=this._colorProvider.getPlotPointStyle(i,d);void 0!==m.colors[0]&&(f=(0,o.ensureDefined)(m.colors[0]));const v={open:n,high:p,low:_,close:l,color:f,wickColor:m.colors[4],borderColor:m.colors[3],hollow:null,center:NaN,left:NaN,right:NaN,timePointIndex:Math.round(t)};this._bars.push(v)}if(e.barPricesToCoordinates(this._bars,l),this._model.timeScale().fillBarBorders(this._bars),this._model.selection().isSelected(this._study)){const t=this._selectionIndexer.indexes();this._selectionData={points:[],hittestResult:Qe.HitTarget.Regular,bgColors:[],visible:!0,barSpacing:this._model.timeScale().barSpacing()};const i=(0,o.ensureNotNull)(this._model.paneForSource(this._study)).height(),s=(0,o.ensureDefined)(this._ohlcPlotIndexes.get(4));for(let r=0;r<t.length;r++){const n=t[r],o=this._study.data().valueAt(n);if(null===o)continue;const a=o[s+1];if(null==a)continue;const c=this._model.timeScale().indexToCoordinate(Math.floor(n)),u=e.priceToCoordinate(a,l);this._selectionData.points.push(new $e.Point(c,u)),this._selectionData.bgColors.push(this._model.backgroundColorAtYPercentFromTop(u/i))}}else this._selectionIndexer.clear()}_isOHLCPlotVisible(){return this._study.isPlotVisibleAt(this._plotName,1)}}class ht extends ut{renderer(){if(!this._isOHLCPlotVisible())return null;this._invalidated&&(this._updateImpl(),this._invalidated=!1);const e={bars:this._bars, dontDrawOpen:this._series.properties().childs().barStyle.childs().dontDrawOpen.value(),thinBars:this._series.properties().childs().barStyle.childs().thinBars.value()},t=new ye.CompositeRenderer;return t.append(new ct.PaneRendererBars(e)),this._model.selection().isSelected(this._study)&&this._isMarkersEnabled&&this._selectionData&&t.append(new Ie.SelectionRenderer(this._selectionData)),t}}var dt=i(956725);class pt extends ut{renderer(){if(!this._isOHLCPlotVisible())return null;const e=this._priceScale();if(!e||e.isEmpty())return null;this._invalidated&&(this._updateImpl(),this._invalidated=!1);const t=(0,o.ensureDefined)(this._study.properties().childs().ohlcPlots).childs()[this._plotName].childs(),i=this._model.timeScale().barSpacing(),s={bars:this._bars,barSpacing:i,wickVisible:t.drawWick.value(),bodyVisible:!0,borderVisible:t.drawBorder.value(),barWidth:(0,Xe.optimalBarWidth)(i),borderColor:t.borderColor.value(),wickColor:t.wickColor.value(),isPriceScaleInverted:e.isInverted()},r=new ye.CompositeRenderer;return r.append(new dt.PaneRendererCandles(s)),this._model.selection().isSelected(this._study)&&this._isMarkersEnabled&&this._selectionData&&r.append(new Ie.SelectionRenderer(this._selectionData)),r}}var _t=i(742391),ft=i(268008),mt=i(955831),vt=i(458963);class gt extends mt.HorizontalLinePaneView{constructor(e,t){super(),this._lineRendererData.linestyle=vt.LINESTYLE_DOTTED,this._study=e,this._plotName=t}_updateImpl(){this._lineRendererData.visible=!1;const e=this._study.properties().childs().styles.childs()[this._plotName].childs();if(!e.trackPrice.value()||!this._study.isPlotVisibleAt(this._plotName,1))return;const t=this._study.lastValueData(this._plotName,!0);t.noData||(this._lineRendererData.visible=!0,this._lineRendererData.y=t.coordinate,this._lineRendererData.color=t.color,this._lineRendererData.linewidth=e.linewidth.value())}}var Pt=i(1584),yt=i(151149),St=i(434294);const bt={type:0,color:"transparent"};class xt extends St.AbstractFilledAreaPaneView{constructor(e,t,i,s){var r,n,l;super(e,t,i),this._palettesInfo={},this._gradientPropsStateCache=null,this._rgbaFromInteger=(0,yt.rgbaFromIntegerCached)();const a=this._source.metaInfo();this._isRGB=Boolean(a.isRGB),this._isHlineFill="hline_hline"===i.type,(0,o.assert)(this._isHlineFill||"plot_plot"===i.type,"Wrong filledArea type: "+i.type),this._isHlineFill&&this._initBandIndexes(i.objAId,i.objBId),this._fillMetaInfo=i,this._fillStyleProps=s,this._gradientFillType=s.hasChild("fillType")&&"gradient"===(null===(r=s.childs().fillType)||void 0===r?void 0:r.value()),this._gradientStaticState={color1:i.topColor,color2:i.bottomColor,value1:i.topValue,value2:i.bottomValue},this._hasAllGradientRequiredProps=this._gradientFillType&&(void 0!==this._gradientStaticState.color1||s.hasChild("topColor")||void 0!==this._gradientStaticState.color2||s.hasChild("bottomColor"))&&(void 0!==this._gradientStaticState.value1||s.hasChild("topValue"))&&(void 0!==this._gradientStaticState.value2||s.hasChild("bottomValue"));const c=()=>{var e ;return this._colorPlotIndex=null!==(e=this._colorPlotIndex)&&void 0!==e?e:{type:1}};for(let t=0;t<a.plots.length;++t){const s=a.plots[t];if(((0,W.isColorerPlot)(s)||(0,W.isDataPlot)(s))&&s.target===i.id){if((0,W.isColorerPlot)(s)){let i;void 0!==s.targetField?"topColor"===s.targetField?(c().colorIndexOrRgba1=t,i="color1"):"bottomColor"===s.targetField&&(c().colorIndexOrRgba2=t,i="color2"):this._colorPlotIndex={type:0,colorIndexOrRgba:t},(0,W.isPaletteColorerPlot)(s)&&(this._palettesInfo[null!=i?i:"color"]={map:(0,o.ensureDefined)(null===(n=(0,o.ensureDefined)(a.palettes)[s.palette])||void 0===n?void 0:n.valToIndex),values:e.properties().palettes[s.palette].colors})}else(0,W.isDataPlot)(s)&&("topValue"===s.targetField?c().valueIndex1=t:"bottomValue"===s.targetField&&(c().valueIndex2=t));if(0===(null===(l=this._colorPlotIndex)||void 0===l?void 0:l.type))break}}}update(e){super.update(e),this._gradientPropsStateCache=null}isForceOverlay(){return!!this._source.metaInfo().isPlotForceOverlay(this._plotAId())}_minFirstBarIndex(){return this._source.getMinFirstBarIndexForPlot(this._fillMetaInfo.id)}_getColorByPlotValue(e){var t,i,s;if(0===e.type){let i;if(null==e.colorIndexOrRgba)return null;if(this._isRGB)i=this._rgbaFromInteger(e.colorIndexOrRgba);else{const s=(0,o.ensureDefined)(this._palettesInfo.color),r=(0,o.ensureDefined)(s.map[e.colorIndexOrRgba]);i=null===(t=s.values[r])||void 0===t?void 0:t.childs().color.value()}return{type:0,color:i}}const r=this._gradientColorPropsState();let n,l;if(this._isRGB)null!=e.colorIndexOrRgba1&&(n=this._rgbaFromInteger(e.colorIndexOrRgba1)),null!=e.colorIndexOrRgba2&&(l=this._rgbaFromInteger(e.colorIndexOrRgba2));else{if(null!=e.colorIndexOrRgba1){const t=(0,o.ensureDefined)(this._palettesInfo.color1);n=t.values[(0,o.ensureDefined)(t.map[e.colorIndexOrRgba1])].childs().color.value()}if(null!=e.colorIndexOrRgba2){const t=(0,o.ensureDefined)(this._palettesInfo.color2);l=t.values[(0,o.ensureDefined)(t.map[e.colorIndexOrRgba2])].childs().color.value()}}const a=null!==(i=e.value1)&&void 0!==i?i:r.value1,c=null!==(s=e.value2)&&void 0!==s?s:r.value2;return n=null!=n?n:r.color1,l=null!=l?l:r.color2,void 0===a||void 0===c||void 0===n&&void 0===l?null:{type:1,color1:n,color2:l,value1:a,value2:c,coordinate1:NaN,coordinate2:NaN}}_plotAId(){return this._fillMetaInfo.objAId}_plotBId(){return this._fillMetaInfo.objBId}_commonColor(){const e=this._fillStyleProps.childs();if(this._gradientFillType){if(!this._hasAllGradientRequiredProps)return bt;const e=this._gradientColorPropsState();return{type:1,color1:e.color1,color2:e.color2,value1:e.value1,value2:e.value2,coordinate1:NaN,coordinate2:NaN}}return{type:0,color:e.color.value()}}_transparency(){return this._fillStyleProps.childs().transparency.value()}_visible(){return this._fillStyleProps.childs().visible.value()}_priceScale(){return this.isForceOverlay()?this._model.mainSeries().priceScale():this._source.priceScale()}_initBandIndexes(e,t){this._bandAKey=null,this._bandBKey=null;const i=this._source.metaInfo().bands ;if(void 0!==i)for(let s=0;s<i.length;++s){const r=i[s];null!==this._bandAKey||r.id!==e?null===this._bandBKey&&r.id===t&&(this._bandBKey=s):this._bandAKey=s}}_gradientColorPropsState(){var e,t,i,s;if(null===this._gradientPropsStateCache){const r=this._fillStyleProps.state();this._gradientPropsStateCache={color1:null!==(e=this._gradientStaticState.color1)&&void 0!==e?e:r.topColor,color2:null!==(t=this._gradientStaticState.color2)&&void 0!==t?t:r.bottomColor,value1:null!==(i=this._gradientStaticState.value1)&&void 0!==i?i:r.topValue,value2:null!==(s=this._gradientStaticState.value2)&&void 0!==s?s:r.bottomValue}}return this._gradientPropsStateCache}}var wt=i(544820),Ct=i(9524);class It{constructor(e,t){this._invalidated=!0,this._lineRenderer=new Ct.HorizontalLineRenderer,this._source=t,this._points=[new $e.Point(-1,-1)],this._invalidated=!0,this._properties=e}update(){this._invalidated=!0}renderer(){this._invalidated&&(this._updateImpl(),this._invalidated=!1);const e={y:this._points[0].y,color:this._properties.childs().color.value(),linewidth:this._properties.childs().linewidth.value(),linestyle:this._properties.childs().linestyle.value()};return this._lineRenderer.setData(e),this._lineRenderer}_updateImpl(){const e=this._source.priceScale();if(!e||e.isEmpty())return void(this._points[0]=new $e.Point(-1,-1));const t=this._properties.childs().value.value(),i=this._source.firstValue(),s=(0,$.isNumber)(t)&&null!==i?e.priceToCoordinate(t,i):NaN;this._points[0]=new $e.Point(-1,s)}}var Tt=i(710455);class Vt extends Tt.MediaCoordinatesPaneRenderer{constructor(){super(),this._data=null,this._data=null}setData(e=null){this._data=e}hitTest(){return null}_drawImpl(e){var t,i;if(null===this._data||0===this._data.points.length)return;const s=e.context,r=e.mediaSize.width;if(this._data.gradient){const e=s.createLinearGradient(0,this._data.coordinate1,0,this._data.coordinate2);e.addColorStop(0,null!==(t=this._data.backColor1)&&void 0!==t?t:"transparent"),e.addColorStop(1,null!==(i=this._data.backColor2)&&void 0!==i?i:"transparent"),s.fillStyle=e}else s.fillStyle=this._data.backcolor;const n=Math.min(this._data.points[0],this._data.points[1]),o=Math.max(this._data.points[0],this._data.points[1]);s.fillRect(0,n,r,o-n)}}class Mt{constructor(e){this._bandBgRenderer=new Vt,this._invalidated=!0,this._source=e}update(){this._invalidated=!0}renderer(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),this._bandBgRenderer}_updateImpl(){this._bandBgRenderer.setData(null);const e=this._source.properties().childs(),t=e.bands;if(t.childCount()<2)return;const i=e.bandsBackground;if(!(null==i?void 0:i.childs().fillBackground.value()))return;const s=t[0].childs(),r=t[1].childs(),n=this._source.priceScale(),l=this._source.firstValue();if(!n||n.isEmpty()||null===l)return;const a=[n.priceToCoordinate(s.value.value(),l),n.priceToCoordinate(r.value.value(),l)],c=(0,o.ensureDefined)(e.bandsBackground).childs(),u=(0,Ve.clamp)(c.transparency.value(),0,100);this._bandBgRenderer.setData({gradient:!1,points:a,backcolor:(0, T.generateColor)(c.backgroundColor.value(),u)})}}class Dt{constructor(e,t,i){var s;this._bandBgRenderer=new Vt,this._bandAKey=null,this._bandBKey=null,this._invalidated=!0,this._source=e,(0,o.assert)("hline_hline"===t.type,"Wrong filledArea type: "+t.type),this._initBandIndexes(t.objAId,t.objBId),this._fillStyleProps=i,this._bandBgRenderer=new Vt,this._gradientFillType=i.hasChild("fillType")&&"gradient"===(null===(s=i.childs().fillType)||void 0===s?void 0:s.value()),this._gradientStaticState={color1:t.topColor,color2:t.bottomColor,value1:t.topValue,value2:t.bottomValue}}update(){this._invalidated=!0}renderer(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),this._bandBgRenderer}_updateImpl(){var e,t,i,s,r,n,l,a;if(this._bandBgRenderer.setData(null),!this._fillStyleProps.childs().visible.value())return;if(null===this._bandAKey||null===this._bandBKey)return;const c=(0,o.ensureDefined)(this._source.properties().childs().bands),u=c.childs()[this._bandAKey].childs(),h=c.childs()[this._bandBKey].childs(),d=this._source.priceScale(),p=this._source.firstValue();if(!d||d.isEmpty()||null===p)return;const _=[d.priceToCoordinate(u.value.value(),p),d.priceToCoordinate(h.value.value(),p)],f=(0,Ve.clamp)(this._fillStyleProps.childs().transparency.value(),0,100);let m;const v=this._fillStyleProps.childs();if(this._gradientFillType){const o=this._gradientStaticState,c=v,u=null!==(e=o.value1)&&void 0!==e?e:null===(t=c.topValue)||void 0===t?void 0:t.value(),h=null!==(i=o.value2)&&void 0!==i?i:null===(s=c.bottomValue)||void 0===s?void 0:s.value();if(void 0===u||void 0===h)return;const g=null!==(r=o.color1)&&void 0!==r?r:null===(n=c.topColor)||void 0===n?void 0:n.value(),P=null!==(l=o.color2)&&void 0!==l?l:null===(a=c.bottomColor)||void 0===a?void 0:a.value();if(void 0===g&&void 0===P)return;m={gradient:!0,points:_,backColor1:g&&(0,T.generateColor)(g,f),backColor2:P&&(0,T.generateColor)(P,f),coordinate1:d.priceToCoordinate(u,p),coordinate2:d.priceToCoordinate(h,p)}}else m={gradient:!1,points:_,backcolor:(0,T.generateColor)(v.color.value(),f)};this._bandBgRenderer.setData(m)}_initBandIndexes(e,t){this._bandAKey=null,this._bandBKey=null;(0,o.ensureDefined)(this._source.metaInfo().bands).forEach(((i,s)=>{null===this._bandAKey&&i.id===e&&(this._bandAKey=s),null===this._bandBKey&&i.id===t&&(this._bandBKey=s)}))}}var At=i(7288),Lt=i(395098),Bt=i(877009),Rt=i(964824),Nt=i(401580),kt=i(444331),Et=i(261066),Ot=i(932167),Ft=i(506387),Wt=i(938471);class zt extends Wt.AbstractBarColorer{constructor(e,t){super(),this._rgbaFromInteger=(0,yt.rgbaFromIntegerCached)(),this._study=e,this._plotIndex=t}applyBarStyle(e,t,i,s){var r;if(t)return i;const n=this._study.properties().childs();if(!n.visible.value())return i;const l=this._study.metaInfo(),a=this._study.data();if(!a||0===a.size())return i;const c=l.plots[this._plotIndex],u=this._getOffset();if(this._study.getMinFirstBarIndexForPlot(c.id)>e+u)return i;if(0===n.styles.childs()[c.id].childs().display.value())return i;const h=a.valueAt(e-u);if(null===h)return i ;let d=h[this._plotIndex+1];if(null==d)return i;if(d=Math.round(d),l.isRGB)i.barColor=this._rgbaFromInteger(d),i.upColor=i.barColor,i.downColor=i.barColor;else{const e=l.plots[this._plotIndex];if("palette"in e){const t=e.palette,s=n.palettes.childs()[t],a=(0,o.ensureDefined)(null===(r=l.palettes)||void 0===r?void 0:r[t]),c=a.valToIndex?(0,o.ensureDefined)(a.valToIndex[d]):d,u=s.childs().colors.childs()[c].childs().color.value();i.barColor=u,i.upColor=u,i.downColor=u}}return i}firstColoredBar(e){var t;let i=e;for(const s of this._backColorers)i=Math.min(i,null!==(t=s.firstColoredBar(e))&&void 0!==t?t:1/0);const s=this._getOffset();i=Math.min(i,e+s);const r=this._getBars().firstIndex();return Math.max(i,null!=r?r:-1/0)}_getBars(){return this._study.series().bars()}_getOffset(){const e=this._study.metaInfo().plots[this._plotIndex];return this._study.offset(e.id)}}var Ht=i(251954),Ut=i(42292),Kt=i(808068),Gt=i(853965),jt=i(312449),qt=i(388545),$t=i(624444),Yt=i(943994),Qt=i(541346),Xt=i(347710),Zt=i(989709);class Jt extends _t.PanePriceAxisView{constructor(e,t,i,s){super(e,t,i),this._dataSource=t,this._isForceOverlay=t.metaInfo().isPlotForceOverlay(s)}_position(){const e=this._isForceOverlay?this._chartModel.mainPane():this._chartModel.paneForSource(this._dataSource);if(null===e)return null;const t=this._isForceOverlay?this._chartModel.mainSeries().priceScale():this._dataSource.priceScale();if(null===t)return null;let i=e.priceScalePosition(t);return"overlay"===i&&(i=e.priceScalePosition(e.defaultPriceScale())),"overlay"===i?null:i}}const ei=(0,c.getLogger)("Chart.Study"),ti=a.t(null,void 0,i(814177));const ii={symbolsForDisplay:!1,symbolsForChartApi:!0,skipHiddenInputs:!1,skipFakeInputs:!1,skipBooleanInputs:!1,asObject:!0,skippedGroups:[],skippedInputs:[],noExchanges:!1,noResolution:!1,keepOptionalSymbolsEmpty:!1,skipColorInputs:!1,skipTimeInputs:!1,skipOptionalEmptySymbolInputs:!1,skipTextareaInputs:!1,priceInputsForDisplay:!1},si={symbolsForDisplay:!1,symbolsForChartApi:!0,skipHiddenInputs:!0,skipFakeInputs:!1,skipBooleanInputs:!1,skippedGroups:[],skippedInputs:[],noExchanges:!1,noResolution:!1,keepOptionalSymbolsEmpty:!1,skipColorInputs:!1,skipTimeInputs:!1,skipOptionalEmptySymbolInputs:!1,skipTextareaInputs:!1,priceInputsForDisplay:!1,fakeInputsForDisplay:!1,doNotSkipHiddenWithMigrate:!1,onlyAtomValues:!0,patchSosInputs:!1},ri=Pe.enabled("study_symbol_ticker_description"),ni=Pe.enabled("hide_main_series_symbol_from_indicator_legend"),oi=Pe.enabled("datasource_copypaste"),li=Pe.enabled("hide_unresolved_symbols_in_legend");function ai(e,t){const i=e.plots[t];if(!i||!(0,W.isOhlcPlot)(i))return!1;const s=i.target,r=e.defaults.styles&&e.defaults.styles[s],n=e.defaults.ohlcPlots&&e.defaults.ohlcPlots[s],o=e.ohlcPlots&&e.ohlcPlots[s];return r&&(0,W.isOhlcPlotStyleBars)(r)||n&&(0,W.isOhlcPlotStyleBars)(n)||!!o&&(0,W.isOhlcPlotStyleBars)(o)}function ci(e,t){const i=e.plots[t];if(!i||!(0,W.isOhlcPlot)(i))return!1 ;const s=i.target,r=e.defaults.styles&&e.defaults.styles[s],n=e.defaults.ohlcPlots&&e.defaults.ohlcPlots[s],o=e.ohlcPlots&&e.ohlcPlots[s];return r&&(0,W.isOhlcPlotStyleCandles)(r)||n&&(0,W.isOhlcPlotStyleCandles)(n)||!!o&&(0,W.isOhlcPlotStyleCandles)(o)}function ui(e,t){(0,o.assert)(void 0!==e,"zOrder must be defined"),(0,o.assert)(!t.has(e),"zOrder must be unique")}function hi(e,t){return e.plots.some((e=>((0,W.isColorerPlot)(e)||(0,W.isDataPlot)(e))&&e.target===t))}function di(e){const t={};if(e.plots)for(let i=0;i<e.plots.length;i++){const s=e.plots[i],r=s.id;if((0,W.isColorerPlot)(s))continue;const n={display:15,color:"#0496FF",linestyle:vt.LINESTYLE_SOLID,linewidth:2,plottype:W.LineStudyPlotStyle.Line,transparency:50,trackPrice:!1};(0,W.isBarColorerPlot)(s)&&(n.transparency=0),n.plottype=s.type,n.title=r,t[r]=n}return{styles:t}}function pi(){const e=(0,$.clone)((0,Ut.defaults)("study"));return e.intervalsVisibilities=(0,$.clone)(Kt.intervalsVisibilitiesDefaults),e}function _i(e,t,i){let s=(0,$.clone)((0,Ut.defaults)(i,t));return"Overlay"!==e.shortId&&"Compare"!==e.shortId||(s.currencyId=null,s.unitId=null),e.isTVScript&&e.TVScriptSourceCode!==s.TVScriptSourceCode&&(s=(0,$.clone)((0,Ut.factoryDefaults)(i))),s}function fi(e,t){var i;const s={};return qt.StudyVersioning.mergeInputsObjPart(s,null!==(i=e.inputs)&&void 0!==i?i:{}),qt.StudyVersioning.mergeInputsObjPart(s,t.inputs),{inputs:s}}function mi(e,t,i,s){var r;if(L.StudyMetaInfo.versionOf(e)<1)throw new Error("This function cannot work with metainfo of the old format version. Required format version >= 1");const o=L.StudyMetaInfo.getStudyPropertyRootName(e),a=(0,$.clone)(e.defaults),c=pi();if((0,n.default)(c,di(e)),(0,n.default)(c,a),(0,n.default)(c,(0,Ut.factoryDefaults)(o)),(0,n.default)(c,_i(e,s,o)),(0,n.default)(c,t),(0,n.default)(c,fi(a,c)),null!==i){const t=i.model().studiesColorRotatorFactory().getColorRotator(e);null!==t&&("Overlay@tv-basicstudies"===e.id?c.lineStyle.color=t.getColor(c.lineStyle.color):(0,n.default)(c,function(e,t){for(const i of Object.keys(e.styles)){const s=e.styles[i];if((0,l.isObject)(s)&&"color"in s){const e=s.color;s.color=t.getColor(e)}}return e}(c,t)))}return s.updateStudyInputsIfNeeded(c,null!==(r=c.version)&&void 0!==r?r:e.version,e),c}function vi(e,t,i,s,r){return function(e,t,i,s,r,n){const o=mi(e,t,i,s);return L.StudyMetaInfo.getSourceInputIds(e).forEach(((e,t)=>{const i=o.inputs[e];t<n.length?o.inputs[e]=`${n[t].id()}$0`:(0,$.isString)(i)&&i.includes("$")&&(o.inputs[e]="close")})),Pi(e,r,o)}(e,t,i,s,L.StudyMetaInfo.getStudyPropertyRootName(e),r)} const gi=["id","description","description_localized","shortDescription","_metainfoVersion","is_price_study","is_hidden_study","priceScale","fullId","shortId","scriptIdPart","packageId","productId","isTVScriptStub","defaults","symbolSource","historyCalculationMayChange","format","linkedToSeries","isTVLibrary","docs","exports","exportTypes","extra","usesPrivateLib","financialPeriod","groupingKey","pine","isRGB","isTVScript","TVScriptMetaInfoExprs","usePlotsZOrder","isTVScriptStrategy","TVScriptSourceCode","lookaheadFutureData","hasAlertFunction","defaultStrategyAlertMessage","tags","canBeChild","canNotBeChild","_serverMetaInfoVersion","warnings"];function Pi(e,t,i){var s;for(const e of gi)delete i[e];const r=["visible","precision","minTick","intervalsVisibilities","inputs.first_visible_bar_time","inputs.last_visible_bar_time","inputs.subscribeRealtime"];for(let t=0;t<e.inputs.length;++t){const i=e.inputs[t];i.isHidden&&(r.push(`inputs.${t}`),r.push(`inputs.${i.id}`))}const n=new Gt.DefaultProperty({defaultName:t,state:i,excludedDefaultsKeys:r,excludedStateKeys:["version"]});n.removeProperty("intervalsVisibilities"),n.addChild("intervalsVisibilities",new jt.IntervalsVisibilitiesProperty(i&&i.intervalsVisibilities)),"PivotPointsStandard@tv-basicstudies"!==e.id&&"PivotPointsHighLow@tv-basicstudies"!==e.id||!n.hasChild("font")||n.removeProperty("font");const o=L.StudyMetaInfo.versionOf(e);return n.hasChild("version")?null===(s=n.childs().version)||void 0===s||s.setValue(o):n.addProperty("version",o),n}function yi(e,t,i,s,r,o){const l=function(e,t,i,s,r){var o;e.version&&i.version&&e.version!==i.version&&ei.logWarn("Serialized metaInfo version "+e.version+" is not equal to the saved state version "+i.version);const l=t||e,a=null!==(o=(0,$.clone)(l.defaults))&&void 0!==o?o:{},c=L.StudyMetaInfo.getStudyPropertyRootName(l),u=L.StudyMetaInfo.getStudyPropertyRootName(e);let h=pi();return(0,n.default)(h,di(e)),(0,n.default)(h,(0,$.clone)(e.defaults)),(0,n.default)(h,a),(0,n.default)(h,(0,Ut.factoryDefaults)(c)),(0,n.default)(h,(0,Ut.factoryDefaults)(u)),(0,n.default)(h,_i(l,s,c)),(0,n.default)(h,_i(e,s,u)),(0,n.default)(h,i),h=s.updateStudyState(h,e,t),void 0!==r&&t&&(h=r(i,h,e,t)),L.StudyMetaInfo.versionOf(l)>=1&&(0,n.default)(h,fi(a,h)),h}(e,t,i,s,o);return Pi(t||e,r,l)}function Si(e,t,i,s,r){return yi(e,t,i,s,L.StudyMetaInfo.getStudyPropertyRootName(e),r)}function bi(e,t,i){let s=0,r=0;return e.inputs.filter((e=>"source"===e.type)).forEach((e=>{(0,m.getInputValue)(i[e.id]).includes("$")&&s++,(0,m.getInputValue)(t[e.id]).includes("$")&&r++})),Math.sign(r)-Math.sign(s)}function xi(e){const t=new Set;for(const i of e.parentSources())for(const e of xi(i))t.add(e);return t.add(e),Array.from(t)}function wi(e,t){return"BISTMIXED"===t&&(0,At.isVolumeDataError)(e.error)&&(e.error="VOLUME_BIST_MIXED",e.solution_id=he.solutionIds.BIST_MIXED_SUBSCRIPTION,e.title=At.noVolumeErrorTooltip),{type:At.StudyStatusType.Error,errorDescription:e}}function Ci(e){return"inherit"===e.type&&(e.type="price"),e}function Ii(e,t,i,s){ if(null!==t)switch(e.type){case"inherit":case"price":return new $t.PriceFormatter(t);case"volume":return new Yt.VolumeFormatter(Math.log10(t));case"percent":return new Qt.PercentageFormatter(t)}if("inherit"===e.type)return null;const r=(0,$.isNumber)(e.precision)?Math.pow(10,e.precision):void 0;switch(e.type){case"price":return new $t.PriceFormatter(r);case"volume":{let t=e.precision;return void 0===t&&(t=i&&(0,$.isNumber)(i.volume_precision)?i.volume_precision:0),new Yt.VolumeFormatter(t)}case"percent":return new Qt.PercentageFormatter(r);default:return ei.logWarn(`Unsupported format type: ${e.type}`),null}}const Ti=new Set(["first_visible_bar_time","last_visible_bar_time","subscribeRealtime"]);class Vi extends M.PriceDataSource{constructor(e,t,i,s){var r,n,l;super(e),this._onStart=new I.Delegate,this._restarting=!1,this._paneViews=[],this._forceOverlaysPaneViews=[],this._legendView=null,this._priceAxisViews=[],this._forceOverlayPriceAxisViews=[],this._priceAxisViewsBase=[],this._resolvedSymbols={},this._resolvedSymbolsByInput={},this._priceLinesAxisViews=[],this._labelPaneViews=[],this._forceOverlayLabelPaneViews=[],this._ownFirstValue=null,this._formatter=null,this._defaultFormatter=null,this._dataUpdated=new I.Delegate,this._currencySourceSymbolInputProperty=null,this._onHibernationStateChange=new I.Delegate,this._symbolsResolved=new I.Delegate,this._statusChanged=new I.Delegate,this._inputsAnchorsPaneView=null,this._inputsLinesPaneView=null,this._inputsTimeAxisPaneViews=[],this._inputsPriceAxisPaneViews=[],this._sources=[],this._status={type:At.StudyStatusType.Undefined},this._recompilationStatus=null,this._wasCompletedBefore=!1,this._studyId=null,this._isSubscribedToSessionId=!1,this._titleStrCache={},this._titleInPartsCache={},this._children=[],this._numericFormatter=new Y.NumericFormatter,this._graphicsPriceAxisViews=[],this._plotOffsets={},this._ongoingDataUpdate=Promise.resolve(),this._studyModified=!1,this._tagsChanged=new I.Delegate,this._studyName="",this._turnaround="st0",this._pendingResolveSymbols=new Map,this._onIsActualIntervalChange=new I.Delegate,this._childStudyByRebind=new I.Delegate,this._lastNonEmptyPlotRowCache={},this._startMovingPoint=null,this._processHibernateBound=this.processHibernate.bind(this,1),this._maxOffset=new Nt.WatchedValue(0),this._currencySourceSymbolInfo=null,this._graphicsPriceRangeGroups=null,this._graphicsViewsReady=!1,this._visibleTimeRangeInputs=null,this._turnaroundCounter=0,this._deferredPinePatchProps=!1,this._propertiesPatched=Promise.resolve(),this._aboutToBeDestroyed=new I.Delegate,this._definitionsViewModel=null,this._plotFormatters=new Map,this._onParentSourcesChanges=new I.Delegate,this._statusChangesSubscriber={},this._chartApi=e.chartApi(),this._properties=t,this._metaInfo=s,this._hideMatches=s.inputs.filter((e=>e.hideWhenPlotsHidden)).map((e=>({id:e.id,plotIds:e.hideWhenPlotsHidden||[]}))),this._series=this._model.mainSeries(),this._series.onIntervalChanged().subscribe(this,this._calcIsActualInterval), this._series.alertCreationAvailable().subscribe(this._updateAlertCreationAvailable.bind(this)),this._showStudyArgumentsProperty=e.properties().childs().paneProperties.childs().legendProperties.childs().showStudyArguments,e.collapsed().subscribe(this._processHibernateBound),this._sources=i,L.StudyMetaInfo.setChildStudyMetaInfoPropertiesSourceId(s,null===(r=this._sources[0])||void 0===r?void 0:r.id(),t),i.forEach((e=>{e.setChild(this)})),[this._series,...i].forEach((e=>{e.currencyChanged().subscribe(this,this._onSourceCurrencyChanged),e.unitChanged().subscribe(this,this._onSourceUnitChanged),e.priceRangeReadyChanged().subscribe(this,this._onSourcePriceRangeReadyChanged),e.formatterChanged().subscribe(this,this._onSourceFormatterChanged),e.priceStepChanged().subscribe(this,this._onSourcePriceStepChanged)})),ri&&this._model.mainSeries().properties().childs().statusViewStyle.childs().symbolTextSource.listeners().subscribe(this,(()=>{this.invalidateTitleCache(!0)}));const a=this._properties.childs();for(const e of L.StudyMetaInfo.getSourceInputIds(s))null===(n=a.inputs.childs()[e])||void 0===n||n.subscribe(this,this._onSourceInputChanged);this._properties.subscribe(this,this._onPropertiesChanged),a.visible.subscribe(this,this._visibleChanged),a.visible.subscribe(this,(()=>this.processHibernate())),a.intervalsVisibilities.subscribe(this,this._calcIsActualInterval),a.inputs.listeners().subscribe(this,this._updateMaxOffsetValue),void 0!==a.offsets&&a.offsets.listeners().subscribe(this,this._updateMaxOffsetValue),void 0!==a.offset&&a.offset.listeners().subscribe(this,this._updateMaxOffsetValue),H.hideAllIndicators().subscribe(this,this._visibleChanged);for(let e=0;e<this._metaInfo.plots.length;e++){const t=this._metaInfo.plots[e].id,i=a.styles.childs()[t];null==i||i.childs().display.subscribe(this,(()=>{this.processHibernate(),this.invalidateTitleCache()}))}for(const e of Object.keys(this._metaInfo.graphics))for(const t of Object.keys(this._metaInfo.graphics[e])){const i=null===(l=a.graphics.childs()[e])||void 0===l?void 0:l.childs()[t];i&&i.childs().visible&&(0,o.ensureDefined)(i.childs().visible).subscribe(this,(()=>this.processHibernate()))}this._isActualInterval=(0,Lt.isActualInterval)(this._series.intervalObj(),a.intervalsVisibilities),this._initializeStudyInputsPaneViews(),this._handler=e=>this._onData(e),this._valuesProvider=new E.StudyValuesProvider(this,e),this._graphicsPriceRangeGroups=ae(this),this._graphics=new B.LiveStudyGraphics(s.graphics),this._signlePerformanceValue=(0,fe.createWVFromGetterAndSubscriptions)((()=>{var e;return null!==(e=Array.from((0,o.ensureDefined)(this._graphics.performance().get("performance")))[0])&&void 0!==e?e:null}),[(0,o.ensureDefined)(this._graphics.observablePerformance().get("performance")).changed(),(0,o.ensureDefined)(this._graphics.observablePerformance().get("performance")).cleared()]),this._chartApi=e.chartApi(),this._invalidateLastNonEmptyPlotRowCache(),this._data=new A.PlotList((0,Zt.studyPlotFunctionMap)(this._metaInfo),Zt.studyEmptyPlotValuePredicate),this._createViews(), this._recreatePriceFormattingDependencies(this._series.symbolInfo()),a.precision.subscribe(this,this._precisionChanged),this._showStudyArgumentsProperty.subscribe(this,(()=>this.invalidateTitleCache(!0))),a.inputs.listeners().subscribe(this,(()=>this.invalidateTitleCache(!0))),Pe.enabled("update_study_formatter_on_symbol_resolve")&&e.mainSeries().dataEvents().symbolResolved().subscribe(this,this._recreatePriceFormattingDependencies),e.mainSeries().dataEvents().symbolResolved().subscribe(this,(()=>this.invalidateTitleCache(!0)));const c=new Set;if(this._simplePlotsCount=s.plots.filter(((e,t)=>{if((0,W.isLinePlot)(e))return!0;if((0,W.isOhlcPlot)(e)){const t=e.target;return!c.has(t)&&(c.add(t),!0)}return!1})).length,this.hasBarColorer()&&a.visible.listeners().subscribe(this,(()=>e.mainSeries().invalidateBarStylesCache)),this._definitionsViewModel=null,this._updateMaxOffsetValue(),s.inputs.some((e=>Ti.has(e.id)))){this._visibleTimeRangeInputs=e.visibleRangeStudiesInputs().spawn();const t=this._visibleTimeRangeInputs.value();let i=null!==t;this._visibleTimeRangeInputs.subscribe((e=>{const t=()=>{this._onVisibleTimeRangeInputsChanged(e),i!==(null!==e)&&(i=null!==e,!i||this._restarting||this.isStarted()||this.start(!0))};this._statusChanged.unsubscribeAll(this._statusChangesSubscriber),this._status.type===At.StudyStatusType.Loading?this._statusChanged.subscribe(this._statusChangesSubscriber,t,!0):t()})),t&&this._updateVisibleTimeRangeInputs(t,!1)}}destroy(){var e,t,i;null===(e=this._signlePerformanceValue)||void 0===e||e.destroy(),this._aboutToBeDestroyed.fire(),null!==this._definitionsViewModel&&(this._definitionsViewModel.destroy(),this._definitionsViewModel=null),this._showStudyArgumentsProperty.unsubscribeAll(this),this._model.mainSeries().dataEvents().symbolResolved().unsubscribeAll(this);this.parentSources().forEach((e=>{e.currencyChanged().unsubscribeAll(this),e.unitChanged().unsubscribeAll(this),e.priceRangeReadyChanged().unsubscribeAll(this),e.formatterChanged().unsubscribeAll(this),e.priceStepChanged().unsubscribeAll(this)})),this._series.properties().childs().statusViewStyle.childs().symbolTextSource.unsubscribeAll(this),this._series.onIntervalChanged().unsubscribeAll(this),this._series.alertCreationAvailable().unsubscribe(this._updateAlertCreationAvailable),this.formatterChanged().unsubscribe(this,this.invalidateTitleCache),H.hideAllIndicators().unsubscribe(this,this._visibleChanged),this._model.collapsed().unsubscribe(this._processHibernateBound),null!==this._currencySourceSymbolInputProperty&&this._currencySourceSymbolInputProperty.unsubscribeAll(this),null===(t=this._legendView)||void 0===t||t.destroy(),null===(i=this._visibleTimeRangeInputs)||void 0===i||i.destroy(),super.destroy()}properties(){return this._properties}propertiesPatched(){return this._propertiesPatched}isDraggable(){return!this._metaInfo.linkedToSeries}logs(){return this._metaInfo.graphics.logs&&this._graphics instanceof B.LiveStudyGraphics?(0,o.ensureDefined)(this._graphics.observableLogs().get("logs")):null}logLevelMask(){ const e=this._properties.childs().inputs.childs().__log_level.value();if(!(0,$.isNumber)(e)||e<0||e>7)throw new Error(`Value of log level is unexpected, current value is ${e}, but expected values from 0 to 7`);return{error:Boolean(1&e),warning:Boolean(2&e),info:Boolean(4&e)}}setLogLevelMask(e){const t=(Number(e.error)&&1)|(Number(e.warning)&&2)|(Number(e.info)&&4);this._properties.childs().inputs.childs().__log_level.setValue(t)}performance(){return this._graphics instanceof B.LiveStudyGraphics?this._signlePerformanceValue:new Nt.WatchedValue(null)}profilingEnabled(){var e;return!!(null===(e=this._properties.childs().inputs.childs().__profile)||void 0===e?void 0:e.value())}enableProfiling(e){var t;null===(t=this._properties.childs().inputs.childs().__profile)||void 0===t||t.setValue(e)}onAboutToBeDestroyed(){return this._aboutToBeDestroyed}lastValueData(e,t,i){const s={noData:!0},r=this.metaInfo().isPlotForceOverlay(e)?this._model.mainSeries().priceScale():this.priceScale();if(this._model.timeScale().isEmpty()||null===r||r.isEmpty()||this.data().isEmpty())return s;const n=this._model.timeScale().visibleBarsStrictRange(),o=this.firstValue(!0);if(null===n||null===o)return s;if(!this._properties.childs().visible.value())return s;const l=this._properties.childs().styles,a=this._properties.childs().ohlcPlots;let c,u;if(l&&l.childs()[e]&&(c=l.childs()[e]),a&&a.childs()[e]&&(c=a.childs()[e]),!c||0===c.childs().display.value())return s;const h=this.metaInfo().plots;for(u=0;u<h.length;u++){const t=h[u];if(t.id===e||(0,W.isOhlcClosePlot)(t)&&t.target===e)break}const d=u+1,p=this.offset(e),_=this.nearestIndex(n.lastBar()-p,R.PlotRowSearchMode.NearestLeft,d);if(void 0===_)return s;const f=this._lastNonEmptyPlotRow(d),m=null!==f&&n.contains(f.index),v=null!==f?f.value:null,g=t||m?v:this.data().valueAt(_);if(!g||!(0,$.isNumber)(g[d]))return s;const P=g[d],y=this._valuesProvider.getPlotColor(u,g),S=r.priceToCoordinate(P,o),b=this.plotFormatter(e).format(P),x={...r.getFormattedValues(P,o,void 0,b),noData:!1,color:y,floatCoordinate:S,coordinate:S};return i&&(x.price=P),x}isFailed(){return this.status().type===At.StudyStatusType.Error}isLoading(){return this.status().type===At.StudyStatusType.Loading}isSymbolInvalid(){return this._status.type===At.StudyStatusType.Error&&this._status.errorDescription.error===ti}series(){return this._series}model(){return this._model}state(e,t){var i,s;const r=(0,o.ensureNotNull)((0,u.getStudyClassName)(this.constructor)),n=this.metaInfo();let l;n instanceof L.StudyMetaInfo?l=(0,$.clone)(n.state()):(l=(0,$.clone)(this.metaInfo()),l.id=L.StudyMetaInfo.parseIdString(l.id+(l.version?"-"+l.version:"")).fullId);const a={type:r,id:this.id(),state:this.properties().state(),zorder:this.zorder(),ownFirstValue:this.isVisible()?null:this._ownFirstValue,metaInfo:l},c=this._sources.map((e=>e.id()));if(c.length&&(a.parentSources=c),e){let e=this.data();const t=this._model.timeScale(),i=this._seriesDataRangeToSave(e);null!==i&&(e=e.range(i.firstBar(),i.lastBar())),a.data=e.state(),a.data.symbols=this._resolvedSymbols, a.data.graphics=(0,B.saveStudyGraphics)(this.graphics(),t.visibleBarsStrictRange()),a.data.plotOffsets=this._plotOffsets}this.ownerSource()&&(a.ownerSource=null===(i=this.ownerSource())||void 0===i?void 0:i.id());for(let e=0;e<n.inputs.length;e++)if("bar_time"===n.inputs[e].type){const t=n.inputs[e].id,i=a.state.inputs[t];if(i<0){const e=this._rightOffsetToUnixTime(-i);a.state.inputs[t]=e&&e>=0?e:0}}if(null===(s=a.state)||void 0===s?void 0:s.inputs){const e=a.metaInfo.inputs.find((e=>"ILScript"===e.name));e&&delete a.state.inputs[e.id],delete a.state.inputs.__log_level,delete a.state.inputs.__profile}const h=this.stateCustomFields();var d;return h&&(a.customFields=h),t&&(d=a).metaInfo&&d.metaInfo.scriptIdPart&&d.metaInfo.scriptIdPart.startsWith("USER;")&&(function(e){if(!e.metaInfo)return;const t=e.metaInfo.scriptIdPart;if(!t)return;const i=t.split(";")[0],s=e.metaInfo;s.id=(s.id||"").replace(t,i),s.fullId=(s.fullId||"").replace(t,i),s.name=(s.name||"").replace(t,i),s.shortId=(s.shortId||"").replace(t,i),s.scriptIdPart=(s.scriptIdPart||"").replace(t,i),e.state&&(e.state.id=(e.state.id||"").replace(t,i),e.state.name=(e.state.name||"").replace(t,i),e.state.scriptIdPart=(e.state.scriptIdPart||"").replace(t,i))}(d),function(e){const t=(e.metaInfo&&e.metaInfo.inputs||[]).find((e=>"ILScript"===e.name));t&&(t.defval="",e.state&&e.state.inputs&&(e.state.inputs[t.id]=""),e.metaInfo.defaults.inputs&&(e.metaInfo.defaults.inputs[t.id]=""))}(d)),a}stateCustomFields(){}restoreStateCustomFields(e){}restoreData(e){var t,i;this._invalidateLastNonEmptyPlotRowCache(),this.data().restoreState(e),this._resolvedSymbols=null!==(t=e.symbols)&&void 0!==t?t:{},this._graphics=e.graphics?(0,B.loadStudyGraphics)(e.graphics):(0,B.emptyStudyGraphics)(),this._postProcessGraphics(),this._plotOffsets=null!==(i=e.plotOffsets)&&void 0!==i?i:{},this._setStatus({type:At.StudyStatusType.Completed},!0)}hasStateForAlert(){return _e.alertsAvailable&&!this.isFailed()&&!this._metaInfo.isTVLibrary&&this._series.alertCreationAvailable().value()&&(this._hasAlertConditions()||this._hasAvailableAlertPlots()||this._hasAlertFunction())}stateForAlert(){const e=(0,o.ensureNotNull)(this._alertMetaInfo()),t=this._plotsForAlert(),i=this._collectDepsForAlert(),s=i.idForAlert,r=i.studyDependencies,n=i.inputsForAlert,l=(this.priceScale()||this.model().mainSeries().priceScale()).formatter(),a=l?_.FormattersSerializer.serialize(l):null,c={id:s,uniqueId:s,type:(0,o.ensureNotNull)((0,u.getStudyClassName)(this.constructor)),title:(0,h.clean)(this._title(Q.TitleDisplayTarget.StatusLine,!1,{},!1,!1,!0),!0),shortTitle:(0,h.clean)(this._title(Q.TitleDisplayTarget.StatusLine,!0,{},!1,!1,!0),!0),shortDescription:(0,h.clean)(e.shortDescription||"Study",!0),fullId:e.fullId,isTVScript:Boolean(e.isTVScript),isTVScriptStrategy:Boolean(e.isTVScriptStrategy),isTVLibrary:Boolean(e.isTVLibrary),hasAlertFunction:Boolean(e.hasAlertFunction),plots:t,inputs:n,alerts:e.alerts,scriptIdPart:e.scriptIdPart,scriptVersion:e.pine?e.pine.version:"-1",callStudyDependencies:(0, d.formatCallstudyArg)(this._dependenciesForAlerts()),studyDependencies:r,formatter:a},p=P(this);p&&(c.dangerReason=p);const f=e.defaultStrategyAlertMessage;return f&&(c.defaultStrategyAlertMessage=(0,h.clean)(f,!0)),c}idForAlert(){return this._collectDepsForAlert().idForAlert}hasBarColorer(){return(0,o.ensureNotNull)(this._metaInfo).plots.some(W.isBarColorerPlot)}barColorer(){const e=this._metaInfo.plots;let t=null;for(let i=0;i<e.length;++i)if((0,W.isBarColorerPlot)(e[i])){const e=new zt(this,i);null===t?t=e:t.pushBackBarColorer(e)}return t}isSavedInStudyTemplates(){return this._metaInfo.inputs.every((e=>"bar_time"!==e.type))}restart(e){this._restarting=!0,this.clearData(),(e||Pe.enabled("stop_study_on_restart"))&&this.stop(),setTimeout(this.start.bind(this),0)}stop(e,t){if(!0===e&&this._children)for(const e of this._children)e.stop(!0);this._stopStudyOnServer(),this.clearData(),this._unsubscribeToSessionId(),this.recalculate()}disconnect(){this._studyId=null,this._model.isSnapshot()||(this._resolvedSymbols={},this._resolvedSymbolsByInput={})}sourceId(){return this._studyId}parentSources(){return this._sources}symbolSource(){return this._firstSourceOrSeries().symbolSource()}valueAt(e,t){return this.symbolSource().valueAt(e,t)}barsProvider(){return this._firstSourceOrSeries().barsProvider()}ownerSource(){return this.isChildStudy()?this._sources[0]:super.ownerSource()}isChildStudy(){return this._sources.length>0}hasChildren(){return this._children.length>0}isStarted(){return Boolean(this._studyId)}isRestarting(){return this._restarting}isActualInterval(){return this._isActualInterval}onIsActualIntervalChange(){return this._onIsActualIntervalChange}isVisible(){var e,t,i;const s=this._properties.childs();if(this._model.collapsed().value()||!s.visible.value()||!this.isActualInterval())return!1;const r=this.metaInfo();if(r.plots.length>0)for(let e=0;e<r.plots.length;e++){const t=r.plots[e].id,i=s.styles.childs()[t];if(void 0===i)continue;if(0!==i.childs().display.value())return!0}if(r.bands)for(let e=0;e<r.bands.length;e++)if(s.bands.childs()[e].childs().visible.value())return!0;for(const n of Object.keys(r.graphics))for(const o of Object.keys(r.graphics[n])){const r=null===(e=s.graphics.childs()[n])||void 0===e?void 0:e.childs()[o];if(void 0!==r&&(null===(i=null===(t=r.child("visible"))||void 0===t?void 0:t.value())||void 0===i||i))return!0}if(r.filledAreas)for(let e=0;e<r.filledAreas.length;e++)if(s.filledAreasStyle.childs()[r.filledAreas[e].id].childs().visible.value())return!0;return!(!r.isTVScriptStrategy&&!r.hasAlertFunction)}async start(e,t,i){const s=this._model.mainSeries();await s.seriesCreated(),await Promise.all(this._sources.filter((e=>e.isHibernated())).map((e=>e.start())));const r=!(this.isHibernationAllowed()&&!this.isVisible())||!0===t;if(this._chartApi&&this._chartApi.isConnected().value()&&r)try{await this._allSymbolsAreResolved(),await this._startAfterSymbolsResolved(e,t)}catch(e){const t=`ERROR: ${this._debugId()} start failed, ${e}`;ei.logError(t),this._restarting=!1, "TooManyStudies"===(null==e?void 0:e.cause)&&(0,C.showTooManyStudiesNotice)(this._chartApi.getStudyCounter())}}replaceData(e,t,i){this._invalidateLastNonEmptyPlotRowCache(),this.data().remove(e+1),this.data().addTail(i,t)}inputs(e){const t=(0,n.default)((0,$.clone)(ii),e||{});t.skipOptionalEmptySymbolInputs&&(t.keepOptionalSymbolsEmpty=!0);const i=(0,r.default)(this._buildInputs(t));return t.patchSosInputs&&L.StudyMetaInfo.patchSoSInputs(i,(e=>{var t,i;return null!==(i=null===(t=this._sources.find((t=>t.id()===e)))||void 0===t?void 0:t.sourceId())&&void 0!==i?i:null})),i}data(){return this._data}moveData(e){this._ongoingDataUpdate=this._ongoingDataUpdate.then((()=>{this._invalidateLastNonEmptyPlotRowCache(),this.data().move(e)}))}plots(){return this.data()}metaInfo(){return this._metaInfo}status(){var e;return null!==(e=this._recompilationStatus)&&void 0!==e?e:this._status}name(e){return e?this.metaInfo().shortDescription||"Study":this.metaInfo().description||"Study"}title(e,t,i,s,r,n){s=void 0===s?!this._showStudyArgumentsProperty.value():s;const o=JSON.stringify([e,t,i,s,r,n]);if(this._titleStrCache[o])return this._titleStrCache[o];if(this._titleInPartsCache[o])return this._joinTitlesParts(this._titleInPartsCache[o]);const l=this._title(e,t,i,s,r,n);return this._titleStrCache[o]=l,l}titleInParts(e,t,i,s,r){s=void 0===s?!this._showStudyArgumentsProperty.value():s;const n=JSON.stringify([e,t,i,s,r]);if(this._titleInPartsCache[n])return this._titleInPartsCache[n];const o=this._titleInParts(e,t,i,s,r);return this._titleInPartsCache[n]=o,o}invalidateTitleCache(e){if(this._titleStrCache={},this._titleInPartsCache={},!0===e&&this._children)for(let t=0;t<this._children.length;++t)this._children[t].invalidateTitleCache(e)}graphics(){return this._graphics}graphicsInfo(){return this._metaInfo.graphics}priceLabelText(e){const t=this._metaInfo.styles,i=this._metaInfo.ohlcPlots;let s;t&&t[e]&&(s=t[e]),i&&i[e]&&(s=i[e]);const r=(0,o.ensureDefined)(s).title;return 1!==this._simplePlotsCount||(0,W.isPlotTitleDefined)(r)?this._metaInfo.is_price_study&&r!==this._metaInfo.shortDescription?""===r?this._metaInfo.shortDescription:this._metaInfo.shortDescription+":"+r:r:this._metaInfo.shortDescription}setOwnFirstValue(e){this._ownFirstValue=e}firstValue(e){if(!this.isChildStudy()&&"Compare@tv-basicstudies"===this._metaInfo.id||!this._metaInfo.is_price_study){const t=this._model.timeScale().visibleBarsStrictRange();if(null===t)return null;const i=this.properties().childs();if(!i.visible.value()||!this.isActualInterval()||null!==this._startMovingPoint)return this._ownFirstValue;const s=t.firstBar(),r=t.lastBar();let n=this._graphicsPriceRangeGroups?function(e,t){const i=e.model().timeScale();if(i.isEmpty())return null;const s=i.visibleBarsStrictRange();if(null===s)return null;const r=s.firstBar(),n=s.lastBar(),o=new ue;for(const e of t){const t=e.firstValue(r,n);o.improve(t)}return o.bestPrice()}(this,this._graphicsPriceRangeGroups):null;const l=this._metaInfo.plots||[];if(null===n){const t=new Set,a=this._metaInfo.filledAreas||[] ;for(let e=0;e<a.length;e++){const s=a[e];i.filledAreasStyle.childs()[s.id].childs().visible.value()&&(t.add(s.objAId),t.add(s.objBId))}for(const a of this.data().rangeIterator(s,r)){const s=a.value;for(let r=0;r<l.length;++r){if((0,W.isColorerPlot)(l[r]))continue;const a=s[r+1];if(null==a)continue;const c=l[r].id;if((0!==(0,o.ensureDefined)(i.styles.childs()[c]).childs().display.value()||t.has(c))&&!(e&&Math.abs(a)<1e-10)){n=a;break}}if(null!==n)break}}return this._ownFirstValue=n,null!==n?n:this._bandsFirstValue(e)}if(this.isChildStudy()){const e=this._getNonPriceParent();if(e&&this.priceScale()===e.priceScale())return null!==e._ownFirstValue?e._ownFirstValue:e.firstValue()}return this._series.firstValue()}desiredPriceScalePosition(){if(this.metaInfo().isTVScriptStub)return"overlay";if(this.metaInfo().linkedToSeries)return"as-series";switch(this.metaInfo().priceScale){case 1:return"left";case 0:return"right";case 2:return"overlay";default:return null}}offset(e){var t;let i=0;this._plotOffsets&&void 0!==this._plotOffsets[e]&&(i+=this._plotOffsets[e]);const s=this.properties().childs(),r=null===(t=s.offsets)||void 0===t?void 0:t.childs()[e];return r&&(i+=r.childs().val.value()),s.offset&&(i+=s.offset.childs().val.value()),i}tags(){return!this._metaInfo||!this._metaInfo.description||this._metaInfo.isTVScriptStub||this._metaInfo.is_hidden_study||this._metaInfo.isTVScript&&"tv-scripting"===this._metaInfo.productId?[]:[this._metaInfo.description]}copiable(){return oi&&!this.isChildStudy()}setPriceScale(e){super.setPriceScale(e),(0,Ht.emit)("study_event",this.id(),"price_scale_changed")}priceRange(e,t,i){let s=null;const r=this._metaInfo,n=this._fillPrecalculatedAutoscaleInfo(e,t,i);let l=this.data().minMaxOnRangeCached(e,t,n.fields);if(l=(0,A.mergeMinMax)(n.baseValueMinMax,l),n.useMainSeriesRange){const i=[{name:"low",offset:0},{name:"high",offset:0}],s=this.series().data().bars().minMaxOnRangeCached(e,t,i);l=(0,A.mergeMinMax)(l,s)}if(null!==l&&(s=new D.PriceRange(l.min,l.max)),r.bands)for(let e=0;e<r.bands.length;e++){const t=(0,o.ensureDefined)(this._properties.childs().bands.childs()[e]).childs();if(t.visible.value()){const e=t.value.value();if(!(0,$.isNumber)(e))continue;s?s.apply(e,e):s=new D.PriceRange(e,e)}}if(this._graphicsPriceRangeGroups){const i=function(e,t,i){let s=null;for(const r of e){const e=r.groupPriceRange(t,i);null!==e&&(s=null===s?e:s.merge(e))}return s}(this._graphicsPriceRangeGroups,e,t);i&&(s=s?s.merge(i):i)}return this._postProcessPriceRange(s,i)}autoScaleInfo(e,t,i){const s=this.priceRange(e,t,i),r=this._graphicsPriceRangeGroups?function(e,t,i){const s=le();for(const r of e){const e=r.groupPixelMargins(t,i);s.bottomPixelMargin=Math.max(s.bottomPixelMargin,e.bottomPixelMargin),s.topPixelMargin=Math.max(s.topPixelMargin,e.topPixelMargin)}return s}(this._graphicsPriceRangeGroups,e,t):{topPixelMargin:0,bottomPixelMargin:0};return{range:s,topPixelMargin:r.topPixelMargin,bottomPixelMargin:r.bottomPixelMargin}}formatter(e){var t ;return null!==(t=this._formatter)&&void 0!==t?t:this._firstSourceOrSeries().formatter(!1)}defaultFormatter(){var e,t,i;const s=this._firstSourceOrSeries();return null!==(i=null!==(e=this._defaultFormatter)&&void 0!==e?e:null===(t=s.defaultFormatter)||void 0===t?void 0:t.call(s))&&void 0!==i?i:s.formatter()}plotFormatter(e){var t;return null!==(t=this._plotFormatters.get(e))&&void 0!==t?t:this.formatter()}isMultiPaneAvailable(){return this._metaInfo.hasForceOverlayPlots()}updateAllViews(e){var t,i,s,r,n;this._paneViews.forEach((t=>t.update(e))),this._forceOverlaysPaneViews.forEach((t=>t.update(e))),this._labelPaneViews.forEach((t=>t.update(e))),this._forceOverlayLabelPaneViews.forEach((t=>t.update(e))),null===(t=this._dataWindowView)||void 0===t||t.update(),null===(i=this._legendView)||void 0===i||i.update(),null===(s=this._statusView)||void 0===s||s.update(),this._priceAxisViews.forEach((t=>t.update(e))),this._forceOverlayPriceAxisViews.forEach((t=>t.update(e))),this._priceLinesAxisViews.forEach((t=>t.update(e))),null===(r=this._inputsLinesPaneView)||void 0===r||r.update(e),null===(n=this._inputsAnchorsPaneView)||void 0===n||n.update(e),this._inputsTimeAxisPaneViews.forEach((t=>t.update(e))),this._inputsPriceAxisPaneViews.forEach((t=>t.update(e))),"data-source-change"===e.type&&e.sourceId===this.id()&&e.clearData&&this._children.forEach((e=>e.updateAllViews({type:"data-source-change",sourceId:e.id(),clearData:!0})))}removeByRemoveAllStudies(){return!0}getStudyName(){return this._studyName}nearestIndex(e,t,i){var s;return null===(s=this.data().search(e,t,i))||void 0===s?void 0:s.index}getMinFirstBarIndexForPlot(e){var t,i,s,r,n,o,l,a,c,u,h,d,p,_,f;const m=this._properties.childs(),v=this._metaInfo,g=null!==(f=null!==(d=null!==(c=null!==(o=null!==(s=null===(i=null===(t=m.styles.childs()[e])||void 0===t?void 0:t.child("showLast"))||void 0===i?void 0:i.value())&&void 0!==s?s:null===(n=null===(r=m.filledAreasStyle.childs()[e])||void 0===r?void 0:r.child("showLast"))||void 0===n?void 0:n.value())&&void 0!==o?o:null===(a=null===(l=v.styles)||void 0===l?void 0:l[e])||void 0===a?void 0:a.showLast)&&void 0!==c?c:null===(h=null===(u=m.ohlcPlots.childs()[e])||void 0===u?void 0:u.child("showLast"))||void 0===h?void 0:h.value())&&void 0!==d?d:null===(_=null===(p=v.ohlcPlots)||void 0===p?void 0:p[e])||void 0===_?void 0:_.showLast)&&void 0!==f?f:null;if(null===g)return-1/0;const P=this.data().lastIndex();return null===P?-1/0:P-g+1}guiPlotName(e,t){var i,s,r;return null!==(r=null===(s=null===(i=this._metaInfo.styles)||void 0===i?void 0:i[t])||void 0===s?void 0:s.title)&&void 0!==r?r:this.title(e)}childStudyByRebind(){return this._childStudyByRebind}isPine(){return void 0!==this._metaInfo.pine}isStandardPine(){return this.isPine()&&L.StudyMetaInfo.isStandardPine(this._metaInfo.id)}isLinkedToSeries(){return!0===this._metaInfo.linkedToSeries}defaultPlotIdForAlert(){return this._metaInfo.plots.length?this._metaInfo.plots[0].id:null}resolvedSymbolInfoBySymbol(e){ return this._resolvedSymbols&&e&&this._resolvedSymbols[this._getSymbolForResolve(e)]||null}hasPendingUnresolvedSymbols(){return this._pendingResolveSymbols.size>0}hasSymbolInputs(){return this._metaInfo.inputs.some((e=>"symbol"===e.type))}currency(){const e=this.metaInfo();return Boolean(e)&&e.is_price_study?this._firstSourceOrSeries().currency():null}currencySourceSymbolInfo(){var e,t,i;return null!==(e=this._currencySourceSymbolInfo)&&void 0!==e?e:null!==(i=null===(t=this.symbolSource())||void 0===t?void 0:t.symbolInfo())&&void 0!==i?i:null}unit(){const e=this.metaInfo();return Boolean(e)&&e.is_price_study?this._firstSourceOrSeries().unit():null}canOverrideMinTick(){return!1}dataWindowView(){return this._dataWindowView}statusView(){return this._statusView}legendView(){return this._legendView}async pineSourceCodeModel(){return this.metaInfo().pine?Promise.all([i.e(86644),i.e(76792),i.e(40032),i.e(89199)]).then(i.bind(i,356146)).then((({PineSourceCodeModel:e})=>new e(this))):Promise.resolve(null)}inputsForAlertState(){return this.inputs()}sessionId(){return this._firstSourceOrSeries().sessionId()}sessionIdChanged(){return this._firstSourceOrSeries().sessionIdChanged()}getSymbolString(e){return""===e?"":(0,K.encodeExtendedSymbolOrGetSimpleSymbolString)(this._getSymbolObject(e))}onStatusChanged(){return this._statusChanged}symbolsResolved(){return this._symbolsResolved}onHibernationStateChange(){return this._onHibernationStateChange}valuesProvider(){return new F(this,this.model())}statusProvider(e){return new q.StudyStatusProvider(this)}correctScaleMargins(e){if("Volume"===this.metaInfo().shortId){const t=this.model().paneForSource(this);return null!==t&&t.isOverlay(this)&&t.containsMainSeries()?{top:.75,bottom:0}:{top:e.top,bottom:0}}return e}canBeHiddenByGlobalFlag(){return!0}isSourceHidden(){return!this.isVisible()||this.canBeHiddenByGlobalFlag()&&H.hideAllIndicators().value()}wasCompletedBefore(){return this._wasCompletedBefore}paneViews(e){const t=this._model.mainPane();if(this.isSourceHidden())return null;if(!e.hasPriceDataSource(this))return this._metaInfo.hasForceOverlayPlots()?e!==t?null:this._forceOverlaysPaneViews:null;const i=[];return!this._startMovingPoint&&this._wasCompletedBefore&&i.push(...this._paneViews.filter((e=>{var t;return!(null===(t=e.isForceOverlay)||void 0===t?void 0:t.call(e))}))),this._inputsLinesPaneView&&(this._startMovingPoint||this._model.selection().isSelected(this))&&i.push(this._inputsLinesPaneView),this._inputsAnchorsPaneView&&i.push(this._inputsAnchorsPaneView),e===t&&i.push(...this._forceOverlaysPaneViews),i}labelPaneViews(e){const t=this._model.mainPane();if(this.isSourceHidden()||!e.hasPriceDataSource(this))return this._metaInfo.hasForceOverlayPlots()?e!==t?null:this._forceOverlayLabelPaneViews:null;const i=[...this._labelPaneViews];return e===t&&i.push(...this._forceOverlayLabelPaneViews),i}timeAxisViews(){return this._model.selection().isSelected(this)?this._inputsTimeAxisPaneViews:null}priceAxisViews(e,t){ if(t!==this.priceScale()&&t===this._model.mainSeries().priceScale()&&!e.hasDataSource(this))return this._forceOverlayPriceAxisViews;const i=this._properties.childs().oldShowLastValue;if(i&&!i.value())return null;let s=this._priceAxisViews.slice();return this._model.selection().isSelected(this)&&(s=s.concat(this._inputsPriceAxisPaneViews)),t===this._model.mainSeries().priceScale()&&(s=s.concat(this._forceOverlayPriceAxisViews)),e.findTargetPriceAxisViews(this,t,s,this._priceLinesAxisViews)}movable(){return null!==this._inputsAnchorsPaneView}startMoving(e,t,i,s){this._startMovingPoint=e}move(e,t,i,s){if(void 0!==e.logical&&null!==this._startMovingPoint){if(Array.isArray(t)){const i=t;this._updateInputValue(e.logical,i[0]),this._updateInputValue(e.logical,i[1])}else this._updateInputValue(e.logical,t);this.updateAllViews((0,Rt.sourceChangeEvent)(this.id()))}}endMoving(e,t){return this._startMovingPoint=null,{indexesChanged:!1,pricesChanged:!1}}clearData(){var e;this._invalidateLastNonEmptyPlotRowCache(),this.data().clear(),this._graphics instanceof B.LiveStudyGraphics&&(null===(e=this._graphics)||void 0===e||e.clear()),this._plotOffsets={},this.hasBarColorer()&&this._model.mainSeries().invalidateBarStylesCache(),this.updateAllViews((0,Rt.sourceChangeEvent)({sourceId:this.id(),clearData:!0}))}convertYCoordinateToPriceForMoving(e,t){const i=this.priceScale();if(!t||!i||i.isEmpty())return null;const s=t.firstValue();return null===s?null:i.coordinateToPrice(e,s)}processHibernate(e){const t=this.isVisible();if(!this.isStarted()&&t&&(this._sources.forEach((e=>{e.processHibernate()})),this.start(void 0,void 0,e),this._onHibernationStateChange.fire(!1)),this.isHibernationAllowed()&&this.isStarted()&&!t){for(const e of this._children)e.processHibernate();this.stop(void 0,e),this._onHibernationStateChange.fire(!0)}}isHibernationAllowed(){return!this.metaInfo().historyCalculationMayChange&&(!this.hasChildren()||!!this._model.collapsed().value()&&this._children.every((e=>e.isHibernationAllowed())))}isPlotVisibleAt(e,t){let i;const s=this.metaInfo().plots.find((t=>t.id===e));if(i=void 0!==s?(0,W.isOhlcPlot)(s)?this._properties.childs().ohlcPlots.childs()[s.target]:this._properties.childs().styles.childs()[e]:this._properties.childs().ohlcPlots.childs()[e],void 0===i)throw new Error(`Study does not contain ${e} plot`);const r=i.childs().display.value();return null!==r&&(r&t)===t}recalculate(){const e=this._model.paneForSource(this);this._model.recalculatePane(e,(0,Rt.sourceChangeEvent)(this.id())),this._model.updateSource(this)}maxOffset(){return this._maxOffset}onStart(){return this._onStart}onParentSourcesChanges(){return this._onParentSourcesChanges}isHibernated(){return!this.isVisible()&&!this.isStarted()}graphicsViewsReady(){return this._graphicsViewsReady}setRecompilationActive(e){var t;e!==Boolean(this._recompilationStatus)&&(this._recompilationStatus=e?{type:At.StudyStatusType.Loading,startTime:Date.now()}:null,null===(t=this._statusView)||void 0===t||t.update(),this._model.updateSource(this), this._statusChanged.fire(this.status()))}turnaround(e){if(!e)return this._turnaround;return function(e,t){let i=t.turnaround,s=[t];for(;s.length>0;){let e=[];const t=[];s.forEach((i=>{const s=ve(i.sourceStudies).sort(me);if(s.length>0){e=e.concat(s);const i=s.map((e=>e.turnaround)).join("_");t.push(i)}})),t.length&&(i=t.join("_")+"_"+i),s=e}return e+"_"+i}(this._series.seriesSource().turnaround(),ge(this))}canHaveChildren(){var e;return this._canHaveChildren=null!==(e=this._canHaveChildren)&&void 0!==e?e:L.StudyMetaInfo.canHaveChildren(this._metaInfo),this._canHaveChildren}setChild(e){-1===this._children.indexOf(e)&&this._children.push(e)}unsetChild(e){const t=this._children.indexOf(e);~t&&this._children.splice(t,1)}getAllChildren(){const e=this._children.slice();for(let t=0;t<e.length;++t){const i=e[t].getAllChildren();for(let t=0;t<i.length;++t)~e.indexOf(i[t])||e.push(i[t])}return e}parentSourceForInput(e){var t;if(e.includes("$")){const i=e.split("$")[0];return null!==(t=this._sources.find((e=>e.id()===i)))&&void 0!==t?t:null}return this._series}priceStep(){return this._priceStep||this._firstSourceOrSeries().priceStep(!1)}recreatePriceFormatter(){this._recreatePriceFormattingDependencies()}setOwnerSource(e){super.setOwnerSource(e),this._recreatePriceFormattingDependencies()}onTagsChanged(){return this._tagsChanged}getPropertyDefinitionsViewModel(){return null===this._definitionsViewModel?this._getPropertyDefinitionsViewModelClass().then((e=>null===e||this._isDestroyed?null:(null===this._definitionsViewModel&&(this._definitionsViewModel=new e(this._model.undoModel(),this)),this._definitionsViewModel))):Promise.resolve(this._definitionsViewModel)}_getPropertyDefinitionsViewModelClass(){return Promise.resolve(null)}_alertMetaInfo(){return this.metaInfo()}_createStudyOnServer(){if(this._isDestroyed)return!1;const e=this._getStudyIdWithLatestVersion();this._studyId=(0,G.makeNextStudyId)(),this._incrementTurnaround(),this._studyName=e;const t=(0,$.clone)((0,o.ensureDefined)(this._inputs));let i;if(L.StudyMetaInfo.patchSoSInputs(t,(e=>{var t,i;return null!==(i=null===(t=this._sources.find((t=>t.id()===e)))||void 0===t?void 0:t.sourceId())&&void 0!==i?i:null})),i=this._chartApi.createStudy(this._studyId,this._turnaround,(0,o.ensureNotNull)(this._series.seriesSource().instanceId()),this._studyName,t,this._handler,this._studySpec()),!i)return this._studyId=null,i;if(void 0===this._oldStudyInputs){if(this._metaInfo.TVScriptMetaInfoExprs){this._previousPatchMap={};const e=this._metaInfo.TVScriptMetaInfoExprs.patchMap;(0,S.iterateAndPatchObjectsByMap)([this._properties,this._metaInfo.defaults,this._metaInfo],e,((e,t,i)=>{const s=e[0],r=e[1],n=e[2];r.hasOwnProperty(t)?(0,o.ensureDefined)(this._previousPatchMap)[i]=s[t].value():(0,o.ensureDefined)(this._previousPatchMap)[i]=n[t]}))}const e=this._prepareInputs(si);Object.keys(e).some((e=>(0,m.isStudyInputDependsOnChart)({id:e})))||(this._oldStudyInputs=e)}return this._deferredPinePatchProps&&!this._restarting&&this._pinePatchProps(),!0}_stopStudyOnServer(){ this._chartApi&&this._chartApi.isConnected().value()&&this.isStarted()&&(this._chartApi.removeStudy((0,o.ensureNotNull)(this._studyId)),this._setStatus({type:At.StudyStatusType.Undefined})),this._studyId=null}_modifyStudyOnServer(e,t){const i=(0,$.clone)((0,o.ensureDefined)(e));L.StudyMetaInfo.patchSoSInputs(i,(e=>{var t,i;return null!==(i=null===(t=this._sources.find((t=>t.id()===e)))||void 0===t?void 0:t.sourceId())&&void 0!==i?i:null})),this._chartApi.modifyStudy((0,o.ensureNotNull)(this._studyId),this._turnaround,i,this._handler,t)}_transformData(e){}_invalidateLastNonEmptyPlotRowCache(){this._lastNonEmptyPlotRowCache={}}_collectDepsForAlert(){const e=[this,...this._getAllOwnerSources().filter((e=>e instanceof Vi))];return(0,y.collectDepsForAlert)(e)}_allInputsAreValid(){var e;if(null===(null===(e=this._visibleTimeRangeInputs)||void 0===e?void 0:e.value()))return!1;for(const e of this._metaInfo.inputs)if("bar_time"===e.type){const t=e.id;if(null==this._properties.childs().inputs.childs()[t].value())return!1}return!0}async _startAfterSymbolsResolved(e,t){await Promise.all(this._sources.map((e=>!e.isStarted()||e.isRestarting()?new Promise((t=>{e.onStart().subscribe(this,t,!0)})):Promise.resolve()))),this.isStarted()&&!this._restarting||(this._restarting=!1,this._allInputsAreValid()&&!this.metaInfo().isTVScriptStub&&(this._inputs=this._apiInputs(),this._createStudyOnServer()&&(this._subscribeToSessionId(),this._onStart.fire(),!0===e&&this._children&&await this._children.map((e=>e.start(!0,t))))))}async _changeInputsImpl(e,t){const s=this._calcSources(),r=bi(this._metaInfo,e,t),n=()=>{for(const i of this._metaInfo.inputs){if("source"!==i.type)continue;const s=e[i.id].v,r=t[i.id].v;if(s!==r){(0,o.ensureDefined)(this._properties.childs().inputs.child(i.id)).setValue(r)}}};if(this.isStarted()&&this._chartApi.isConnected().value()&&r>0&&!this._chartApi.canCreateStudy(this._studySpec(!0),!0).success){const e=window.user.pro_plan;return(0,b.createGoProDialog)({feature:"studyOnStudy",actions:e&&e===w.ExpertPlans.PremiumExpert?[{text:a.t(null,void 0,i(875139)),action:x.PredefinedAction.Close}]:void 0}),void n()}this._inputs=e;let l=!1;const c=Object.values(m.RangeDependentStudyInputNames);for(const i of Object.keys(e))if(JSON.stringify(e[i])!==JSON.stringify(t[i])&&!c.includes(i)){l=!0;break}this._incrementTurnaround(),l&&this.disablePriceRangeReady();try{await this._updateParentSources(s,r,!0),this._modifyStudyOnServer(e,r),this._studyModified=!0}catch(e){ei.logError(`Error applying parent sources: ${e}`),n()}this.invalidateTitleCache()}_createPriceAxisView(e){return new Ot.StudyPriceAxisView(this,{plotIndex:e})}_createPriceLineAxisView(e){return new Ft.StudyPriceLineAxisView(this,e)}_createStudyPlotPaneView(e){return new ft.StudyPlotPaneView(this,this._series,this._model,e)}_createViews(){var e,t,i,s;this._priceAxisViewsBase=[],this._forceOverlayPriceAxisViews=[],this._priceLinesAxisViews=[],this._paneViews=[],this._forceOverlaysPaneViews=[],this._labelPaneViews=[],this._forceOverlayLabelPaneViews=[] ;const r=new Set,n=this.metaInfo(),l=Boolean(n.usePlotsZOrder),a=new Map,c=this._properties.childs();if(c.filledAreasStyle&&n.filledAreas)for(let e=0;e<n.filledAreas.length;++e){const t=n.filledAreas[e],i=(0,o.ensureDefined)(c.filledAreasStyle.childs()[t.id]),s=hi(n,t.id);let r;if("plot_plot"===t.type||s?r=new xt(this,this.model(),t,i):"hline_hline"===t.type?r=new Dt(this,t,i):ei.logWarn("Unsupported filledArea type: "+t.type),void 0!==r){let e=!1;if("plot_plot"===t.type&&(e=n.isPlotForceOverlay(t.objAId)),e)this._forceOverlaysPaneViews.push(r);else{const e=l?(0,o.ensureDefined)(t.zorder):a.size;ui(e,a),a.set(e,{paneViews:[r]})}}}{let s=-1e5;for(let c=0;c<n.plots.length;c++){const u=n.plots[c];let h,d,p,_,f,m=n.isPlotForceOverlay(u.id);if((0,W.isNonVisualPlot)(u))continue;let v=u.id,g=n.styles;const P=(0,W.isBgColorerPlot)(u);if(P)h=new Ce(this,this._series,this._model,v);else if((0,W.isShapesPlot)(u))h=new Ge(this,this._series,this._model,v);else if((0,W.isCharsPlot)(u))h=new tt(this,this._series,this._model,v);else if((0,W.isArrowsPlot)(u))h=new at(this,this._series,this._model,v);else if((0,W.isOhlcPlot)(u)){const e=u.target;if(r.has(e))continue;if(m=n.isPlotForceOverlay(e),r.add(e),ai(n,c))h=new ht(this,this._series,this._model,e);else{if(!ci(n,c)){ei.logError(`plot ${u.id} looks to be invalid`);continue}h=new pt(this,this._series,this._model,e)}_=this._createPriceAxisView(e),p=new _t.PanePriceAxisView(_,this,this._model),v=e,g=n.ohlcPlots}else(0,W.isDataPlot)(u)||(_=this._createPriceAxisView(v),f=this._createPriceLineAxisView(v),h=this._createStudyPlotPaneView(v),(null===(t=null===(e=this._properties.childs().styles.childs()[v])||void 0===e?void 0:e.child("trackPrice"))||void 0===t?void 0:t.value())&&(d=new gt(this,v)),p=new Jt(_,this,this._model,v));const y=l?P?s++:(0,o.ensureDefined)(null===(i=null==g?void 0:g[v])||void 0===i?void 0:i.zorder):a.size;if(ui(y,a),m)_&&this._forceOverlayPriceAxisViews.push(_),h&&this._forceOverlaysPaneViews.push(h),p&&this._forceOverlayLabelPaneViews.push(p);else{const e={paneViews:void 0!==h?[h]:[],labelView:p,priceAxisView:_,priceLineAxisView:f};void 0!==d&&e.paneViews.push(d),a.set(y,e)}}}(null!==(s=this._metaInfo.bands)&&void 0!==s?s:[]).forEach(((e,t)=>{const i=c.bands.childs()[t];if(i&&i.childs().visible.value()){const t=new It(i,this),s=l?(0,o.ensureDefined)(e.zorder):a.size;ui(s,a),a.set(s,{paneViews:[t]})}})),c.bandsBackground&&((0,o.assert)(!l,"'usePlotsZOrder' flag does not supported"),a.set(a.size,{paneViews:[new Mt(this)]}));const u=this._paneViews;this._createGraphicsPaneViews().then((e=>{for(let t=0;t<e.length;t++)u.push(e[t]);this._model.lightUpdate(),this._graphicsViewsReady=!0})),c.areaBackground&&((0,o.assert)(!l,"'usePlotsZOrder' flag does not supported"),a.set(a.size,{paneViews:[new Pt.AreaBackgroundPaneView(this,this.model())]}));const h=Array.from(a.keys()).sort(((e,t)=>e-t));for(let e=0;e<h.length;e++){const t=(0,o.ensureDefined)(a.get(h[e]));this._paneViews.push(...t.paneViews),t.labelView&&this._labelPaneViews.push(t.labelView), t.priceAxisView&&this._priceAxisViewsBase.push(t.priceAxisView),t.priceLineAxisView&&this._priceLinesAxisViews.push(t.priceLineAxisView)}this._dataWindowView||(this._dataWindowView=new wt.StudyDataWindowView(this,this._model)),this._legendView||(this._legendView=new z(this,this._model)),this._statusView||(this._statusView=new U.StudyStatusView(this)),this._concatPriceAxisViews()}_onData(e){switch(e.method){case"study_loading":this._onStudyLoading();break;case"study_error":this._onStudyError(e.params[2]);break;case"study_completed":if(!this._checkTurnaround(e.params[1]))return;this._onStudyCompleted(e.params[e.params.length-1]);break;case"data_update":if(e.params.customId!==this.sourceId()||!this._checkTurnaround(e.params.turnaround))return;(0,o.assert)(!!e.params.nonseries,"data.params.nonseries is missing"),this._onDataUpdate(e.params.plots,(0,o.ensureDefined)(e.params.nonseries),e.params.lastBar);break;case"clear_data":this._checkTurnaround(e.params.turnaround)&&this.clearData()}}_getTelemetryObjectName(){return"study"}_onDataUpdated(e,t,i,s){if(this.hasBarColorer()&&e.length>0){const t=(0,o.ensureNotNull)(this.barColorer()).firstColoredBar(e[0].index);null!==t&&this._model.mainSeries().invalidateBarStylesCache(t)}null!==t&&this._postProcessGraphics();const r=this._model.paneForSource(this);this._model.recalculatePane(r,(0,Rt.sourceChangeEvent)({sourceId:this.id(),firstUpdatedTimePointIndex:null!=s?s:void 0,nonSeriesOnly:0===e.length})),this._updateSources()}_titleInputs(e,t,i){return this.inputs(this._titleInputsOptions(e,t,i))}_titleInputsOptions(e,t,i){return{symbolsForDisplay:!0,skipHiddenInputs:!0,skipFakeInputs:!1,fakeInputsForDisplay:!0,asObject:!0,skippedGroups:[],skippedInputs:this._skippedTitleInputs(),noExchanges:t,noResolution:i,priceInputsForDisplay:!0,skipOptionalEmptySymbolInputs:ni,displayMask:e}}_postProcessGraphics(){this._graphicsPriceAxisViews=this._createGraphicsPriceAxisViews(),this._concatPriceAxisViews()}async _createGraphicsPaneViews(){return(0,B.createGraphicsPaneViews)(this,this.model())}_createGraphicsPriceAxisViews(){return(0,B.createGraphicsPriceAxisViews)(this)}_subscribeToSessionId(){!this._isSubscribedToSessionId&&this.hasSymbolInputs()&&(this.sessionIdChanged().subscribe(this,this._onSessionIdChanged),this._isSubscribedToSessionId=!0)}_recreateFormatter(e){this._recreatePlotsFormatters(e),this._formatter=this._tryCreateFormatter(e),this._defaultFormatter=this._tryCreateDefaultFormatter(e),this._formatterChanged.fire();const t=this.priceScale();null!==t&&t.updateFormatter(),this.getAllChildren().forEach((e=>{e.recreatePriceFormatter()})),this._model.fullUpdate()}_recreatePriceFormattingDependencies(e){this._recreateFormatter(e),this._recreatePriceStep()}_title(e,t,i,s,r,n){const o=this._titleInParts(e,t,i,s,r,n);return this._joinTitlesParts(o)}_postProcessPriceRange(e,t){if(e&&e.minValue()===e.maxValue()&&!this.metaInfo().is_price_study){const t=.005*e.minValue();e=new D.PriceRange(e.minValue()-t,e.maxValue()+t)}const i=t.targetPriceScale ;return i&&i.isLog()&&e?new D.PriceRange(i.priceToLogical(e.minValue()),i.priceToLogical(e.maxValue())):e}_titleInParts(e,t,s,r,n,l){var c;const u=this.name(t);s=s||{};const h=[a.t(u,{context:"study"},i(168716))];let d=[];if(!r){const i=this._getMTFResolutionInputTitle();null!==i&&i.length>0&&h.push(i);const r=this.metaInfo(),a=this._titleInputs(e,n,!0),u=r.inputs.filter((e=>a.hasOwnProperty(e.id))).map((e=>({meta:e,value:a[e.id]})));if(u.length>0){const i={};if(this.isChildStudy())for(let s=0;s<r.inputs.length;++s){const a=r.inputs[s];if(!L.StudyMetaInfo.isSourceInput(a))continue;const u=a.id,h=(0,o.ensureDefined)(this._properties.childs().inputs.child(u)).value();if(h.indexOf("$")>=0){const s=this.parentSourceForInput(h);if(s instanceof Vi){const r=s.metaInfo(),o=s.title(e,t,{},!0,n,l);if(1===r.plots.length)i[h]=o;else{const e=h.split("$")[1],t=null===(c=r.plots[parseInt(e)])||void 0===c?void 0:c.id,s=r.styles&&r.styles[t],n=s&&s.title||t;i[h]=o+": "+n}}}}d=u.map((({meta:e,value:t})=>{if("time"===e.type)return new Date(t).toISOString();let r=(0,$.isNumber)(t)?this._numericFormatter.format(t):i&&i[t.toString()]||t.toString();return s&&s[r.toString()]&&(r=s[r.toString()]),r}))}}return[h.join(" · "),d]}_seriesDataRangeToSave(e){return this._model.timeScale().visibleExtendedDataRange(e,0)}_getSymbolForResolve(e){return this.getSymbolString(this._getSymbolForApi(e))}_getSymbolForApi(e){return e}_getSymbolObject(e){const t={symbol:e},i=this.currency();return null!==this._currencySourceSymbolInputProperty&&null!==this._currencySourceSymbolInfo&&this._getSymbolForApi(this._currencySourceSymbolInputProperty.value())===e&&(t["currency-id"]=i),t.session=this.sessionId(),t}_onSymbolResolved(e,t,i){{const e=(0,o.ensureNotNull)(this._model.alertsWatcher());e.syncSourceAlertLabels(this);const t=this.getAllChildren();for(const i of t)e.syncSourceAlertLabels(i)}this._onCurrencyMayChange()}_onSymbolResolvingStart(e,t){}_onSymbolError(){}_setStatus(e,t){var i;const s=this.isFailed();this._status=e,e.type===At.StudyStatusType.Completed?this._wasCompletedBefore=!0:e.type!==At.StudyStatusType.Error&&e.type!==At.StudyStatusType.Undefined||(this._wasCompletedBefore=!1),t||(null===(i=this._statusView)||void 0===i||i.update(),this._model.updateSource(this),this._statusChanged.fire(this.status())),s!==this.isFailed()&&this._updateAlertCreationAvailable()}_onPropertiesChanged(){this._restarting||(this._inputs?this._tryChangeInputs():this._chartApi&&this._chartApi.isConnected().value()&&this.restart()),this._metaInfo.isTVScript&&this._metaInfo.TVScriptMetaInfoExprs&&(this._restarting?this._deferredPinePatchProps=!0:this._pinePatchProps()),this._recreatePaneViews(),(0,Ht.emit)("study_properties_changed",this._id)}_lastNonEmptyPlotRow(e){var t;if(!(0,$.isInteger)(e))return ei.logDebug("_lastNonEmptyPlotRow: incorrect plotIndex"),null;let i=null!==(t=this._lastNonEmptyPlotRowCache[e])&&void 0!==t?t:null;if(null!==i)return i;return i=this.data().findLast(((t,i)=>void 0!==i[e]),1e3),null===i?null:(this._lastNonEmptyPlotRowCache[e]=i,i)} _onCurrencyChanged(){"alwaysOff"!==(0,Et.currencyUnitVisibilityProperty)().value()&&this._model.fullUpdate(),this.isStarted()&&this._tryChangeInputs(),this._currencyChanged.fire()}_apiInputs(){return this.inputs({keepOptionalSymbolsEmpty:!0})}async _tryChangeInputs(){const e=this.isStarted()&&this._chartApi.isConnected().value(),t=this._allInputsAreValid(),i=(0,o.ensureDefined)((0,$.clone)(this._inputs)),s=this._apiInputs(),r=JSON.stringify(s),n=r!==JSON.stringify(this._inputs);if(e&&t)try{if(await this._allSymbolsAreResolved(),r!==JSON.stringify(this._apiInputs()))return this._tryChangeInputs();if(this._isStopped())return void(n&&this.disablePriceRangeReady());n&&(await this._changeInputsImpl(s,(0,o.ensureDefined)((0,$.clone)(this._inputs))),(0,o.ensureNotNull)(this.model().alertsWatcher()).syncSourceAlertLabels(this))}catch(e){ei.logError(`ERROR: ${this._debugId()} _tryChangeInputs: cannot modify study, ${e}`)}else if(e&&!t&&this.stop(!0),!e&&t&&this.start(!0),n){const e=this._calcSources(),t=bi(this._metaInfo,s,i);this._updateParentSources(e,t,!0),this._inputs=s}this._tagsChanged.fire()}_onCurrencyMayChange(){if(null!==this._currencySourceSymbolInputProperty){const e=this.currency();this._updateCurrencySourceSymbolInfo(),e!==this.currency()&&this._onCurrencyChanged()}}_fillPrecalculatedAutoscaleInfo(e,t,i){const s=this._metaInfo,r=this.properties().childs(),n=new Set,o=this._metaInfo.filledAreas||[];for(let e=0;e<o.length;e++){const t=o[e];r.filledAreasStyle.childs()[t.id].childs().visible.value()&&(n.add(t.objAId),n.add(t.objBId))}return s.plots.filter((e=>!(0,W.isPlotWithTechnicalValues)(e))).filter((e=>this._metaInfo.isPlotForceOverlay(e.id)?i.targetPriceScale===this._model.mainSeries().priceScale():i.targetPriceScale===this.priceScale())).filter((e=>n.has(e.id)||this.isPlotVisibleAt(e.id,1))).reduce(((i,s)=>this._applyPlotToPrecalculatedAutoscaleInfo(e,t,i,s)),{fields:[],useMainSeriesRange:!1,baseValueMinMax:null})}_firstSourceOrSeries(){var e;return null!==(e=this._sources[0])&&void 0!==e?e:this._series}_skipHistogramBaseOnAutoScale(){return!1}_tryCreateFormatter(e){const t=void 0===e?this.symbolSource().symbolInfo():e;return Ii(this._metaInfo.format,this._priceScaleByProperties(),t,this.properties().childs().precision.value())}_tryCreateDefaultFormatter(e){return this._tryCreateFormatter(e)}_mergeData(e){return this._invalidateLastNonEmptyPlotRowCache(),this.data().merge(e)}_skippedTitleInputs(){return this._hideMatches.filter((e=>e.plotIds.every((e=>0===this._getPlotDisplayValue(e))))).map((e=>e.id))}_getPlotDisplayValue(e){var t,i,s,r,n,o,l;return null===(l=null===(o=null===(n=null===(r=null===(s=null===(i=null===(t=this.properties())||void 0===t?void 0:t.childs())||void 0===i?void 0:i.styles)||void 0===s?void 0:s.childs())||void 0===r?void 0:r[e])||void 0===n?void 0:n.childs())||void 0===o?void 0:o.display)||void 0===l?void 0:l.value()}_incrementTurnaround(){this._turnaround="st"+ ++this._turnaroundCounter}_checkTurnaround(e){ return e===this._turnaround||e===this._model.mainSeries().seriesSource().turnaround()||e===this.turnaround(!0)}_updateMaxOffsetValue(){let e=-1/0;for(const t of this._metaInfo.plots)e=Math.max(this.offset(t.id),e);this._maxOffset.setValue(e)}_rightOffsetToUnixTime(e){if(this._series.bars().size()>=e){const t=(0,o.ensureNotNull)(this._series.bars().lastIndex())-e;return(0,o.ensureNotNull)(this._series.bars().valueAt(t))[0]}return null}_concatPriceAxisViews(){this._priceAxisViews=[...this._priceAxisViewsBase,...this._graphicsPriceAxisViews]}_onStudyLoading(){var e;this._setStatus({type:At.StudyStatusType.Loading,startTime:Date.now()}),null===(e=this._statusView)||void 0===e||e.update(),this._model.updateSource(this)}_handleStudyError(e){var t,i,s;this.clearData(),this._setStatus(e);{const s=(0,At.convertStudyStatusToString)(e),r=this._getTelemetryAdditionalData(),n=s.indexOf("Command info");r.reason=n>=0?s.slice(0,n).trim():s;if(!/study in error state|the data vendor doesn\'t provide volume data for this symbol.|error in series|unsupported resolution/gi.test(null!==(i=null===(t=r.reason)||void 0===t?void 0:t.toLowerCase())&&void 0!==i?i:"")){const e=this._getTelemetryObjectName();this._sendTelemetryCounter(e+"_error",r)}}null===(s=this._statusView)||void 0===s||s.update(),this._model.updateSource(this)}_onStudyError(e){this._handleStudyError(this._createStudyError(e)),this._enablePriceRangeReady()}_createStudyError(e){var t;return wi("string"==typeof e?{error:this._getStudyErrorText(e)}:e,null===(t=this.symbolSource().symbolInfo())||void 0===t?void 0:t.exchange)}_onStudyCompleted(e){var t;this._studyModified&&(this.clearData(),this._studyModified=!1),this._sendTelemetryCounter(this._getTelemetryObjectName()+"_loaded"),this._setStatus({type:At.StudyStatusType.Completed}),null===(t=this._statusView)||void 0===t||t.update();const i=this._model.paneForSource(this);this._model.recalculatePane(i,(0,Rt.sourceChangeEvent)(this.id())),this._updateSources();const s=Bt.InvalidationMask.full();null!==this._model.appliedTimeFrame().value()&&s.lockVisibleTimeRangeOnResize(),this._model.invalidate(s)}_updateSources(){this._model.updateSource(this),this.hasBarColorer()&&this._model.updateSource(this._model.mainSeries())}_unsubscribeToSessionId(){this._isSubscribedToSessionId&&(this.sessionIdChanged().unsubscribe(this,this._onSessionIdChanged),this._isSubscribedToSessionId=!1)}_onSessionIdChanged(){this.restart(!0)}_recreatePriceStep(){var e;let t=null;const i=null!==(e=this._priceScaleByProperties())&&void 0!==e?e:this._priceScaleByMetaInfo();null!==i&&(t=1/i),this._priceStep!==t&&(this._priceStep=t,this._priceStepChanged.fire())}_recreatePlotsFormatters(e){var t,i;this._plotFormatters.clear();const s=this._metaInfo.format,r=this._priceScaleByProperties(),n=void 0===e?this.symbolSource().symbolInfo():e;for(const[e,i]of Object.entries(null!==(t=this._metaInfo.ohlcPlots)&&void 0!==t?t:{}))if(null==i?void 0:i.format){const t=Ii(Ci({...s,...null==i?void 0:i.format}),r,n,this.properties().childs().precision.value()) ;t&&this._plotFormatters.set(e,t)}for(const[e,t]of Object.entries(null!==(i=this._metaInfo.styles)&&void 0!==i?i:{}))if(null==t?void 0:t.format){const i=Ii(Ci({...s,...null==t?void 0:t.format}),r,n,this.properties().childs().precision.value());i&&this._plotFormatters.set(e,i)}for(const e of this._metaInfo.plots)if((0,W.isOhlcPlot)(e)){const t=this._plotFormatters.get(e.target);t&&this._plotFormatters.set(e.id,t)}}_joinTitlesParts(e){const t=e[1]?e[1].join(", "):"";return e[0]+(t.length>0?" ("+t+")":"")}_getMTFResolutionInputTitle(){const e=this.metaInfo();for(let t=0;t<e.inputs.length;t++){const i=e.inputs[t];if("resolution"===i.type&&i.isMTFResolution)return(0,o.ensureDefined)(this._properties.childs().inputs.child(i.id)).value()}return null}_onDataUpdate(e,t,i){this._studyModified&&(this.clearData(),this._studyModified=!1);const s=(0,V.unpackNonSeriesData)(t.d);return this._ongoingDataUpdate=this._ongoingDataUpdate.then((()=>s),(()=>s)).then(this._onDataUnpacked.bind(this,e,t.indexes,i)),this._ongoingDataUpdate}_allSymbolsAreResolved(){const e=this._inputSymbols(),t=[];let i=!1;for(const s of e){const e=this._getSymbolForResolve(s);if(""!==e)if(this._resolvedSymbols[e])i=!0;else{const i=this._resolveSymbol(e,s);t.push(i)}}if(0===t.length){const e=Promise.resolve();return i?e.then((()=>this._symbolsResolved.fire())):e}return Promise.all(t).catch((e=>(this._inputSymbols().includes(e)&&this.stop(!0),this._setStatus({type:At.StudyStatusType.Error,errorDescription:{error:ti}}),this._model.updateSource(this),Promise.reject("Invalid symbol, "+e)))).then((()=>{this._symbolsResolved.fire(),this._recheckLineToolsActuality()}))}_resolveSymbol(e,t){if(""===e)return Promise.resolve();let i=this._pendingResolveSymbols.get(e);return void 0!==i||(i=new Promise(((i,s)=>{this._onSymbolResolvingStart(e,t),this._chartApi.resolveSymbol((0,G.makeNextSymbolId)(),e,(r=>{switch(this._pendingResolveSymbols.delete(e),r.method){case"symbol_resolved":{this._setStatus({type:At.StudyStatusType.Undefined});const s=r.params[1];this._resolvedSymbols[e]=s,this._resolvedSymbolsByInput[t]=s,this._onSymbolResolved(e,t,s),this.invalidateTitleCache(!0),i();break}case"symbol_error":if(this._setStatus({type:At.StudyStatusType.Error,errorDescription:{error:r.params[1]}}),this._onSymbolError(),r.params[1]===j.permissionDenied&&r.params[2]){if(r.params[2]!==j.SymbolErrorPermissionDeniedReason.Symbol)return void this._resolveSymbol(r.params[2],t).then(i);if(r.params[3])return void this._resolveSymbol(r.params[3],t).then(i)}this._sendTelemetryCounter("symbol_error",Object.assign(this._getTelemetryAdditionalData(),{symbol:e,reason:r.params[1]})),s(t)}}))})),this._pendingResolveSymbols.set(e,i)),i}_recheckLineToolsActuality(){const e=this._model.paneForSource(this);null!==e&&e.sourcesByGroup().lineSourcesForAllSymbols().forEach((e=>{e.ownerSource()===this&&e.calcIsActualSymbol()}))}_sendTelemetryCounter(e,t){void 0===t&&(t=this._getTelemetryAdditionalData());const i={count:1,additional:t};de.telemetry.sendChartReport(e,i)}_getTelemetryAdditionalData(){let e="" ;return this._metaInfo.pine&&this._metaInfo.pine.version&&this._metaInfo.shortId.indexOf("USER")>=0&&(e="_v"+this._metaInfo.pine.version),{symbol:this.series().actualSymbol(),resolution:this.series().interval(),study:this._metaInfo.shortId+e}}_onSourceFormatterChanged(){null===this._formatter&&(null!==this._priceScale&&this._priceScale.updateFormatter(),this._formatterChanged.fire())}_onSourcePriceStepChanged(){null===this._priceStep&&this._priceStepChanged.fire()}_bandsFirstValue(e){const t=this._metaInfo;if(!t.bands)return null;for(let i=0;i<t.bands.length;i++){const t=(0,o.ensureDefined)(this._properties.childs().bands).childs()[i];if(t.childs().visible.value()){const i=t.childs().value.value();if(e&&0===i)continue;return i}}return null}_prepareInputs(e){(0,o.assert)(!!e,"options not set");const t=this.metaInfo(),i={},s=e.allowedInputTypes?new Set(e.allowedInputTypes):null;for(let r=0;r<t.inputs.length;r++){const n=t.inputs[r];if(null!==s&&!s.has(n.type))continue;if(n.isFake&&e.skipFakeInputs)continue;if(n.isMTFResolution&&e.noResolution)continue;if(void 0!==e.displayMask&&!((0,o.ensureDefined)(n.display)&e.displayMask))continue;if(e.skipHiddenInputs&&(!e.doNotSkipHiddenWithMigrate||!n.migrate)){let t=!1;switch(n.type){case"bool":t=e.skipBooleanInputs;break;case"color":t=e.skipColorInputs;break;case"time":t=e.skipTimeInputs;break;case"text_area":t=e.skipTextareaInputs;break;default:t=Boolean(n.isHidden)}if(t)continue}if(void 0!==n.groupId&&-1!==e.skippedGroups.indexOf(n.groupId))continue;if(-1!==e.skippedInputs.indexOf(n.id))continue;const l=this._prepareInput(n,e);"symbol"===n.type&&e.skipOptionalEmptySymbolInputs&&""===l||(i[n.id]=(0,$.clone)(l))}return i}_prepareInputValue(e,t){var i,s,r,n;const o=e.id,l=this._properties.childs();if(t.valuesAsIsFromProperties)return l.inputs.childs()[o].value();if("symbol"===e.type){const r=t&&t.symbolsForDisplay,n=l.inputs.childs()[o].value();let a=r?n:this._getSymbolForApi(n),c=null!==(s=null===(i=this._resolvedSymbols)||void 0===i?void 0:i[this._getSymbolForResolve(a)])&&void 0!==s?s:null;if(""===a&&e.optional){if(t&&t.keepOptionalSymbolsEmpty)return a;a=this._model.mainSeries().symbol(),c=this._model.mainSeries().symbolInfo()}if(r)if(c)if(ri){switch(this._model.mainSeries().symbolTextSourceProxyProperty().value()){case"description":a=c.description;break;case"ticker-and-description":a=`${c.name}, ${c.description}`;break;case"ticker":a=c.name}}else a=(0,kt.symbolTitle)(c,t.noExchanges);else li&&(a="");else c&&(a=c.ticker||c.full_name),!this.isPine()&&t&&t.symbolsForChartApi&&(a=this.getSymbolString(a));return a}if("bar_time"===e.type){let e=l.inputs.childs()[o].value();if(e<0){const t=this._rightOffsetToUnixTime(-e);e=t&&t>=0?t:e}return e}if(this._metaInfo.isTVScript||this._metaInfo.pine){if("text"===o)return null!==(n=null===(r=this._metaInfo.defaults.inputs)||void 0===r?void 0:r.text)&&void 0!==n?n:"";if("pineId"===o)return this._metaInfo.scriptIdPart;if("pineVersion"===o)return this._metaInfo.pine?this._metaInfo.pine.version:"-1";if("color"===e.type&&this._metaInfo.isRGB){ const e=l.inputs.childs()[o].value();return(0,T.colorToInteger)(e)}if("price"===e.type){const e=l.inputs.childs()[o].value();return t.priceInputsForDisplay?this.formatter().format(e):e}}return l.inputs.childs()[o].value()}_getAllOwnerSources(){return xi(this).reverse().slice(1)}_getStudyIdWithLatestVersion(){return L.StudyMetaInfo.getStudyIdWithLatestVersion(this.metaInfo())}_debugId(){const e=[];return this._studyId&&e.push(this._studyId),e.push(this._metaInfo.fullId),e.push(this._metaInfo.description),JSON.stringify({study:e})}_hasAvailableAlertPlots(){if(null===this._alertMetaInfo())return!1;const e=this.stateForAlert(),t=p.alertBandFactory.create(e).getPlots();return null!=t&&t.length>0}_hasAlertConditions(){const e=this._alertMetaInfo();if(null===e)return!1;if(e.plots.some(W.isAlertConditionPlot))return!0;const t=this.stateForAlert();return Boolean(t.alerts&&t.alerts.conditions)}_hasAlertFunction(){const e=this._alertMetaInfo();return Boolean(null!==e&&e.hasAlertFunction)}async _updateParentSources(e,t,i){if(this._sources.forEach((e=>e.unsetChild(this))),i&&await Promise.all(e.map((e=>e.isStarted()?Promise.resolve():e.start(!1,!0)))),e.forEach((e=>e.setChild(this))),this._setSources(e),this._recreatePriceFormattingDependencies(),0!==t&&this._sources.length<=1){const e=this._firstSourceOrSeries(),t=this._priceScale,i=(0,o.ensureNotNull)(e.priceScale());if(t!==i){const t=this._model.paneForSource(this),s=(0,o.ensureNotNull)(this._model.paneForSource(e));t===s&&s.move(this,i,!0)}}}_calcSources(){const e=this._properties.childs().inputs.state();return L.StudyMetaInfo.getSourceIdsByInputs(this._metaInfo.inputs,e).map((e=>{if("high"===e||"open"===e||"low"===e||"close"===e||"hl2"===e||"ohl3"===e||"ohlc4"===e)return null;{const t=this._model.allStudies().find((t=>t.canHaveChildren()&&t.id()===e));return null!=t?t:null}})).filter($.notNull)}_isStopped(){return!this.isStarted()}_onDataUnpacked(e,t,i,s){if(this._isDestroyed)return;"nochange"!==t&&this._processPlotOffsets(s),this._transformData(e);const r=this._mergeData(e);null!==s&&(s.indexes_replace?((0,o.assert)("nochange"!==t),this._graphics.replaceIndexesTo(t)):("nochange"!==t&&this._graphics.replaceIndexesTo(t),void 0!==s.graphicsCmds&&this._graphics.processCommands(s.graphicsCmds))),this._onDataUpdated(e,s,t,r&&r.index),this.priceRangeReady()||this._enablePriceRangeReady(),this._dataUpdated.fire(i,!1,r)}_processPlotOffsets(e){if(e&&e.indexes_replace)return;const t=this._plotOffsets;this._plotOffsets=e&&e.offsets||{},(0,s.default)(t,this._plotOffsets)||this.updateAllViews((0,Rt.sourceChangeEvent)({sourceId:this.id(),clearData:!0})),this._updateMaxOffsetValue()}_applyPlotToPrecalculatedAutoscaleInfo(e,t,i,s){var r,n,l;const a=s.id,c=this._properties.childs().styles.childs()[a],u=(0,W.isShapesPlot)(s)||(0,W.isCharsPlot)(s);i.useMainSeriesRange=i.useMainSeriesRange||(0,W.isArrowsPlot)(s);let h=(0,W.isLinePlot)(s)||(0,W.isOhlcPlot)(s);if(u){const e=(0, o.ensureDefined)(c).childs().location.value(),t=[N.MarkLocation.Absolute,N.MarkLocation.Top,N.MarkLocation.Bottom].indexOf(e)<0;i.useMainSeriesRange=i.useMainSeriesRange||u&&t,h=h||e===N.MarkLocation.Absolute}if(!h)return i;const d={name:a,offset:this.offset(a)},p=c.childs().plottype.value();if(!this._skipHistogramBaseOnAutoScale()&&[W.LineStudyPlotStyle.Histogram,W.LineStudyPlotStyle.Columns,W.LineStudyPlotStyle.Area].indexOf(p)>=0){const s=null===(l=null===(n=null!==(r=this._metaInfo.styles)&&void 0!==r?r:{})||void 0===n?void 0:n[a])||void 0===l?void 0:l.histogramBase;if(void 0===s)return i;const o=this.data().minMaxOnRangeCached(e,t,[d]);return(0,$.isNumber)(s)&&null!==o&&(i.baseValueMinMax=(0,A.mergeMinMax)(i.baseValueMinMax,{min:s,max:s}),i.baseValueMinMax=(0,A.mergeMinMax)(i.baseValueMinMax,o)),i}return i.fields.push(d),i}async _onSourceInputChanged(){if(!this.isStarted()){const e=this._calcSources();{const t=1===e.length&&e[0]!==this._sources[0]?1:0;this._updateParentSources(e,t,!1)}}}_buildInputs(e){(0,o.assert)(!!e,"options not set");let t={};try{t=this._prepareInputs(e)}catch(e){ei.logWarn("Failed to prepare study inputs: "+e)}if(e.asObject){const e={};return Object.keys(t).forEach((i=>{null!=t[i]&&(e[i]=t[i])})),e}{const e=[];return Object.keys(t).forEach((i=>{null!=t[i]&&e.push(t[i])})),e}}_prepareInput(e,t){const i=this._prepareInputValue(e,t);return!e.isFake||t.fakeInputsForDisplay||t.onlyAtomValues?i:{v:i,f:!0,t:e.type}}_plotsForAlert(){return(0,y.plotsForAlert)(this.metaInfo(),this.offset.bind(this))}_dependenciesForAlerts(){const e=this._getAllOwnerSources().filter((e=>e instanceof Vi));return(0,y.dependenciesForAlerts)(e,(0,Xt.studyMetaInfoRepository)())}_calcIsActualInterval(){const e=this._isActualInterval;this._isActualInterval=(0,Lt.isActualInterval)(this._series.intervalObj(),this._properties.childs().intervalsVisibilities),e!==this._isActualInterval&&(this._onIsActualIntervalChange.fire(),this._visibleChanged(),this.processHibernate())}_visibleChanged(){this._series.invalidateBarColorerCache()}_getNonPriceParent(){const e=this._sources;for(const t of e)if(t instanceof Vi){const e=t.metaInfo();return e.is_price_study&&"Compare@tv-basicstudies"!==e.id?t._getNonPriceParent():t}return null}_updateInputValue(e,t){const i=this._properties.childs().inputs.childs();if(i[t.id])if("price"===t.type)i[t.id].setValue(e.price);else if("time"===t.type){const s=this._model.timeScale().indexToTimePoint(e.index);null!==s&&i[t.id].setValue(1e3*s)}}_initializeStudyInputsPaneViews(){const e=(0,m.editableStudyInputs)(this._metaInfo.inputs);if(0===e.length)return;const t={convertPriceToCoordinate:e=>{const t=this.priceScale();if(null!==t&&!t.isEmpty()){const i=this.firstValue();if(null!==i)return t.priceToCoordinate(e,i)}return null},formatPrice:e=>{const t=this.priceScale();if(null!==t&&!t.isEmpty()){const i=this.firstValue();if(null!==i)return t.formatPrice(e,i)}return""},getInputValue:e=>{var t,i;return null!==(i=null===(t=this._properties.childs().inputs.child(e))||void 0===t?void 0:t.value())&&void 0!==i?i:null },isSelected:()=>this._model.selection().isSelected(this),isHovered:()=>this===this._model.hoveredSource()};Promise.all([i.e(62183).then(i.bind(i,781929)),i.e(62183).then(i.bind(i,141361)),i.e(62183).then(i.bind(i,286125)),i.e(62183).then(i.bind(i,180861))]).then((i=>{const[s,r,n,o]=i;this._inputsAnchorsPaneView=new s.StudyInputsAnchorsPaneView(e,this._model,t);const l=e.filter((e=>!Array.isArray(e)));this._inputsLinesPaneView=new r.StudyInputsLinesPaneView(l,this._model,t);let a=!1;e.forEach((e=>{if(Array.isArray(e)){const i="time"===e[0].type?e[0]:e[1],s="price"===e[0].type?e[0]:e[1];this._inputsTimeAxisPaneViews.push(new n.StudyInputTimeAxisPaneView(i,this._model,t.getInputValue)),this._inputsPriceAxisPaneViews.push(new o.StudyInputPriceAxisPaneView(s,t)),a=!0}else"time"===e.type?this._inputsTimeAxisPaneViews.push(new n.StudyInputTimeAxisPaneView(e,this._model,t.getInputValue)):(this._inputsPriceAxisPaneViews.push(new o.StudyInputPriceAxisPaneView(e,t)),a=!0)})),a&&this.formatterChanged().subscribe(this,this.invalidateTitleCache)}))}_updateCurrencySourceSymbolInfo(){}_initializeCurrencySource(){var e,t;const i=this.metaInfo(),s="symbolInputSymbolSource"===(null===(e=i.symbolSource)||void 0===e?void 0:e.type)&&(null===(t=i.symbolSource)||void 0===t?void 0:t.inputId),r=i.inputs.find((e=>e.id===s)),n="symbol"===(null==r?void 0:r.type);if("string"==typeof s&&n&&i.is_price_study){const e=this._properties.childs().inputs.childs()[s];void 0!==e&&(e.subscribe(this,this._onCurrencyMayChange),this._currencySourceSymbolInputProperty=e)}}_recreatePaneViews(){this.hasBarColorer()&&this._model.mainSeries().invalidateBarStylesCache(),this._createViews(),this.recalculate(),this.updateAllViews((0,Rt.sourceChangeEvent)(this.id()))}_pinePatchProps(){this._deferredPinePatchProps=!1;const e=this._prepareInputs(si);if(!this._areStudyInputsModified(e))return;this._oldStudyInputs=e;const t=(0,S.patchPropertiesAsync)(this._properties,this._metaInfo,e,this._previousPatchMap),i=this._allSymbolsAreResolved(),s=this._propertiesPatched=new Promise((e=>{const r=()=>{s===this._propertiesPatched?e():this._propertiesPatched.then(e)};Promise.all([t,i]).then((()=>{r(),this._isDestroyed||(this._createViews(),this.recalculate(),this.updateAllViews((0,Rt.sourceChangeEvent)(this.id())),this.invalidateTitleCache())})).catch((e=>{r(),ei.logError(`ERROR: ${this._debugId()} pine inputs patching failed, reason: ${e}`)}))}))}_areStudyInputsModified(e){if(0===Object.keys(e).length)return!1;if(void 0===this._oldStudyInputs)return!0;const t=Object.keys(this._oldStudyInputs);(0,o.assert)(t.length===Object.keys(e).length,"keys quantity should be equal");for(const i of t)if((0,o.assert)(e.hasOwnProperty(i),`key '${i}' should exist in study inputs`),(0,o.ensureDefined)(this._oldStudyInputs)[i]!==e[i])return!0;return!1}_onVisibleTimeRangeInputsChanged(e){null!==e?this._updateVisibleTimeRangeInputs(e):this.isStarted()&&this._chartApi.isConnected().value()&&this.stop(!0)}_updateVisibleTimeRangeInputs(e,t=!0){const i={first_visible_bar_time:e.firstVisibleBarTime, last_visible_bar_time:e.lastVisibleBarTime,subscribeRealtime:e.subscribeRealtime},s=this.metaInfo().inputs,r=[];for(const e of s)i.hasOwnProperty(e.id)&&r.push(e.id);const n=this.properties().childs().inputs;for(const e of r)n.childs()[e].setValueSilently(i[e]);t&&r.length>0&&n.listeners().fire(n,"")}_getStudyErrorText(e){var t;switch(null===(t=e.match(/^study_not_auth:(.*)?@.*/))||void 0===t?void 0:t[1]){case"Script":case"StrategyScript":return"This script is invite-only. To request access, please contact its author.";case"VbPSessions":case"VbPPeriodic":case"VbPVisible":return"Volume Profile indicator available only on our upgraded plans."}return e.split(":",2)[0]}_priceScaleByProperties(){if("default"===this.properties().childs().precision.value())return null;const e=parseInt(this.properties().childs().precision.value());return isFinite(e)?Math.pow(10,e):null}_priceScaleByMetaInfo(){const e=this.metaInfo().format,t="inherit"!==e.type?e.precision:void 0,i=(0,$.isNumber)(t)?Math.pow(10,t):void 0;if("price"===e.type||"percent"===e.type)return i||100;if("volume"===e.type){if(void 0===e.precision){const e=this.series().symbolInfo();if(null!==e&&(0,$.isNumber)(e.volume_precision))return Math.pow(10,e.volume_precision)}return 1}return"inherit"===e.type||ei.logWarn("Unsupported format type: "+e.type),null}_inputSymbols(){return this.metaInfo().inputs.filter((e=>"symbol"===e.type)).map((e=>(0,o.ensureDefined)(this._properties.childs().inputs.child(e.id)).value()))}_studySpec(e){return{id:this._metaInfo.id,child:null!=e?e:this.isChildStudy(),fundamental:(0,pe.isFundamentalStudyMetaInfo)(this._metaInfo)}}_precisionChanged(){this._recreatePriceFormattingDependencies()}_setSources(e){this.invalidateTitleCache(),this._sources=e,this._onParentSourcesChanges.fire()}}(0,u.addStudyInfoToMap)("Study",(0,u.createStudyInfo)(Vi))},466144:(e,t,i)=>{i.d(t,{plotShapesData:()=>r});var s=i(444372);const r={shape_arrow_down:{guiName:s.t(null,void 0,i(348732)),id:"shape_arrow_down",paneRendererClass:"PaneRendererArrowDown",pineName:"shape.arrowdown",icon:"arrow_down"},shape_arrow_up:{guiName:s.t(null,void 0,i(610650)),id:"shape_arrow_up",paneRendererClass:"PaneRendererArrowUp",pineName:"shape.arrowup",icon:"arrow_up"},shape_circle:{guiName:s.t(null,void 0,i(490068)),id:"shape_circle",paneRendererClass:"PaneRendererCircleShape",pineName:"shape.circle",icon:"circle"},shape_cross:{guiName:s.t(null,void 0,i(429908)),id:"shape_cross",paneRendererClass:"PaneRendererCrossShape",pineName:"shape.cross",icon:"cross"},shape_diamond:{guiName:s.t(null,void 0,i(773720)),id:"shape_diamond",paneRendererClass:"PaneRendererDiamond",pineName:"shape.diamond",icon:"diamond"},shape_flag:{guiName:s.t(null,void 0,i(121524)),id:"shape_flag",paneRendererClass:"PaneRendererFlagShape",pineName:"shape.flag",icon:"flag"},shape_label_down:{guiName:s.t(null,void 0,i(318528)),id:"shape_label_down",paneRendererClass:"PaneRendererLabelDown",pineName:"shape.labeldown",icon:"label_down"},shape_label_up:{guiName:s.t(null,void 0,i(513046)),id:"shape_label_up", paneRendererClass:"PaneRendererLabelUp",pineName:"shape.labelup",icon:"label_up"},shape_square:{guiName:s.t(null,void 0,i(944904)),id:"shape_square",paneRendererClass:"PaneRendererSquare",pineName:"shape.square",icon:"square"},shape_triangle_down:{guiName:s.t(null,void 0,i(483356)),id:"shape_triangle_down",paneRendererClass:"PaneRendererTriangleApexDown",pineName:"shape.triangledown",icon:"triangle_down"},shape_triangle_up:{guiName:s.t(null,void 0,i(928340)),id:"shape_triangle_up",paneRendererClass:"PaneRendererTriangleApexUp",pineName:"shape.triangleup",icon:"triangle_up"},shape_xcross:{guiName:s.t(null,void 0,i(707050)),id:"shape_xcross",paneRendererClass:"PaneRendererXCross",pineName:"shape.xcross",icon:"x_cross"}}},502141:(e,t,i)=>{i.d(t,{areEqualSymbols:()=>n,compareSymbolParams:()=>c,symbolParams:()=>a,symbolSameAsCurrent:()=>l});i(244842);var s=i(444331),r=i(223699);function n(e,t){return void 0===e?void 0===t:void 0!==t&&e.toUpperCase()===t.toUpperCase()}function o(e,t){return e.some((e=>n(t,e)))}function l(e,t){if(null===t)return!1;if(t){if(n(t.full_name,e)||n(t.pro_name,e))return!0;if(n(t.ticker,e))return!0;if(t.aliases&&o(t.aliases,e))return!0;if(t.alternatives&&o(t.alternatives,e))return!0;if(0===e.indexOf("FRA:")&&n(t.pro_name,e.replace("FRA:","FWB:")))return!0}return!1}function a(e){return{symbol:e.symbol(),currency:e.currency(),unit:e.unit(),interval:e.interval(),style:e.style()}}function c(e,t,i,n){const{symbol:o,currency:l,unit:a,style:c}=t;let u=t.interval;const h=e.symbolInfo(),d=void 0!==o&&!e.symbolSameAsResolved(o);let p,_,f;if(null!==h?(p=void 0!==l&&!function(e,t){return null===e&&!(0,s.isConvertedToOtherCurrency)(t)||e===(0,s.symbolCurrency)(t)}(l,h),_=void 0!==a&&!function(e,t,i){return null===e&&!(0,s.isConvertedToOtherUnit)(t,i)||e===(0,s.symbolUnit)(t,i)}(a,h,i)):(p=void 0!==l&&l!==e.currency(),_=void 0!==a&&a!==e.unit()),void 0!==u&&!d&&n){const e=n(u);r.Interval.isEqual(e,u)||(u=e,f=u)}return{symbolChanged:d,intervalChanged:void 0!==u&&!r.Interval.isEqual(e.interval(),u),currencyChanged:p,unitChanged:_,styleChanged:void 0!==c&&c!==e.style(),correctedInterval:f,styleChangeRequiresRestart:void 0!==c&&(0,s.styleChangeRequiresRestart)(c,e.style())}}},294162:(e,t,i)=>{i.d(t,{TextWidthCache:()=>s});class s{constructor(e=150){this._actualSize=0,this._usageTick=1,this._oldestTick=1,this._tick2Labels=new Map,this._cache=new Map,this._maxSize=e}reset(){this._actualSize=0,this._cache.clear(),this._usageTick=1,this._oldestTick=1,this._tick2Labels.clear()}measureText(e,t){return this.getMetrics(e,t).width}yMidCorrection(e,t){const i=this.getMetrics(e,t);return"actualBoundingBoxAscent"in i&&"actualBoundingBoxDescent"in i?(i.actualBoundingBoxAscent-i.actualBoundingBoxDescent)/2:0}getMetrics(e,t){const i=this._cache.get(t);if(void 0!==i)return i.metrics;if(this._actualSize===this._maxSize){const e=this._tick2Labels.get(this._oldestTick);this._tick2Labels.delete(this._oldestTick),this._cache.delete(e),this._oldestTick++,this._actualSize--}e.save(),e.textBaseline="middle";const s=e.measureText(t) ;return e.restore(),0===s.width&&t.length||(this._cache.set(t,{metrics:s,tick:this._usageTick}),this._tick2Labels.set(this._usageTick,t),this._actualSize++,this._usageTick++),s}}},161164:(e,t,i)=>{i.d(t,{TimeAxisView:()=>o});var s=i(246733),r=i(199471);class n{constructor(){this._data=null}setData(e){this._data=e}draw(e,t,i){if(null===this._data||!this._data.visible||0===this._data.text.length)return;const s=this._data;e.font=i.font;const n=Math.round(i.widthCache.measureText(e,s.text));if(n<=0)return;e.save();const o=i.paddingHorizontal,l=n+2*o,a=l/2;let c=s.coordinate,u=Math.floor(c-a)+.5;if(s.alwaysInViewPort){const e=s.width;u<0?(c+=Math.abs(0-u),u=Math.floor(c-a)+.5):u+l>e&&(c-=Math.abs(e-(u+l)),u=Math.floor(c-a)+.5)}const h=u+l,d=Math.ceil(0+i.borderSize+i.offsetSize+i.paddingTop+i.fontSize+i.paddingBottom),{horizontalPixelRatio:p,verticalPixelRatio:_}=t;e.fillStyle=s.background;const f=Math.round(u*p),m=Math.round(0*_),v=Math.round(h*p),g=Math.round(d*_),P=Math.round(2*p);e.beginPath(),e.moveTo(f,m),e.lineTo(f,g-P),e.arcTo(f,g,f+P,g,P),e.lineTo(v-P,g),e.arcTo(v,g,v,g-P,P),e.lineTo(v,m),e.fill();const y=0+i.borderSize+i.offsetSize+i.paddingTop+i.fontSize/2;e.textAlign="left",e.textBaseline="middle",e.fillStyle=s.color;const S=i.widthCache.yMidCorrection(e,"Apr0");e.translate((u+o)*p,(y+S)*_),(0,r.drawScaled)(e,p,_,(()=>e.fillText(s.text,0,0))),e.restore()}}class o{constructor(e){this._renderer=new n,this._rendererData={background:"",color:"",coordinate:0,text:"",visible:!1,width:0,alwaysInViewPort:!0},this._invalidated=!0,this._model=e,this._renderer.setData(this._rendererData)}update(){this._invalidated=!0}renderer(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),this._renderer}coordinate(){return this._rendererData.coordinate}_getAlwaysInViewPort(){return!0}_getText(e){const t=this._model.timeScale().indexToUserTime(e);return null!==t?this._model.dateTimeFormatter().format(t):""}_updateImpl(){const e=this._rendererData;if(e.visible=!1,this._model.timeScale().isEmpty()||!this._isVisible())return;const t=this._getIndex();null!==t&&Number.isFinite(t)&&(e.visible=!0,e.width=this._model.timeScale().width(),e.background=this._getBgColor(),e.color=(0,s.colorFromBackground)(e.background),e.coordinate=this._model.timeScale().indexToCoordinate(t),e.alwaysInViewPort=this._getAlwaysInViewPort(),e.text=this._getText(t),this._invalidated=!1)}}},87053:(e,t,i)=>{i.d(t,{createVisibilityController:()=>c});var s=i(444372),r=i(778785),n=i(152633),o=i(62802);const l="visibleOnMouseOver";function a(e){return"alwaysOn"===e||"alwaysOff"===e?e:l}function c(e,t){let c,u;function h(){if(!c){c=(0,n.createPrimitiveProperty)();let i=o.getValue(e);void 0===i&&void 0!==t&&(i=o.getValue(t)),c.setValue(a(i)),c.subscribe(c,(t=>{o.setValue(e,a(t.value()))}))}return c}return{property:h,availableValues:function(){return[{id:"visibleOnMouseOver",value:"visibleOnMouseOver",title:s.t(null,void 0,i(689960))},{id:"alwaysOn",value:"alwaysOn",title:s.t(null,void 0,i(471997))},{id:"alwaysOff",value:"alwaysOff", title:s.t(null,void 0,i(109408))}]},actualBehavior:function(){if(!u){u=(0,n.createPrimitiveProperty)();const e=h(),t=()=>{let t=e.value();"alwaysOn"!==t&&"alwaysOff"!==t&&(t=r.mobiletouch?"alwaysOn":"visibleOnMouseOver"),u&&u.setValue(t)};e.subscribe(u,t),t()}return u},restoreDefaultValue:function(){h().setValue(l),o.remove(e)}}}},558793:(e,t,i)=>{i.d(t,{getChartAlertsFacade:()=>l,getChartAlertsFacadeIfCreatedBefore:()=>a});var s=i(922100),r=i(307500);let n,o;async function l(){return n||(n=async function(){const[e,{getAlertsCollection:t},n,o]=await Promise.all([Promise.all([i.e(32327),i.e(94949),i.e(28035),i.e(29589),i.e(36679)]).then(i.bind(i,667103)),Promise.all([i.e(23482),i.e(68239),i.e(94949),i.e(2532),i.e(28035),i.e(14141)]).then(i.bind(i,228035)),(0,r.getChartSourceIdsGetter)(),(0,s.getAlertsFiresFocusHandler)()]);return new e.ChartAlertsFacade(t(),o,n)}()),o||(o=await n),o}function a(){return null!=o?o:null}},307500:(e,t,i)=>{i.d(t,{getChartSourceIdsGetter:()=>s});const s=(0,i(895171).default)((async()=>{const{ChartSourceIdsGetter:e}=await Promise.all([i.e(94949),i.e(28035),i.e(79979)]).then(i.bind(i,845483));return new e}))},511131:(e,t,i)=>{function s(e,t,i,s){return`${s?s+" ":""}${i?i+" ":""}${e}px ${t}`}i.d(t,{makeFont:()=>s,parseFont:()=>n});const r=/(bold )?(italic )?(\d+)(px|pt) (.*)$/;function n(e){const t=r.exec(e);return null===t?null:{family:t[5],size:parseInt(t[3])*("pt"===t[4]?.75:1),bold:Boolean(t[1]),italic:Boolean(t[2])}}},151149:(e,t,i)=>{i.d(t,{rgbaFromIntegerCached:()=>o});var s=i(448874),r=i(246733),n=i(407478);function o(e=1e3){const t=s.default.Cache;s.default.Cache=n.CircularCacheBuffer.bind(n.CircularCacheBuffer,e);const i=(0,s.default)(r.rgbaFromInteger);return s.default.Cache=t,i}},298113:(e,t,i)=>{function s(e,t){for(const i of t.keys())e.add(i)}i.d(t,{addToSet:()=>s})},847754:(e,t,i)=>{async function s(e){(await Promise.all([i.e(23453),i.e(55270),i.e(84358),i.e(67681),i.e(38697),i.e(12742),i.e(18251),i.e(58742),i.e(26595),i.e(80278),i.e(93797),i.e(30855),i.e(64642),i.e(65621),i.e(76497),i.e(69494),i.e(90385),i.e(53490),i.e(32605),i.e(8658),i.e(37867),i.e(85860),i.e(94913)]).then(i.bind(i,960345))).renderRunOrSigninWithFeatureDialog(e)}i.d(t,{createRunOrSigniWithFeatureDialog:()=>s})}}]);